mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-09-14 14:19:57 +00:00
psa: test buffer too small for RSA decrypt
Signed-off-by: Manuel Pégourié-Gonnard <[email protected]>
This commit is contained in:
@@ -8776,6 +8776,16 @@ void asymmetric_encrypt_decrypt(int key_type_arg,
|
||||
TEST_MEMORY_COMPARE(input_data->x, input_data->len,
|
||||
output2, output2_length);
|
||||
|
||||
/* Try again with an output buffer that's one byte too small */
|
||||
if (output2_size != 0) {
|
||||
TEST_EQUAL(PSA_ERROR_BUFFER_TOO_SMALL,
|
||||
psa_asymmetric_decrypt(key, alg,
|
||||
output, output_length,
|
||||
label->x, label->len,
|
||||
output2, output2_size - 1,
|
||||
&output2_length));
|
||||
}
|
||||
|
||||
exit:
|
||||
/*
|
||||
* Key attributes may have been returned by psa_get_key_attributes()
|
||||
@@ -8857,6 +8867,17 @@ void asymmetric_decrypt(int key_type_arg,
|
||||
output, output_length);
|
||||
}
|
||||
|
||||
/* Try again with an output buffer that's one byte too small */
|
||||
if (output_size != 0) {
|
||||
TEST_EQUAL(PSA_ERROR_BUFFER_TOO_SMALL,
|
||||
psa_asymmetric_decrypt(key, alg,
|
||||
input_data->x, input_data->len,
|
||||
label->x, label->len,
|
||||
output,
|
||||
output_size - 1,
|
||||
&output_length));
|
||||
}
|
||||
|
||||
exit:
|
||||
psa_reset_key_attributes(&attributes);
|
||||
psa_destroy_key(key);
|
||||
|
||||
Reference in New Issue
Block a user