mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-23 16:20:49 +00:00
Cover multiple calls to mbedtls_gcm_update_ad in gcm test suite.
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
This commit is contained in:
parent
bd513bb53d
commit
658f4fd6d8
@ -16,15 +16,19 @@ static int check_multipart( mbedtls_gcm_context *ctx,
|
||||
int ok = 0;
|
||||
uint8_t *output = NULL;
|
||||
size_t n2 = input->len - n1;
|
||||
size_t n1_add = n1 < add->len ? add->len - n1 : add->len;
|
||||
size_t n2_add = add->len - n1_add;
|
||||
size_t olen;
|
||||
|
||||
/* Sanity checks on the test data */
|
||||
TEST_ASSERT( n1 <= input->len );
|
||||
TEST_ASSERT( n1_add <= add->len );
|
||||
TEST_EQUAL( input->len, expected_output->len );
|
||||
|
||||
TEST_EQUAL( 0, mbedtls_gcm_starts( ctx, mode,
|
||||
iv->x, iv->len ) );
|
||||
TEST_EQUAL( 0, mbedtls_gcm_update_ad( ctx, add->x, add->len ) );
|
||||
TEST_EQUAL( 0, mbedtls_gcm_update_ad( ctx, add->x, n1_add ) );
|
||||
TEST_EQUAL( 0, mbedtls_gcm_update_ad( ctx, add->x + n1_add, n2_add ) );
|
||||
|
||||
/* Allocate a tight buffer for each update call. This way, if the function
|
||||
* tries to write beyond the advertised required buffer size, this will
|
||||
|
Loading…
x
Reference in New Issue
Block a user