mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 06:45:38 +01:00
aes: xts: Add tests for invalid key sizes
Test that we get the error we expect when using various valid and invalid keysizes with mbedtls_aes_xts_setkey_enc() and mbedtls_aes_xts_setkey_dec().
This commit is contained in:
parent
8cfc75f603
commit
142383e25b
@ -258,6 +258,21 @@ void aes_crypt_xts_size( int size, int retval )
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_XTS */
|
||||
void aes_crypt_xts_keysize( int size, int retval )
|
||||
{
|
||||
mbedtls_aes_xts_context ctx;
|
||||
const unsigned char *key = NULL;
|
||||
size_t key_len = size;
|
||||
|
||||
mbedtls_aes_xts_init( &ctx );
|
||||
|
||||
TEST_ASSERT( mbedtls_aes_xts_setkey_enc( &ctx, key, key_len * 8 ) == retval );
|
||||
TEST_ASSERT( mbedtls_aes_xts_setkey_dec( &ctx, key, key_len * 8 ) == retval );
|
||||
exit:
|
||||
mbedtls_aes_xts_free( &ctx );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
|
||||
|
@ -13,6 +13,21 @@ aes_crypt_xts_size:16777217:MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH
|
||||
AES-128-XTS Encrypt Fail Sector Too Large (by 1 block)
|
||||
aes_crypt_xts_size:16777232:MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH
|
||||
|
||||
AES-0-XTS Setkey Fail Invalid Key Length
|
||||
aes_crypt_xts_keysize:0:MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||
|
||||
AES-4-XTS Setkey Fail Invalid Key Length
|
||||
aes_crypt_xts_keysize:1:MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||
|
||||
AES-64-XTS Setkey Fail Invalid Key Length
|
||||
aes_crypt_xts_keysize:16:MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||
|
||||
AES-192-XTS Setkey Fail Invalid Key Length
|
||||
aes_crypt_xts_keysize:48:MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||
|
||||
AES-384-XTS Setkey Fail Invalid Key Length
|
||||
aes_crypt_xts_keysize:96:MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||
|
||||
AES-128-XTS Encrypt NIST XTSTestVectors #1
|
||||
aes_encrypt_xts:"a1b90cba3f06ac353b2c343876081762090923026e91771815f29dab01932f2f":"4faef7117cda59c66e4b92013e768ad5":"ebabce95b14d3c8d6fb350390790311c":"778ae8b43cb98d5a825081d5be471c63"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user