Skip to content

Commit d5940a2

Browse files
committed
Add AES CFB tests
1 parent 4a26ff5 commit d5940a2

File tree

1 file changed

+45
-2
lines changed

1 file changed

+45
-2
lines changed

test/test_cipher.c

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
#include "unit.h"
2222

2323
#if defined(WP_HAVE_DES3CBC) || defined(WP_HAVE_AESCBC) || \
24-
defined(WP_HAVE_AESECB) || defined(WP_HAVE_AESCTR)
24+
defined(WP_HAVE_AESECB) || defined(WP_HAVE_AESCTR) || \
25+
defined(WP_HAVE_AESCFB)
2526

2627
static int test_cipher_enc(const EVP_CIPHER *cipher,
2728
unsigned char *key, unsigned char *iv,
@@ -179,7 +180,8 @@ static int test_cipher_enc_dec(void *data, const char *cipher, int keyLen,
179180
#endif
180181

181182
#if defined(WP_HAVE_DES3CBC) || defined(WP_HAVE_AESCBC) || \
182-
defined(WP_HAVE_AESECB) || defined(WP_HAVE_AESCTR)
183+
defined(WP_HAVE_AESECB) || defined(WP_HAVE_AESCTR) || \
184+
defined(WP_HAVE_AESCFB)
183185

184186

185187
/******************************************************************************/
@@ -542,3 +544,44 @@ int test_aes256_ctr_stream(void *data)
542544

543545
#endif /* WP_HAVE_AESCTR */
544546

547+
#ifdef WP_HAVE_AESCFB
548+
549+
int test_aes128_cfb_stream(void *data)
550+
{
551+
int err;
552+
553+
err = test_stream_enc_dec(data, "AES-128-CFB", 16, 16, 16, 0);
554+
if (err == 0)
555+
err = test_stream_enc_dec(data, "AES-128-CFB", 16, 16, 1, 0);
556+
557+
return err;
558+
}
559+
560+
/******************************************************************************/
561+
562+
int test_aes192_cfb_stream(void *data)
563+
{
564+
int err;
565+
566+
err = test_stream_enc_dec(data, "AES-192-CFB", 24, 16, 15, 0);
567+
if (err == 0)
568+
err = test_stream_enc_dec(data, "AES-192-CFB", 24, 16, 2, 0);
569+
570+
return err;
571+
}
572+
573+
/******************************************************************************/
574+
575+
int test_aes256_cfb_stream(void *data)
576+
{
577+
int err;
578+
579+
err = test_stream_enc_dec(data, "AES-256-CFB", 32, 16, 14, 0);
580+
if (err == 0)
581+
err = test_stream_enc_dec(data, "AES-256-CFB", 32, 16, 3, 0);
582+
583+
return err;
584+
}
585+
586+
#endif /* WP_HAVE_AESCFB */
587+

0 commit comments

Comments
 (0)