Fix Misclassification of ECDSA Signatures in verifyMultisig()
#1973
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses issue #1898 by refining the logic in
verifyMultisig()
to correctly distinguish betweenECDSA
,Ed25519
, andSr25519
signatures.Problem:
Previously,
verifyMultisig()
misidentified certainECDSA
signatures (65 bytes) asEd25519
orSr25519
signatures (64 bytes) when the first byte of theECDSA
signature was0
or1
. This happened because the function interpreted the first byte as a multisignature prefix rather than part of theECDSA
signature itself.Solution:
Improved signature length handling:
ECDSA
signature prefixed with a crypto type byte, so the prefix is removed before verification.ECDSA
signature, which should remain unchanged for verification.Ed25519
/Sr25519
signature (1-byte prefix + 64-byte signature), in which case the prefix is removed before verification.Improved verification order:
Ed25519
/Sr25519
verification by removing the prefix.ECDSA
verification using the full 65-byte signature.closes Signing and verifying a message using ECDSA sometimes fails #1898