mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-21 15:41:00 +00:00
Add calls to BLOCK_CIPHER_PSA_INIT / BLOCK_CIPHER_PSA_DONE
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
ba8e9addd9
commit
12285c5c7c
@ -499,8 +499,11 @@ exit:
|
||||
void gcm_invalid_iv_len(void)
|
||||
{
|
||||
mbedtls_gcm_context ctx;
|
||||
mbedtls_gcm_init(&ctx);
|
||||
uint8_t b16[16] = { 0 };
|
||||
|
||||
BLOCK_CIPHER_PSA_INIT();
|
||||
|
||||
// Invalid IV length 0
|
||||
gcm_reset_ctx(&ctx, b16, sizeof(b16) * 8, b16, 0, MBEDTLS_ERR_GCM_BAD_INPUT);
|
||||
mbedtls_gcm_free(&ctx);
|
||||
@ -514,8 +517,8 @@ void gcm_invalid_iv_len(void)
|
||||
|
||||
goto exit; /* To suppress error that exit is defined but not used */
|
||||
exit:
|
||||
/* empty */
|
||||
return;
|
||||
mbedtls_gcm_free(&ctx);
|
||||
BLOCK_CIPHER_PSA_DONE();
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
@ -525,7 +528,10 @@ void gcm_add_len_too_long(void)
|
||||
// Only testable on platforms where sizeof(size_t) >= 8.
|
||||
#if SIZE_MAX >= UINT64_MAX
|
||||
mbedtls_gcm_context ctx;
|
||||
mbedtls_gcm_init(&ctx);
|
||||
uint8_t b16[16] = { 0 };
|
||||
BLOCK_CIPHER_PSA_INIT();
|
||||
|
||||
/* NISP SP 800-38D, Section 5.2.1.1 requires that bit length of AD should
|
||||
* be <= 2^64 - 1, ie < 2^64. This is the minimum invalid length in bytes. */
|
||||
uint64_t len_max = 1ULL << 61;
|
||||
@ -550,6 +556,7 @@ void gcm_add_len_too_long(void)
|
||||
|
||||
exit:
|
||||
mbedtls_gcm_free(&ctx);
|
||||
BLOCK_CIPHER_PSA_DONE();
|
||||
#endif
|
||||
}
|
||||
/* END_CASE */
|
||||
@ -563,6 +570,9 @@ void gcm_input_len_too_long(void)
|
||||
uint8_t b16[16] = { 0 };
|
||||
uint8_t out[1];
|
||||
size_t out_len;
|
||||
mbedtls_gcm_init(&ctx);
|
||||
BLOCK_CIPHER_PSA_INIT();
|
||||
|
||||
/* NISP SP 800-38D, Section 5.2.1.1 requires that bit length of input should
|
||||
* be <= 2^39 - 256. This is the maximum valid length in bytes. */
|
||||
uint64_t len_max = (1ULL << 36) - 32;
|
||||
@ -590,6 +600,7 @@ void gcm_input_len_too_long(void)
|
||||
|
||||
exit:
|
||||
mbedtls_gcm_free(&ctx);
|
||||
BLOCK_CIPHER_PSA_DONE();
|
||||
#endif
|
||||
}
|
||||
/* END_CASE */
|
||||
|
Loading…
x
Reference in New Issue
Block a user