fix(eddsa): fix the size of the signature check for ed448

This commit is contained in:
Michael Muré
2025-07-22 11:34:12 +02:00
parent 0763d6f8b6
commit 182036b055

View File

@@ -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)
}
}