1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

psa_util: convert_der_to_raw_single_int() accepts also all zero integers

These values are not mathematically valid as signature, but as
for what it concerns with ECDSA conversion functions, 0 values
in DER format should be translated to 0 values in raw format.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti
2024-02-05 15:50:02 +01:00
parent 8334d00772
commit bec1d842ac
2 changed files with 16 additions and 12 deletions

View File

@ -493,10 +493,6 @@ static int convert_der_to_raw_single_int(unsigned char *der, size_t der_len,
p++;
unpadded_len--;
}
/* It should never happen that the input number has 0 length. */
if (unpadded_len == 0) {
return MBEDTLS_ERR_ASN1_INVALID_DATA;
}
if (unpadded_len > coordinate_size) {
/* Parsed number is longer than the maximum expected value. */