mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 00:15:37 +01:00
Changed mbedtls_platform_memcpy back to memcpy for selftest and test functions
This commit is contained in:
parent
3137fb271a
commit
b5c4671a80
@ -1992,9 +1992,9 @@ int mbedtls_aes_self_test( int verbose )
|
||||
{
|
||||
unsigned char tmp[16];
|
||||
|
||||
mbedtls_platform_memcpy( tmp, prv, 16 );
|
||||
mbedtls_platform_memcpy( prv, buf, 16 );
|
||||
mbedtls_platform_memcpy( buf, tmp, 16 );
|
||||
memcpy( tmp, prv, 16 );
|
||||
memcpy( prv, buf, 16 );
|
||||
memcpy( buf, tmp, 16 );
|
||||
}
|
||||
|
||||
ret = mbedtls_aes_crypt_cbc( &ctx, mode, 16, iv, buf, buf );
|
||||
@ -2069,12 +2069,12 @@ int mbedtls_aes_self_test( int verbose )
|
||||
|
||||
if( mode == MBEDTLS_AES_DECRYPT )
|
||||
{
|
||||
mbedtls_platform_memcpy( buf, aes_test_cfb128_ct[u], 64 );
|
||||
memcpy( buf, aes_test_cfb128_ct[u], 64 );
|
||||
aes_tests = aes_test_cfb128_pt;
|
||||
}
|
||||
else
|
||||
{
|
||||
mbedtls_platform_memcpy( buf, aes_test_cfb128_pt, 64 );
|
||||
memcpy( buf, aes_test_cfb128_pt, 64 );
|
||||
aes_tests = aes_test_cfb128_ct[u];
|
||||
}
|
||||
|
||||
@ -2148,12 +2148,12 @@ int mbedtls_aes_self_test( int verbose )
|
||||
|
||||
if( mode == MBEDTLS_AES_DECRYPT )
|
||||
{
|
||||
mbedtls_platform_memcpy( buf, aes_test_ofb_ct[u], 64 );
|
||||
memcpy( buf, aes_test_ofb_ct[u], 64 );
|
||||
aes_tests = aes_test_ofb_pt;
|
||||
}
|
||||
else
|
||||
{
|
||||
mbedtls_platform_memcpy( buf, aes_test_ofb_pt, 64 );
|
||||
memcpy( buf, aes_test_ofb_pt, 64 );
|
||||
aes_tests = aes_test_ofb_ct[u];
|
||||
}
|
||||
|
||||
@ -2215,12 +2215,12 @@ int mbedtls_aes_self_test( int verbose )
|
||||
|
||||
if( mode == MBEDTLS_AES_DECRYPT )
|
||||
{
|
||||
mbedtls_platform_memcpy( buf, aes_test_ctr_ct[u], len );
|
||||
memcpy( buf, aes_test_ctr_ct[u], len );
|
||||
aes_tests = aes_test_ctr_pt[u];
|
||||
}
|
||||
else
|
||||
{
|
||||
mbedtls_platform_memcpy( buf, aes_test_ctr_pt[u], len );
|
||||
memcpy( buf, aes_test_ctr_pt[u], len );
|
||||
aes_tests = aes_test_ctr_ct[u];
|
||||
}
|
||||
|
||||
@ -2283,7 +2283,7 @@ int mbedtls_aes_self_test( int verbose )
|
||||
ret = mbedtls_aes_xts_setkey_dec( &ctx_xts, key, 256 );
|
||||
if( ret != 0)
|
||||
goto exit;
|
||||
mbedtls_platform_memcpy( buf, aes_test_xts_ct32[u], len );
|
||||
memcpy( buf, aes_test_xts_ct32[u], len );
|
||||
aes_tests = aes_test_xts_pt32[u];
|
||||
}
|
||||
else
|
||||
@ -2291,7 +2291,7 @@ int mbedtls_aes_self_test( int verbose )
|
||||
ret = mbedtls_aes_xts_setkey_enc( &ctx_xts, key, 256 );
|
||||
if( ret != 0)
|
||||
goto exit;
|
||||
mbedtls_platform_memcpy( buf, aes_test_xts_pt32[u], len );
|
||||
memcpy( buf, aes_test_xts_pt32[u], len );
|
||||
aes_tests = aes_test_xts_ct32[u];
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ int mbedtls_arc4_self_test( int verbose )
|
||||
if( verbose != 0 )
|
||||
mbedtls_printf( " ARC4 test #%d: ", i + 1 );
|
||||
|
||||
mbedtls_platform_memcpy( ibuf, arc4_test_pt[i], 8 );
|
||||
memcpy( ibuf, arc4_test_pt[i], 8 );
|
||||
|
||||
mbedtls_arc4_setup( &ctx, arc4_test_key[i], 8 );
|
||||
mbedtls_arc4_crypt( &ctx, 8, ibuf, obuf );
|
||||
|
@ -986,8 +986,8 @@ int mbedtls_aria_self_test( int verbose )
|
||||
if( verbose )
|
||||
mbedtls_printf( " ARIA-CBC-%d (enc): ", 128 + 64 * i );
|
||||
mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i );
|
||||
mbedtls_platform_memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
||||
mbedtls_platform_memset( buf, 0x55, sizeof( buf ) );
|
||||
memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
||||
memset( buf, 0x55, sizeof( buf ) );
|
||||
mbedtls_aria_crypt_cbc( &ctx, MBEDTLS_ARIA_ENCRYPT, 48, iv,
|
||||
aria_test2_pt, buf );
|
||||
if( memcmp( buf, aria_test2_cbc_ct[i], 48 ) != 0 )
|
||||
@ -997,8 +997,8 @@ int mbedtls_aria_self_test( int verbose )
|
||||
if( verbose )
|
||||
mbedtls_printf( " ARIA-CBC-%d (dec): ", 128 + 64 * i );
|
||||
mbedtls_aria_setkey_dec( &ctx, aria_test2_key, 128 + 64 * i );
|
||||
mbedtls_platform_memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
||||
mbedtls_platform_memset( buf, 0xAA, sizeof( buf ) );
|
||||
memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
||||
memset( buf, 0xAA, sizeof( buf ) );
|
||||
mbedtls_aria_crypt_cbc( &ctx, MBEDTLS_ARIA_DECRYPT, 48, iv,
|
||||
aria_test2_cbc_ct[i], buf );
|
||||
if( memcmp( buf, aria_test2_pt, 48 ) != 0 )
|
||||
@ -1016,8 +1016,8 @@ int mbedtls_aria_self_test( int verbose )
|
||||
if( verbose )
|
||||
mbedtls_printf( " ARIA-CFB-%d (enc): ", 128 + 64 * i );
|
||||
mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i );
|
||||
mbedtls_platform_memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
||||
mbedtls_platform_memset( buf, 0x55, sizeof( buf ) );
|
||||
memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
||||
memset( buf, 0x55, sizeof( buf ) );
|
||||
j = 0;
|
||||
mbedtls_aria_crypt_cfb128( &ctx, MBEDTLS_ARIA_ENCRYPT, 48, &j, iv,
|
||||
aria_test2_pt, buf );
|
||||
@ -1028,8 +1028,8 @@ int mbedtls_aria_self_test( int verbose )
|
||||
if( verbose )
|
||||
mbedtls_printf( " ARIA-CFB-%d (dec): ", 128 + 64 * i );
|
||||
mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i );
|
||||
mbedtls_platform_memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
||||
mbedtls_platform_memset( buf, 0xAA, sizeof( buf ) );
|
||||
memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
||||
memset( buf, 0xAA, sizeof( buf ) );
|
||||
j = 0;
|
||||
mbedtls_aria_crypt_cfb128( &ctx, MBEDTLS_ARIA_DECRYPT, 48, &j,
|
||||
iv, aria_test2_cfb_ct[i], buf );
|
||||
|
@ -962,16 +962,16 @@ int mbedtls_camellia_self_test( int verbose )
|
||||
(v == MBEDTLS_CAMELLIA_DECRYPT) ? "dec" : "enc");
|
||||
|
||||
for( i = 0; i < CAMELLIA_TESTS_ECB; i++ ) {
|
||||
mbedtls_platform_memcpy( key, camellia_test_ecb_key[u][i], 16 + 8 * u );
|
||||
memcpy( key, camellia_test_ecb_key[u][i], 16 + 8 * u );
|
||||
|
||||
if( v == MBEDTLS_CAMELLIA_DECRYPT ) {
|
||||
mbedtls_camellia_setkey_dec( &ctx, key, 128 + u * 64 );
|
||||
mbedtls_platform_memcpy( src, camellia_test_ecb_cipher[u][i], 16 );
|
||||
mbedtls_platform_memcpy( dst, camellia_test_ecb_plain[i], 16 );
|
||||
memcpy( src, camellia_test_ecb_cipher[u][i], 16 );
|
||||
memcpy( dst, camellia_test_ecb_plain[i], 16 );
|
||||
} else { /* MBEDTLS_CAMELLIA_ENCRYPT */
|
||||
mbedtls_camellia_setkey_enc( &ctx, key, 128 + u * 64 );
|
||||
mbedtls_platform_memcpy( src, camellia_test_ecb_plain[i], 16 );
|
||||
mbedtls_platform_memcpy( dst, camellia_test_ecb_cipher[u][i], 16 );
|
||||
memcpy( src, camellia_test_ecb_plain[i], 16 );
|
||||
memcpy( dst, camellia_test_ecb_cipher[u][i], 16 );
|
||||
}
|
||||
|
||||
mbedtls_camellia_crypt_ecb( &ctx, v, src, buf );
|
||||
@ -1005,9 +1005,9 @@ int mbedtls_camellia_self_test( int verbose )
|
||||
mbedtls_printf( " CAMELLIA-CBC-%3d (%s): ", 128 + u * 64,
|
||||
( v == MBEDTLS_CAMELLIA_DECRYPT ) ? "dec" : "enc" );
|
||||
|
||||
mbedtls_platform_memcpy( src, camellia_test_cbc_iv, 16 );
|
||||
mbedtls_platform_memcpy( dst, camellia_test_cbc_iv, 16 );
|
||||
mbedtls_platform_memcpy( key, camellia_test_cbc_key[u], 16 + 8 * u );
|
||||
memcpy( src, camellia_test_cbc_iv, 16 );
|
||||
memcpy( dst, camellia_test_cbc_iv, 16 );
|
||||
memcpy( key, camellia_test_cbc_key[u], 16 + 8 * u );
|
||||
|
||||
if( v == MBEDTLS_CAMELLIA_DECRYPT ) {
|
||||
mbedtls_camellia_setkey_dec( &ctx, key, 128 + u * 64 );
|
||||
@ -1018,13 +1018,13 @@ int mbedtls_camellia_self_test( int verbose )
|
||||
for( i = 0; i < CAMELLIA_TESTS_CBC; i++ ) {
|
||||
|
||||
if( v == MBEDTLS_CAMELLIA_DECRYPT ) {
|
||||
mbedtls_platform_memcpy( iv , src, 16 );
|
||||
mbedtls_platform_memcpy( src, camellia_test_cbc_cipher[u][i], 16 );
|
||||
mbedtls_platform_memcpy( dst, camellia_test_cbc_plain[i], 16 );
|
||||
memcpy( iv , src, 16 );
|
||||
memcpy( src, camellia_test_cbc_cipher[u][i], 16 );
|
||||
memcpy( dst, camellia_test_cbc_plain[i], 16 );
|
||||
} else { /* MBEDTLS_CAMELLIA_ENCRYPT */
|
||||
mbedtls_platform_memcpy( iv , dst, 16 );
|
||||
mbedtls_platform_memcpy( src, camellia_test_cbc_plain[i], 16 );
|
||||
mbedtls_platform_memcpy( dst, camellia_test_cbc_cipher[u][i], 16 );
|
||||
memcpy( iv , dst, 16 );
|
||||
memcpy( src, camellia_test_cbc_plain[i], 16 );
|
||||
memcpy( dst, camellia_test_cbc_cipher[u][i], 16 );
|
||||
}
|
||||
|
||||
mbedtls_camellia_crypt_cbc( &ctx, v, 16, iv, src, buf );
|
||||
@ -1059,8 +1059,8 @@ int mbedtls_camellia_self_test( int verbose )
|
||||
mbedtls_printf( " CAMELLIA-CTR-128 (%s): ",
|
||||
( v == MBEDTLS_CAMELLIA_DECRYPT ) ? "dec" : "enc" );
|
||||
|
||||
mbedtls_platform_memcpy( nonce_counter, camellia_test_ctr_nonce_counter[u], 16 );
|
||||
mbedtls_platform_memcpy( key, camellia_test_ctr_key[u], 16 );
|
||||
memcpy( nonce_counter, camellia_test_ctr_nonce_counter[u], 16 );
|
||||
memcpy( key, camellia_test_ctr_key[u], 16 );
|
||||
|
||||
offset = 0;
|
||||
mbedtls_camellia_setkey_enc( &ctx, key, 128 );
|
||||
@ -1068,7 +1068,7 @@ int mbedtls_camellia_self_test( int verbose )
|
||||
if( v == MBEDTLS_CAMELLIA_DECRYPT )
|
||||
{
|
||||
len = camellia_test_ctr_len[u];
|
||||
mbedtls_platform_memcpy( buf, camellia_test_ctr_ct[u], len );
|
||||
memcpy( buf, camellia_test_ctr_ct[u], len );
|
||||
|
||||
mbedtls_camellia_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block,
|
||||
buf, buf );
|
||||
@ -1084,7 +1084,7 @@ int mbedtls_camellia_self_test( int verbose )
|
||||
else
|
||||
{
|
||||
len = camellia_test_ctr_len[u];
|
||||
mbedtls_platform_memcpy( buf, camellia_test_ctr_pt[u], len );
|
||||
memcpy( buf, camellia_test_ctr_pt[u], len );
|
||||
|
||||
mbedtls_camellia_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block,
|
||||
buf, buf );
|
||||
|
@ -495,9 +495,9 @@ int mbedtls_ccm_self_test( int verbose )
|
||||
if( verbose != 0 )
|
||||
mbedtls_printf( " CCM-AES #%u: ", (unsigned int) i + 1 );
|
||||
|
||||
mbedtls_platform_memset( plaintext, 0, CCM_SELFTEST_PT_MAX_LEN );
|
||||
mbedtls_platform_memset( ciphertext, 0, CCM_SELFTEST_CT_MAX_LEN );
|
||||
mbedtls_platform_memcpy( plaintext, msg, msg_len[i] );
|
||||
memset( plaintext, 0, CCM_SELFTEST_PT_MAX_LEN );
|
||||
memset( ciphertext, 0, CCM_SELFTEST_CT_MAX_LEN );
|
||||
memcpy( plaintext, msg, msg_len[i] );
|
||||
|
||||
ret = mbedtls_ccm_encrypt_and_tag( &ctx, msg_len[i],
|
||||
iv, iv_len[i], ad, add_len[i],
|
||||
|
@ -649,7 +649,7 @@ static int ctr_drbg_self_test_entropy( void *data, unsigned char *buf,
|
||||
size_t len )
|
||||
{
|
||||
const unsigned char *p = data;
|
||||
mbedtls_platform_memcpy( buf, p + test_offset, len );
|
||||
memcpy( buf, p + test_offset, len );
|
||||
test_offset += len;
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -896,7 +896,7 @@ int mbedtls_des_self_test( int verbose )
|
||||
( u == 0 ) ? ' ' : '3', 56 + u * 56,
|
||||
( v == MBEDTLS_DES_DECRYPT ) ? "dec" : "enc" );
|
||||
|
||||
mbedtls_platform_memcpy( buf, des3_test_buf, 8 );
|
||||
memcpy( buf, des3_test_buf, 8 );
|
||||
|
||||
switch( i )
|
||||
{
|
||||
@ -969,9 +969,9 @@ int mbedtls_des_self_test( int verbose )
|
||||
( u == 0 ) ? ' ' : '3', 56 + u * 56,
|
||||
( v == MBEDTLS_DES_DECRYPT ) ? "dec" : "enc" );
|
||||
|
||||
mbedtls_platform_memcpy( iv, des3_test_iv, 8 );
|
||||
mbedtls_platform_memcpy( prv, des3_test_iv, 8 );
|
||||
mbedtls_platform_memcpy( buf, des3_test_buf, 8 );
|
||||
memcpy( iv, des3_test_iv, 8 );
|
||||
memcpy( prv, des3_test_iv, 8 );
|
||||
memcpy( buf, des3_test_buf, 8 );
|
||||
|
||||
switch( i )
|
||||
{
|
||||
@ -1024,12 +1024,12 @@ int mbedtls_des_self_test( int verbose )
|
||||
else
|
||||
mbedtls_des3_crypt_cbc( &ctx3, v, 8, iv, buf, buf );
|
||||
|
||||
mbedtls_platform_memcpy( tmp, prv, 8 );
|
||||
mbedtls_platform_memcpy( prv, buf, 8 );
|
||||
mbedtls_platform_memcpy( buf, tmp, 8 );
|
||||
memcpy( tmp, prv, 8 );
|
||||
memcpy( prv, buf, 8 );
|
||||
memcpy( buf, tmp, 8 );
|
||||
}
|
||||
|
||||
mbedtls_platform_memcpy( buf, prv, 8 );
|
||||
memcpy( buf, prv, 8 );
|
||||
}
|
||||
|
||||
if( ( v == MBEDTLS_DES_DECRYPT &&
|
||||
|
@ -983,7 +983,7 @@ static int ecjpake_lgc( void *p, unsigned char *out, size_t len )
|
||||
{
|
||||
size_t use_len = len > 4 ? 4 : len;
|
||||
x = 1664525 * x + 1013904223;
|
||||
mbedtls_platform_memcpy( out, &x, use_len );
|
||||
memcpy( out, &x, use_len );
|
||||
out += use_len;
|
||||
len -= use_len;
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ static int hmac_drbg_self_test_entropy( void *data,
|
||||
unsigned char *buf, size_t len )
|
||||
{
|
||||
const unsigned char *p = data;
|
||||
mbedtls_platform_memcpy( buf, p + test_offset, len );
|
||||
memcpy( buf, p + test_offset, len );
|
||||
test_offset += len;
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -2623,7 +2623,7 @@ int mbedtls_rsa_self_test( int verbose )
|
||||
if( verbose != 0 )
|
||||
mbedtls_printf( "passed\n PKCS#1 encryption : " );
|
||||
|
||||
mbedtls_platform_memcpy( rsa_plaintext, RSA_PT, PT_LEN );
|
||||
memcpy( rsa_plaintext, RSA_PT, PT_LEN );
|
||||
|
||||
if( mbedtls_rsa_pkcs1_encrypt( &rsa, myrand, NULL, MBEDTLS_RSA_PUBLIC,
|
||||
PT_LEN, rsa_plaintext,
|
||||
|
@ -245,7 +245,7 @@ int mbedtls_xtea_self_test( int verbose )
|
||||
if( verbose != 0 )
|
||||
mbedtls_printf( " XTEA test #%d: ", i + 1 );
|
||||
|
||||
mbedtls_platform_memcpy( buf, xtea_test_pt[i], 8 );
|
||||
memcpy( buf, xtea_test_pt[i], 8 );
|
||||
|
||||
mbedtls_xtea_setup( &ctx, xtea_test_key[i] );
|
||||
mbedtls_xtea_crypt_ecb( &ctx, MBEDTLS_XTEA_ENCRYPT, buf, buf );
|
||||
|
Loading…
Reference in New Issue
Block a user