mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-10 05:03:02 +03:00
Test consistency of cipher max-size macros
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@@ -63,6 +63,9 @@ static int check_cipher_info(mbedtls_cipher_type_t type,
|
|||||||
key_bitlen == 192 ||
|
key_bitlen == 192 ||
|
||||||
key_bitlen == 256);
|
key_bitlen == 256);
|
||||||
}
|
}
|
||||||
|
TEST_LE_U(key_bitlen, MBEDTLS_MAX_KEY_LENGTH * 8);
|
||||||
|
TEST_LE_U(block_size, MBEDTLS_MAX_BLOCK_LENGTH);
|
||||||
|
TEST_LE_U(iv_size, MBEDTLS_MAX_IV_LENGTH);
|
||||||
|
|
||||||
if (strstr(info->name, "-ECB") != NULL) {
|
if (strstr(info->name, "-ECB") != NULL) {
|
||||||
TEST_ASSERT(iv_size == 0);
|
TEST_ASSERT(iv_size == 0);
|
||||||
|
@@ -111,6 +111,8 @@ void mbedtls_cmac_setkey(int cipher_type, int key_size, int result)
|
|||||||
|
|
||||||
TEST_ASSERT((cipher_info = mbedtls_cipher_info_from_type(cipher_type))
|
TEST_ASSERT((cipher_info = mbedtls_cipher_info_from_type(cipher_type))
|
||||||
!= NULL);
|
!= NULL);
|
||||||
|
TEST_LE_U(mbedtls_cipher_info_get_block_size(cipher_info),
|
||||||
|
MBEDTLS_CIPHER_BLKSIZE_MAX);
|
||||||
|
|
||||||
memset(buf, 0x2A, sizeof(buf));
|
memset(buf, 0x2A, sizeof(buf));
|
||||||
TEST_ASSERT((result == mbedtls_cipher_cmac(cipher_info, key, key_size,
|
TEST_ASSERT((result == mbedtls_cipher_cmac(cipher_info, key, key_size,
|
||||||
|
Reference in New Issue
Block a user