mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
Merge pull request #2094 from dgarske/ecdsa_der_len
Adds strict checking of the ECDSA signature DER encoding length
This commit is contained in:
@ -13275,9 +13275,17 @@ int DecodeECC_DSA_Sig(const byte* sig, word32 sigLen, mp_int* r, mp_int* s)
|
|||||||
return ASN_ECC_KEY_E;
|
return ASN_ECC_KEY_E;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NO_STRICT_ECDSA_LEN
|
||||||
|
/* enable strict length checking for signature */
|
||||||
|
if (sigLen != idx + (word32)len) {
|
||||||
|
return ASN_ECC_KEY_E;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/* allow extra signature bytes at end */
|
||||||
if ((word32)len > (sigLen - idx)) {
|
if ((word32)len > (sigLen - idx)) {
|
||||||
return ASN_ECC_KEY_E;
|
return ASN_ECC_KEY_E;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (GetInt(r, sig, &idx, sigLen) < 0) {
|
if (GetInt(r, sig, &idx, sigLen) < 0) {
|
||||||
return ASN_ECC_KEY_E;
|
return ASN_ECC_KEY_E;
|
||||||
|
Reference in New Issue
Block a user