mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
aes: Remove AES-XEX
AES-XEX is a building block for other cryptographic standards and not yet a standard in and of itself. We'll just provide the standardized AES-XTS algorithm, and not AES-XEX. The AES-XTS algorithm and interface provided can be used to perform the AES-XEX algorithm when the length of the input is a multiple of the AES block size.
This commit is contained in:
@ -48,7 +48,6 @@ add_test_suite(aes aes.ecb)
|
||||
add_test_suite(aes aes.cbc)
|
||||
add_test_suite(aes aes.cfb)
|
||||
add_test_suite(aes aes.rest)
|
||||
add_test_suite(aes aes.xex)
|
||||
add_test_suite(aes aes.xts)
|
||||
add_test_suite(arc4)
|
||||
add_test_suite(aria)
|
||||
|
@ -151,80 +151,6 @@ exit:
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_XEX */
|
||||
void aes_encrypt_xex( char *hex_key_string, char *hex_iv_string,
|
||||
char *hex_src_string, char *hex_dst_string,
|
||||
int xex_result )
|
||||
{
|
||||
unsigned char key_str[100] = { 0, };
|
||||
unsigned char iv_str[100] = { 0, };
|
||||
unsigned char src_str[100] = { 0, };
|
||||
unsigned char dst_str[100] = { 0, };
|
||||
unsigned char output[100] = { 0, };
|
||||
mbedtls_aes_context crypt_ctx, tweak_ctx;
|
||||
int key_len, data_len;
|
||||
|
||||
mbedtls_aes_init( &crypt_ctx );
|
||||
mbedtls_aes_init( &tweak_ctx );
|
||||
|
||||
key_len = unhexify( key_str, hex_key_string );
|
||||
unhexify( iv_str, hex_iv_string );
|
||||
data_len = unhexify( src_str, hex_src_string );
|
||||
|
||||
mbedtls_aes_setkey_enc( &crypt_ctx, key_str, ( key_len * 8 ) / 2 );
|
||||
mbedtls_aes_setkey_enc( &tweak_ctx, key_str + key_len / 2, ( key_len * 8 ) / 2 );
|
||||
|
||||
TEST_ASSERT( mbedtls_aes_crypt_xex( &crypt_ctx, &tweak_ctx, MBEDTLS_AES_ENCRYPT, data_len, iv_str, src_str, output ) == xex_result );
|
||||
if( xex_result == 0 )
|
||||
{
|
||||
hexify( dst_str, output, data_len );
|
||||
|
||||
TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 );
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_aes_free( &crypt_ctx );
|
||||
mbedtls_aes_free( &tweak_ctx );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_XEX */
|
||||
void aes_decrypt_xex( char *hex_key_string, char *hex_iv_string,
|
||||
char *hex_src_string, char *hex_dst_string,
|
||||
int xex_result )
|
||||
{
|
||||
unsigned char key_str[100] = { 0, };
|
||||
unsigned char iv_str[100] = { 0, };
|
||||
unsigned char src_str[100] = { 0, };
|
||||
unsigned char dst_str[100] = { 0, };
|
||||
unsigned char output[100] = { 0, };
|
||||
mbedtls_aes_context crypt_ctx, tweak_ctx;
|
||||
int key_len, data_len;
|
||||
|
||||
mbedtls_aes_init( &crypt_ctx );
|
||||
mbedtls_aes_init( &tweak_ctx );
|
||||
|
||||
key_len = unhexify( key_str, hex_key_string );
|
||||
unhexify( iv_str, hex_iv_string );
|
||||
data_len = unhexify( src_str, hex_src_string );
|
||||
|
||||
mbedtls_aes_setkey_dec( &crypt_ctx, key_str, ( key_len * 8 ) / 2 );
|
||||
mbedtls_aes_setkey_enc( &tweak_ctx, key_str + key_len / 2, ( key_len * 8 ) / 2 );
|
||||
|
||||
TEST_ASSERT( mbedtls_aes_crypt_xex( &crypt_ctx, &tweak_ctx, MBEDTLS_AES_DECRYPT, data_len, iv_str, src_str, output ) == xex_result );
|
||||
if( xex_result == 0 )
|
||||
{
|
||||
hexify( dst_str, output, data_len );
|
||||
|
||||
TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 );
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_aes_free( &crypt_ctx );
|
||||
mbedtls_aes_free( &tweak_ctx );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_XTS */
|
||||
void aes_encrypt_xts( char *hex_key_string, char *hex_iv_string,
|
||||
char *hex_src_string, char *hex_dst_string,
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user