From b6ecaf5276a2ef08aadc517c3c0f1c5d65df7f4e Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Tue, 19 Apr 2011 14:29:23 +0000
Subject: [PATCH] - Added additional (configurable) cipher block modes.
AES-CTR, Camellia-CTR, XTEA-CBC
---
ChangeLog | 6 +
include/polarssl/aes.h | 24 ++++
include/polarssl/cipher.h | 2 +-
include/polarssl/config.h | 16 ++-
include/polarssl/xtea.h | 21 ++++
library/aes.c | 171 +++++++++++++++++++++++++-
library/camellia.c | 166 +++++++++++++++++++++++++
library/xtea.c | 52 ++++++++
tests/suites/test_suite_aes.data | 72 +++++++++++
tests/suites/test_suite_camellia.data | 24 ++++
10 files changed, 551 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index acc71c35a..e8a7f6998 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
PolarSSL ChangeLog
+= Version trunk
+Features
+ * Added additional Cipher Block Modes to symmetric ciphers
+ (AES CTR, Camellia CTR, XTEA CBC) including the option to
+ enable and disable individual modes when needed
+
= Version 0.99-pre4 released on 2011-04-01
Features
* Added support for PKCS#1 v2.1 encoding and thus support
diff --git a/include/polarssl/aes.h b/include/polarssl/aes.h
index c94478bf1..40b3a56bf 100644
--- a/include/polarssl/aes.h
+++ b/include/polarssl/aes.h
@@ -127,6 +127,30 @@ int aes_crypt_cfb128( aes_context *ctx,
const unsigned char *input,
unsigned char *output );
+/*
+ * \brief AES-CTR buffer encryption/decryption
+ *
+ * Warning: You have to keep the maximum use of your counter in mind!
+ *
+ * \param length The length of the data
+ * \param nc_off The offset in the current stream_block (for resuming
+ * within current cipher stream). The offset pointer to
+ * should be 0 at the start of a stream.
+ * \param nonce_counter The 128-bit nonce and counter.
+ * \param stream_block The saved stream-block for resuming. Is overwritten
+ * by the function.
+ * \param input The input data stream
+ * \param output The output data stream
+ *
+ * \return 0 if successful
+ */
+int aes_crypt_ctr( aes_context *ctx,
+ int length,
+ int *nc_off,
+ unsigned char nonce_counter[16],
+ unsigned char stream_block[16],
+ const unsigned char *input,
+ unsigned char *output );
/**
* \brief Checkup routine
*
diff --git a/include/polarssl/cipher.h b/include/polarssl/cipher.h
index 9bd587534..53755598f 100644
--- a/include/polarssl/cipher.h
+++ b/include/polarssl/cipher.h
@@ -98,7 +98,7 @@ typedef struct {
/** Cipher key length, in bits (default length for variable sized ciphers) */
int key_length;
- /** Name of the message digest */
+ /** Name of the cipher */
const char * name;
/** IV size, in bytes */
diff --git a/include/polarssl/config.h b/include/polarssl/config.h
index 09807fa77..79071a393 100644
--- a/include/polarssl/config.h
+++ b/include/polarssl/config.h
@@ -105,6 +105,20 @@
* \{
*/
+/**
+ * \def POLARSSL_CIPHER_MODE_CFB
+ *
+ * Enable Cipher Feedback mode (CFB) for symmetric ciphers.
+ */
+#define POLARSSL_CIPHER_MODE_CFB
+
+/**
+ * \def POLARSSL_CIPHER_MODE_CTR
+ *
+ * Enable Counter Block Cipher mode (CTR) for symmetric ciphers.
+ */
+#define POLARSSL_CIPHER_MODE_CTR
+
/**
* \def POLARSSL_DEBUG_MSG
*
@@ -130,7 +144,7 @@
/**
* \def POLARSSL_GENPRIME
*
- * Enable the prime-number generation code.
+ * Enable the RSA prime-number generation code.
*/
#define POLARSSL_GENPRIME
diff --git a/include/polarssl/xtea.h b/include/polarssl/xtea.h
index 16020d112..feb1237cc 100644
--- a/include/polarssl/xtea.h
+++ b/include/polarssl/xtea.h
@@ -37,6 +37,7 @@ typedef UINT32 uint32_t;
#define XTEA_ENCRYPT 1
#define XTEA_DECRYPT 0
+#define POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH -0x0820
/**
* \brief XTEA context structure
@@ -74,6 +75,26 @@ int xtea_crypt_ecb( xtea_context *ctx,
unsigned char input[8],
unsigned char output[8] );
+/**
+ * \brief XTEA CBC cipher function
+ *
+ * \param ctx XTEA context
+ * \param mode XTEA_ENCRYPT or XTEA_DECRYPT
+ * \param length the length of input, multiple of 8
+ * \param iv initialization vector for CBC mode
+ * \param input input block
+ * \param output output block
+ *
+ * \return 0 if successful,
+ * POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH if the length % 8 != 0
+ */
+int xtea_crypt_cbc( xtea_context *ctx,
+ int mode,
+ int length,
+ unsigned char iv[8],
+ unsigned char *input,
+ unsigned char *output);
+
/*
* \brief Checkup routine
*
diff --git a/library/aes.c b/library/aes.c
index 45f74a616..3a4cd150a 100644
--- a/library/aes.c
+++ b/library/aes.c
@@ -817,6 +817,7 @@ int aes_crypt_cbc( aes_context *ctx,
return( 0 );
}
+#if defined(POLARSSL_CIPHER_MODE_CFB)
/*
* AES-CFB128 buffer encryption/decryption
*/
@@ -861,6 +862,45 @@ int aes_crypt_cfb128( aes_context *ctx,
return( 0 );
}
+#endif /*POLARSSL_CIPHER_MODE_CFB */
+
+#if defined(POLARSSL_CIPHER_MODE_CTR)
+/*
+ * AES-CTR buffer encryption/decryption
+ */
+int aes_crypt_ctr( aes_context *ctx,
+ int length,
+ int *nc_off,
+ unsigned char nonce_counter[16],
+ unsigned char stream_block[16],
+ const unsigned char *input,
+ unsigned char *output )
+{
+ int c, n = *nc_off, i, cb;
+
+ while( length-- )
+ {
+ if( n == 0 ) {
+ aes_crypt_ecb( ctx, AES_ENCRYPT, nonce_counter, stream_block );
+
+ i = 15;
+ do {
+ nonce_counter[i]++;
+ cb = nonce_counter[i] == 0;
+ } while( i-- && cb );
+
+ }
+ c = *input++;
+ *output++ = (unsigned char)( c ^ stream_block[n] );
+
+ n = (n + 1) & 0x0F;
+ }
+
+ *nc_off = n;
+
+ return( 0 );
+}
+#endif /* POLARSSL_CIPHER_MODE_CTR */
#if defined(POLARSSL_SELF_TEST)
@@ -911,6 +951,7 @@ static const unsigned char aes_test_cbc_enc[3][16] =
0x6F, 0xCD, 0x88, 0xB2, 0xCC, 0x89, 0x8F, 0xF0 }
};
+#if defined(POLARSSL_CIPHER_MODE_CFB)
/*
* AES-CFB128 test vectors from:
*
@@ -974,17 +1015,86 @@ static const unsigned char aes_test_cfb128_ct[3][64] =
0x75, 0xA3, 0x85, 0x74, 0x1A, 0xB9, 0xCE, 0xF8,
0x20, 0x31, 0x62, 0x3D, 0x55, 0xB1, 0xE4, 0x71 }
};
+#endif /* POLARSSL_CIPHER_MODE_CFB */
+
+#if defined(POLARSSL_CIPHER_MODE_CTR)
+/*
+ * AES-CTR test vectors from:
+ *
+ * http://www.faqs.org/rfcs/rfc3686.html
+ */
+
+static const unsigned char aes_test_ctr_key[3][16] =
+{
+ { 0xAE, 0x68, 0x52, 0xF8, 0x12, 0x10, 0x67, 0xCC,
+ 0x4B, 0xF7, 0xA5, 0x76, 0x55, 0x77, 0xF3, 0x9E },
+ { 0x7E, 0x24, 0x06, 0x78, 0x17, 0xFA, 0xE0, 0xD7,
+ 0x43, 0xD6, 0xCE, 0x1F, 0x32, 0x53, 0x91, 0x63 },
+ { 0x76, 0x91, 0xBE, 0x03, 0x5E, 0x50, 0x20, 0xA8,
+ 0xAC, 0x6E, 0x61, 0x85, 0x29, 0xF9, 0xA0, 0xDC }
+};
+
+static const unsigned char aes_test_ctr_nonce_counter[3][16] =
+{
+ { 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
+ { 0x00, 0x6C, 0xB6, 0xDB, 0xC0, 0x54, 0x3B, 0x59,
+ 0xDA, 0x48, 0xD9, 0x0B, 0x00, 0x00, 0x00, 0x01 },
+ { 0x00, 0xE0, 0x01, 0x7B, 0x27, 0x77, 0x7F, 0x3F,
+ 0x4A, 0x17, 0x86, 0xF0, 0x00, 0x00, 0x00, 0x01 }
+};
+
+static const unsigned char aes_test_ctr_pt[3][48] =
+{
+ { 0x53, 0x69, 0x6E, 0x67, 0x6C, 0x65, 0x20, 0x62,
+ 0x6C, 0x6F, 0x63, 0x6B, 0x20, 0x6D, 0x73, 0x67 },
+
+ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F },
+
+ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
+ 0x20, 0x21, 0x22, 0x23 }
+};
+
+static const unsigned char aes_test_ctr_ct[3][48] =
+{
+ { 0xE4, 0x09, 0x5D, 0x4F, 0xB7, 0xA7, 0xB3, 0x79,
+ 0x2D, 0x61, 0x75, 0xA3, 0x26, 0x13, 0x11, 0xB8 },
+ { 0x51, 0x04, 0xA1, 0x06, 0x16, 0x8A, 0x72, 0xD9,
+ 0x79, 0x0D, 0x41, 0xEE, 0x8E, 0xDA, 0xD3, 0x88,
+ 0xEB, 0x2E, 0x1E, 0xFC, 0x46, 0xDA, 0x57, 0xC8,
+ 0xFC, 0xE6, 0x30, 0xDF, 0x91, 0x41, 0xBE, 0x28 },
+ { 0xC1, 0xCF, 0x48, 0xA8, 0x9F, 0x2F, 0xFD, 0xD9,
+ 0xCF, 0x46, 0x52, 0xE9, 0xEF, 0xDB, 0x72, 0xD7,
+ 0x45, 0x40, 0xA4, 0x2B, 0xDE, 0x6D, 0x78, 0x36,
+ 0xD5, 0x9A, 0x5C, 0xEA, 0xAE, 0xF3, 0x10, 0x53,
+ 0x25, 0xB2, 0x07, 0x2F }
+};
+
+static const int aes_test_ctr_len[3] =
+ { 16, 32, 36 };
+#endif /* POLARSSL_CIPHER_MODE_CTR */
/*
* Checkup routine
*/
int aes_self_test( int verbose )
{
- int i, j, u, v, offset;
+ int i, j, u, v;
unsigned char key[32];
unsigned char buf[64];
unsigned char prv[16];
unsigned char iv[16];
+#if defined(POLARSSL_CIPHER_MODE_CTR)
+ int offset, len;
+ unsigned char nonce_counter[16];
+ unsigned char stream_block[16];
+#endif
aes_context ctx;
memset( key, 0, 32 );
@@ -1103,6 +1213,7 @@ int aes_self_test( int verbose )
if( verbose != 0 )
printf( "\n" );
+#if defined(POLARSSL_CIPHERY_MODE_CFB)
/*
* CFB128 mode
*/
@@ -1152,9 +1263,67 @@ int aes_self_test( int verbose )
printf( "passed\n" );
}
+ if( verbose != 0 )
+ printf( "\n" );
+#endif /* POLARSSL_CIPHER_MODE_CFB */
+
+#if defined(POLARSSL_CIPHER_MODE_CTR)
+ /*
+ * CTR mode
+ */
+ for( i = 0; i < 6; i++ )
+ {
+ u = i >> 1;
+ v = i & 1;
+
+ if( verbose != 0 )
+ printf( " AES-CTR-128 (%s): ",
+ ( v == AES_DECRYPT ) ? "dec" : "enc" );
+
+ memcpy( nonce_counter, aes_test_ctr_nonce_counter[u], 16 );
+ memcpy( key, aes_test_ctr_key[u], 16 );
+
+ offset = 0;
+ aes_setkey_enc( &ctx, key, 128 );
+
+ if( v == AES_DECRYPT )
+ {
+ len = aes_test_ctr_len[u];
+ memcpy( buf, aes_test_ctr_ct[u], len );
+
+ aes_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, buf, buf );
+
+ if( memcmp( buf, aes_test_ctr_pt[u], len ) != 0 )
+ {
+ if( verbose != 0 )
+ printf( "failed\n" );
+
+ return( 1 );
+ }
+ }
+ else
+ {
+ len = aes_test_ctr_len[u];
+ memcpy( buf, aes_test_ctr_pt[u], len );
+
+ aes_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, buf, buf );
+
+ if( memcmp( buf, aes_test_ctr_ct[u], len ) != 0 )
+ {
+ if( verbose != 0 )
+ printf( "failed\n" );
+
+ return( 1 );
+ }
+ }
+
+ if( verbose != 0 )
+ printf( "passed\n" );
+ }
if( verbose != 0 )
printf( "\n" );
+#endif /* POLARSSL_CIPHER_MODE_CTR */
return( 0 );
}
diff --git a/library/camellia.c b/library/camellia.c
index 89001bd15..6624d175a 100644
--- a/library/camellia.c
+++ b/library/camellia.c
@@ -573,6 +573,7 @@ int camellia_crypt_cbc( camellia_context *ctx,
return( 0 );
}
+#if defined(POLARSSL_CIPHER_MODE_CFB)
/*
* Camellia-CFB128 buffer encryption/decryption
*/
@@ -617,6 +618,45 @@ int camellia_crypt_cfb128( camellia_context *ctx,
return( 0 );
}
+#endif /* POLARSSL_CIPHER_MODE_CFB */
+
+#if defined(POLARSSL_CIPHER_MODE_CTR)
+/*
+ * Camellia-CTR buffer encryption/decryption
+ */
+int camellia_crypt_ctr( camellia_context *ctx,
+ int length,
+ int *nc_off,
+ unsigned char nonce_counter[16],
+ unsigned char stream_block[16],
+ const unsigned char *input,
+ unsigned char *output )
+{
+ int c, n = *nc_off, i, cb;
+
+ while( length-- )
+ {
+ if( n == 0 ) {
+ camellia_crypt_ecb( ctx, CAMELLIA_ENCRYPT, nonce_counter, stream_block );
+
+ i = 15;
+ do {
+ nonce_counter[i]++;
+ cb = nonce_counter[i] == 0;
+ } while( i-- && cb );
+
+ }
+ c = *input++;
+ *output++ = (unsigned char)( c ^ stream_block[n] );
+
+ n = (n + 1) & 0x0F;
+ }
+
+ *nc_off = n;
+
+ return( 0 );
+}
+#endif /* POLARSSL_CIPHER_MODE_CTR */
#if defined(POLARSSL_SELF_TEST)
@@ -752,6 +792,68 @@ static const unsigned char camellia_test_cbc_cipher[3][CAMELLIA_TESTS_CBC][16] =
}
};
+#if defined(POLARSSL_CIPHER_MODE_CTR)
+/*
+ * Camellia-CTR test vectors from:
+ *
+ * http://www.faqs.org/rfcs/rfc5528.html
+ */
+
+static const unsigned char camellia_test_ctr_key[3][16] =
+{
+ { 0xAE, 0x68, 0x52, 0xF8, 0x12, 0x10, 0x67, 0xCC,
+ 0x4B, 0xF7, 0xA5, 0x76, 0x55, 0x77, 0xF3, 0x9E },
+ { 0x7E, 0x24, 0x06, 0x78, 0x17, 0xFA, 0xE0, 0xD7,
+ 0x43, 0xD6, 0xCE, 0x1F, 0x32, 0x53, 0x91, 0x63 },
+ { 0x76, 0x91, 0xBE, 0x03, 0x5E, 0x50, 0x20, 0xA8,
+ 0xAC, 0x6E, 0x61, 0x85, 0x29, 0xF9, 0xA0, 0xDC }
+};
+
+static const unsigned char camellia_test_ctr_nonce_counter[3][16] =
+{
+ { 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
+ { 0x00, 0x6C, 0xB6, 0xDB, 0xC0, 0x54, 0x3B, 0x59,
+ 0xDA, 0x48, 0xD9, 0x0B, 0x00, 0x00, 0x00, 0x01 },
+ { 0x00, 0xE0, 0x01, 0x7B, 0x27, 0x77, 0x7F, 0x3F,
+ 0x4A, 0x17, 0x86, 0xF0, 0x00, 0x00, 0x00, 0x01 }
+};
+
+static const unsigned char camellia_test_ctr_pt[3][48] =
+{
+ { 0x53, 0x69, 0x6E, 0x67, 0x6C, 0x65, 0x20, 0x62,
+ 0x6C, 0x6F, 0x63, 0x6B, 0x20, 0x6D, 0x73, 0x67 },
+
+ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F },
+
+ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
+ 0x20, 0x21, 0x22, 0x23 }
+};
+
+static const unsigned char camellia_test_ctr_ct[3][48] =
+{
+ { 0xD0, 0x9D, 0xC2, 0x9A, 0x82, 0x14, 0x61, 0x9A,
+ 0x20, 0x87, 0x7C, 0x76, 0xDB, 0x1F, 0x0B, 0x3F },
+ { 0xDB, 0xF3, 0xC7, 0x8D, 0xC0, 0x83, 0x96, 0xD4,
+ 0xDA, 0x7C, 0x90, 0x77, 0x65, 0xBB, 0xCB, 0x44,
+ 0x2B, 0x8E, 0x8E, 0x0F, 0x31, 0xF0, 0xDC, 0xA7,
+ 0x2C, 0x74, 0x17, 0xE3, 0x53, 0x60, 0xE0, 0x48 },
+ { 0xB1, 0x9D, 0x1F, 0xCD, 0xCB, 0x75, 0xEB, 0x88,
+ 0x2F, 0x84, 0x9C, 0xE2, 0x4D, 0x85, 0xCF, 0x73,
+ 0x9C, 0xE6, 0x4B, 0x2B, 0x5C, 0x9D, 0x73, 0xF1,
+ 0x4F, 0x2D, 0x5D, 0x9D, 0xCE, 0x98, 0x89, 0xCD,
+ 0xDF, 0x50, 0x86, 0x96 }
+};
+
+static const int camellia_test_ctr_len[3] =
+ { 16, 32, 36 };
+#endif /* POLARSSL_CIPHER_MODE_CTR */
/*
* Checkup routine
@@ -764,6 +866,12 @@ int camellia_self_test( int verbose )
unsigned char src[16];
unsigned char dst[16];
unsigned char iv[16];
+#if defined(POLARSSL_CIPHER_MODE_CTR)
+ int offset, len;
+ unsigned char nonce_counter[16];
+ unsigned char stream_block[16];
+#endif
+
camellia_context ctx;
memset( key, 0, 32 );
@@ -859,6 +967,64 @@ int camellia_self_test( int verbose )
if( verbose != 0 )
printf( "\n" );
+#if defined(POLARSSL_CIPHER_MODE_CTR)
+ /*
+ * CTR mode
+ */
+ for( i = 0; i < 6; i++ )
+ {
+ u = i >> 1;
+ v = i & 1;
+
+ if( verbose != 0 )
+ printf( " CAMELLIA-CTR-128 (%s): ",
+ ( v == CAMELLIA_DECRYPT ) ? "dec" : "enc" );
+
+ memcpy( nonce_counter, camellia_test_ctr_nonce_counter[u], 16 );
+ memcpy( key, camellia_test_ctr_key[u], 16 );
+
+ offset = 0;
+ camellia_setkey_enc( &ctx, key, 128 );
+
+ if( v == CAMELLIA_DECRYPT )
+ {
+ len = camellia_test_ctr_len[u];
+ memcpy( buf, camellia_test_ctr_ct[u], len );
+
+ camellia_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, buf, buf );
+
+ if( memcmp( buf, camellia_test_ctr_pt[u], len ) != 0 )
+ {
+ if( verbose != 0 )
+ printf( "failed\n" );
+
+ return( 1 );
+ }
+ }
+ else
+ {
+ len = camellia_test_ctr_len[u];
+ memcpy( buf, camellia_test_ctr_pt[u], len );
+
+ camellia_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, buf, buf );
+
+ if( memcmp( buf, camellia_test_ctr_ct[u], len ) != 0 )
+ {
+ if( verbose != 0 )
+ printf( "failed\n" );
+
+ return( 1 );
+ }
+ }
+
+ if( verbose != 0 )
+ printf( "passed\n" );
+ }
+
+ if( verbose != 0 )
+ printf( "\n" );
+#endif /* POLARSSL_CIPHER_MODE_CTR */
+
return ( 0 );
}
diff --git a/library/xtea.c b/library/xtea.c
index 2f85aeacb..036948d04 100644
--- a/library/xtea.c
+++ b/library/xtea.c
@@ -111,6 +111,58 @@ int xtea_crypt_ecb( xtea_context *ctx, int mode, unsigned char input[8],
return( 0 );
}
+/*
+ * XTEA-CBC buffer encryption/decryption
+ */
+int xtea_crypt_cbc( xtea_context *ctx,
+ int mode,
+ int length,
+ unsigned char iv[8],
+ unsigned char *input,
+ unsigned char *output)
+{
+ int i;
+ unsigned char temp[8];
+
+ if(length % 8)
+ return( POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH );
+
+ if( mode == XTEA_DECRYPT )
+ {
+ while( length > 0 )
+ {
+ memcpy( temp, input, 8 );
+ xtea_crypt_ecb( ctx, mode, input, output );
+
+ for(i = 0; i < 8; i++)
+ output[i] = (unsigned char)( output[i] ^ iv[i] );
+
+ memcpy( iv, temp, 8 );
+
+ input += 8;
+ output += 8;
+ length -= 8;
+ }
+ }
+ else
+ {
+ while( length > 0 )
+ {
+ for( i = 0; i < 8; i++ )
+ output[i] = (unsigned char)( input[i] ^ iv[i] );
+
+ xtea_crypt_ecb( ctx, mode, output, output );
+ memcpy( iv, output, 8 );
+
+ input += 8;
+ output += 8;
+ length -= 8;
+ }
+ }
+
+ return( 0 );
+}
+
#if defined(POLARSSL_SELF_TEST)
#include
diff --git a/tests/suites/test_suite_aes.data b/tests/suites/test_suite_aes.data
index 8a0de606a..bbdfc3fca 100644
--- a/tests/suites/test_suite_aes.data
+++ b/tests/suites/test_suite_aes.data
@@ -446,219 +446,291 @@ AES-256-CBC Decrypt NIST KAT #12
aes_decrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"623a52fcea5d443e48d9181ab32c7421":"761c1fe41a18acf20d241650611d90f1":0
AES-128-CFB128 Encrypt NIST KAT #1
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"f0000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"970014d634e2b7650777e8e84d03ccd8"
AES-128-CFB128 Encrypt NIST KAT #2
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"f8000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"f17e79aed0db7e279e955b5f493875a7"
AES-128-CFB128 Encrypt NIST KAT #3
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"fc000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"9ed5a75136a940d0963da379db4af26a"
AES-128-CFB128 Encrypt NIST KAT #4
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"64cf9c7abc50b888af65f49d521944b2":"00000000000000000000000000000000":"00000000000000000000000000000000":"f7efc89d5dba578104016ce5ad659c05"
AES-128-CFB128 Encrypt NIST KAT #5
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"47d6742eefcc0465dc96355e851b64d9":"00000000000000000000000000000000":"00000000000000000000000000000000":"0306194f666d183624aa230a8b264ae7"
AES-128-CFB128 Encrypt NIST KAT #6
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"3eb39790678c56bee34bbcdeccf6cdb5":"00000000000000000000000000000000":"00000000000000000000000000000000":"858075d536d79ccee571f7d7204b1f67"
AES-128-CFB128 Encrypt NIST KAT #7
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"00000000000000000000000000000000":"6a118a874519e64e9963798a503f1d35":"00000000000000000000000000000000":"dc43be40be0e53712f7e2bf5ca707209"
AES-128-CFB128 Encrypt NIST KAT #8
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"00000000000000000000000000000000":"cb9fceec81286ca3e989bd979b0cb284":"00000000000000000000000000000000":"92beedab1895a94faa69b632e5cc47ce"
AES-128-CFB128 Encrypt NIST KAT #9
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"00000000000000000000000000000000":"b26aeb1874e47ca8358ff22378f09144":"00000000000000000000000000000000":"459264f4798f6a78bacb89c15ed3d601"
AES-128-CFB128 Encrypt NIST KAT #10
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"00000000000000000000000000000000":"fffffffffffffffffffffffffffffff0":"00000000000000000000000000000000":"f9b0fda0c4a898f5b9e6f661c4ce4d07"
AES-128-CFB128 Encrypt NIST KAT #11
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"00000000000000000000000000000000":"fffffffffffffffffffffffffffffff8":"00000000000000000000000000000000":"8ade895913685c67c5269f8aae42983e"
AES-128-CFB128 Encrypt NIST KAT #12
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"00000000000000000000000000000000":"fffffffffffffffffffffffffffffffc":"00000000000000000000000000000000":"39bde67d5c8ed8a8b1c37eb8fa9f5ac0"
AES-128-CFB128 Decrypt NIST KAT #1
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"fffffffe000000000000000000000000":"00000000000000000000000000000000":"1114bc2028009b923f0b01915ce5e7c4":"00000000000000000000000000000000"
AES-128-CFB128 Decrypt NIST KAT #2
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"ffffffff000000000000000000000000":"00000000000000000000000000000000":"9c28524a16a1e1c1452971caa8d13476":"00000000000000000000000000000000"
AES-128-CFB128 Decrypt NIST KAT #3
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"ffffffff800000000000000000000000":"00000000000000000000000000000000":"ed62e16363638360fdd6ad62112794f0":"00000000000000000000000000000000"
AES-128-CFB128 Decrypt NIST KAT #4
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"3071a2a48fe6cbd04f1a129098e308f8":"00000000000000000000000000000000":"4b98e06d356deb07ebb824e5713f7be3":"00000000000000000000000000000000"
AES-128-CFB128 Decrypt NIST KAT #5
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"90f42ec0f68385f2ffc5dfc03a654dce":"00000000000000000000000000000000":"7a20a53d460fc9ce0423a7a0764c6cf2":"00000000000000000000000000000000"
AES-128-CFB128 Decrypt NIST KAT #6
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"febd9a24d8b65c1c787d50a4ed3619a9":"00000000000000000000000000000000":"f4a70d8af877f9b02b4c40df57d45b17":"00000000000000000000000000000000"
AES-128-CFB128 Decrypt NIST KAT #7
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"00000000000000000000000000000000":"f34481ec3cc627bacd5dc3fb08f273e6":"0336763e966d92595a567cc9ce537f5e":"00000000000000000000000000000000"
AES-128-CFB128 Decrypt NIST KAT #8
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"00000000000000000000000000000000":"9798c4640bad75c7c3227db910174e72":"a9a1631bf4996954ebc093957b234589":"00000000000000000000000000000000"
AES-128-CFB128 Decrypt NIST KAT #9
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"00000000000000000000000000000000":"96ab5c2ff612d9dfaae8c31f30c42168":"ff4f8391a6a40ca5b25d23bedd44a597":"00000000000000000000000000000000"
AES-128-CFB128 Decrypt NIST KAT #10
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"00000000000000000000000000000000":"ffffffffffffffff0000000000000000":"f807c3e7985fe0f5a50e2cdb25c5109e":"00000000000000000000000000000000"
AES-128-CFB128 Decrypt NIST KAT #11
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"00000000000000000000000000000000":"ffffffffffffffff8000000000000000":"41f992a856fb278b389a62f5d274d7e9":"00000000000000000000000000000000"
AES-128-CFB128 Decrypt NIST KAT #12
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"00000000000000000000000000000000":"ffffffffffffffffc000000000000000":"10d3ed7a6fe15ab4d91acbc7d0767ab1":"00000000000000000000000000000000"
AES-192-CFB128 Encrypt NIST KAT #1
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"fffffffffffffffffffc0000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"8dfd999be5d0cfa35732c0ddc88ff5a5"
AES-192-CFB128 Encrypt NIST KAT #2
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"fffffffffffffffffffe0000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"02647c76a300c3173b841487eb2bae9f"
AES-192-CFB128 Encrypt NIST KAT #3
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"ffffffffffffffffffff0000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"172df8b02f04b53adab028b4e01acd87"
AES-192-CFB128 Encrypt NIST KAT #4
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"d184c36cf0dddfec39e654195006022237871a47c33d3198":"00000000000000000000000000000000":"00000000000000000000000000000000":"2e19fb60a3e1de0166f483c97824a978"
AES-192-CFB128 Encrypt NIST KAT #5
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"4c6994ffa9dcdc805b60c2c0095334c42d95a8fc0ca5b080":"00000000000000000000000000000000":"00000000000000000000000000000000":"7656709538dd5fec41e0ce6a0f8e207d"
AES-192-CFB128 Encrypt NIST KAT #6
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"c88f5b00a4ef9a6840e2acaf33f00a3bdc4e25895303fa72":"00000000000000000000000000000000":"00000000000000000000000000000000":"a67cf333b314d411d3c0ae6e1cfcd8f5"
AES-192-CFB128 Encrypt NIST KAT #7
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"000000000000000000000000000000000000000000000000":"9c2d8842e5f48f57648205d39a239af1":"00000000000000000000000000000000":"c9b8135ff1b5adc413dfd053b21bd96d"
AES-192-CFB128 Encrypt NIST KAT #8
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"000000000000000000000000000000000000000000000000":"bff52510095f518ecca60af4205444bb":"00000000000000000000000000000000":"4a3650c3371ce2eb35e389a171427440"
AES-192-CFB128 Encrypt NIST KAT #9
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"000000000000000000000000000000000000000000000000":"51719783d3185a535bd75adc65071ce1":"00000000000000000000000000000000":"4f354592ff7c8847d2d0870ca9481b7c"
AES-192-CFB128 Encrypt NIST KAT #10
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"000000000000000000000000000000000000000000000000":"ffffffffffffffe00000000000000000":"00000000000000000000000000000000":"f34e4a6324ea4a5c39a661c8fe5ada8f"
AES-192-CFB128 Encrypt NIST KAT #11
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"000000000000000000000000000000000000000000000000":"fffffffffffffff00000000000000000":"00000000000000000000000000000000":"0882a16f44088d42447a29ac090ec17e"
AES-192-CFB128 Encrypt NIST KAT #12
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"000000000000000000000000000000000000000000000000":"fffffffffffffff80000000000000000":"00000000000000000000000000000000":"3a3c15bfc11a9537c130687004e136ee"
AES-192-CFB128 Decrypt NIST KAT #1
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"ffffffffffffffffffffffffffffffffffffffffffe00000":"00000000000000000000000000000000":"60136703374f64e860b48ce31f930716":"00000000000000000000000000000000"
AES-192-CFB128 Decrypt NIST KAT #2
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"fffffffffffffffffffffffffffffffffffffffffff00000":"00000000000000000000000000000000":"8d63a269b14d506ccc401ab8a9f1b591":"00000000000000000000000000000000"
AES-192-CFB128 Decrypt NIST KAT #3
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"fffffffffffffffffffffffffffffffffffffffffff80000":"00000000000000000000000000000000":"d317f81dc6aa454aee4bd4a5a5cff4bd":"00000000000000000000000000000000"
AES-192-CFB128 Decrypt NIST KAT #4
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"98c6b8e01e379fbd14e61af6af891596583565f2a27d59e9":"00000000000000000000000000000000":"19c80ec4a6deb7e5ed1033dda933498f":"00000000000000000000000000000000"
AES-192-CFB128 Decrypt NIST KAT #5
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"b3ad5cea1dddc214ca969ac35f37dae1a9a9d1528f89bb35":"00000000000000000000000000000000":"3cf5e1d21a17956d1dffad6a7c41c659":"00000000000000000000000000000000"
AES-192-CFB128 Decrypt NIST KAT #6
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"45899367c3132849763073c435a9288a766c8b9ec2308516":"00000000000000000000000000000000":"69fd12e8505f8ded2fdcb197a121b362":"00000000000000000000000000000000"
AES-192-CFB128 Decrypt NIST KAT #7
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"000000000000000000000000000000000000000000000000":"1b077a6af4b7f98229de786d7516b639":"275cfc0413d8ccb70513c3859b1d0f72":"00000000000000000000000000000000"
AES-192-CFB128 Decrypt NIST KAT #8
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"000000000000000000000000000000000000000000000000":"9c2d8842e5f48f57648205d39a239af1":"c9b8135ff1b5adc413dfd053b21bd96d":"00000000000000000000000000000000"
AES-192-CFB128 Decrypt NIST KAT #9
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"000000000000000000000000000000000000000000000000":"bff52510095f518ecca60af4205444bb":"4a3650c3371ce2eb35e389a171427440":"00000000000000000000000000000000"
AES-192-CFB128 Decrypt NIST KAT #10
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"000000000000000000000000000000000000000000000000":"ffffffffffffffffffff000000000000":"54d632d03aba0bd0f91877ebdd4d09cb":"00000000000000000000000000000000"
AES-192-CFB128 Decrypt NIST KAT #11
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"000000000000000000000000000000000000000000000000":"ffffffffffffffffffff800000000000":"d3427be7e4d27cd54f5fe37b03cf0897":"00000000000000000000000000000000"
AES-192-CFB128 Decrypt NIST KAT #12
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"000000000000000000000000000000000000000000000000":"ffffffffffffffffffffc00000000000":"b2099795e88cc158fd75ea133d7e7fbe":"00000000000000000000000000000000"
AES-256-CFB128 Encrypt NIST KAT #1
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"ffffffe000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"bbd1097a62433f79449fa97d4ee80dbf"
AES-256-CFB128 Encrypt NIST KAT #2
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"fffffff000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"07058e408f5b99b0e0f061a1761b5b3b"
AES-256-CFB128 Encrypt NIST KAT #3
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"fffffff800000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"5fd1f13fa0f31e37fabde328f894eac2"
AES-256-CFB128 Encrypt NIST KAT #4
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"13428b5e4c005e0636dd338405d173ab135dec2a25c22c5df0722d69dcc43887":"00000000000000000000000000000000":"00000000000000000000000000000000":"649a71545378c783e368c9ade7114f6c"
AES-256-CFB128 Encrypt NIST KAT #5
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"07eb03a08d291d1b07408bf3512ab40c91097ac77461aad4bb859647f74f00ee":"00000000000000000000000000000000":"00000000000000000000000000000000":"47cb030da2ab051dfc6c4bf6910d12bb"
AES-256-CFB128 Encrypt NIST KAT #6
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"90143ae20cd78c5d8ebdd6cb9dc1762427a96c78c639bccc41a61424564eafe1":"00000000000000000000000000000000":"00000000000000000000000000000000":"798c7c005dee432b2c8ea5dfa381ecc3"
AES-256-CFB128 Encrypt NIST KAT #7
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"0b24af36193ce4665f2825d7b4749c98":"00000000000000000000000000000000":"a9ff75bd7cf6613d3731c77c3b6d0c04"
AES-256-CFB128 Encrypt NIST KAT #8
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"761c1fe41a18acf20d241650611d90f1":"00000000000000000000000000000000":"623a52fcea5d443e48d9181ab32c7421"
AES-256-CFB128 Encrypt NIST KAT #9
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"8a560769d605868ad80d819bdba03771":"00000000000000000000000000000000":"38f2c7ae10612415d27ca190d27da8b4"
AES-256-CFB128 Encrypt NIST KAT #10
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"ffffffffffffffffffffffffe0000000":"00000000000000000000000000000000":"2be1fae5048a25582a679ca10905eb80"
AES-256-CFB128 Encrypt NIST KAT #11
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"fffffffffffffffffffffffff0000000":"00000000000000000000000000000000":"da86f292c6f41ea34fb2068df75ecc29"
AES-256-CFB128 Encrypt NIST KAT #12
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_encrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"fffffffffffffffffffffffff8000000":"00000000000000000000000000000000":"220df19f85d69b1b562fa69a3c5beca5"
AES-256-CFB128 Decrypt NIST KAT #1
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"ffffffffff800000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"be66cfea2fecd6bf0ec7b4352c99bcaa":"00000000000000000000000000000000"
AES-256-CFB128 Decrypt NIST KAT #2
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"ffffffffffc00000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"df31144f87a2ef523facdcf21a427804":"00000000000000000000000000000000"
AES-256-CFB128 Decrypt NIST KAT #3
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"ffffffffffe00000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"b5bb0f5629fb6aae5e1839a3c3625d63":"00000000000000000000000000000000"
AES-256-CFB128 Decrypt NIST KAT #4
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"1d85a181b54cde51f0e098095b2962fdc93b51fe9b88602b3f54130bf76a5bd9":"00000000000000000000000000000000":"531c2c38344578b84d50b3c917bbb6e1":"00000000000000000000000000000000"
AES-256-CFB128 Decrypt NIST KAT #5
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"dc0eba1f2232a7879ded34ed8428eeb8769b056bbaf8ad77cb65c3541430b4cf":"00000000000000000000000000000000":"fc6aec906323480005c58e7e1ab004ad":"00000000000000000000000000000000"
AES-256-CFB128 Decrypt NIST KAT #6
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"f8be9ba615c5a952cabbca24f68f8593039624d524c816acda2c9183bd917cb9":"00000000000000000000000000000000":"a3944b95ca0b52043584ef02151926a8":"00000000000000000000000000000000"
AES-256-CFB128 Decrypt NIST KAT #7
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"761c1fe41a18acf20d241650611d90f1":"623a52fcea5d443e48d9181ab32c7421":"00000000000000000000000000000000"
AES-256-CFB128 Decrypt NIST KAT #8
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"8a560769d605868ad80d819bdba03771":"38f2c7ae10612415d27ca190d27da8b4":"00000000000000000000000000000000"
AES-256-CFB128 Decrypt NIST KAT #9
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"91fbef2d15a97816060bee1feaa49afe":"1bc704f1bce135ceb810341b216d7abe":"00000000000000000000000000000000"
AES-256-CFB128 Decrypt NIST KAT #10
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"e0000000000000000000000000000000":"9b80eefb7ebe2d2b16247aa0efc72f5d":"00000000000000000000000000000000"
AES-256-CFB128 Decrypt NIST KAT #11
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"f0000000000000000000000000000000":"7f2c5ece07a98d8bee13c51177395ff7":"00000000000000000000000000000000"
AES-256-CFB128 Decrypt NIST KAT #12
+depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB
aes_decrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"f8000000000000000000000000000000":"7818d800dcf6f4be1e0e94f403d1e4c2":"00000000000000000000000000000000"
AES-ECB Encrypt (Invalid keylength)
diff --git a/tests/suites/test_suite_camellia.data b/tests/suites/test_suite_camellia.data
index d1c446b9a..51f556607 100644
--- a/tests/suites/test_suite_camellia.data
+++ b/tests/suites/test_suite_camellia.data
@@ -89,75 +89,99 @@ Camellia-256-CBC Encrypt Perl EVP #4
camellia_encrypt_cbc:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"E31A6055297D96CA3330CDF1B1860A83":"F69F2445DF4F9B17AD2B417BE66C3710":"5D563F6D1CCCF236051C0C5C1C58F28F":0
Camellia-128-CFB128 Encrypt Perl EVP #1
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_encrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"000102030405060708090A0B0C0D0E0F":"6BC1BEE22E409F96E93D7E117393172A":"14F7646187817EB586599146B82BD719"
Camellia-128-CFB128 Encrypt Perl EVP #2
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_encrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"14F7646187817EB586599146B82BD719":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"A53D28BB82DF741103EA4F921A44880B"
Camellia-128-CFB128 Encrypt Perl EVP #3
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_encrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"A53D28BB82DF741103EA4F921A44880B":"30C81C46A35CE411E5FBC1191A0A52EF":"9C2157A664626D1DEF9EA420FDE69B96"
Camellia-128-CFB128 Encrypt Perl EVP #4
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_encrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"9C2157A664626D1DEF9EA420FDE69B96":"F69F2445DF4F9B17AD2B417BE66C3710":"742A25F0542340C7BAEF24CA8482BB09"
Camellia-128-CFB128 Decrypt Perl EVP #1
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_decrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"000102030405060708090A0B0C0D0E0F":"6BC1BEE22E409F96E93D7E117393172A":"14F7646187817EB586599146B82BD719"
Camellia-128-CFB128 Decrypt Perl EVP #2
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_decrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"14F7646187817EB586599146B82BD719":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"A53D28BB82DF741103EA4F921A44880B"
Camellia-128-CFB128 Decrypt Perl EVP #3
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_decrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"A53D28BB82DF741103EA4F921A44880B":"30C81C46A35CE411E5FBC1191A0A52EF":"9C2157A664626D1DEF9EA420FDE69B96"
Camellia-128-CFB128 Decrypt Perl EVP #4
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_decrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"9C2157A664626D1DEF9EA420FDE69B96":"F69F2445DF4F9B17AD2B417BE66C3710":"742A25F0542340C7BAEF24CA8482BB09"
Camellia-192-CFB128 Encrypt Perl EVP #1
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_encrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"000102030405060708090A0B0C0D0E0F":"6BC1BEE22E409F96E93D7E117393172A":"C832BB9780677DAA82D9B6860DCD565E"
Camellia-192-CFB128 Encrypt Perl EVP #2
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_encrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"C832BB9780677DAA82D9B6860DCD565E":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"86F8491627906D780C7A6D46EA331F98"
Camellia-192-CFB128 Encrypt Perl EVP #3
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_encrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"86F8491627906D780C7A6D46EA331F98":"30C81C46A35CE411E5FBC1191A0A52EF":"69511CCE594CF710CB98BB63D7221F01"
Camellia-192-CFB128 Encrypt Perl EVP #4
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_encrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"69511CCE594CF710CB98BB63D7221F01":"F69F2445DF4F9B17AD2B417BE66C3710":"D5B5378A3ABED55803F25565D8907B84"
Camellia-192-CFB128 Decrypt Perl EVP #1
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_decrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"000102030405060708090A0B0C0D0E0F":"6BC1BEE22E409F96E93D7E117393172A":"C832BB9780677DAA82D9B6860DCD565E"
Camellia-192-CFB128 Decrypt Perl EVP #2
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_decrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"C832BB9780677DAA82D9B6860DCD565E":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"86F8491627906D780C7A6D46EA331F98"
Camellia-192-CFB128 Decrypt Perl EVP #3
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_decrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"86F8491627906D780C7A6D46EA331F98":"30C81C46A35CE411E5FBC1191A0A52EF":"69511CCE594CF710CB98BB63D7221F01"
Camellia-192-CFB128 Decrypt Perl EVP #4
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_decrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"69511CCE594CF710CB98BB63D7221F01":"F69F2445DF4F9B17AD2B417BE66C3710":"D5B5378A3ABED55803F25565D8907B84"
Camellia-256-CFB128 Encrypt Perl EVP #1
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_encrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"000102030405060708090A0B0C0D0E0F":"6BC1BEE22E409F96E93D7E117393172A":"CF6107BB0CEA7D7FB1BD31F5E7B06C93"
Camellia-256-CFB128 Encrypt Perl EVP #2
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_encrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"CF6107BB0CEA7D7FB1BD31F5E7B06C93":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"89BEDB4CCDD864EA11BA4CBE849B5E2B"
Camellia-256-CFB128 Encrypt Perl EVP #3
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_encrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"89BEDB4CCDD864EA11BA4CBE849B5E2B":"30C81C46A35CE411E5FBC1191A0A52EF":"555FC3F34BDD2D54C62D9E3BF338C1C4"
Camellia-256-CFB128 Encrypt Perl EVP #4
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_encrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"555FC3F34BDD2D54C62D9E3BF338C1C4":"F69F2445DF4F9B17AD2B417BE66C3710":"5953ADCE14DB8C7F39F1BD39F359BFFA"
Camellia-256-CFB128 Decrypt Perl EVP #1
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_decrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"000102030405060708090A0B0C0D0E0F":"6BC1BEE22E409F96E93D7E117393172A":"CF6107BB0CEA7D7FB1BD31F5E7B06C93"
Camellia-256-CFB128 Decrypt Perl EVP #2
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_decrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"CF6107BB0CEA7D7FB1BD31F5E7B06C93":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"89BEDB4CCDD864EA11BA4CBE849B5E2B"
Camellia-256-CFB128 Decrypt Perl EVP #3
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_decrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"89BEDB4CCDD864EA11BA4CBE849B5E2B":"30C81C46A35CE411E5FBC1191A0A52EF":"555FC3F34BDD2D54C62D9E3BF338C1C4"
Camellia-256-CFB128 Decrypt Perl EVP #4
+depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB
camellia_decrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"555FC3F34BDD2D54C62D9E3BF338C1C4":"F69F2445DF4F9B17AD2B417BE66C3710":"5953ADCE14DB8C7F39F1BD39F359BFFA"
Camellia-ECB Encrypt (Invalid key length)