psa_util: convert_der_to_raw_single_int: ensure the input DER integers have valid length
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
3122f4da50
commit
2d73baf171
1 changed files with 4 additions and 4 deletions
|
@ -492,10 +492,10 @@ static int convert_der_to_raw_single_int(unsigned char *der, size_t der_len,
|
|||
if ((unpadded_len > 0) && (*p == 0x00)) {
|
||||
p++;
|
||||
unpadded_len--;
|
||||
/* It should never happen that the input number is all zeros. */
|
||||
if (unpadded_len == 0) {
|
||||
return MBEDTLS_ERR_ASN1_LENGTH_MISMATCH;
|
||||
}
|
||||
}
|
||||
/* 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) {
|
||||
|
|
Loading…
Reference in a new issue