Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ECDSA builtin #151

Merged
merged 18 commits into from
Nov 14, 2023
Prev Previous commit
Next Next commit
Fix comments
jmjac committed Nov 9, 2023
commit 1ab631d996c3d6fd263c67436137902eaae3db83
6 changes: 2 additions & 4 deletions pkg/vm/builtins/ecdsa.go
Original file line number Diff line number Diff line change
@@ -16,9 +16,7 @@ type ECDSA struct {
signatures map[uint64]ecdsa.Signature
}

// verify_ecdsa_signature(message_hash, public_key, sig_r, sig_s)
//
// Test with casm ?
// verify_ecdsa_signature(message_hash, public_key, sig_r, sig_s)
func (e *ECDSA) CheckWrite(segment *memory.Segment, offset uint64, value *memory.MemoryValue) error {
ecdsaIndex := offset % cellsPerECDSA
pubOffset := offset - ecdsaIndex
@@ -46,7 +44,7 @@ func (e *ECDSA) CheckWrite(segment *memory.Segment, offset uint64, value *memory
return err
}

//Sig verification
//Recover Y part of the public key
posY, negY, err := recoverY(pubX)
if err != nil {
return err