Fix signature format detection (#6)

64 bytes means compact, less is invalid, other try DER and let the library handle the actual check.
This commit is contained in:
Fabrice Drouin 2020-07-09 15:59:07 +02:00 committed by GitHub
parent 6c850eb2c4
commit 5af1807f38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -186,18 +186,9 @@ JNIEXPORT jbyteArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256
int GetSignatureFormat(size_t size)
{
switch(size) {
case 64:
return SIG_FORMAT_COMPACT;
break;
case 70:
case 71:
case 72:
case 73:
return SIG_FORMAT_DER;
break;
default: return SIG_FORMAT_UNKNOWN;
}
if (size == 64) return SIG_FORMAT_COMPACT;
if (size < 64) return SIG_FORMAT_UNKNOWN;
return SIG_FORMAT_DER;
}
/*