Changed mbedtls_platform_memset/cpy/cmp in selftest functions back to original methods

This commit is contained in:
Teppo Järvelin 2019-10-30 13:48:12 +02:00
parent 6f4e030166
commit d49d2b6d4f
9 changed files with 18 additions and 18 deletions

View File

@ -1846,7 +1846,7 @@ int mbedtls_aes_self_test( int verbose )
#endif #endif
mbedtls_aes_context ctx; mbedtls_aes_context ctx;
mbedtls_platform_memset( key, 0, 32 ); memset( key, 0, 32 );
mbedtls_aes_init( &ctx ); mbedtls_aes_init( &ctx );
/* /*
@ -1878,7 +1878,7 @@ int mbedtls_aes_self_test( int verbose )
} }
#endif /* MBEDTLS_AES_ONLY_ENCRYPT */ #endif /* MBEDTLS_AES_ONLY_ENCRYPT */
mbedtls_platform_memset( buf, 0, 16 ); memset( buf, 0, 16 );
if( mode == MBEDTLS_AES_DECRYPT ) if( mode == MBEDTLS_AES_DECRYPT )
{ {
@ -1956,9 +1956,9 @@ int mbedtls_aes_self_test( int verbose )
} }
#endif /* MBEDTLS_AES_ONLY_ENCRYPT */ #endif /* MBEDTLS_AES_ONLY_ENCRYPT */
mbedtls_platform_memset( iv , 0, 16 ); memset( iv , 0, 16 );
mbedtls_platform_memset( prv, 0, 16 ); memset( prv, 0, 16 );
mbedtls_platform_memset( buf, 0, 16 ); memset( buf, 0, 16 );
if( mode == MBEDTLS_AES_DECRYPT ) if( mode == MBEDTLS_AES_DECRYPT )
{ {
@ -2272,8 +2272,8 @@ int mbedtls_aes_self_test( int verbose )
} }
#endif /* MBEDTLS_AES_ONLY_ENCRYPT */ #endif /* MBEDTLS_AES_ONLY_ENCRYPT */
mbedtls_platform_memset( key, 0, sizeof( key ) ); memset( key, 0, sizeof( key ) );
mbedtls_platform_memcpy( key, aes_test_xts_key[u], 32 ); memcpy( key, aes_test_xts_key[u], 32 );
data_unit = aes_test_xts_data_unit[u]; data_unit = aes_test_xts_data_unit[u];
len = sizeof( *aes_test_xts_ct32 ); len = sizeof( *aes_test_xts_ct32 );

View File

@ -1047,8 +1047,8 @@ int mbedtls_aria_self_test( int verbose )
if( verbose ) if( verbose )
mbedtls_printf( " ARIA-CTR-%d (enc): ", 128 + 64 * i ); mbedtls_printf( " ARIA-CTR-%d (enc): ", 128 + 64 * i );
mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i ); mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i );
mbedtls_platform_memset( iv, 0, MBEDTLS_ARIA_BLOCKSIZE ); // IV = 0 memset( iv, 0, MBEDTLS_ARIA_BLOCKSIZE ); // IV = 0
mbedtls_platform_memset( buf, 0x55, sizeof( buf ) ); memset( buf, 0x55, sizeof( buf ) );
j = 0; j = 0;
mbedtls_aria_crypt_ctr( &ctx, 48, &j, iv, blk, mbedtls_aria_crypt_ctr( &ctx, 48, &j, iv, blk,
aria_test2_pt, buf ); aria_test2_pt, buf );
@ -1059,8 +1059,8 @@ int mbedtls_aria_self_test( int verbose )
if( verbose ) if( verbose )
mbedtls_printf( " ARIA-CTR-%d (dec): ", 128 + 64 * i ); mbedtls_printf( " ARIA-CTR-%d (dec): ", 128 + 64 * i );
mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i ); mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i );
mbedtls_platform_memset( iv, 0, MBEDTLS_ARIA_BLOCKSIZE ); // IV = 0 memset( iv, 0, MBEDTLS_ARIA_BLOCKSIZE ); // IV = 0
mbedtls_platform_memset( buf, 0xAA, sizeof( buf ) ); memset( buf, 0xAA, sizeof( buf ) );
j = 0; j = 0;
mbedtls_aria_crypt_ctr( &ctx, 48, &j, iv, blk, mbedtls_aria_crypt_ctr( &ctx, 48, &j, iv, blk,
aria_test2_ctr_ct[i], buf ); aria_test2_ctr_ct[i], buf );

