signatureNormalize: relax check on signature size

Checking that the sig size is >= 64 is enough, this is just a quick check before the actual library method is called.
This commit is contained in:
sstone 2020-09-10 20:21:58 +02:00
parent 7272a55b8a
commit 6a67dbe9f6
No known key found for this signature in database
GPG Key ID: 7A73FE77DE2C4027

View File

@ -79,7 +79,7 @@ public object Secp256k1Native : Secp256k1 {
} }
public override fun signatureNormalize(sig: ByteArray): Pair<ByteArray, Boolean> { public override fun signatureNormalize(sig: ByteArray): Pair<ByteArray, Boolean> {
require(sig.size == 64 || sig.size in 70..73) require(sig.size >= 64){ "invalid signature ${Hex.encode(sig)}" }
memScoped { memScoped {
val nSig = allocSignature(sig) val nSig = allocSignature(sig)
val isHighS = secp256k1_ecdsa_signature_normalize(ctx, nSig.ptr, nSig.ptr) val isHighS = secp256k1_ecdsa_signature_normalize(ctx, nSig.ptr, nSig.ptr)