mirror of
https://github.com/luxfi/crypto.git
synced 2026-07-27 01:54:50 +00:00
fix: validate signature is not all zeros in SignatureFromBytes
- Add check for all-zero signatures which are invalid - Return ErrInvalidSignature for zero signatures - Fixes compatibility with warp signature tests
This commit is contained in:
+12
@@ -232,6 +232,18 @@ func SignatureFromBytes(sigBytes []byte) (*Signature, error) {
|
||||
return nil, ErrFailedSignatureDecompress
|
||||
}
|
||||
|
||||
// Check if signature is all zeros (invalid)
|
||||
allZero := true
|
||||
for _, b := range sigBytes {
|
||||
if b != 0 {
|
||||
allZero = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if allZero {
|
||||
return nil, ErrInvalidSignature
|
||||
}
|
||||
|
||||
return &Signature{sig: sigBytes}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user