fix(eddsa): fix the size of the signature check for ed448
This commit is contained in:
18
eddsa.go
18
eddsa.go
@@ -77,7 +77,14 @@ func NewEdDSAVarsig(curve EdDSACurve, hashAlgorithm Hash, payloadEncoding Payloa
|
||||
hashAlg: hashAlgorithm,
|
||||
}
|
||||
|
||||
return validateSig(v, ed25519.SignatureSize)
|
||||
switch curve {
|
||||
case CurveEd25519:
|
||||
return validateSig(v, ed25519.SignatureSize)
|
||||
case CurveEd448:
|
||||
return validateSig(v, 114)
|
||||
default:
|
||||
return EdDSAVarsig{}, fmt.Errorf("%w: %x", ErrUnknownEdDSACurve, curve)
|
||||
}
|
||||
}
|
||||
|
||||
// Curve returns the Edwards curve used to generate the EdDSA signature.
|
||||
@@ -136,5 +143,12 @@ func decodeEd25519(r BytesReader, vers Version, disc Discriminator) (Varsig, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return validateSig(v, ed25519.SignatureSize)
|
||||
switch curve {
|
||||
case CurveEd25519:
|
||||
return validateSig(v, ed25519.SignatureSize)
|
||||
case CurveEd448:
|
||||
return validateSig(v, 114)
|
||||
default:
|
||||
return EdDSAVarsig{}, fmt.Errorf("%w: %x", ErrUnknownEdDSACurve, curve)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user