1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-30 22:43:08 +03:00

psa_util: skip leading zeros in der format with "if" instead of "while"

This is possible because we know that DER format can have at most
1 leading zero.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti
2024-01-10 11:12:31 +01:00
parent 3ccb2b5423
commit 86bae52c55

View File

@ -494,8 +494,8 @@ static int convert_der_to_raw_single_int(unsigned char *der, size_t der_len,
return ret;
}
/* Skip leading zeros */
while (*p == 0x00) {
/* Skip possible leading zero */
if (*p == 0x00) {
p++;
unpadded_len--;
/* It should never happen that the input number is all zeros. */