CFB Mode
Jean-Luc Cooke
jlcooke at certainkey.com
Mon Sep 27 16:54:01 CEST 2004
On Mon, Sep 27, 2004 at 10:53:36AM -0400, Jean-Luc Cooke wrote:
> Doh! I'll fix this patch now. Attached.
>
> No they didn't, I grabbed new ones.
>
> JLC
>
> ps.... this one sat in my inbox for too long. sorry.
>
> On Thu, Sep 23, 2004 at 09:44:20PM -0500, Michael Halcrow wrote:
> > On Thu, Sep 23, 2004 at 11:35:22PM -0400, Jean-Luc Cooke wrote:
> > > Here it is.
> > >
> > > Thoughts?
> >
> > As long as it's applied in reverse... :-) Did the tests work out for
> > CFB? I've been totally immersed in getting cryptfs up to speed.
> >
> > Mike
> >
-------------- next part --------------
diff -X exclude -Nur linux-2.6.8.1/crypto/cipher.c linux-2.6.8.1-rand2/crypto/cipher.c
--- linux-2.6.8.1/crypto/cipher.c 2004-08-14 06:55:32.000000000 -0400
+++ linux-2.6.8.1-rand2/crypto/cipher.c 2004-09-24 08:57:30.016607160 -0400
@@ -4,6 +4,8 @@
* Cipher operations.
*
* Copyright (c) 2002 James Morris <jmorris at intercode.com.au>
+ * Copyright (c) 2004 Jean-Luc Cooke <jlcooke at certainkey.com>
+ * Copyright (c) 2004 International Business Machines <mahalcro at us.ibm.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -95,6 +97,80 @@
}
}
+inline void ctr_increment_iv(u8 *iv, int blocksize) {
+ int i;
+ switch (blocksize) {
+ case 8:
+ if (++((u32*)iv)[0])
+ ++((u32*)iv)[1];
+ break;
+
+ case 16:
+ if (++((u32*)iv)[0])
+ if (++((u32*)iv)[1])
+ if (++((u32*)iv)[2])
+ ++((u32*)iv)[3];
+ break;
+
+ default:
+ for (i=0; i<blocksize; i++)
+ if (++iv[i])
+ break;
+ break;
+ }
+}
+static void ctr_process(struct crypto_tfm *tfm, u8 *dst, u8 *src,
+ cryptfn_t fn, int enc, void *info, int in_place)
+{
+ u8 *iv = info;
+ u8 stack[in_place ? crypto_tfm_alg_blocksize(tfm) : 0];
+ u8 *buf = in_place ? stack : dst;
+
+ /* Null encryption */
+ if (!iv)
+ return;
+
+ /* jlcooke: encrypt is the same as decrypt */
+
+ fn(crypto_tfm_ctx(tfm), buf, iv);
+ tfm->crt_u.cipher.cit_xor_block(buf, src);
+ memcpy(dst, buf, crypto_tfm_alg_blocksize(tfm));
+ ctr_increment_iv(iv, crypto_tfm_alg_blocksize(tfm));
+}
+
+static void cfb_process(struct crypto_tfm *tfm, u8 *dst, u8 *src,
+ cryptfn_t fn, int enc, void *info, int in_place)
+{
+ u8 *iv = info;
+ /* Null encryption */
+ if (!iv)
+ return;
+ if (enc) {
+ if (in_place) {
+ u8 buf[crypto_tfm_alg_blocksize(tfm)];
+ fn(crypto_tfm_ctx(tfm), buf, iv);
+ tfm->crt_u.cipher.cit_xor_block(buf, src);
+ memcpy(dst, buf, crypto_tfm_alg_blocksize(tfm));
+ memcpy(iv, buf, crypto_tfm_alg_blocksize(tfm));
+ } else {
+ fn(crypto_tfm_ctx(tfm), dst, iv);
+ tfm->crt_u.cipher.cit_xor_block(dst, src);
+ memcpy(iv, dst, crypto_tfm_alg_blocksize(tfm));
+ }
+ } else {
+ if (in_place) {
+ u8 buf[crypto_tfm_alg_blocksize(tfm)];
+ fn(crypto_tfm_ctx(tfm), buf, iv);
+ tfm->crt_u.cipher.cit_xor_block(buf, src);
+ memcpy(dst, buf, crypto_tfm_alg_blocksize(tfm));
+ } else {
+ fn(crypto_tfm_ctx(tfm), dst, iv);
+ tfm->crt_u.cipher.cit_xor_block(dst, src);
+ }
+ memcpy(iv, src, crypto_tfm_alg_blocksize(tfm));
+ }
+}
+
static void cbc_process(struct crypto_tfm *tfm, u8 *dst, u8 *src,
cryptfn_t fn, int enc, void *info, int in_place)
{
@@ -197,6 +273,67 @@
cbc_process, 0, iv);
}
+
+static int ctr_encrypt(struct crypto_tfm *tfm,
+ struct scatterlist *dst,
+ struct scatterlist *src,
+ unsigned int nbytes)
+{
+ return crypt(tfm, dst, src, nbytes,
+ tfm->__crt_alg->cra_cipher.cia_encrypt,
+ ctr_process, 1, tfm->crt_cipher.cit_iv);
+}
+
+static int ctr_encrypt_iv(struct crypto_tfm *tfm,
+ struct scatterlist *dst,
+ struct scatterlist *src,
+ unsigned int nbytes, u8 *iv)
+{
+ return crypt(tfm, dst, src, nbytes,
+ tfm->__crt_alg->cra_cipher.cia_encrypt,
+ ctr_process, 1, iv);
+}
+
+static int cfb_encrypt(struct crypto_tfm *tfm,
+ struct scatterlist *dst,
+ struct scatterlist *src,
+ unsigned int nbytes)
+{
+ return crypt(tfm, dst, src, nbytes,
+ tfm->__crt_alg->cra_cipher.cia_encrypt,
+ cfb_process, 1, tfm->crt_cipher.cit_iv);
+}
+
+static int cfb_encrypt_iv(struct crypto_tfm *tfm,
+ struct scatterlist *dst,
+ struct scatterlist *src,
+ unsigned int nbytes, u8 *iv)
+{
+ return crypt(tfm, dst, src, nbytes,
+ tfm->__crt_alg->cra_cipher.cia_encrypt,
+ cfb_process, 1, iv);
+}
+
+static int cfb_decrypt(struct crypto_tfm *tfm,
+ struct scatterlist *dst,
+ struct scatterlist *src,
+ unsigned int nbytes)
+{
+ return crypt(tfm, dst, src, nbytes,
+ tfm->__crt_alg->cra_cipher.cia_decrypt,
+ cfb_process, 0, tfm->crt_cipher.cit_iv);
+}
+
+static int cfb_decrypt_iv(struct crypto_tfm *tfm,
+ struct scatterlist *dst,
+ struct scatterlist *src,
+ unsigned int nbytes, u8 *iv)
+{
+ return crypt(tfm, dst, src, nbytes,
+ tfm->__crt_alg->cra_cipher.cia_decrypt,
+ cfb_process, 0, iv);
+}
+
static int nocrypt(struct crypto_tfm *tfm,
struct scatterlist *dst,
struct scatterlist *src,
@@ -245,6 +382,13 @@
break;
case CRYPTO_TFM_MODE_CFB:
+ ops->cit_encrypt = cfb_encrypt;
+ ops->cit_decrypt = cfb_decrypt;
+ ops->cit_encrypt_iv = cfb_encrypt_iv;
+ ops->cit_decrypt_iv = cfb_decrypt_iv;
+ break;
+
+ case CRYPTO_TFM_MODE_OFB:
ops->cit_encrypt = nocrypt;
ops->cit_decrypt = nocrypt;
ops->cit_encrypt_iv = nocrypt_iv;
@@ -252,17 +396,17 @@
break;
case CRYPTO_TFM_MODE_CTR:
- ops->cit_encrypt = nocrypt;
- ops->cit_decrypt = nocrypt;
- ops->cit_encrypt_iv = nocrypt_iv;
- ops->cit_decrypt_iv = nocrypt_iv;
+ ops->cit_encrypt = ctr_encrypt;
+ ops->cit_decrypt = ctr_encrypt;
+ ops->cit_encrypt_iv = ctr_encrypt_iv;
+ ops->cit_decrypt_iv = ctr_encrypt_iv;
break;
default:
BUG();
}
- if (ops->cit_mode == CRYPTO_TFM_MODE_CBC) {
+ if (ops->cit_mode != CRYPTO_TFM_MODE_ECB) {
switch (crypto_tfm_alg_blocksize(tfm)) {
case 8:
diff -X exclude -Nur linux-2.6.8.1/crypto/tcrypt.c linux-2.6.8.1-rand2/crypto/tcrypt.c
--- linux-2.6.8.1/crypto/tcrypt.c 2004-08-14 06:55:59.000000000 -0400
+++ linux-2.6.8.1-rand2/crypto/tcrypt.c 2004-09-24 11:07:23.778775216 -0400
@@ -6,6 +6,8 @@
*
* Copyright (c) 2002 James Morris <jmorris at intercode.com.au>
* Copyright (c) 2002 Jean-Francois Dive <jef at linuxbe.org>
+ * Copyright (c) 2004 Jean-Luc Cooke <jlcooke at certainkey.com>
+ * Copyright (c) 2004 International Business Machines <mahalcro at us.ibm.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -49,8 +51,11 @@
*/
#define ENCRYPT 1
#define DECRYPT 0
-#define MODE_ECB 1
-#define MODE_CBC 0
+#define MODE_ECB 0
+#define MODE_CBC 1
+#define MODE_CFB 2
+#define MODE_OFB 3
+#define MODE_CTR 4
static unsigned int IDX[8] = { IDX1, IDX2, IDX3, IDX4, IDX5, IDX6, IDX7, IDX8 };
@@ -269,10 +274,16 @@
strncpy(e, "encryption", 11);
else
strncpy(e, "decryption", 11);
- if (mode == MODE_ECB)
- strncpy(m, "ECB", 4);
- else
+ if (mode == MODE_CBC)
strncpy(m, "CBC", 4);
+ else if (mode == MODE_CFB)
+ strncpy(m, "CFB", 4);
+ else if (mode == MODE_OFB)
+ strncpy(m, "OFB", 4);
+ else if (mode == MODE_CTR)
+ strncpy(m, "CTR", 4);
+ else
+ strncpy(m, "ECB", 4);
printk("\ntesting %s %s %s \n", algo, m, e);
@@ -288,10 +299,16 @@
memcpy(tvmem, template, tsize);
cipher_tv = (void *) tvmem;
- if (mode)
- tfm = crypto_alloc_tfm (algo, 0);
- else
+ if (mode == MODE_CBC)
tfm = crypto_alloc_tfm (algo, CRYPTO_TFM_MODE_CBC);
+ else if (mode == MODE_CFB)
+ tfm = crypto_alloc_tfm (algo, CRYPTO_TFM_MODE_CFB);
+ else if (mode == MODE_OFB)
+ tfm = crypto_alloc_tfm (algo, CRYPTO_TFM_MODE_OFB);
+ else if (mode == MODE_CTR)
+ tfm = crypto_alloc_tfm (algo, CRYPTO_TFM_MODE_CTR);
+ else
+ tfm = crypto_alloc_tfm (algo, 0);
if (tfm == NULL) {
printk("failed to load transform for %s %s\n", algo, m);
@@ -323,7 +340,7 @@
sg[0].offset = offset_in_page(p);
sg[0].length = cipher_tv[i].ilen;
- if (!mode) {
+ if (mode != MODE_ECB) {
crypto_cipher_set_iv(tfm, cipher_tv[i].iv,
crypto_tfm_alg_ivsize (tfm));
}
@@ -382,7 +399,7 @@
sg[k].length = cipher_tv[i].tap[k];
}
- if (!mode) {
+ if (mode != MODE_ECB) {
crypto_cipher_set_iv(tfm, cipher_tv[i].iv,
crypto_tfm_alg_ivsize (tfm));
}
@@ -652,6 +669,14 @@
//AES
test_cipher ("aes", MODE_ECB, ENCRYPT, aes_enc_tv_template, AES_ENC_TEST_VECTORS);
test_cipher ("aes", MODE_ECB, DECRYPT, aes_dec_tv_template, AES_DEC_TEST_VECTORS);
+ test_cipher ("aes", MODE_CBC, ENCRYPT, aes_cbc_enc_tv_template, AES_CBC_ENC_TEST_VECTORS);
+ test_cipher ("aes", MODE_CBC, DECRYPT, aes_cbc_dec_tv_template, AES_CBC_DEC_TEST_VECTORS);
+ test_cipher ("aes", MODE_CFB, ENCRYPT, aes_cfb_enc_tv_template, AES_CFB_ENC_TEST_VECTORS);
+ test_cipher ("aes", MODE_CFB, DECRYPT, aes_cfb_dec_tv_template, AES_CFB_DEC_TEST_VECTORS);
+ test_cipher ("aes", MODE_OFB, ENCRYPT, aes_ofb_enc_tv_template, AES_OFB_ENC_TEST_VECTORS);
+ test_cipher ("aes", MODE_OFB, DECRYPT, aes_ofb_dec_tv_template, AES_OFB_DEC_TEST_VECTORS);
+ test_cipher ("aes", MODE_CTR, ENCRYPT, aes_ctr_enc_tv_template, AES_CTR_ENC_TEST_VECTORS);
+ test_cipher ("aes", MODE_CTR, DECRYPT, aes_ctr_dec_tv_template, AES_CTR_DEC_TEST_VECTORS);
//CAST5
test_cipher ("cast5", MODE_ECB, ENCRYPT, cast5_enc_tv_template, CAST5_ENC_TEST_VECTORS);
@@ -680,6 +705,7 @@
test_hash("sha384", sha384_tv_template, SHA384_TEST_VECTORS);
test_hash("sha512", sha512_tv_template, SHA512_TEST_VECTORS);
+
test_deflate();
test_crc32c();
#ifdef CONFIG_CRYPTO_HMAC
@@ -739,6 +765,14 @@
case 10:
test_cipher ("aes", MODE_ECB, ENCRYPT, aes_enc_tv_template, AES_ENC_TEST_VECTORS);
test_cipher ("aes", MODE_ECB, DECRYPT, aes_dec_tv_template, AES_DEC_TEST_VECTORS);
+ test_cipher ("aes", MODE_CBC, ENCRYPT, aes_cbc_enc_tv_template, AES_CBC_ENC_TEST_VECTORS);
+ test_cipher ("aes", MODE_CBC, DECRYPT, aes_cbc_dec_tv_template, AES_CBC_DEC_TEST_VECTORS);
+ test_cipher ("aes", MODE_CFB, ENCRYPT, aes_cfb_enc_tv_template, AES_CFB_ENC_TEST_VECTORS);
+ test_cipher ("aes", MODE_CFB, DECRYPT, aes_cfb_dec_tv_template, AES_CFB_DEC_TEST_VECTORS);
+ test_cipher ("aes", MODE_OFB, ENCRYPT, aes_ofb_enc_tv_template, AES_OFB_ENC_TEST_VECTORS);
+ test_cipher ("aes", MODE_OFB, DECRYPT, aes_ofb_dec_tv_template, AES_OFB_DEC_TEST_VECTORS);
+ test_cipher ("aes", MODE_CTR, ENCRYPT, aes_ctr_enc_tv_template, AES_CTR_ENC_TEST_VECTORS);
+ test_cipher ("aes", MODE_CTR, DECRYPT, aes_ctr_dec_tv_template, AES_CTR_DEC_TEST_VECTORS);
break;
case 11:
diff -X exclude -Nur linux-2.6.8.1/crypto/tcrypt.h linux-2.6.8.1-rand2/crypto/tcrypt.h
--- linux-2.6.8.1/crypto/tcrypt.h 2004-08-14 06:56:20.000000000 -0400
+++ linux-2.6.8.1-rand2/crypto/tcrypt.h 2004-09-24 11:07:55.701922160 -0400
@@ -6,6 +6,8 @@
*
* Copyright (c) 2002 James Morris <jmorris at intercode.com.au>
* Copyright (c) 2002 Jean-Francois Dive <jef at linuxbe.org>
+ * Copyright (c) 2004 Jean-Luc Cooke <jlcooke at certainkey.com>
+ * Copyright (c) 2004 International Business Machines <mahalcro at us.ibm.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -301,6 +303,113 @@
},
};
+/*
+ * WHIRLPOOL test vectors from ISO
+ */
+#define WHIRLPOOL_TEST_VECTORS 8
+struct hash_testvec whirlpool_tv_template[] = {
+ {
+ .plaintext = "",
+ .psize = 1,
+ .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66,
+ 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26,
+ 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8,
+ 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7,
+ 0x3E, 0x83, 0xBE, 0x69, 0x8B, 0x28, 0x8F, 0xEB,
+ 0xCF, 0x88, 0xE3, 0xE0, 0x3C, 0x4F, 0x07, 0x57,
+ 0xEA, 0x89, 0x64, 0xE5, 0x9B, 0x63, 0xD9, 0x37,
+ 0x08, 0xB1, 0x38, 0xCC, 0x42, 0xA6, 0x6E, 0xB3 },
+ }, {
+ .plaintext = "a",
+ .psize = 1,
+ .digest = { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F,
+ 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7,
+ 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69,
+ 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42,
+ 0xD1, 0x1B, 0xC6, 0x45, 0x41, 0x3A, 0xEF, 0xF6,
+ 0x3A, 0x42, 0x39, 0x1A, 0x39, 0x14, 0x5A, 0x59,
+ 0x1A, 0x92, 0x20, 0x0D, 0x56, 0x01, 0x95, 0xE5,
+ 0x3B, 0x47, 0x85, 0x84, 0xFD, 0xAE, 0x23, 0x1A },
+ }, {
+ .plaintext = "abc",
+ .psize = 3,
+ .digest = { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB,
+ 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B,
+ 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72,
+ 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C,
+ 0x71, 0x81, 0xEE, 0xBD, 0xB6, 0xC5, 0x7E, 0x27,
+ 0x7D, 0x0E, 0x34, 0x95, 0x71, 0x14, 0xCB, 0xD6,
+ 0xC7, 0x97, 0xFC, 0x9D, 0x95, 0xD8, 0xB5, 0x82,
+ 0xD2, 0x25, 0x29, 0x20, 0x76, 0xD4, 0xEE, 0xF5 },
+ }, {
+ .plaintext = "message digest",
+ .psize = 14,
+ .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6,
+ 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC,
+ 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C,
+ 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B,
+ 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1,
+ 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6,
+ 0x92, 0xED, 0x92, 0x00, 0x52, 0x83, 0x8F, 0x33,
+ 0x62, 0xE8, 0x6D, 0xBD, 0x37, 0xA8, 0x90, 0x3E },
+ }, {
+ .plaintext = "abcdefghijklmnopqrstuvwxyz",
+ .psize = 26,
+ .digest = { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9,
+ 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A,
+ 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5,
+ 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B,
+ 0x08, 0xBF, 0x2A, 0x92, 0x51, 0xC3, 0x0B, 0x6A,
+ 0x0B, 0x8A, 0xAE, 0x86, 0x17, 0x7A, 0xB4, 0xA6,
+ 0xF6, 0x8F, 0x67, 0x3E, 0x72, 0x07, 0x86, 0x5D,
+ 0x5D, 0x98, 0x19, 0xA3, 0xDB, 0xA4, 0xEB, 0x3B },
+ }, {
+ .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
+ .psize = 62,
+ .digest = { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B,
+ 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90,
+ 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC,
+ 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E,
+ 0x08, 0xEB, 0xA2, 0x66, 0x29, 0x12, 0x9D, 0x8F,
+ 0xB7, 0xCB, 0x57, 0x21, 0x1B, 0x92, 0x81, 0xA6,
+ 0x55, 0x17, 0xCC, 0x87, 0x9D, 0x7B, 0x96, 0x21,
+ 0x42, 0xC6, 0x5F, 0x5A, 0x7A, 0xF0, 0x14, 0x67 },
+ }, {
+ .plaintext = "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
+ .psize = 80,
+ .digest = { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D,
+ 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0,
+ 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6,
+ 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29,
+ 0x4D, 0x5B, 0xD8, 0xDF, 0x2A, 0x6C, 0x44, 0xE5,
+ 0x38, 0xCD, 0x04, 0x7B, 0x26, 0x81, 0xA5, 0x1A,
+ 0x2C, 0x60, 0x48, 0x1E, 0x88, 0xC5, 0xA2, 0x0B,
+ 0x2C, 0x2A, 0x80, 0xCF, 0x3A, 0x9A, 0x08, 0x3B },
+ }, {
+ .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
+ .psize = 32,
+ .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61,
+ 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48,
+ 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62,
+ 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69,
+ 0x16, 0xBD, 0xC8, 0x03, 0x1B, 0xC5, 0xBE, 0x1B,
+ 0x7B, 0x94, 0x76, 0x39, 0xFE, 0x05, 0x0B, 0x56,
+ 0x93, 0x9B, 0xAA, 0xA0, 0xAD, 0xFF, 0x9A, 0xE6,
+ 0x74, 0x5B, 0x7B, 0x18, 0x1C, 0x3B, 0xE3, 0xFD },
+ .np = 4,
+ .tap = { 26, 26, 26, 26 }
+ },
+};
+
+/*
+ * WHIRLPOOL384/WHIRLPOOL256 test vectors
+ */
+#define WHIRLPOOL384_TEST_VECTORS 8
+#define whirlpool384_tv_template whirlpool_tv_template
+#define WHIRLPOOL256_TEST_VECTORS 8
+#define whirlpool256_tv_template whirlpool_tv_template
+
+
#ifdef CONFIG_CRYPTO_HMAC
/*
* HMAC-MD5 test vectors from RFC2202
@@ -1349,13 +1458,19 @@
},
};
-
/*
* AES test vectors.
*/
#define AES_ENC_TEST_VECTORS 3
#define AES_DEC_TEST_VECTORS 3
+/*
+key= 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+iv = 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
+in = 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70
+out= 54 ef 38 3d c8 d0 3a 6c 79 1c 1d 34 02 29 5b 36
+
+ */
struct cipher_testvec aes_enc_tv_template[] = {
{ /* From FIPS-197 */
.key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
@@ -1430,6 +1545,134 @@
},
};
+
+/*
+ * AES test vectors.
+ */
+#define AES_CTR_ENC_TEST_VECTORS 1
+#define AES_CTR_DEC_TEST_VECTORS 1
+
+struct cipher_testvec aes_ctr_enc_tv_template[] = {
+ {
+ .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ .klen = 16,
+ .input = { 0x61, 0x62, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70 },
+ .iv = { 0x20, 0x21, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f },
+ .ilen = 16,
+ .result = { 0x46, 0xc7, 0x9e, 0x47, 0x6d, 0xf0, 0xfe, 0x48,
+ 0x77, 0xb3, 0xc9, 0xd9, 0x88, 0xbf, 0x75, 0x37 },
+ .rlen = 16,
+ },
+};
+
+struct cipher_testvec aes_ctr_dec_tv_template[] = {
+ {
+ .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ .klen = 16,
+ .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
+ 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
+ .iv = { 0x10, 0x11, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
+ .ilen = 16,
+ .result = { 0x77, 0xdd, 0x58, 0x2a, 0xe8, 0x53, 0x8d, 0xba,
+ 0x9f, 0x11, 0x6b, 0x93, 0xd6, 0x57, 0x2e, 0xab },
+ .rlen = 16,
+ },
+};
+
+#define AES_CBC_ENC_TEST_VECTORS 1
+#define AES_CBC_DEC_TEST_VECTORS 0
+struct cipher_testvec aes_cbc_enc_tv_template[] = {
+ {
+ .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ .klen = 16,
+ .input = { 0x61, 0x62, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70 },
+ .iv = { 0x10, 0x11, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
+ .ilen = 16,
+ .result = { 0x0b, 0xc1, 0x9f, 0xdc, 0xdd, 0x59, 0x62, 0x23,
+ 0x49, 0x62, 0x28, 0xe3, 0x9c, 0x19, 0xc1, 0xdd },
+ .rlen = 16,
+ },
+};
+
+struct cipher_testvec aes_cbc_dec_tv_template[] = {
+ {
+ .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ .klen = 16,
+ .input = { 0x61, 0x62, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70 },
+ .iv = { 0x10, 0x11, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
+ .ilen = 16,
+ .result = { 0x54, 0xef, 0x38, 0x3d, 0xc8, 0xd0, 0x3a, 0x6c,
+ 0x79, 0x1c, 0x1d, 0x34, 0x02, 0x29, 0x5b, 0x36 },
+ .rlen = 16,
+ },
+};
+
+#define AES_CFB_ENC_TEST_VECTORS 1
+#define AES_CFB_DEC_TEST_VECTORS 1
+struct cipher_testvec aes_cfb_enc_tv_template[] = {
+ {
+ .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ .klen = 16,
+ .input = { 0x61, 0x62, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70 },
+ .iv = { 0x10, 0x11, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
+ .ilen = 16,
+ .result = { 0xbb, 0x42, 0x5b, 0x8f, 0x12, 0xd8, 0x85, 0xa9,
+ 0x8c, 0xb0, 0xa2, 0x7c, 0x6a, 0x98, 0x05, 0xe0 },
+ .rlen = 16,
+ },
+};
+
+struct cipher_testvec aes_cfb_dec_tv_template[] = {
+ {
+ .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ .klen = 16,
+ .input = { 0x61, 0x62, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70 },
+ .iv = { 0x10, 0x11, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
+ .ilen = 16,
+ .result = { 0x81, 0xfa, 0x56, 0x98, 0x18, 0xfc, 0xe4, 0x3a,
+ 0x96, 0x5b, 0xeb, 0x72, 0x0f, 0xad, 0x42, 0xa2 },
+ .rlen = 16,
+ },
+};
+
+#define AES_OFB_ENC_TEST_VECTORS 1
+#define AES_OFB_DEC_TEST_VECTORS 0
+struct cipher_testvec aes_ofb_enc_tv_template[] = {
+ {
+ .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ .klen = 16,
+ .input = { 0x61, 0x62, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70 },
+ .iv = { 0x10, 0x11, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
+ .ilen = 16,
+ .result = { 0x54, 0xef, 0x38, 0x3d, 0xc8, 0xd0, 0x3a, 0x6c,
+ 0x79, 0x1c, 0x1d, 0x34, 0x02, 0x29, 0x5b, 0x36 },
+ .rlen = 16,
+ },
+};
+
+struct cipher_testvec aes_ofb_dec_tv_template[] = {
+};
+
/* Cast5 test vectors from RFC 2144 */
#define CAST5_ENC_TEST_VECTORS 3
#define CAST5_DEC_TEST_VECTORS 3
@@ -1630,291 +1873,6 @@
},
};
-/*
- * TEA test vectors
- */
-#define TEA_ENC_TEST_VECTORS 4
-#define TEA_DEC_TEST_VECTORS 4
-
-struct cipher_testvec tea_enc_tv_template[] =
-{
- {
- .key = { [0 ... 15] = 0x00 },
- .klen = 16,
- .input = { [0 ... 8] = 0x00 },
- .ilen = 8,
- .result = { 0x0a, 0x3a, 0xea, 0x41, 0x40, 0xa9, 0xba, 0x94 },
- .rlen = 8,
- }, {
- .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
- 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
- .klen = 16,
- .input = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
- .ilen = 8,
- .result = { 0x77, 0x5d, 0x2a, 0x6a, 0xf6, 0xce, 0x92, 0x09 },
- .rlen = 8,
- }, {
- .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
- 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
- .klen = 16,
- .input = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
- 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
- .ilen = 16,
- .result = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e,
- 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 },
- .rlen = 16,
- }, {
- .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
- 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
- .klen = 16,
- .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
- 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
- 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
- 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
- .ilen = 32,
- .result = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47,
- 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8,
- 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a,
- 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 },
- .rlen = 32,
- }
-};
-
-struct cipher_testvec tea_dec_tv_template[] =
-{
- {
- .key = { [0 ... 15] = 0x00 },
- .klen = 16,
- .input = { 0x0a, 0x3a, 0xea, 0x41, 0x40, 0xa9, 0xba, 0x94 },
- .ilen = 8,
- .result = { [0 ... 8] = 0x00 },
- .rlen = 8,
- }, {
- .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
- 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
- .klen = 16,
- .input = { 0x77, 0x5d, 0x2a, 0x6a, 0xf6, 0xce, 0x92, 0x09 },
- .ilen = 8,
- .result = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
- .rlen = 8,
- }, {
- .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
- 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
- .klen = 16,
- .input = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e,
- 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 },
- .ilen = 16,
- .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
- 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
- .rlen = 16,
- }, {
- .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
- 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
- .klen = 16,
- .input = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47,
- 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8,
- 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a,
- 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 },
- .ilen = 32,
- .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
- 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
- 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
- 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
- .rlen = 32,
- }
-};
-
-/*
- * XTEA test vectors
- */
-#define XTEA_ENC_TEST_VECTORS 4
-#define XTEA_DEC_TEST_VECTORS 4
-
-struct cipher_testvec xtea_enc_tv_template[] =
-{
- {
- .key = { [0 ... 15] = 0x00 },
- .klen = 16,
- .input = { [0 ... 8] = 0x00 },
- .ilen = 8,
- .result = { 0xaa, 0x22, 0x96, 0xe5, 0x6c, 0x61, 0xf3, 0x45 },
- .rlen = 8,
- }, {
- .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
- 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
- .klen = 16,
- .input = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
- .ilen = 8,
- .result = { 0x82, 0x3e, 0xeb, 0x35, 0xdc, 0xdd, 0xd9, 0xc3 },
- .rlen = 8,
- }, {
- .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
- 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
- .klen = 16,
- .input = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
- 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
- .ilen = 16,
- .result = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea,
- 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c },
- .rlen = 16,
- }, {
- .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
- 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
- .klen = 16,
- .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
- 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
- 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
- 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
- .ilen = 32,
- .result = { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1,
- 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4,
- 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f,
- 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 },
- .rlen = 32,
- }
-};
-
-struct cipher_testvec xtea_dec_tv_template[] =
-{
- {
- .key = { [0 ... 15] = 0x00 },
- .klen = 16,
- .input = { 0xaa, 0x22, 0x96, 0xe5, 0x6c, 0x61, 0xf3, 0x45 },
- .ilen = 8,
- .result = { [0 ... 8] = 0x00 },
- .rlen = 8,
- }, {
- .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
- 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
- .klen = 16,
- .input = { 0x82, 0x3e, 0xeb, 0x35, 0xdc, 0xdd, 0xd9, 0xc3 },
- .ilen = 8,
- .result = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
- .rlen = 8,
- }, {
- .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
- 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
- .klen = 16,
- .input = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea,
- 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c },
- .ilen = 16,
- .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
- 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
- .rlen = 16,
- }, {
- .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
- 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
- .klen = 16,
- .input = { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1,
- 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4,
- 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f,
- 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 },
- .ilen = 32,
- .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
- 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
- 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
- 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
- .rlen = 32,
- }
-};
-
-/*
- * KHAZAD test vectors.
- */
-#define KHAZAD_ENC_TEST_VECTORS 5
-#define KHAZAD_DEC_TEST_VECTORS 5
-
-struct cipher_testvec khazad_enc_tv_template[] = {
- {
- .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
- .klen = 16,
- .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
- .ilen = 8,
- .result = { 0x49, 0xa4, 0xce, 0x32, 0xac, 0x19, 0x0e, 0x3f },
- .rlen = 8,
- }, {
- .key = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
- 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
- .klen = 16,
- .input = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
- .ilen = 8,
- .result = { 0x7e, 0x82, 0x12, 0xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 },
- .rlen = 8,
- }, {
- .key = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2,
- 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
- .klen = 16,
- .input = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
- .ilen = 8,
- .result = { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c },
- .rlen = 8,
- }, {
- .key = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
- 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
- .klen = 16,
- .input = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
- .ilen = 8,
- .result = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
- .rlen = 8,
- }, {
- .key = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
- 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
- .klen = 16,
- .input = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f ,
- 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
- .ilen = 16,
- .result = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 ,
- 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
- .rlen = 16,
- },
-};
-
-struct cipher_testvec khazad_dec_tv_template[] = {
- {
- .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
- .klen = 16,
- .input = { 0X49, 0Xa4, 0Xce, 0X32, 0Xac, 0X19, 0X0e, 0X3f },
- .ilen = 8,
- .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
- .rlen = 8,
- }, {
- .key = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
- 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
- .klen = 16,
- .input = { 0X7e, 0X82, 0X12, 0Xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 },
- .ilen = 8,
- .result = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
- .rlen = 8,
- }, {
- .key = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2,
- 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
- .klen = 16,
- .input = { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c },
- .ilen = 8,
- .result = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
- .rlen = 8,
- }, {
- .key = { 0x2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
- 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
- .klen = 16,
- .input = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
- .ilen = 8,
- .result = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
- .rlen = 8,
- }, {
- .key = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
- 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
- .klen = 16,
- .input = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 ,
- 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
- .ilen = 16,
- .result = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f ,
- 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
- .rlen = 16,
- },
-};
/*
* Compression stuff.
@@ -2056,5 +2014,4 @@
.digest = { 0x0a, 0x94, 0x2b, 0x12, 0x4e, 0xca, 0xa5, 0x46 },
}
};
-
#endif /* _CRYPTO_TCRYPT_H */
More information about the CryptoAPI
mailing list