Add more tests to check setting padding mode
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
This commit is contained in:
parent
071b69f47b
commit
f4e665101d
5 changed files with 77 additions and 35 deletions
|
@ -35,8 +35,8 @@ depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
|||
enc_dec_buf:MBEDTLS_CIPHER_AES_128_CBC:"AES-128-CBC":128:15:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
AES-128 CBC - Encrypt and decrypt 16 bytes with PKCS7 padding
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
enc_dec_buf:MBEDTLS_CIPHER_AES_128_CBC:"AES-128-CBC":128:16:MBEDTLS_PADDING_NONE
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
enc_dec_buf:MBEDTLS_CIPHER_AES_128_CBC:"AES-128-CBC":128:16:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
AES-128 CBC - Encrypt and decrypt 17 bytes with PKCS7 padding
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
|
@ -251,15 +251,15 @@ depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
|||
enc_dec_buf:MBEDTLS_CIPHER_AES_128_CBC:"AES-128-CBC":128:0:MBEDTLS_PADDING_NONE
|
||||
|
||||
AES-128 CBC - Encrypt and decrypt 16 bytes with no padding
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
enc_dec_buf:MBEDTLS_CIPHER_AES_128_CBC:"AES-128-CBC":128:16:MBEDTLS_PADDING_NONE
|
||||
|
||||
AES-128 CBC - Encrypt and decrypt 32 bytes with no padding
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
enc_dec_buf:MBEDTLS_CIPHER_AES_128_CBC:"AES-128-CBC":128:32:MBEDTLS_PADDING_NONE
|
||||
|
||||
AES-128 CBC - Encrypt and decrypt 48 bytes with no padding
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
enc_dec_buf:MBEDTLS_CIPHER_AES_128_CBC:"AES-128-CBC":128:48:MBEDTLS_PADDING_NONE
|
||||
|
||||
AES-128 CBC - Try encrypting 1 bytes with no padding
|
||||
|
@ -1299,8 +1299,8 @@ depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7:!M
|
|||
enc_dec_buf:MBEDTLS_CIPHER_AES_192_CBC:"AES-192-CBC":192:15:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
AES-192 CBC - Encrypt and decrypt 16 bytes with PKCS7 padding
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
enc_dec_buf:MBEDTLS_CIPHER_AES_192_CBC:"AES-192-CBC":192:16:MBEDTLS_PADDING_NONE
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
enc_dec_buf:MBEDTLS_CIPHER_AES_192_CBC:"AES-192-CBC":192:16:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
AES-192 CBC - Encrypt and decrypt 17 bytes with PKCS7 padding
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
|
@ -1407,8 +1407,8 @@ depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7:!M
|
|||
enc_dec_buf:MBEDTLS_CIPHER_AES_256_CBC:"AES-256-CBC":256:15:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
AES-256 CBC - Encrypt and decrypt 16 bytes with PKCS7 padding
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
enc_dec_buf:MBEDTLS_CIPHER_AES_256_CBC:"AES-256-CBC":256:16:MBEDTLS_PADDING_NONE
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
enc_dec_buf:MBEDTLS_CIPHER_AES_256_CBC:"AES-256-CBC":256:16:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
AES-256 CBC - Encrypt and decrypt 17 bytes with PKCS7 padding
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
|
@ -2258,6 +2258,14 @@ Cipher Corner Case behaviours
|
|||
depends_on:MBEDTLS_AES_C
|
||||
cipher_special_behaviours:
|
||||
|
||||
Check set padding
|
||||
Check set padding - 128 bit key
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
check_set_padding:MBEDTLS_CIPHER_AES_128_CBC
|
||||
|
||||
Check set padding - 192 bit key
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
check_set_padding:MBEDTLS_CIPHER_AES_192_CBC
|
||||
|
||||
Check set padding - 256 bit key
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
check_set_padding:MBEDTLS_CIPHER_AES_256_CBC
|
||||
|
|
|
@ -338,6 +338,14 @@ ARIA-256-CCM*-NO-TAG crypt Decrypt
|
|||
depends_on:MBEDTLS_ARIA_C:MBEDTLS_CCM_C
|
||||
test_vec_crypt:MBEDTLS_CIPHER_ARIA_256_CCM_STAR_NO_TAG:MBEDTLS_DECRYPT:"C0C1C2C3C4C5C6C7C8C9CACBCCCDCECFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECF":"00000003020100A0A1A2A3A4A5":"08090A0B0C0D0E0F101112131415161718191A1B1C1D1E":"5fdd984a6aa77c1d9a204c08f28172c4b4528bee27c41f":0:0
|
||||
|
||||
Check set padding
|
||||
Check set padding - 128 bit key
|
||||
depends_on:MBEDTLS_ARIA_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
check_set_padding:MBEDTLS_CIPHER_ARIA_128_CBC
|
||||
|
||||
Check set padding - 192 bit key
|
||||
depends_on:MBEDTLS_ARIA_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
check_set_padding:MBEDTLS_CIPHER_ARIA_192_CBC
|
||||
|
||||
Check set padding - 256 bit key
|
||||
depends_on:MBEDTLS_ARIA_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
check_set_padding:MBEDTLS_CIPHER_ARIA_256_CBC
|
||||
|
|
|
@ -35,8 +35,8 @@ depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKC
|
|||
enc_dec_buf:MBEDTLS_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:15:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
CAMELLIA Encrypt and decrypt 16 bytes [#1]
|
||||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
enc_dec_buf:MBEDTLS_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:16:MBEDTLS_PADDING_NONE
|
||||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
enc_dec_buf:MBEDTLS_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:16:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
CAMELLIA Encrypt and decrypt 17 bytes [#1]
|
||||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
|
@ -47,8 +47,8 @@ depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKC
|
|||
enc_dec_buf:MBEDTLS_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:31:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
CAMELLIA Encrypt and decrypt 32 bytes [#1]
|
||||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
enc_dec_buf:MBEDTLS_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:32:MBEDTLS_PADDING_NONE
|
||||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
enc_dec_buf:MBEDTLS_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:32:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
CAMELLIA Encrypt and decrypt 33 bytes [#2]
|
||||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
|
@ -251,15 +251,15 @@ depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKC
|
|||
enc_dec_buf:MBEDTLS_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:0:MBEDTLS_PADDING_NONE
|
||||
|
||||
CAMELLIA Encrypt and decrypt 16 bytes with no padding
|
||||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
enc_dec_buf:MBEDTLS_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:16:MBEDTLS_PADDING_NONE
|
||||
|
||||
CAMELLIA Encrypt and decrypt 32 bytes with no padding
|
||||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
enc_dec_buf:MBEDTLS_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:32:MBEDTLS_PADDING_NONE
|
||||
|
||||
CAMELLIA Encrypt and decrypt 48 bytes with no padding
|
||||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
enc_dec_buf:MBEDTLS_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:48:MBEDTLS_PADDING_NONE
|
||||
|
||||
CAMELLIA Try encrypting 1 bytes with no padding
|
||||
|
@ -1102,6 +1102,14 @@ CAMELLIA-256-CCM*-NO-TAG crypt Decrypt
|
|||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CCM_C
|
||||
test_vec_crypt:MBEDTLS_CIPHER_CAMELLIA_256_CCM_STAR_NO_TAG:MBEDTLS_DECRYPT:"C0C1C2C3C4C5C6C7C8C9CACBCCCDCECFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECF":"00000003020100A0A1A2A3A4A5":"08090A0B0C0D0E0F101112131415161718191A1B1C1D1E":"933f749801d0e1262cd101831defd8366ab2a22e7c03cd":0:0
|
||||
|
||||
Check set padding
|
||||
Check set padding - 128 bit key
|
||||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
check_set_padding:MBEDTLS_CIPHER_CAMELLIA_128_CBC
|
||||
|
||||
Check set padding - 192 bit key
|
||||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
check_set_padding:MBEDTLS_CIPHER_CAMELLIA_192_CBC
|
||||
|
||||
Check set padding - 256 bit key
|
||||
depends_on:MBEDTLS_CAMELLIA_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
check_set_padding:MBEDTLS_CIPHER_CAMELLIA_256_CBC
|
||||
|
|
|
@ -27,8 +27,8 @@ depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
|||
enc_dec_buf:MBEDTLS_CIPHER_DES_CBC:"DES-CBC":64:7:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
DES Encrypt and decrypt 8 bytes
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
enc_dec_buf:MBEDTLS_CIPHER_DES_CBC:"DES-CBC":64:8:MBEDTLS_PADDING_NONE
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
enc_dec_buf:MBEDTLS_CIPHER_DES_CBC:"DES-CBC":64:8:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
DES Encrypt and decrypt 9 bytes
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
|
@ -39,8 +39,8 @@ depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
|||
enc_dec_buf:MBEDTLS_CIPHER_DES_CBC:"DES-CBC":64:15:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
DES Encrypt and decrypt 16 bytes
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
enc_dec_buf:MBEDTLS_CIPHER_DES_CBC:"DES-CBC":64:16:MBEDTLS_PADDING_NONE
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
enc_dec_buf:MBEDTLS_CIPHER_DES_CBC:"DES-CBC":64:16:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
DES Encrypt and decrypt 17 bytes
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
|
@ -51,8 +51,8 @@ depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
|||
enc_dec_buf:MBEDTLS_CIPHER_DES_CBC:"DES-CBC":64:31:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
DES Encrypt and decrypt 32 bytes [#1]
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
enc_dec_buf:MBEDTLS_CIPHER_DES_CBC:"DES-CBC":64:32:MBEDTLS_PADDING_NONE
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
enc_dec_buf:MBEDTLS_CIPHER_DES_CBC:"DES-CBC":64:32:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
DES Encrypt and decrypt 33 bytes [#2]
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
|
@ -478,6 +478,10 @@ DES3 Encrypt and decrypt 8 bytes [#2]
|
|||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
enc_dec_buf:MBEDTLS_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":192:8:MBEDTLS_PADDING_NONE
|
||||
|
||||
DES3 Encrypt and decrypt 8 bytes (PKCS7 padding) [#2]
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
enc_dec_buf:MBEDTLS_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":192:8:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
DES3 Encrypt and decrypt 9 bytes [#2]
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
enc_dec_buf:MBEDTLS_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":192:9:MBEDTLS_PADDING_PKCS7
|
||||
|
@ -490,6 +494,10 @@ DES3 Encrypt and decrypt 16 bytes [#2]
|
|||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
enc_dec_buf:MBEDTLS_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":192:16:MBEDTLS_PADDING_NONE
|
||||
|
||||
DES3 Encrypt and decrypt 16 bytes (PKCS7 padding) [#2]
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
enc_dec_buf:MBEDTLS_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":192:16:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
DES3 Encrypt and decrypt 17 bytes [#2]
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
enc_dec_buf:MBEDTLS_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":192:17:MBEDTLS_PADDING_PKCS7
|
||||
|
@ -502,6 +510,10 @@ DES3 Encrypt and decrypt 32 bytes [#3]
|
|||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
enc_dec_buf:MBEDTLS_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":192:32:MBEDTLS_PADDING_PKCS7
|
||||
|
||||
DES3 Encrypt and decrypt 32 bytes (PKCS7 padding) [#3]
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
enc_dec_buf:MBEDTLS_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":192:32:MBEDTLS_PADDING_NONE
|
||||
|
||||
DES3 Encrypt and decrypt 33 bytes [#4]
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
enc_dec_buf:MBEDTLS_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":192:33:MBEDTLS_PADDING_PKCS7
|
||||
|
@ -602,6 +614,10 @@ DES3-EDE ECB Decrypt test vector (OpenSSL) #2
|
|||
depends_on:MBEDTLS_DES_C
|
||||
test_vec_ecb:MBEDTLS_CIPHER_DES_EDE_ECB:MBEDTLS_DECRYPT:"FFFFFFFFFFFFFFFF3000000000000000":"199E9D6DF39AA816":"FFFFFFFFFFFFFFFF":0
|
||||
|
||||
Check set padding
|
||||
Check set padding - DES
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
check_set_padding:MBEDTLS_CIPHER_DES_EDE_CBC
|
||||
|
||||
Check set padding - Triple DES
|
||||
depends_on:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||
check_set_padding:MBEDTLS_CIPHER_DES_EDE3_CBC
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include "mbedtls/cipher.h"
|
||||
#include "mbedtls/aes.h"
|
||||
|
||||
|
||||
#if defined(MBEDTLS_GCM_C)
|
||||
#include "mbedtls/gcm.h"
|
||||
#endif
|
||||
|
@ -602,14 +601,12 @@ void dec_empty_buf(int cipher,
|
|||
|
||||
TEST_ASSERT(0 == mbedtls_cipher_reset(&ctx_dec));
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
|
||||
#if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING) && defined(MBEDTLS_CIPHER_PADDING_PKCS7)
|
||||
if (ctx_dec.cipher_info->mode == MBEDTLS_MODE_CBC) {
|
||||
#if defined(MBEDTLS_CIPHER_PADDING_PKCS7)
|
||||
TEST_ASSERT(0 == mbedtls_cipher_set_padding_mode(&ctx_dec,
|
||||
MBEDTLS_PADDING_PKCS7));
|
||||
#endif
|
||||
}
|
||||
#endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
|
||||
int expected = (cipher_info->mode == MBEDTLS_MODE_GCM ||
|
||||
|
@ -1213,12 +1210,13 @@ exit:
|
|||
void check_set_padding(int cipher_id)
|
||||
{
|
||||
mbedtls_cipher_context_t ctx;
|
||||
unsigned char key[16] = { 0 };
|
||||
unsigned char *key = NULL;
|
||||
unsigned char iv[16] = { 0 };
|
||||
unsigned char input[16] = { 0 };
|
||||
unsigned char output[32] = { 0 };
|
||||
size_t outlen = 0;
|
||||
const mbedtls_cipher_info_t *cipher_info;
|
||||
size_t keylen = 0;
|
||||
|
||||
cipher_info = mbedtls_cipher_info_from_type(cipher_id);
|
||||
|
||||
|
@ -1226,23 +1224,27 @@ void check_set_padding(int cipher_id)
|
|||
TEST_FAIL("Cipher mode must be CBC");
|
||||
}
|
||||
|
||||
keylen = mbedtls_cipher_info_get_key_bitlen(cipher_info);
|
||||
TEST_CALLOC(key, keylen/8);
|
||||
memset(key, 0, keylen/8);
|
||||
|
||||
mbedtls_cipher_init(&ctx);
|
||||
|
||||
TEST_EQUAL(0, mbedtls_cipher_setup(&ctx, cipher_info));
|
||||
|
||||
TEST_EQUAL(0, mbedtls_cipher_setkey(&ctx, key, 128, MBEDTLS_ENCRYPT));
|
||||
TEST_EQUAL(0, mbedtls_cipher_setkey(&ctx, key, keylen,
|
||||
MBEDTLS_ENCRYPT));
|
||||
|
||||
TEST_EQUAL(MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
|
||||
mbedtls_cipher_crypt(&ctx, iv, sizeof(iv), input,
|
||||
sizeof(input), output, &outlen));
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
|
||||
TEST_EQUAL(0, mbedtls_cipher_set_padding_mode(&ctx, MBEDTLS_PADDING_NONE));
|
||||
TEST_EQUAL(0, mbedtls_cipher_crypt(&ctx, iv, sizeof(iv), input,
|
||||
sizeof(input), output, &outlen));
|
||||
#endif
|
||||
|
||||
exit:
|
||||
mbedtls_cipher_free(&ctx);
|
||||
mbedtls_free(key);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
|
Loading…
Reference in a new issue