mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-01-07 15:09:28 +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
2 changed files with 30 additions and 0 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue