mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-11-09 14:50:17 +08:00
pk: test RSA decrypt with buffer too small
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
parent
682d8f3e89
commit
689a05df0b
@ -1546,6 +1546,12 @@ void pk_rsa_decrypt_test_vec(data_t *cipher, int mod, int padding, int md_alg,
|
||||
if (ret == 0) {
|
||||
TEST_ASSERT(olen == clear->len);
|
||||
TEST_ASSERT(memcmp(output, clear->x, olen) == 0);
|
||||
|
||||
/* Try again with an output buffer that's too small */
|
||||
TEST_EQUAL(mbedtls_pk_decrypt(&pk, cipher->x, cipher->len,
|
||||
output, &olen, clear->len - 1,
|
||||
mbedtls_test_rnd_pseudo_rand, &rnd_info),
|
||||
MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE);
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user