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:
@ -494,8 +494,8 @@ static int convert_der_to_raw_single_int(unsigned char *der, size_t der_len,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip leading zeros */
|
/* Skip possible leading zero */
|
||||||
while (*p == 0x00) {
|
if (*p == 0x00) {
|
||||||
p++;
|
p++;
|
||||||
unpadded_len--;
|
unpadded_len--;
|
||||||
/* It should never happen that the input number is all zeros. */
|
/* It should never happen that the input number is all zeros. */
|
||||||
|
Reference in New Issue
Block a user