-
Notifications
You must be signed in to change notification settings - Fork 277
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
fix R and S may not be 32 bytes #130
Conversation
ecdsa/signing/finalize.go
Outdated
|
||
func fillTo32BytesInPlace(src []byte) []byte { | ||
oriLen := len(src) | ||
if oriLen < 32 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really minor : I think it would have been nicer to accept the wanted length as another input parameter to the function.
Besides that I would also rename the function to padToLengthBytesInPlace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
padToLengthBytesInPlace
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx, updated!
* fix R and S may not be 32 bytes * refactor according to review comments (cherry picked from commit 49366aa) # Conflicts: # ecdsa/signing/finalize.go # ecdsa/signing/local_party_test.go
The R and S might not be less than 32 bytes, if we return such R and S and the client code concatenates these two bytes together, the signature would not be 64 bytes. Such signature would fail for blockchains (for example Ethereum) that check the signature length: https://github.com/ethereum/go-ethereum/blob/master/crypto/secp256k1/secp256.go#L169-L171