View File

@ -951,7 +951,7 @@ int mbedtls_camellia_self_test( int verbose )
mbedtls_camellia_context ctx; mbedtls_camellia_context ctx;
mbedtls_platform_memset( key, 0, 32 ); memset( key, 0, 32 );
for( j = 0; j < 6; j++ ) { for( j = 0; j < 6; j++ ) {
u = j >> 1; u = j >> 1;

View File

@ -512,7 +512,7 @@ int mbedtls_ccm_self_test( int verbose )
return( 1 ); return( 1 );
} }
mbedtls_platform_memset( plaintext, 0, CCM_SELFTEST_PT_MAX_LEN ); memset( plaintext, 0, CCM_SELFTEST_PT_MAX_LEN );
ret = mbedtls_ccm_auth_decrypt( &ctx, msg_len[i], ret = mbedtls_ccm_auth_decrypt( &ctx, msg_len[i],
iv, iv_len[i], ad, add_len[i], iv, iv_len[i], ad, add_len[i],

View File

@ -1104,7 +1104,7 @@ int mbedtls_ecjpake_self_test( int verbose )
TEST_ASSERT( len == sizeof( ecjpake_test_pms ) ); TEST_ASSERT( len == sizeof( ecjpake_test_pms ) );
TEST_ASSERT( memcmp( buf, ecjpake_test_pms, len ) == 0 ); TEST_ASSERT( memcmp( buf, ecjpake_test_pms, len ) == 0 );
mbedtls_platform_memset( buf, 0, len ); /* Avoid interferences with next step */ memset( buf, 0, len ); /* Avoid interferences with next step */
/* Client derives PMS */ /* Client derives PMS */
TEST_ASSERT( mbedtls_ecjpake_derive_secret( &cli, TEST_ASSERT( mbedtls_ecjpake_derive_secret( &cli,

View File

@ -520,7 +520,7 @@ int mbedtls_ripemd160_self_test( int verbose )
int i, ret = 0; int i, ret = 0;
unsigned char output[20]; unsigned char output[20];
mbedtls_platform_memset( output, 0, sizeof output ); memset( output, 0, sizeof output );
for( i = 0; i < TESTS; i++ ) for( i = 0; i < TESTS; i++ )
{ {

View File

@ -523,7 +523,7 @@ int mbedtls_sha1_self_test( int verbose )
if( i == 2 ) if( i == 2 )
{ {
mbedtls_platform_memset( buf, 'a', buflen = 1000 ); memset( buf, 'a', buflen = 1000 );
for( j = 0; j < 1000; j++ ) for( j = 0; j < 1000; j++ )
{ {

View File

@ -527,7 +527,7 @@ int mbedtls_sha256_self_test( int verbose )
if( j == 2 ) if( j == 2 )
{ {
mbedtls_platform_memset( buf, 'a', buflen = 1000 ); memset( buf, 'a', buflen = 1000 );
for( j = 0; j < 1000; j++ ) for( j = 0; j < 1000; j++ )
{ {

View File

@ -585,7 +585,7 @@ int mbedtls_sha512_self_test( int verbose )
if( j == 2 ) if( j == 2 )
{ {
mbedtls_platform_memset( buf, 'a', buflen = 1000 ); memset( buf, 'a', buflen = 1000 );
for( j = 0; j < 1000; j++ ) for( j = 0; j < 1000; j++ )
{ {