mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 04:25:44 +01:00
Merge pull request #4155 from gilles-peskine-arm/ccm-test-iv-overflow-warning-2.16
Backport 2.16: Silence gcc-10 warning in test_suite_ccm
This commit is contained in:
commit
6c91b7c91e
@ -200,12 +200,11 @@ void mbedtls_ccm_star_encrypt_and_tag( int cipher_id,
|
|||||||
unsigned char iv[13];
|
unsigned char iv[13];
|
||||||
unsigned char result[50];
|
unsigned char result[50];
|
||||||
mbedtls_ccm_context ctx;
|
mbedtls_ccm_context ctx;
|
||||||
size_t i, iv_len, tag_len;
|
size_t iv_len, tag_len;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mbedtls_ccm_init( &ctx );
|
mbedtls_ccm_init( &ctx );
|
||||||
|
|
||||||
memset( iv, 0x00, sizeof( iv ) );
|
|
||||||
memset( result, 0x00, sizeof( result ) );
|
memset( result, 0x00, sizeof( result ) );
|
||||||
|
|
||||||
if( sec_level % 4 == 0)
|
if( sec_level % 4 == 0)
|
||||||
@ -213,12 +212,10 @@ void mbedtls_ccm_star_encrypt_and_tag( int cipher_id,
|
|||||||
else
|
else
|
||||||
tag_len = 1 << ( sec_level % 4 + 1);
|
tag_len = 1 << ( sec_level % 4 + 1);
|
||||||
|
|
||||||
for( i = 0; i < source_address->len; i++ )
|
TEST_ASSERT( source_address->len == 8 );
|
||||||
iv[i] = source_address->x[i];
|
TEST_ASSERT( frame_counter->len == 4 );
|
||||||
|
memcpy( iv, source_address->x, source_address->len );
|
||||||
for( i = 0; i < frame_counter->len; i++ )
|
memcpy( iv + source_address->len, frame_counter->x, frame_counter->len );
|
||||||
iv[source_address->len + i] = frame_counter->x[i];
|
|
||||||
|
|
||||||
iv[source_address->len + frame_counter->len] = sec_level;
|
iv[source_address->len + frame_counter->len] = sec_level;
|
||||||
iv_len = sizeof( iv );
|
iv_len = sizeof( iv );
|
||||||
|
|
||||||
@ -253,7 +250,7 @@ void mbedtls_ccm_star_auth_decrypt( int cipher_id,
|
|||||||
unsigned char iv[13];
|
unsigned char iv[13];
|
||||||
unsigned char result[50];
|
unsigned char result[50];
|
||||||
mbedtls_ccm_context ctx;
|
mbedtls_ccm_context ctx;
|
||||||
size_t i, iv_len, tag_len;
|
size_t iv_len, tag_len;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mbedtls_ccm_init( &ctx );
|
mbedtls_ccm_init( &ctx );
|
||||||
@ -266,12 +263,10 @@ void mbedtls_ccm_star_auth_decrypt( int cipher_id,
|
|||||||
else
|
else
|
||||||
tag_len = 1 << ( sec_level % 4 + 1);
|
tag_len = 1 << ( sec_level % 4 + 1);
|
||||||
|
|
||||||
for( i = 0; i < source_address->len; i++ )
|
TEST_ASSERT( source_address->len == 8 );
|
||||||
iv[i] = source_address->x[i];
|
TEST_ASSERT( frame_counter->len == 4 );
|
||||||
|
memcpy( iv, source_address->x, source_address->len );
|
||||||
for( i = 0; i < frame_counter->len; i++ )
|
memcpy( iv + source_address->len, frame_counter->x, frame_counter->len );
|
||||||
iv[source_address->len + i] = frame_counter->x[i];
|
|
||||||
|
|
||||||
iv[source_address->len + frame_counter->len] = sec_level;
|
iv[source_address->len + frame_counter->len] = sec_level;
|
||||||
iv_len = sizeof( iv );
|
iv_len = sizeof( iv );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user