Changed mbedtls_platform_memcpy back to memcpy for selftest and test functions
diff --git a/library/aes.c b/library/aes.c
index 33eeb24..51ecd1e 100644
--- a/library/aes.c
+++ b/library/aes.c
@@ -1992,9 +1992,9 @@
{
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 @@
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 @@
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 @@
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 @@
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 @@
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];
}
diff --git a/library/arc4.c b/library/arc4.c
index e936fc5..eeebbdc 100644
--- a/library/arc4.c
+++ b/library/arc4.c
@@ -169,7 +169,7 @@
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 );
diff --git a/library/aria.c b/library/aria.c
index ee4b8e1..3a785d4 100644
--- a/library/aria.c
+++ b/library/aria.c
@@ -986,8 +986,8 @@
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 @@
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 @@
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 @@
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 );
diff --git a/library/camellia.c b/library/camellia.c
index 982a0b5..58ae1a8 100644
--- a/library/camellia.c
+++ b/library/camellia.c
@@ -962,16 +962,16 @@
(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 @@
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 @@
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 @@
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 @@
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 @@
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 );
diff --git a/library/ccm.c b/library/ccm.c
index a515df6..bec7498 100644
--- a/library/ccm.c
+++ b/library/ccm.c
@@ -495,9 +495,9 @@
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],
diff --git a/library/ctr_drbg.c b/library/ctr_drbg.c
index dd8aad6..069303f 100644
--- a/library/ctr_drbg.c
+++ b/library/ctr_drbg.c
@@ -649,7 +649,7 @@
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 );
}
diff --git a/library/des.c b/library/des.c
index e6dcc05..c920328 100644
--- a/library/des.c
+++ b/library/des.c
@@ -896,7 +896,7 @@
( 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 @@
( 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 @@
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 &&
diff --git a/library/ecjpake.c b/library/ecjpake.c
index ce62df4..2b6a989 100644
--- a/library/ecjpake.c
+++ b/library/ecjpake.c
@@ -983,7 +983,7 @@
{
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;
}
diff --git a/library/hmac_drbg.c b/library/hmac_drbg.c
index 27806f3..d0de5de 100644
--- a/library/hmac_drbg.c
+++ b/library/hmac_drbg.c
@@ -547,7 +547,7 @@
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 );
}
diff --git a/library/rsa.c b/library/rsa.c
index 9cadd1b..cde07e3 100644
--- a/library/rsa.c
+++ b/library/rsa.c
@@ -2623,7 +2623,7 @@
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,
diff --git a/library/xtea.c b/library/xtea.c
index c66bdd4..572936d 100644
--- a/library/xtea.c
+++ b/library/xtea.c
@@ -245,7 +245,7 @@
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 );