diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 01:01:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 01:01:27 -0500 |
commit | 4f58cb90bcb04cfe18f524d1c9a65edef5eb3f51 (patch) | |
tree | 8c686e8b736eed7258921909282c0955543c7d2f /crypto | |
parent | e7691a1ce341c80ed9504244a36b31c025217391 (diff) | |
parent | 08c70fc3a239475122e20b7a21dfae4c264c24f7 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (54 commits)
crypto: gf128mul - remove leftover "(EXPERIMENTAL)" in Kconfig
crypto: serpent-sse2 - remove unneeded LRW/XTS #ifdefs
crypto: serpent-sse2 - select LRW and XTS
crypto: twofish-x86_64-3way - remove unneeded LRW/XTS #ifdefs
crypto: twofish-x86_64-3way - select LRW and XTS
crypto: xts - remove dependency on EXPERIMENTAL
crypto: lrw - remove dependency on EXPERIMENTAL
crypto: picoxcell - fix boolean and / or confusion
crypto: caam - remove DECO access initialization code
crypto: caam - fix polarity of "propagate error" logic
crypto: caam - more desc.h cleanups
crypto: caam - desc.h - convert spaces to tabs
crypto: talitos - convert talitos_error to struct device
crypto: talitos - remove NO_IRQ references
crypto: talitos - fix bad kfree
crypto: convert drivers/crypto/* to use module_platform_driver()
char: hw_random: convert drivers/char/hw_random/* to use module_platform_driver()
crypto: serpent-sse2 - should select CRYPTO_CRYPTD
crypto: serpent - rename serpent.c to serpent_generic.c
crypto: serpent - cleanup checkpatch errors and warnings
...
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/Kconfig | 52 | ||||
-rw-r--r-- | crypto/Makefile | 2 | ||||
-rw-r--r-- | crypto/algapi.c | 29 | ||||
-rw-r--r-- | crypto/ansi_cprng.c | 8 | ||||
-rw-r--r-- | crypto/crypto_user.c | 2 | ||||
-rw-r--r-- | crypto/lrw.c | 156 | ||||
-rw-r--r-- | crypto/serpent.c | 587 | ||||
-rw-r--r-- | crypto/serpent_generic.c | 684 | ||||
-rw-r--r-- | crypto/tcrypt.c | 310 | ||||
-rw-r--r-- | crypto/tcrypt.h | 2 | ||||
-rw-r--r-- | crypto/testmgr.c | 150 | ||||
-rw-r--r-- | crypto/testmgr.h | 2759 | ||||
-rw-r--r-- | crypto/twofish_common.c | 13 | ||||
-rw-r--r-- | crypto/xts.c | 79 |
14 files changed, 4194 insertions, 639 deletions
diff --git a/crypto/Kconfig b/crypto/Kconfig index ae9c3ceb2867..e6cfe1a25137 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig | |||
@@ -105,7 +105,7 @@ config CRYPTO_USER | |||
105 | depends on NET | 105 | depends on NET |
106 | select CRYPTO_MANAGER | 106 | select CRYPTO_MANAGER |
107 | help | 107 | help |
108 | Userapace configuration for cryptographic instantiations such as | 108 | Userspace configuration for cryptographic instantiations such as |
109 | cbc(aes). | 109 | cbc(aes). |
110 | 110 | ||
111 | config CRYPTO_MANAGER_DISABLE_TESTS | 111 | config CRYPTO_MANAGER_DISABLE_TESTS |
@@ -117,7 +117,7 @@ config CRYPTO_MANAGER_DISABLE_TESTS | |||
117 | algorithm registration. | 117 | algorithm registration. |
118 | 118 | ||
119 | config CRYPTO_GF128MUL | 119 | config CRYPTO_GF128MUL |
120 | tristate "GF(2^128) multiplication functions (EXPERIMENTAL)" | 120 | tristate "GF(2^128) multiplication functions" |
121 | help | 121 | help |
122 | Efficient table driven implementation of multiplications in the | 122 | Efficient table driven implementation of multiplications in the |
123 | field GF(2^128). This is needed by some cypher modes. This | 123 | field GF(2^128). This is needed by some cypher modes. This |
@@ -241,8 +241,7 @@ config CRYPTO_ECB | |||
241 | the input block by block. | 241 | the input block by block. |
242 | 242 | ||
243 | config CRYPTO_LRW | 243 | config CRYPTO_LRW |
244 | tristate "LRW support (EXPERIMENTAL)" | 244 | tristate "LRW support" |
245 | depends on EXPERIMENTAL | ||
246 | select CRYPTO_BLKCIPHER | 245 | select CRYPTO_BLKCIPHER |
247 | select CRYPTO_MANAGER | 246 | select CRYPTO_MANAGER |
248 | select CRYPTO_GF128MUL | 247 | select CRYPTO_GF128MUL |
@@ -262,8 +261,7 @@ config CRYPTO_PCBC | |||
262 | This block cipher algorithm is required for RxRPC. | 261 | This block cipher algorithm is required for RxRPC. |
263 | 262 | ||
264 | config CRYPTO_XTS | 263 | config CRYPTO_XTS |
265 | tristate "XTS support (EXPERIMENTAL)" | 264 | tristate "XTS support" |
266 | depends on EXPERIMENTAL | ||
267 | select CRYPTO_BLKCIPHER | 265 | select CRYPTO_BLKCIPHER |
268 | select CRYPTO_MANAGER | 266 | select CRYPTO_MANAGER |
269 | select CRYPTO_GF128MUL | 267 | select CRYPTO_GF128MUL |
@@ -764,6 +762,46 @@ config CRYPTO_SERPENT | |||
764 | See also: | 762 | See also: |
765 | <http://www.cl.cam.ac.uk/~rja14/serpent.html> | 763 | <http://www.cl.cam.ac.uk/~rja14/serpent.html> |
766 | 764 | ||
765 | config CRYPTO_SERPENT_SSE2_X86_64 | ||
766 | tristate "Serpent cipher algorithm (x86_64/SSE2)" | ||
767 | depends on X86 && 64BIT | ||
768 | select CRYPTO_ALGAPI | ||
769 | select CRYPTO_CRYPTD | ||
770 | select CRYPTO_SERPENT | ||
771 | select CRYPTO_LRW | ||
772 | select CRYPTO_XTS | ||
773 | help | ||
774 | Serpent cipher algorithm, by Anderson, Biham & Knudsen. | ||
775 | |||
776 | Keys are allowed to be from 0 to 256 bits in length, in steps | ||
777 | of 8 bits. | ||
778 | |||
779 | This module provides Serpent cipher algorithm that processes eigth | ||
780 | blocks parallel using SSE2 instruction set. | ||
781 | |||
782 | See also: | ||
783 | <http://www.cl.cam.ac.uk/~rja14/serpent.html> | ||
784 | |||
785 | config CRYPTO_SERPENT_SSE2_586 | ||
786 | tristate "Serpent cipher algorithm (i586/SSE2)" | ||
787 | depends on X86 && !64BIT | ||
788 | select CRYPTO_ALGAPI | ||
789 | select CRYPTO_CRYPTD | ||
790 | select CRYPTO_SERPENT | ||
791 | select CRYPTO_LRW | ||
792 | select CRYPTO_XTS | ||
793 | help | ||
794 | Serpent cipher algorithm, by Anderson, Biham & Knudsen. | ||
795 | |||
796 | Keys are allowed to be from 0 to 256 bits in length, in steps | ||
797 | of 8 bits. | ||
798 | |||
799 | This module provides Serpent cipher algorithm that processes four | ||
800 | blocks parallel using SSE2 instruction set. | ||
801 | |||
802 | See also: | ||
803 | <http://www.cl.cam.ac.uk/~rja14/serpent.html> | ||
804 | |||
767 | config CRYPTO_TEA | 805 | config CRYPTO_TEA |
768 | tristate "TEA, XTEA and XETA cipher algorithms" | 806 | tristate "TEA, XTEA and XETA cipher algorithms" |
769 | select CRYPTO_ALGAPI | 807 | select CRYPTO_ALGAPI |
@@ -840,6 +878,8 @@ config CRYPTO_TWOFISH_X86_64_3WAY | |||
840 | select CRYPTO_ALGAPI | 878 | select CRYPTO_ALGAPI |
841 | select CRYPTO_TWOFISH_COMMON | 879 | select CRYPTO_TWOFISH_COMMON |
842 | select CRYPTO_TWOFISH_X86_64 | 880 | select CRYPTO_TWOFISH_X86_64 |
881 | select CRYPTO_LRW | ||
882 | select CRYPTO_XTS | ||
843 | help | 883 | help |
844 | Twofish cipher algorithm (x86_64, 3-way parallel). | 884 | Twofish cipher algorithm (x86_64, 3-way parallel). |
845 | 885 | ||
diff --git a/crypto/Makefile b/crypto/Makefile index 9e6eee2c05db..f638063f4ea9 100644 --- a/crypto/Makefile +++ b/crypto/Makefile | |||
@@ -65,7 +65,7 @@ obj-$(CONFIG_CRYPTO_BLOWFISH) += blowfish_generic.o | |||
65 | obj-$(CONFIG_CRYPTO_BLOWFISH_COMMON) += blowfish_common.o | 65 | obj-$(CONFIG_CRYPTO_BLOWFISH_COMMON) += blowfish_common.o |
66 | obj-$(CONFIG_CRYPTO_TWOFISH) += twofish_generic.o | 66 | obj-$(CONFIG_CRYPTO_TWOFISH) += twofish_generic.o |
67 | obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o | 67 | obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o |
68 | obj-$(CONFIG_CRYPTO_SERPENT) += serpent.o | 68 | obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o |
69 | obj-$(CONFIG_CRYPTO_AES) += aes_generic.o | 69 | obj-$(CONFIG_CRYPTO_AES) += aes_generic.o |
70 | obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia.o | 70 | obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia.o |
71 | obj-$(CONFIG_CRYPTO_CAST5) += cast5.o | 71 | obj-$(CONFIG_CRYPTO_CAST5) += cast5.o |
diff --git a/crypto/algapi.c b/crypto/algapi.c index 54dd4e33b5d6..9d4a9fe913f8 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
@@ -518,6 +518,35 @@ err: | |||
518 | } | 518 | } |
519 | EXPORT_SYMBOL_GPL(crypto_register_instance); | 519 | EXPORT_SYMBOL_GPL(crypto_register_instance); |
520 | 520 | ||
521 | int crypto_unregister_instance(struct crypto_alg *alg) | ||
522 | { | ||
523 | int err; | ||
524 | struct crypto_instance *inst = (void *)alg; | ||
525 | struct crypto_template *tmpl = inst->tmpl; | ||
526 | LIST_HEAD(users); | ||
527 | |||
528 | if (!(alg->cra_flags & CRYPTO_ALG_INSTANCE)) | ||
529 | return -EINVAL; | ||
530 | |||
531 | BUG_ON(atomic_read(&alg->cra_refcnt) != 1); | ||
532 | |||
533 | down_write(&crypto_alg_sem); | ||
534 | |||
535 | hlist_del_init(&inst->list); | ||
536 | err = crypto_remove_alg(alg, &users); | ||
537 | |||
538 | up_write(&crypto_alg_sem); | ||
539 | |||
540 | if (err) | ||
541 | return err; | ||
542 | |||
543 | tmpl->free(inst); | ||
544 | crypto_remove_final(&users); | ||
545 | |||
546 | return 0; | ||
547 | } | ||
548 | EXPORT_SYMBOL_GPL(crypto_unregister_instance); | ||
549 | |||
521 | int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, | 550 | int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, |
522 | struct crypto_instance *inst, u32 mask) | 551 | struct crypto_instance *inst, u32 mask) |
523 | { | 552 | { |
diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c index ffa0245e2abc..6ddd99e6114b 100644 --- a/crypto/ansi_cprng.c +++ b/crypto/ansi_cprng.c | |||
@@ -414,10 +414,18 @@ static int fips_cprng_get_random(struct crypto_rng *tfm, u8 *rdata, | |||
414 | static int fips_cprng_reset(struct crypto_rng *tfm, u8 *seed, unsigned int slen) | 414 | static int fips_cprng_reset(struct crypto_rng *tfm, u8 *seed, unsigned int slen) |
415 | { | 415 | { |
416 | u8 rdata[DEFAULT_BLK_SZ]; | 416 | u8 rdata[DEFAULT_BLK_SZ]; |
417 | u8 *key = seed + DEFAULT_BLK_SZ; | ||
417 | int rc; | 418 | int rc; |
418 | 419 | ||
419 | struct prng_context *prng = crypto_rng_ctx(tfm); | 420 | struct prng_context *prng = crypto_rng_ctx(tfm); |
420 | 421 | ||
422 | if (slen < DEFAULT_PRNG_KSZ + DEFAULT_BLK_SZ) | ||
423 | return -EINVAL; | ||
424 | |||
425 | /* fips strictly requires seed != key */ | ||
426 | if (!memcmp(seed, key, DEFAULT_PRNG_KSZ)) | ||
427 | return -EINVAL; | ||
428 | |||
421 | rc = cprng_reset(tfm, seed, slen); | 429 | rc = cprng_reset(tfm, seed, slen); |
422 | 430 | ||
423 | if (!rc) | 431 | if (!rc) |
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c index 0605a2bbba75..3ba6ef508869 100644 --- a/crypto/crypto_user.c +++ b/crypto/crypto_user.c | |||
@@ -298,7 +298,7 @@ static int crypto_del_alg(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
298 | if (atomic_read(&alg->cra_refcnt) != 1) | 298 | if (atomic_read(&alg->cra_refcnt) != 1) |
299 | return -EBUSY; | 299 | return -EBUSY; |
300 | 300 | ||
301 | return crypto_unregister_alg(alg); | 301 | return crypto_unregister_instance(alg); |
302 | } | 302 | } |
303 | 303 | ||
304 | static int crypto_add_alg(struct sk_buff *skb, struct nlmsghdr *nlh, | 304 | static int crypto_add_alg(struct sk_buff *skb, struct nlmsghdr *nlh, |
diff --git a/crypto/lrw.c b/crypto/lrw.c index 358f80be2bf9..ba42acc4deba 100644 --- a/crypto/lrw.c +++ b/crypto/lrw.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (c) 2006 Rik Snel <rsnel@cube.dyndns.org> | 4 | * Copyright (c) 2006 Rik Snel <rsnel@cube.dyndns.org> |
5 | * | 5 | * |
6 | * Based om ecb.c | 6 | * Based on ecb.c |
7 | * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au> | 7 | * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify it | 9 | * This program is free software; you can redistribute it and/or modify it |
@@ -16,6 +16,7 @@ | |||
16 | * http://www.mail-archive.com/stds-p1619@listserv.ieee.org/msg00173.html | 16 | * http://www.mail-archive.com/stds-p1619@listserv.ieee.org/msg00173.html |
17 | * | 17 | * |
18 | * The test vectors are included in the testing module tcrypt.[ch] */ | 18 | * The test vectors are included in the testing module tcrypt.[ch] */ |
19 | |||
19 | #include <crypto/algapi.h> | 20 | #include <crypto/algapi.h> |
20 | #include <linux/err.h> | 21 | #include <linux/err.h> |
21 | #include <linux/init.h> | 22 | #include <linux/init.h> |
@@ -26,21 +27,11 @@ | |||
26 | 27 | ||
27 | #include <crypto/b128ops.h> | 28 | #include <crypto/b128ops.h> |
28 | #include <crypto/gf128mul.h> | 29 | #include <crypto/gf128mul.h> |
30 | #include <crypto/lrw.h> | ||
29 | 31 | ||
30 | struct priv { | 32 | struct priv { |
31 | struct crypto_cipher *child; | 33 | struct crypto_cipher *child; |
32 | /* optimizes multiplying a random (non incrementing, as at the | 34 | struct lrw_table_ctx table; |
33 | * start of a new sector) value with key2, we could also have | ||
34 | * used 4k optimization tables or no optimization at all. In the | ||
35 | * latter case we would have to store key2 here */ | ||
36 | struct gf128mul_64k *table; | ||
37 | /* stores: | ||
38 | * key2*{ 0,0,...0,0,0,0,1 }, key2*{ 0,0,...0,0,0,1,1 }, | ||
39 | * key2*{ 0,0,...0,0,1,1,1 }, key2*{ 0,0,...0,1,1,1,1 } | ||
40 | * key2*{ 0,0,...1,1,1,1,1 }, etc | ||
41 | * needed for optimized multiplication of incrementing values | ||
42 | * with key2 */ | ||
43 | be128 mulinc[128]; | ||
44 | }; | 35 | }; |
45 | 36 | ||
46 | static inline void setbit128_bbe(void *b, int bit) | 37 | static inline void setbit128_bbe(void *b, int bit) |
@@ -54,28 +45,16 @@ static inline void setbit128_bbe(void *b, int bit) | |||
54 | ), b); | 45 | ), b); |
55 | } | 46 | } |
56 | 47 | ||
57 | static int setkey(struct crypto_tfm *parent, const u8 *key, | 48 | int lrw_init_table(struct lrw_table_ctx *ctx, const u8 *tweak) |
58 | unsigned int keylen) | ||
59 | { | 49 | { |
60 | struct priv *ctx = crypto_tfm_ctx(parent); | ||
61 | struct crypto_cipher *child = ctx->child; | ||
62 | int err, i; | ||
63 | be128 tmp = { 0 }; | 50 | be128 tmp = { 0 }; |
64 | int bsize = crypto_cipher_blocksize(child); | 51 | int i; |
65 | |||
66 | crypto_cipher_clear_flags(child, CRYPTO_TFM_REQ_MASK); | ||
67 | crypto_cipher_set_flags(child, crypto_tfm_get_flags(parent) & | ||
68 | CRYPTO_TFM_REQ_MASK); | ||
69 | if ((err = crypto_cipher_setkey(child, key, keylen - bsize))) | ||
70 | return err; | ||
71 | crypto_tfm_set_flags(parent, crypto_cipher_get_flags(child) & | ||
72 | CRYPTO_TFM_RES_MASK); | ||
73 | 52 | ||
74 | if (ctx->table) | 53 | if (ctx->table) |
75 | gf128mul_free_64k(ctx->table); | 54 | gf128mul_free_64k(ctx->table); |
76 | 55 | ||
77 | /* initialize multiplication table for Key2 */ | 56 | /* initialize multiplication table for Key2 */ |
78 | ctx->table = gf128mul_init_64k_bbe((be128 *)(key + keylen - bsize)); | 57 | ctx->table = gf128mul_init_64k_bbe((be128 *)tweak); |
79 | if (!ctx->table) | 58 | if (!ctx->table) |
80 | return -ENOMEM; | 59 | return -ENOMEM; |
81 | 60 | ||
@@ -88,6 +67,34 @@ static int setkey(struct crypto_tfm *parent, const u8 *key, | |||
88 | 67 | ||
89 | return 0; | 68 | return 0; |
90 | } | 69 | } |
70 | EXPORT_SYMBOL_GPL(lrw_init_table); | ||
71 | |||
72 | void lrw_free_table(struct lrw_table_ctx *ctx) | ||
73 | { | ||
74 | if (ctx->table) | ||
75 | gf128mul_free_64k(ctx->table); | ||
76 | } | ||
77 | EXPORT_SYMBOL_GPL(lrw_free_table); | ||
78 | |||
79 | static int setkey(struct crypto_tfm *parent, const u8 *key, | ||
80 | unsigned int keylen) | ||
81 | { | ||
82 | struct priv *ctx = crypto_tfm_ctx(parent); | ||
83 | struct crypto_cipher *child = ctx->child; | ||
84 | int err, bsize = LRW_BLOCK_SIZE; | ||
85 | const u8 *tweak = key + keylen - bsize; | ||
86 | |||
87 | crypto_cipher_clear_flags(child, CRYPTO_TFM_REQ_MASK); | ||
88 | crypto_cipher_set_flags(child, crypto_tfm_get_flags(parent) & | ||
89 | CRYPTO_TFM_REQ_MASK); | ||
90 | err = crypto_cipher_setkey(child, key, keylen - bsize); | ||
91 | if (err) | ||
92 | return err; | ||
93 | crypto_tfm_set_flags(parent, crypto_cipher_get_flags(child) & | ||
94 | CRYPTO_TFM_RES_MASK); | ||
95 | |||
96 | return lrw_init_table(&ctx->table, tweak); | ||
97 | } | ||
91 | 98 | ||
92 | struct sinfo { | 99 | struct sinfo { |
93 | be128 t; | 100 | be128 t; |
@@ -134,7 +141,7 @@ static int crypt(struct blkcipher_desc *d, | |||
134 | { | 141 | { |
135 | int err; | 142 | int err; |
136 | unsigned int avail; | 143 | unsigned int avail; |
137 | const int bs = crypto_cipher_blocksize(ctx->child); | 144 | const int bs = LRW_BLOCK_SIZE; |
138 | struct sinfo s = { | 145 | struct sinfo s = { |
139 | .tfm = crypto_cipher_tfm(ctx->child), | 146 | .tfm = crypto_cipher_tfm(ctx->child), |
140 | .fn = fn | 147 | .fn = fn |
@@ -155,7 +162,7 @@ static int crypt(struct blkcipher_desc *d, | |||
155 | s.t = *iv; | 162 | s.t = *iv; |
156 | 163 | ||
157 | /* T <- I*Key2 */ | 164 | /* T <- I*Key2 */ |
158 | gf128mul_64k_bbe(&s.t, ctx->table); | 165 | gf128mul_64k_bbe(&s.t, ctx->table.table); |
159 | 166 | ||
160 | goto first; | 167 | goto first; |
161 | 168 | ||
@@ -163,7 +170,8 @@ static int crypt(struct blkcipher_desc *d, | |||
163 | do { | 170 | do { |
164 | /* T <- I*Key2, using the optimization | 171 | /* T <- I*Key2, using the optimization |
165 | * discussed in the specification */ | 172 | * discussed in the specification */ |
166 | be128_xor(&s.t, &s.t, &ctx->mulinc[get_index128(iv)]); | 173 | be128_xor(&s.t, &s.t, |
174 | &ctx->table.mulinc[get_index128(iv)]); | ||
167 | inc(iv); | 175 | inc(iv); |
168 | 176 | ||
169 | first: | 177 | first: |
@@ -206,6 +214,85 @@ static int decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | |||
206 | crypto_cipher_alg(ctx->child)->cia_decrypt); | 214 | crypto_cipher_alg(ctx->child)->cia_decrypt); |
207 | } | 215 | } |
208 | 216 | ||
217 | int lrw_crypt(struct blkcipher_desc *desc, struct scatterlist *sdst, | ||
218 | struct scatterlist *ssrc, unsigned int nbytes, | ||
219 | struct lrw_crypt_req *req) | ||
220 | { | ||
221 | const unsigned int bsize = LRW_BLOCK_SIZE; | ||
222 | const unsigned int max_blks = req->tbuflen / bsize; | ||
223 | struct lrw_table_ctx *ctx = req->table_ctx; | ||
224 | struct blkcipher_walk walk; | ||
225 | unsigned int nblocks; | ||
226 | be128 *iv, *src, *dst, *t; | ||
227 | be128 *t_buf = req->tbuf; | ||
228 | int err, i; | ||
229 | |||
230 | BUG_ON(max_blks < 1); | ||
231 | |||
232 | blkcipher_walk_init(&walk, sdst, ssrc, nbytes); | ||
233 | |||
234 | err = blkcipher_walk_virt(desc, &walk); | ||
235 | nbytes = walk.nbytes; | ||
236 | if (!nbytes) | ||
237 | return err; | ||
238 | |||
239 | nblocks = min(walk.nbytes / bsize, max_blks); | ||
240 | src = (be128 *)walk.src.virt.addr; | ||
241 | dst = (be128 *)walk.dst.virt.addr; | ||
242 | |||
243 | /* calculate first value of T */ | ||
244 | iv = (be128 *)walk.iv; | ||
245 | t_buf[0] = *iv; | ||
246 | |||
247 | /* T <- I*Key2 */ | ||
248 | gf128mul_64k_bbe(&t_buf[0], ctx->table); | ||
249 | |||
250 | i = 0; | ||
251 | goto first; | ||
252 | |||
253 | for (;;) { | ||
254 | do { | ||
255 | for (i = 0; i < nblocks; i++) { | ||
256 | /* T <- I*Key2, using the optimization | ||
257 | * discussed in the specification */ | ||
258 | be128_xor(&t_buf[i], t, | ||
259 | &ctx->mulinc[get_index128(iv)]); | ||
260 | inc(iv); | ||
261 | first: | ||
262 | t = &t_buf[i]; | ||
263 | |||
264 | /* PP <- T xor P */ | ||
265 | be128_xor(dst + i, t, src + i); | ||
266 | } | ||
267 | |||
268 | /* CC <- E(Key2,PP) */ | ||
269 | req->crypt_fn(req->crypt_ctx, (u8 *)dst, | ||
270 | nblocks * bsize); | ||
271 | |||
272 | /* C <- T xor CC */ | ||
273 | for (i = 0; i < nblocks; i++) | ||
274 | be128_xor(dst + i, dst + i, &t_buf[i]); | ||
275 | |||
276 | src += nblocks; | ||
277 | dst += nblocks; | ||
278 | nbytes -= nblocks * bsize; | ||
279 | nblocks = min(nbytes / bsize, max_blks); | ||
280 | } while (nblocks > 0); | ||
281 | |||
282 | err = blkcipher_walk_done(desc, &walk, nbytes); | ||
283 | nbytes = walk.nbytes; | ||
284 | if (!nbytes) | ||
285 | break; | ||
286 | |||
287 | nblocks = min(nbytes / bsize, max_blks); | ||
288 | src = (be128 *)walk.src.virt.addr; | ||
289 | dst = (be128 *)walk.dst.virt.addr; | ||
290 | } | ||
291 | |||
292 | return err; | ||
293 | } | ||
294 | EXPORT_SYMBOL_GPL(lrw_crypt); | ||
295 | |||
209 | static int init_tfm(struct crypto_tfm *tfm) | 296 | static int init_tfm(struct crypto_tfm *tfm) |
210 | { | 297 | { |
211 | struct crypto_cipher *cipher; | 298 | struct crypto_cipher *cipher; |
@@ -218,8 +305,9 @@ static int init_tfm(struct crypto_tfm *tfm) | |||
218 | if (IS_ERR(cipher)) | 305 | if (IS_ERR(cipher)) |
219 | return PTR_ERR(cipher); | 306 | return PTR_ERR(cipher); |
220 | 307 | ||
221 | if (crypto_cipher_blocksize(cipher) != 16) { | 308 | if (crypto_cipher_blocksize(cipher) != LRW_BLOCK_SIZE) { |
222 | *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; | 309 | *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; |
310 | crypto_free_cipher(cipher); | ||
223 | return -EINVAL; | 311 | return -EINVAL; |
224 | } | 312 | } |
225 | 313 | ||
@@ -230,8 +318,8 @@ static int init_tfm(struct crypto_tfm *tfm) | |||
230 | static void exit_tfm(struct crypto_tfm *tfm) | 318 | static void exit_tfm(struct crypto_tfm *tfm) |
231 | { | 319 | { |
232 | struct priv *ctx = crypto_tfm_ctx(tfm); | 320 | struct priv *ctx = crypto_tfm_ctx(tfm); |
233 | if (ctx->table) | 321 | |
234 | gf128mul_free_64k(ctx->table); | 322 | lrw_free_table(&ctx->table); |
235 | crypto_free_cipher(ctx->child); | 323 | crypto_free_cipher(ctx->child); |
236 | } | 324 | } |
237 | 325 | ||
diff --git a/crypto/serpent.c b/crypto/serpent.c deleted file mode 100644 index b651a55fa569..000000000000 --- a/crypto/serpent.c +++ /dev/null | |||
@@ -1,587 +0,0 @@ | |||
1 | /* | ||
2 | * Cryptographic API. | ||
3 | * | ||
4 | * Serpent Cipher Algorithm. | ||
5 | * | ||
6 | * Copyright (C) 2002 Dag Arne Osvik <osvik@ii.uib.no> | ||
7 | * 2003 Herbert Valerio Riedel <hvr@gnu.org> | ||
8 | * | ||
9 | * Added tnepres support: Ruben Jesus Garcia Hernandez <ruben@ugr.es>, 18.10.2004 | ||
10 | * Based on code by hvr | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License as published by | ||
14 | * the Free Software Foundation; either version 2 of the License, or | ||
15 | * (at your option) any later version. | ||
16 | */ | ||
17 | |||
18 | #include <linux/init.h> | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/errno.h> | ||
21 | #include <asm/byteorder.h> | ||
22 | #include <linux/crypto.h> | ||
23 | #include <linux/types.h> | ||
24 | |||
25 | /* Key is padded to the maximum of 256 bits before round key generation. | ||
26 | * Any key length <= 256 bits (32 bytes) is allowed by the algorithm. | ||
27 | */ | ||
28 | |||
29 | #define SERPENT_MIN_KEY_SIZE 0 | ||
30 | #define SERPENT_MAX_KEY_SIZE 32 | ||
31 | #define SERPENT_EXPKEY_WORDS 132 | ||
32 | #define SERPENT_BLOCK_SIZE 16 | ||
33 | |||
34 | #define PHI 0x9e3779b9UL | ||
35 | |||
36 | #define keyiter(a,b,c,d,i,j) \ | ||
37 | b ^= d; b ^= c; b ^= a; b ^= PHI ^ i; b = rol32(b,11); k[j] = b; | ||
38 | |||
39 | #define loadkeys(x0,x1,x2,x3,i) \ | ||
40 | x0=k[i]; x1=k[i+1]; x2=k[i+2]; x3=k[i+3]; | ||
41 | |||
42 | #define storekeys(x0,x1,x2,x3,i) \ | ||
43 | k[i]=x0; k[i+1]=x1; k[i+2]=x2; k[i+3]=x3; | ||
44 | |||
45 | #define K(x0,x1,x2,x3,i) \ | ||
46 | x3 ^= k[4*(i)+3]; x2 ^= k[4*(i)+2]; \ | ||
47 | x1 ^= k[4*(i)+1]; x0 ^= k[4*(i)+0]; | ||
48 | |||
49 | #define LK(x0,x1,x2,x3,x4,i) \ | ||
50 | x0=rol32(x0,13);\ | ||
51 | x2=rol32(x2,3); x1 ^= x0; x4 = x0 << 3; \ | ||
52 | x3 ^= x2; x1 ^= x2; \ | ||
53 | x1=rol32(x1,1); x3 ^= x4; \ | ||
54 | x3=rol32(x3,7); x4 = x1; \ | ||
55 | x0 ^= x1; x4 <<= 7; x2 ^= x3; \ | ||
56 | x0 ^= x3; x2 ^= x4; x3 ^= k[4*i+3]; \ | ||
57 | x1 ^= k[4*i+1]; x0=rol32(x0,5); x2=rol32(x2,22);\ | ||
58 | x0 ^= k[4*i+0]; x2 ^= k[4*i+2]; | ||
59 | |||
60 | #define KL(x0,x1,x2,x3,x4,i) \ | ||
61 | x0 ^= k[4*i+0]; x1 ^= k[4*i+1]; x2 ^= k[4*i+2]; \ | ||
62 | x3 ^= k[4*i+3]; x0=ror32(x0,5); x2=ror32(x2,22);\ | ||
63 | x4 = x1; x2 ^= x3; x0 ^= x3; \ | ||
64 | x4 <<= 7; x0 ^= x1; x1=ror32(x1,1); \ | ||
65 | x2 ^= x4; x3=ror32(x3,7); x4 = x0 << 3; \ | ||
66 | x1 ^= x0; x3 ^= x4; x0=ror32(x0,13);\ | ||
67 | x1 ^= x2; x3 ^= x2; x2=ror32(x2,3); | ||
68 | |||
69 | #define S0(x0,x1,x2,x3,x4) \ | ||
70 | x4 = x3; \ | ||
71 | x3 |= x0; x0 ^= x4; x4 ^= x2; \ | ||
72 | x4 =~ x4; x3 ^= x1; x1 &= x0; \ | ||
73 | x1 ^= x4; x2 ^= x0; x0 ^= x3; \ | ||
74 | x4 |= x0; x0 ^= x2; x2 &= x1; \ | ||
75 | x3 ^= x2; x1 =~ x1; x2 ^= x4; \ | ||
76 | x1 ^= x2; | ||
77 | |||
78 | #define S1(x0,x1,x2,x3,x4) \ | ||
79 | x4 = x1; \ | ||
80 | x1 ^= x0; x0 ^= x3; x3 =~ x3; \ | ||
81 | x4 &= x1; x0 |= x1; x3 ^= x2; \ | ||
82 | x0 ^= x3; x1 ^= x3; x3 ^= x4; \ | ||
83 | x1 |= x4; x4 ^= x2; x2 &= x0; \ | ||
84 | x2 ^= x1; x1 |= x0; x0 =~ x0; \ | ||
85 | x0 ^= x2; x4 ^= x1; | ||
86 | |||
87 | #define S2(x0,x1,x2,x3,x4) \ | ||
88 | x3 =~ x3; \ | ||
89 | x1 ^= x0; x4 = x0; x0 &= x2; \ | ||
90 | x0 ^= x3; x3 |= x4; x2 ^= x1; \ | ||
91 | x3 ^= x1; x1 &= x0; x0 ^= x2; \ | ||
92 | x2 &= x3; x3 |= x1; x0 =~ x0; \ | ||
93 | x3 ^= x0; x4 ^= x0; x0 ^= x2; \ | ||
94 | x1 |= x2; | ||
95 | |||
96 | #define S3(x0,x1,x2,x3,x4) \ | ||
97 | x4 = x1; \ | ||
98 | x1 ^= x3; x3 |= x0; x4 &= x0; \ | ||
99 | x0 ^= x2; x2 ^= x1; x1 &= x3; \ | ||
100 | x2 ^= x3; x0 |= x4; x4 ^= x3; \ | ||
101 | x1 ^= x0; x0 &= x3; x3 &= x4; \ | ||
102 | x3 ^= x2; x4 |= x1; x2 &= x1; \ | ||
103 | x4 ^= x3; x0 ^= x3; x3 ^= x2; | ||
104 | |||
105 | #define S4(x0,x1,x2,x3,x4) \ | ||
106 | x4 = x3; \ | ||
107 | x3 &= x0; x0 ^= x4; \ | ||
108 | x3 ^= x2; x2 |= x4; x0 ^= x1; \ | ||
109 | x4 ^= x3; x2 |= x0; \ | ||
110 | x2 ^= x1; x1 &= x0; \ | ||
111 | x1 ^= x4; x4 &= x2; x2 ^= x3; \ | ||
112 | x4 ^= x0; x3 |= x1; x1 =~ x1; \ | ||
113 | x3 ^= x0; | ||
114 | |||
115 | #define S5(x0,x1,x2,x3,x4) \ | ||
116 | x4 = x1; x1 |= x0; \ | ||
117 | x2 ^= x1; x3 =~ x3; x4 ^= x0; \ | ||
118 | x0 ^= x2; x1 &= x4; x4 |= x3; \ | ||
119 | x4 ^= x0; x0 &= x3; x1 ^= x3; \ | ||
120 | x3 ^= x2; x0 ^= x1; x2 &= x4; \ | ||
121 | x1 ^= x2; x2 &= x0; \ | ||
122 | x3 ^= x2; | ||
123 | |||
124 | #define S6(x0,x1,x2,x3,x4) \ | ||
125 | x4 = x1; \ | ||
126 | x3 ^= x0; x1 ^= x2; x2 ^= x0; \ | ||
127 | x0 &= x3; x1 |= x3; x4 =~ x4; \ | ||
128 | x0 ^= x1; x1 ^= x2; \ | ||
129 | x3 ^= x4; x4 ^= x0; x2 &= x0; \ | ||
130 | x4 ^= x1; x2 ^= x3; x3 &= x1; \ | ||
131 | x3 ^= x0; x1 ^= x2; | ||
132 | |||
133 | #define S7(x0,x1,x2,x3,x4) \ | ||
134 | x1 =~ x1; \ | ||
135 | x4 = x1; x0 =~ x0; x1 &= x2; \ | ||
136 | x1 ^= x3; x3 |= x4; x4 ^= x2; \ | ||
137 | x2 ^= x3; x3 ^= x0; x0 |= x1; \ | ||
138 | x2 &= x0; x0 ^= x4; x4 ^= x3; \ | ||
139 | x3 &= x0; x4 ^= x1; \ | ||
140 | x2 ^= x4; x3 ^= x1; x4 |= x0; \ | ||
141 | x4 ^= x1; | ||
142 | |||
143 | #define SI0(x0,x1,x2,x3,x4) \ | ||
144 | x4 = x3; x1 ^= x0; \ | ||
145 | x3 |= x1; x4 ^= x1; x0 =~ x0; \ | ||
146 | x2 ^= x3; x3 ^= x0; x0 &= x1; \ | ||
147 | x0 ^= x2; x2 &= x3; x3 ^= x4; \ | ||
148 | x2 ^= x3; x1 ^= x3; x3 &= x0; \ | ||
149 | x1 ^= x0; x0 ^= x2; x4 ^= x3; | ||
150 | |||
151 | #define SI1(x0,x1,x2,x3,x4) \ | ||
152 | x1 ^= x3; x4 = x0; \ | ||
153 | x0 ^= x2; x2 =~ x2; x4 |= x1; \ | ||
154 | x4 ^= x3; x3 &= x1; x1 ^= x2; \ | ||
155 | x2 &= x4; x4 ^= x1; x1 |= x3; \ | ||
156 | x3 ^= x0; x2 ^= x0; x0 |= x4; \ | ||
157 | x2 ^= x4; x1 ^= x0; \ | ||
158 | x4 ^= x1; | ||
159 | |||
160 | #define SI2(x0,x1,x2,x3,x4) \ | ||
161 | x2 ^= x1; x4 = x3; x3 =~ x3; \ | ||
162 | x3 |= x2; x2 ^= x4; x4 ^= x0; \ | ||
163 | x3 ^= x1; x1 |= x2; x2 ^= x0; \ | ||
164 | x1 ^= x4; x4 |= x3; x2 ^= x3; \ | ||
165 | x4 ^= x2; x2 &= x1; \ | ||
166 | x2 ^= x3; x3 ^= x4; x4 ^= x0; | ||
167 | |||
168 | #define SI3(x0,x1,x2,x3,x4) \ | ||
169 | x2 ^= x1; \ | ||
170 | x4 = x1; x1 &= x2; \ | ||
171 | x1 ^= x0; x0 |= x4; x4 ^= x3; \ | ||
172 | x0 ^= x3; x3 |= x1; x1 ^= x2; \ | ||
173 | x1 ^= x3; x0 ^= x2; x2 ^= x3; \ | ||
174 | x3 &= x1; x1 ^= x0; x0 &= x2; \ | ||
175 | x4 ^= x3; x3 ^= x0; x0 ^= x1; | ||
176 | |||
177 | #define SI4(x0,x1,x2,x3,x4) \ | ||
178 | x2 ^= x3; x4 = x0; x0 &= x1; \ | ||
179 | x0 ^= x2; x2 |= x3; x4 =~ x4; \ | ||
180 | x1 ^= x0; x0 ^= x2; x2 &= x4; \ | ||
181 | x2 ^= x0; x0 |= x4; \ | ||
182 | x0 ^= x3; x3 &= x2; \ | ||
183 | x4 ^= x3; x3 ^= x1; x1 &= x0; \ | ||
184 | x4 ^= x1; x0 ^= x3; | ||
185 | |||
186 | #define SI5(x0,x1,x2,x3,x4) \ | ||
187 | x4 = x1; x1 |= x2; \ | ||
188 | x2 ^= x4; x1 ^= x3; x3 &= x4; \ | ||
189 | x2 ^= x3; x3 |= x0; x0 =~ x0; \ | ||
190 | x3 ^= x2; x2 |= x0; x4 ^= x1; \ | ||
191 | x2 ^= x4; x4 &= x0; x0 ^= x1; \ | ||
192 | x1 ^= x3; x0 &= x2; x2 ^= x3; \ | ||
193 | x0 ^= x2; x2 ^= x4; x4 ^= x3; | ||
194 | |||
195 | #define SI6(x0,x1,x2,x3,x4) \ | ||
196 | x0 ^= x2; \ | ||
197 | x4 = x0; x0 &= x3; x2 ^= x3; \ | ||
198 | x0 ^= x2; x3 ^= x1; x2 |= x4; \ | ||
199 | x2 ^= x3; x3 &= x0; x0 =~ x0; \ | ||
200 | x3 ^= x1; x1 &= x2; x4 ^= x0; \ | ||
201 | x3 ^= x4; x4 ^= x2; x0 ^= x1; \ | ||
202 | x2 ^= x0; | ||
203 | |||
204 | #define SI7(x0,x1,x2,x3,x4) \ | ||
205 | x4 = x3; x3 &= x0; x0 ^= x2; \ | ||
206 | x2 |= x4; x4 ^= x1; x0 =~ x0; \ | ||
207 | x1 |= x3; x4 ^= x0; x0 &= x2; \ | ||
208 | x0 ^= x1; x1 &= x2; x3 ^= x2; \ | ||
209 | x4 ^= x3; x2 &= x3; x3 |= x0; \ | ||
210 | x1 ^= x4; x3 ^= x4; x4 &= x0; \ | ||
211 | x4 ^= x2; | ||
212 | |||
213 | struct serpent_ctx { | ||
214 | u32 expkey[SERPENT_EXPKEY_WORDS]; | ||
215 | }; | ||
216 | |||
217 | |||
218 | static int serpent_setkey(struct crypto_tfm *tfm, const u8 *key, | ||
219 | unsigned int keylen) | ||
220 | { | ||
221 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); | ||
222 | u32 *k = ctx->expkey; | ||
223 | u8 *k8 = (u8 *)k; | ||
224 | u32 r0,r1,r2,r3,r4; | ||
225 | int i; | ||
226 | |||
227 | /* Copy key, add padding */ | ||
228 | |||
229 | for (i = 0; i < keylen; ++i) | ||
230 | k8[i] = key[i]; | ||
231 | if (i < SERPENT_MAX_KEY_SIZE) | ||
232 | k8[i++] = 1; | ||
233 | while (i < SERPENT_MAX_KEY_SIZE) | ||
234 | k8[i++] = 0; | ||
235 | |||
236 | /* Expand key using polynomial */ | ||
237 | |||
238 | r0 = le32_to_cpu(k[3]); | ||
239 | r1 = le32_to_cpu(k[4]); | ||
240 | r2 = le32_to_cpu(k[5]); | ||
241 | r3 = le32_to_cpu(k[6]); | ||
242 | r4 = le32_to_cpu(k[7]); | ||
243 | |||
244 | keyiter(le32_to_cpu(k[0]),r0,r4,r2,0,0); | ||
245 | keyiter(le32_to_cpu(k[1]),r1,r0,r3,1,1); | ||
246 | keyiter(le32_to_cpu(k[2]),r2,r1,r4,2,2); | ||
247 | keyiter(le32_to_cpu(k[3]),r3,r2,r0,3,3); | ||
248 | keyiter(le32_to_cpu(k[4]),r4,r3,r1,4,4); | ||
249 | keyiter(le32_to_cpu(k[5]),r0,r4,r2,5,5); | ||
250 | keyiter(le32_to_cpu(k[6]),r1,r0,r3,6,6); | ||
251 | keyiter(le32_to_cpu(k[7]),r2,r1,r4,7,7); | ||
252 | |||
253 | keyiter(k[ 0],r3,r2,r0, 8, 8); keyiter(k[ 1],r4,r3,r1, 9, 9); | ||
254 | keyiter(k[ 2],r0,r4,r2, 10, 10); keyiter(k[ 3],r1,r0,r3, 11, 11); | ||
255 | keyiter(k[ 4],r2,r1,r4, 12, 12); keyiter(k[ 5],r3,r2,r0, 13, 13); | ||
256 | keyiter(k[ 6],r4,r3,r1, 14, 14); keyiter(k[ 7],r0,r4,r2, 15, 15); | ||
257 | keyiter(k[ 8],r1,r0,r3, 16, 16); keyiter(k[ 9],r2,r1,r4, 17, 17); | ||
258 | keyiter(k[ 10],r3,r2,r0, 18, 18); keyiter(k[ 11],r4,r3,r1, 19, 19); | ||
259 | keyiter(k[ 12],r0,r4,r2, 20, 20); keyiter(k[ 13],r1,r0,r3, 21, 21); | ||
260 | keyiter(k[ 14],r2,r1,r4, 22, 22); keyiter(k[ 15],r3,r2,r0, 23, 23); | ||
261 | keyiter(k[ 16],r4,r3,r1, 24, 24); keyiter(k[ 17],r0,r4,r2, 25, 25); | ||
262 | keyiter(k[ 18],r1,r0,r3, 26, 26); keyiter(k[ 19],r2,r1,r4, 27, 27); | ||
263 | keyiter(k[ 20],r3,r2,r0, 28, 28); keyiter(k[ 21],r4,r3,r1, 29, 29); | ||
264 | keyiter(k[ 22],r0,r4,r2, 30, 30); keyiter(k[ 23],r1,r0,r3, 31, 31); | ||
265 | |||
266 | k += 50; | ||
267 | |||
268 | keyiter(k[-26],r2,r1,r4, 32,-18); keyiter(k[-25],r3,r2,r0, 33,-17); | ||
269 | keyiter(k[-24],r4,r3,r1, 34,-16); keyiter(k[-23],r0,r4,r2, 35,-15); | ||
270 | keyiter(k[-22],r1,r0,r3, 36,-14); keyiter(k[-21],r2,r1,r4, 37,-13); | ||
271 | keyiter(k[-20],r3,r2,r0, 38,-12); keyiter(k[-19],r4,r3,r1, 39,-11); | ||
272 | keyiter(k[-18],r0,r4,r2, 40,-10); keyiter(k[-17],r1,r0,r3, 41, -9); | ||
273 | keyiter(k[-16],r2,r1,r4, 42, -8); keyiter(k[-15],r3,r2,r0, 43, -7); | ||
274 | keyiter(k[-14],r4,r3,r1, 44, -6); keyiter(k[-13],r0,r4,r2, 45, -5); | ||
275 | keyiter(k[-12],r1,r0,r3, 46, -4); keyiter(k[-11],r2,r1,r4, 47, -3); | ||
276 | keyiter(k[-10],r3,r2,r0, 48, -2); keyiter(k[ -9],r4,r3,r1, 49, -1); | ||
277 | keyiter(k[ -8],r0,r4,r2, 50, 0); keyiter(k[ -7],r1,r0,r3, 51, 1); | ||
278 | keyiter(k[ -6],r2,r1,r4, 52, 2); keyiter(k[ -5],r3,r2,r0, 53, 3); | ||
279 | keyiter(k[ -4],r4,r3,r1, 54, 4); keyiter(k[ -3],r0,r4,r2, 55, 5); | ||
280 | keyiter(k[ -2],r1,r0,r3, 56, 6); keyiter(k[ -1],r2,r1,r4, 57, 7); | ||
281 | keyiter(k[ 0],r3,r2,r0, 58, 8); keyiter(k[ 1],r4,r3,r1, 59, 9); | ||
282 | keyiter(k[ 2],r0,r4,r2, 60, 10); keyiter(k[ 3],r1,r0,r3, 61, 11); | ||
283 | keyiter(k[ 4],r2,r1,r4, 62, 12); keyiter(k[ 5],r3,r2,r0, 63, 13); | ||
284 | keyiter(k[ 6],r4,r3,r1, 64, 14); keyiter(k[ 7],r0,r4,r2, 65, 15); | ||
285 | keyiter(k[ 8],r1,r0,r3, 66, 16); keyiter(k[ 9],r2,r1,r4, 67, 17); | ||
286 | keyiter(k[ 10],r3,r2,r0, 68, 18); keyiter(k[ 11],r4,r3,r1, 69, 19); | ||
287 | keyiter(k[ 12],r0,r4,r2, 70, 20); keyiter(k[ 13],r1,r0,r3, 71, 21); | ||
288 | keyiter(k[ 14],r2,r1,r4, 72, 22); keyiter(k[ 15],r3,r2,r0, 73, 23); | ||
289 | keyiter(k[ 16],r4,r3,r1, 74, 24); keyiter(k[ 17],r0,r4,r2, 75, 25); | ||
290 | keyiter(k[ 18],r1,r0,r3, 76, 26); keyiter(k[ 19],r2,r1,r4, 77, 27); | ||
291 | keyiter(k[ 20],r3,r2,r0, 78, 28); keyiter(k[ 21],r4,r3,r1, 79, 29); | ||
292 | keyiter(k[ 22],r0,r4,r2, 80, 30); keyiter(k[ 23],r1,r0,r3, 81, 31); | ||
293 | |||
294 | k += 50; | ||
295 | |||
296 | keyiter(k[-26],r2,r1,r4, 82,-18); keyiter(k[-25],r3,r2,r0, 83,-17); | ||
297 | keyiter(k[-24],r4,r3,r1, 84,-16); keyiter(k[-23],r0,r4,r2, 85,-15); | ||
298 | keyiter(k[-22],r1,r0,r3, 86,-14); keyiter(k[-21],r2,r1,r4, 87,-13); | ||
299 | keyiter(k[-20],r3,r2,r0, 88,-12); keyiter(k[-19],r4,r3,r1, 89,-11); | ||
300 | keyiter(k[-18],r0,r4,r2, 90,-10); keyiter(k[-17],r1,r0,r3, 91, -9); | ||
301 | keyiter(k[-16],r2,r1,r4, 92, -8); keyiter(k[-15],r3,r2,r0, 93, -7); | ||
302 | keyiter(k[-14],r4,r3,r1, 94, -6); keyiter(k[-13],r0,r4,r2, 95, -5); | ||
303 | keyiter(k[-12],r1,r0,r3, 96, -4); keyiter(k[-11],r2,r1,r4, 97, -3); | ||
304 | keyiter(k[-10],r3,r2,r0, 98, -2); keyiter(k[ -9],r4,r3,r1, 99, -1); | ||
305 | keyiter(k[ -8],r0,r4,r2,100, 0); keyiter(k[ -7],r1,r0,r3,101, 1); | ||
306 | keyiter(k[ -6],r2,r1,r4,102, 2); keyiter(k[ -5],r3,r2,r0,103, 3); | ||
307 | keyiter(k[ -4],r4,r3,r1,104, 4); keyiter(k[ -3],r0,r4,r2,105, 5); | ||
308 | keyiter(k[ -2],r1,r0,r3,106, 6); keyiter(k[ -1],r2,r1,r4,107, 7); | ||
309 | keyiter(k[ 0],r3,r2,r0,108, 8); keyiter(k[ 1],r4,r3,r1,109, 9); | ||
310 | keyiter(k[ 2],r0,r4,r2,110, 10); keyiter(k[ 3],r1,r0,r3,111, 11); | ||
311 | keyiter(k[ 4],r2,r1,r4,112, 12); keyiter(k[ 5],r3,r2,r0,113, 13); | ||
312 | keyiter(k[ 6],r4,r3,r1,114, 14); keyiter(k[ 7],r0,r4,r2,115, 15); | ||
313 | keyiter(k[ 8],r1,r0,r3,116, 16); keyiter(k[ 9],r2,r1,r4,117, 17); | ||
314 | keyiter(k[ 10],r3,r2,r0,118, 18); keyiter(k[ 11],r4,r3,r1,119, 19); | ||
315 | keyiter(k[ 12],r0,r4,r2,120, 20); keyiter(k[ 13],r1,r0,r3,121, 21); | ||
316 | keyiter(k[ 14],r2,r1,r4,122, 22); keyiter(k[ 15],r3,r2,r0,123, 23); | ||
317 | keyiter(k[ 16],r4,r3,r1,124, 24); keyiter(k[ 17],r0,r4,r2,125, 25); | ||
318 | keyiter(k[ 18],r1,r0,r3,126, 26); keyiter(k[ 19],r2,r1,r4,127, 27); | ||
319 | keyiter(k[ 20],r3,r2,r0,128, 28); keyiter(k[ 21],r4,r3,r1,129, 29); | ||
320 | keyiter(k[ 22],r0,r4,r2,130, 30); keyiter(k[ 23],r1,r0,r3,131, 31); | ||
321 | |||
322 | /* Apply S-boxes */ | ||
323 | |||
324 | S3(r3,r4,r0,r1,r2); storekeys(r1,r2,r4,r3, 28); loadkeys(r1,r2,r4,r3, 24); | ||
325 | S4(r1,r2,r4,r3,r0); storekeys(r2,r4,r3,r0, 24); loadkeys(r2,r4,r3,r0, 20); | ||
326 | S5(r2,r4,r3,r0,r1); storekeys(r1,r2,r4,r0, 20); loadkeys(r1,r2,r4,r0, 16); | ||
327 | S6(r1,r2,r4,r0,r3); storekeys(r4,r3,r2,r0, 16); loadkeys(r4,r3,r2,r0, 12); | ||
328 | S7(r4,r3,r2,r0,r1); storekeys(r1,r2,r0,r4, 12); loadkeys(r1,r2,r0,r4, 8); | ||
329 | S0(r1,r2,r0,r4,r3); storekeys(r0,r2,r4,r1, 8); loadkeys(r0,r2,r4,r1, 4); | ||
330 | S1(r0,r2,r4,r1,r3); storekeys(r3,r4,r1,r0, 4); loadkeys(r3,r4,r1,r0, 0); | ||
331 | S2(r3,r4,r1,r0,r2); storekeys(r2,r4,r3,r0, 0); loadkeys(r2,r4,r3,r0, -4); | ||
332 | S3(r2,r4,r3,r0,r1); storekeys(r0,r1,r4,r2, -4); loadkeys(r0,r1,r4,r2, -8); | ||
333 | S4(r0,r1,r4,r2,r3); storekeys(r1,r4,r2,r3, -8); loadkeys(r1,r4,r2,r3,-12); | ||
334 | S5(r1,r4,r2,r3,r0); storekeys(r0,r1,r4,r3,-12); loadkeys(r0,r1,r4,r3,-16); | ||
335 | S6(r0,r1,r4,r3,r2); storekeys(r4,r2,r1,r3,-16); loadkeys(r4,r2,r1,r3,-20); | ||
336 | S7(r4,r2,r1,r3,r0); storekeys(r0,r1,r3,r4,-20); loadkeys(r0,r1,r3,r4,-24); | ||
337 | S0(r0,r1,r3,r4,r2); storekeys(r3,r1,r4,r0,-24); loadkeys(r3,r1,r4,r0,-28); | ||
338 | k -= 50; | ||
339 | S1(r3,r1,r4,r0,r2); storekeys(r2,r4,r0,r3, 22); loadkeys(r2,r4,r0,r3, 18); | ||
340 | S2(r2,r4,r0,r3,r1); storekeys(r1,r4,r2,r3, 18); loadkeys(r1,r4,r2,r3, 14); | ||
341 | S3(r1,r4,r2,r3,r0); storekeys(r3,r0,r4,r1, 14); loadkeys(r3,r0,r4,r1, 10); | ||
342 | S4(r3,r0,r4,r1,r2); storekeys(r0,r4,r1,r2, 10); loadkeys(r0,r4,r1,r2, 6); | ||
343 | S5(r0,r4,r1,r2,r3); storekeys(r3,r0,r4,r2, 6); loadkeys(r3,r0,r4,r2, 2); | ||
344 | S6(r3,r0,r4,r2,r1); storekeys(r4,r1,r0,r2, 2); loadkeys(r4,r1,r0,r2, -2); | ||
345 | S7(r4,r1,r0,r2,r3); storekeys(r3,r0,r2,r4, -2); loadkeys(r3,r0,r2,r4, -6); | ||
346 | S0(r3,r0,r2,r4,r1); storekeys(r2,r0,r4,r3, -6); loadkeys(r2,r0,r4,r3,-10); | ||
347 | S1(r2,r0,r4,r3,r1); storekeys(r1,r4,r3,r2,-10); loadkeys(r1,r4,r3,r2,-14); | ||
348 | S2(r1,r4,r3,r2,r0); storekeys(r0,r4,r1,r2,-14); loadkeys(r0,r4,r1,r2,-18); | ||
349 | S3(r0,r4,r1,r2,r3); storekeys(r2,r3,r4,r0,-18); loadkeys(r2,r3,r4,r0,-22); | ||
350 | k -= 50; | ||
351 | S4(r2,r3,r4,r0,r1); storekeys(r3,r4,r0,r1, 28); loadkeys(r3,r4,r0,r1, 24); | ||
352 | S5(r3,r4,r0,r1,r2); storekeys(r2,r3,r4,r1, 24); loadkeys(r2,r3,r4,r1, 20); | ||
353 | S6(r2,r3,r4,r1,r0); storekeys(r4,r0,r3,r1, 20); loadkeys(r4,r0,r3,r1, 16); | ||
354 | S7(r4,r0,r3,r1,r2); storekeys(r2,r3,r1,r4, 16); loadkeys(r2,r3,r1,r4, 12); | ||
355 | S0(r2,r3,r1,r4,r0); storekeys(r1,r3,r4,r2, 12); loadkeys(r1,r3,r4,r2, 8); | ||
356 | S1(r1,r3,r4,r2,r0); storekeys(r0,r4,r2,r1, 8); loadkeys(r0,r4,r2,r1, 4); | ||
357 | S2(r0,r4,r2,r1,r3); storekeys(r3,r4,r0,r1, 4); loadkeys(r3,r4,r0,r1, 0); | ||
358 | S3(r3,r4,r0,r1,r2); storekeys(r1,r2,r4,r3, 0); | ||
359 | |||
360 | return 0; | ||
361 | } | ||
362 | |||
363 | static void serpent_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
364 | { | ||
365 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); | ||
366 | const u32 | ||
367 | *k = ctx->expkey; | ||
368 | const __le32 *s = (const __le32 *)src; | ||
369 | __le32 *d = (__le32 *)dst; | ||
370 | u32 r0, r1, r2, r3, r4; | ||
371 | |||
372 | /* | ||
373 | * Note: The conversions between u8* and u32* might cause trouble | ||
374 | * on architectures with stricter alignment rules than x86 | ||
375 | */ | ||
376 | |||
377 | r0 = le32_to_cpu(s[0]); | ||
378 | r1 = le32_to_cpu(s[1]); | ||
379 | r2 = le32_to_cpu(s[2]); | ||
380 | r3 = le32_to_cpu(s[3]); | ||
381 | |||
382 | K(r0,r1,r2,r3,0); | ||
383 | S0(r0,r1,r2,r3,r4); LK(r2,r1,r3,r0,r4,1); | ||
384 | S1(r2,r1,r3,r0,r4); LK(r4,r3,r0,r2,r1,2); | ||
385 | S2(r4,r3,r0,r2,r1); LK(r1,r3,r4,r2,r0,3); | ||
386 | S3(r1,r3,r4,r2,r0); LK(r2,r0,r3,r1,r4,4); | ||
387 | S4(r2,r0,r3,r1,r4); LK(r0,r3,r1,r4,r2,5); | ||
388 | S5(r0,r3,r1,r4,r2); LK(r2,r0,r3,r4,r1,6); | ||
389 | S6(r2,r0,r3,r4,r1); LK(r3,r1,r0,r4,r2,7); | ||
390 | S7(r3,r1,r0,r4,r2); LK(r2,r0,r4,r3,r1,8); | ||
391 | S0(r2,r0,r4,r3,r1); LK(r4,r0,r3,r2,r1,9); | ||
392 | S1(r4,r0,r3,r2,r1); LK(r1,r3,r2,r4,r0,10); | ||
393 | S2(r1,r3,r2,r4,r0); LK(r0,r3,r1,r4,r2,11); | ||
394 | S3(r0,r3,r1,r4,r2); LK(r4,r2,r3,r0,r1,12); | ||
395 | S4(r4,r2,r3,r0,r1); LK(r2,r3,r0,r1,r4,13); | ||
396 | S5(r2,r3,r0,r1,r4); LK(r4,r2,r3,r1,r0,14); | ||
397 | S6(r4,r2,r3,r1,r0); LK(r3,r0,r2,r1,r4,15); | ||
398 | S7(r3,r0,r2,r1,r4); LK(r4,r2,r1,r3,r0,16); | ||
399 | S0(r4,r2,r1,r3,r0); LK(r1,r2,r3,r4,r0,17); | ||
400 | S1(r1,r2,r3,r4,r0); LK(r0,r3,r4,r1,r2,18); | ||
401 | S2(r0,r3,r4,r1,r2); LK(r2,r3,r0,r1,r4,19); | ||
402 | S3(r2,r3,r0,r1,r4); LK(r1,r4,r3,r2,r0,20); | ||
403 | S4(r1,r4,r3,r2,r0); LK(r4,r3,r2,r0,r1,21); | ||
404 | S5(r4,r3,r2,r0,r1); LK(r1,r4,r3,r0,r2,22); | ||
405 | S6(r1,r4,r3,r0,r2); LK(r3,r2,r4,r0,r1,23); | ||
406 | S7(r3,r2,r4,r0,r1); LK(r1,r4,r0,r3,r2,24); | ||
407 | S0(r1,r4,r0,r3,r2); LK(r0,r4,r3,r1,r2,25); | ||
408 | S1(r0,r4,r3,r1,r2); LK(r2,r3,r1,r0,r4,26); | ||
409 | S2(r2,r3,r1,r0,r4); LK(r4,r3,r2,r0,r1,27); | ||
410 | S3(r4,r3,r2,r0,r1); LK(r0,r1,r3,r4,r2,28); | ||
411 | S4(r0,r1,r3,r4,r2); LK(r1,r3,r4,r2,r0,29); | ||
412 | S5(r1,r3,r4,r2,r0); LK(r0,r1,r3,r2,r4,30); | ||
413 | S6(r0,r1,r3,r2,r4); LK(r3,r4,r1,r2,r0,31); | ||
414 | S7(r3,r4,r1,r2,r0); K(r0,r1,r2,r3,32); | ||
415 | |||
416 | d[0] = cpu_to_le32(r0); | ||
417 | d[1] = cpu_to_le32(r1); | ||
418 | d[2] = cpu_to_le32(r2); | ||
419 | d[3] = cpu_to_le32(r3); | ||
420 | } | ||
421 | |||
422 | static void serpent_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
423 | { | ||
424 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); | ||
425 | const u32 | ||
426 | *k = ((struct serpent_ctx *)ctx)->expkey; | ||
427 | const __le32 *s = (const __le32 *)src; | ||
428 | __le32 *d = (__le32 *)dst; | ||
429 | u32 r0, r1, r2, r3, r4; | ||
430 | |||
431 | r0 = le32_to_cpu(s[0]); | ||
432 | r1 = le32_to_cpu(s[1]); | ||
433 | r2 = le32_to_cpu(s[2]); | ||
434 | r3 = le32_to_cpu(s[3]); | ||
435 | |||
436 | K(r0,r1,r2,r3,32); | ||
437 | SI7(r0,r1,r2,r3,r4); KL(r1,r3,r0,r4,r2,31); | ||
438 | SI6(r1,r3,r0,r4,r2); KL(r0,r2,r4,r1,r3,30); | ||
439 | SI5(r0,r2,r4,r1,r3); KL(r2,r3,r0,r4,r1,29); | ||
440 | SI4(r2,r3,r0,r4,r1); KL(r2,r0,r1,r4,r3,28); | ||
441 | SI3(r2,r0,r1,r4,r3); KL(r1,r2,r3,r4,r0,27); | ||
442 | SI2(r1,r2,r3,r4,r0); KL(r2,r0,r4,r3,r1,26); | ||
443 | SI1(r2,r0,r4,r3,r1); KL(r1,r0,r4,r3,r2,25); | ||
444 | SI0(r1,r0,r4,r3,r2); KL(r4,r2,r0,r1,r3,24); | ||
445 | SI7(r4,r2,r0,r1,r3); KL(r2,r1,r4,r3,r0,23); | ||
446 | SI6(r2,r1,r4,r3,r0); KL(r4,r0,r3,r2,r1,22); | ||
447 | SI5(r4,r0,r3,r2,r1); KL(r0,r1,r4,r3,r2,21); | ||
448 | SI4(r0,r1,r4,r3,r2); KL(r0,r4,r2,r3,r1,20); | ||
449 | SI3(r0,r4,r2,r3,r1); KL(r2,r0,r1,r3,r4,19); | ||
450 | SI2(r2,r0,r1,r3,r4); KL(r0,r4,r3,r1,r2,18); | ||
451 | SI1(r0,r4,r3,r1,r2); KL(r2,r4,r3,r1,r0,17); | ||
452 | SI0(r2,r4,r3,r1,r0); KL(r3,r0,r4,r2,r1,16); | ||
453 | SI7(r3,r0,r4,r2,r1); KL(r0,r2,r3,r1,r4,15); | ||
454 | SI6(r0,r2,r3,r1,r4); KL(r3,r4,r1,r0,r2,14); | ||
455 | SI5(r3,r4,r1,r0,r2); KL(r4,r2,r3,r1,r0,13); | ||
456 | SI4(r4,r2,r3,r1,r0); KL(r4,r3,r0,r1,r2,12); | ||
457 | SI3(r4,r3,r0,r1,r2); KL(r0,r4,r2,r1,r3,11); | ||
458 | SI2(r0,r4,r2,r1,r3); KL(r4,r3,r1,r2,r0,10); | ||
459 | SI1(r4,r3,r1,r2,r0); KL(r0,r3,r1,r2,r4,9); | ||
460 | SI0(r0,r3,r1,r2,r4); KL(r1,r4,r3,r0,r2,8); | ||
461 | SI7(r1,r4,r3,r0,r2); KL(r4,r0,r1,r2,r3,7); | ||
462 | SI6(r4,r0,r1,r2,r3); KL(r1,r3,r2,r4,r0,6); | ||
463 | SI5(r1,r3,r2,r4,r0); KL(r3,r0,r1,r2,r4,5); | ||
464 | SI4(r3,r0,r1,r2,r4); KL(r3,r1,r4,r2,r0,4); | ||
465 | SI3(r3,r1,r4,r2,r0); KL(r4,r3,r0,r2,r1,3); | ||
466 | SI2(r4,r3,r0,r2,r1); KL(r3,r1,r2,r0,r4,2); | ||
467 | SI1(r3,r1,r2,r0,r4); KL(r4,r1,r2,r0,r3,1); | ||
468 | SI0(r4,r1,r2,r0,r3); K(r2,r3,r1,r4,0); | ||
469 | |||
470 | d[0] = cpu_to_le32(r2); | ||
471 | d[1] = cpu_to_le32(r3); | ||
472 | d[2] = cpu_to_le32(r1); | ||
473 | d[3] = cpu_to_le32(r4); | ||
474 | } | ||
475 | |||
476 | static struct crypto_alg serpent_alg = { | ||
477 | .cra_name = "serpent", | ||
478 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
479 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
480 | .cra_ctxsize = sizeof(struct serpent_ctx), | ||
481 | .cra_alignmask = 3, | ||
482 | .cra_module = THIS_MODULE, | ||
483 | .cra_list = LIST_HEAD_INIT(serpent_alg.cra_list), | ||
484 | .cra_u = { .cipher = { | ||
485 | .cia_min_keysize = SERPENT_MIN_KEY_SIZE, | ||
486 | .cia_max_keysize = SERPENT_MAX_KEY_SIZE, | ||
487 | .cia_setkey = serpent_setkey, | ||
488 | .cia_encrypt = serpent_encrypt, | ||
489 | .cia_decrypt = serpent_decrypt } } | ||
490 | }; | ||
491 | |||
492 | static int tnepres_setkey(struct crypto_tfm *tfm, const u8 *key, | ||
493 | unsigned int keylen) | ||
494 | { | ||
495 | u8 rev_key[SERPENT_MAX_KEY_SIZE]; | ||
496 | int i; | ||
497 | |||
498 | for (i = 0; i < keylen; ++i) | ||
499 | rev_key[keylen - i - 1] = key[i]; | ||
500 | |||
501 | return serpent_setkey(tfm, rev_key, keylen); | ||
502 | } | ||
503 | |||
504 | static void tnepres_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
505 | { | ||
506 | const u32 * const s = (const u32 * const)src; | ||
507 | u32 * const d = (u32 * const)dst; | ||
508 | |||
509 | u32 rs[4], rd[4]; | ||
510 | |||
511 | rs[0] = swab32(s[3]); | ||
512 | rs[1] = swab32(s[2]); | ||
513 | rs[2] = swab32(s[1]); | ||
514 | rs[3] = swab32(s[0]); | ||
515 | |||
516 | serpent_encrypt(tfm, (u8 *)rd, (u8 *)rs); | ||
517 | |||
518 | d[0] = swab32(rd[3]); | ||
519 | d[1] = swab32(rd[2]); | ||
520 | d[2] = swab32(rd[1]); | ||
521 | d[3] = swab32(rd[0]); | ||
522 | } | ||
523 | |||
524 | static void tnepres_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
525 | { | ||
526 | const u32 * const s = (const u32 * const)src; | ||
527 | u32 * const d = (u32 * const)dst; | ||
528 | |||
529 | u32 rs[4], rd[4]; | ||
530 | |||
531 | rs[0] = swab32(s[3]); | ||
532 | rs[1] = swab32(s[2]); | ||
533 | rs[2] = swab32(s[1]); | ||
534 | rs[3] = swab32(s[0]); | ||
535 | |||
536 | serpent_decrypt(tfm, (u8 *)rd, (u8 *)rs); | ||
537 | |||
538 | d[0] = swab32(rd[3]); | ||
539 | d[1] = swab32(rd[2]); | ||
540 | d[2] = swab32(rd[1]); | ||
541 | d[3] = swab32(rd[0]); | ||
542 | } | ||
543 | |||
544 | static struct crypto_alg tnepres_alg = { | ||
545 | .cra_name = "tnepres", | ||
546 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
547 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
548 | .cra_ctxsize = sizeof(struct serpent_ctx), | ||
549 | .cra_alignmask = 3, | ||
550 | .cra_module = THIS_MODULE, | ||
551 | .cra_list = LIST_HEAD_INIT(serpent_alg.cra_list), | ||
552 | .cra_u = { .cipher = { | ||
553 | .cia_min_keysize = SERPENT_MIN_KEY_SIZE, | ||
554 | .cia_max_keysize = SERPENT_MAX_KEY_SIZE, | ||
555 | .cia_setkey = tnepres_setkey, | ||
556 | .cia_encrypt = tnepres_encrypt, | ||
557 | .cia_decrypt = tnepres_decrypt } } | ||
558 | }; | ||
559 | |||
560 | static int __init serpent_mod_init(void) | ||
561 | { | ||
562 | int ret = crypto_register_alg(&serpent_alg); | ||
563 | |||
564 | if (ret) | ||
565 | return ret; | ||
566 | |||
567 | ret = crypto_register_alg(&tnepres_alg); | ||
568 | |||
569 | if (ret) | ||
570 | crypto_unregister_alg(&serpent_alg); | ||
571 | |||
572 | return ret; | ||
573 | } | ||
574 | |||
575 | static void __exit serpent_mod_fini(void) | ||
576 | { | ||
577 | crypto_unregister_alg(&tnepres_alg); | ||
578 | crypto_unregister_alg(&serpent_alg); | ||
579 | } | ||
580 | |||
581 | module_init(serpent_mod_init); | ||
582 | module_exit(serpent_mod_fini); | ||
583 | |||
584 | MODULE_LICENSE("GPL"); | ||
585 | MODULE_DESCRIPTION("Serpent and tnepres (kerneli compatible serpent reversed) Cipher Algorithm"); | ||
586 | MODULE_AUTHOR("Dag Arne Osvik <osvik@ii.uib.no>"); | ||
587 | MODULE_ALIAS("tnepres"); | ||
diff --git a/crypto/serpent_generic.c b/crypto/serpent_generic.c new file mode 100644 index 000000000000..8f32cf35e5ce --- /dev/null +++ b/crypto/serpent_generic.c | |||
@@ -0,0 +1,684 @@ | |||
1 | /* | ||
2 | * Cryptographic API. | ||
3 | * | ||
4 | * Serpent Cipher Algorithm. | ||
5 | * | ||
6 | * Copyright (C) 2002 Dag Arne Osvik <osvik@ii.uib.no> | ||
7 | * 2003 Herbert Valerio Riedel <hvr@gnu.org> | ||
8 | * | ||
9 | * Added tnepres support: | ||
10 | * Ruben Jesus Garcia Hernandez <ruben@ugr.es>, 18.10.2004 | ||
11 | * Based on code by hvr | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | */ | ||
18 | |||
19 | #include <linux/init.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/errno.h> | ||
22 | #include <asm/byteorder.h> | ||
23 | #include <linux/crypto.h> | ||
24 | #include <linux/types.h> | ||
25 | #include <crypto/serpent.h> | ||
26 | |||
27 | /* Key is padded to the maximum of 256 bits before round key generation. | ||
28 | * Any key length <= 256 bits (32 bytes) is allowed by the algorithm. | ||
29 | */ | ||
30 | |||
31 | #define PHI 0x9e3779b9UL | ||
32 | |||
33 | #define keyiter(a, b, c, d, i, j) \ | ||
34 | ({ b ^= d; b ^= c; b ^= a; b ^= PHI ^ i; b = rol32(b, 11); k[j] = b; }) | ||
35 | |||
36 | #define loadkeys(x0, x1, x2, x3, i) \ | ||
37 | ({ x0 = k[i]; x1 = k[i+1]; x2 = k[i+2]; x3 = k[i+3]; }) | ||
38 | |||
39 | #define storekeys(x0, x1, x2, x3, i) \ | ||
40 | ({ k[i] = x0; k[i+1] = x1; k[i+2] = x2; k[i+3] = x3; }) | ||
41 | |||
42 | #define store_and_load_keys(x0, x1, x2, x3, s, l) \ | ||
43 | ({ storekeys(x0, x1, x2, x3, s); loadkeys(x0, x1, x2, x3, l); }) | ||
44 | |||
45 | #define K(x0, x1, x2, x3, i) ({ \ | ||
46 | x3 ^= k[4*(i)+3]; x2 ^= k[4*(i)+2]; \ | ||
47 | x1 ^= k[4*(i)+1]; x0 ^= k[4*(i)+0]; \ | ||
48 | }) | ||
49 | |||
50 | #define LK(x0, x1, x2, x3, x4, i) ({ \ | ||
51 | x0 = rol32(x0, 13);\ | ||
52 | x2 = rol32(x2, 3); x1 ^= x0; x4 = x0 << 3; \ | ||
53 | x3 ^= x2; x1 ^= x2; \ | ||
54 | x1 = rol32(x1, 1); x3 ^= x4; \ | ||
55 | x3 = rol32(x3, 7); x4 = x1; \ | ||
56 | x0 ^= x1; x4 <<= 7; x2 ^= x3; \ | ||
57 | x0 ^= x3; x2 ^= x4; x3 ^= k[4*i+3]; \ | ||
58 | x1 ^= k[4*i+1]; x0 = rol32(x0, 5); x2 = rol32(x2, 22);\ | ||
59 | x0 ^= k[4*i+0]; x2 ^= k[4*i+2]; \ | ||
60 | }) | ||
61 | |||
62 | #define KL(x0, x1, x2, x3, x4, i) ({ \ | ||
63 | x0 ^= k[4*i+0]; x1 ^= k[4*i+1]; x2 ^= k[4*i+2]; \ | ||
64 | x3 ^= k[4*i+3]; x0 = ror32(x0, 5); x2 = ror32(x2, 22);\ | ||
65 | x4 = x1; x2 ^= x3; x0 ^= x3; \ | ||
66 | x4 <<= 7; x0 ^= x1; x1 = ror32(x1, 1); \ | ||
67 | x2 ^= x4; x3 = ror32(x3, 7); x4 = x0 << 3; \ | ||
68 | x1 ^= x0; x3 ^= x4; x0 = ror32(x0, 13);\ | ||
69 | x1 ^= x2; x3 ^= x2; x2 = ror32(x2, 3); \ | ||
70 | }) | ||
71 | |||
72 | #define S0(x0, x1, x2, x3, x4) ({ \ | ||
73 | x4 = x3; \ | ||
74 | x3 |= x0; x0 ^= x4; x4 ^= x2; \ | ||
75 | x4 = ~x4; x3 ^= x1; x1 &= x0; \ | ||
76 | x1 ^= x4; x2 ^= x0; x0 ^= x3; \ | ||
77 | x4 |= x0; x0 ^= x2; x2 &= x1; \ | ||
78 | x3 ^= x2; x1 = ~x1; x2 ^= x4; \ | ||
79 | x1 ^= x2; \ | ||
80 | }) | ||
81 | |||
82 | #define S1(x0, x1, x2, x3, x4) ({ \ | ||
83 | x4 = x1; \ | ||
84 | x1 ^= x0; x0 ^= x3; x3 = ~x3; \ | ||
85 | x4 &= x1; x0 |= x1; x3 ^= x2; \ | ||
86 | x0 ^= x3; x1 ^= x3; x3 ^= x4; \ | ||
87 | x1 |= x4; x4 ^= x2; x2 &= x0; \ | ||
88 | x2 ^= x1; x1 |= x0; x0 = ~x0; \ | ||
89 | x0 ^= x2; x4 ^= x1; \ | ||
90 | }) | ||
91 | |||
92 | #define S2(x0, x1, x2, x3, x4) ({ \ | ||
93 | x3 = ~x3; \ | ||
94 | x1 ^= x0; x4 = x0; x0 &= x2; \ | ||
95 | x0 ^= x3; x3 |= x4; x2 ^= x1; \ | ||
96 | x3 ^= x1; x1 &= x0; x0 ^= x2; \ | ||
97 | x2 &= x3; x3 |= x1; x0 = ~x0; \ | ||
98 | x3 ^= x0; x4 ^= x0; x0 ^= x2; \ | ||
99 | x1 |= x2; \ | ||
100 | }) | ||
101 | |||
102 | #define S3(x0, x1, x2, x3, x4) ({ \ | ||
103 | x4 = x1; \ | ||
104 | x1 ^= x3; x3 |= x0; x4 &= x0; \ | ||
105 | x0 ^= x2; x2 ^= x1; x1 &= x3; \ | ||
106 | x2 ^= x3; x0 |= x4; x4 ^= x3; \ | ||
107 | x1 ^= x0; x0 &= x3; x3 &= x4; \ | ||
108 | x3 ^= x2; x4 |= x1; x2 &= x1; \ | ||
109 | x4 ^= x3; x0 ^= x3; x3 ^= x2; \ | ||
110 | }) | ||
111 | |||
112 | #define S4(x0, x1, x2, x3, x4) ({ \ | ||
113 | x4 = x3; \ | ||
114 | x3 &= x0; x0 ^= x4; \ | ||
115 | x3 ^= x2; x2 |= x4; x0 ^= x1; \ | ||
116 | x4 ^= x3; x2 |= x0; \ | ||
117 | x2 ^= x1; x1 &= x0; \ | ||
118 | x1 ^= x4; x4 &= x2; x2 ^= x3; \ | ||
119 | x4 ^= x0; x3 |= x1; x1 = ~x1; \ | ||
120 | x3 ^= x0; \ | ||
121 | }) | ||
122 | |||
123 | #define S5(x0, x1, x2, x3, x4) ({ \ | ||
124 | x4 = x1; x1 |= x0; \ | ||
125 | x2 ^= x1; x3 = ~x3; x4 ^= x0; \ | ||
126 | x0 ^= x2; x1 &= x4; x4 |= x3; \ | ||
127 | x4 ^= x0; x0 &= x3; x1 ^= x3; \ | ||
128 | x3 ^= x2; x0 ^= x1; x2 &= x4; \ | ||
129 | x1 ^= x2; x2 &= x0; \ | ||
130 | x3 ^= x2; \ | ||
131 | }) | ||
132 | |||
133 | #define S6(x0, x1, x2, x3, x4) ({ \ | ||
134 | x4 = x1; \ | ||
135 | x3 ^= x0; x1 ^= x2; x2 ^= x0; \ | ||
136 | x0 &= x3; x1 |= x3; x4 = ~x4; \ | ||
137 | x0 ^= x1; x1 ^= x2; \ | ||
138 | x3 ^= x4; x4 ^= x0; x2 &= x0; \ | ||
139 | x4 ^= x1; x2 ^= x3; x3 &= x1; \ | ||
140 | x3 ^= x0; x1 ^= x2; \ | ||
141 | }) | ||
142 | |||
143 | #define S7(x0, x1, x2, x3, x4) ({ \ | ||
144 | x1 = ~x1; \ | ||
145 | x4 = x1; x0 = ~x0; x1 &= x2; \ | ||
146 | x1 ^= x3; x3 |= x4; x4 ^= x2; \ | ||
147 | x2 ^= x3; x3 ^= x0; x0 |= x1; \ | ||
148 | x2 &= x0; x0 ^= x4; x4 ^= x3; \ | ||
149 | x3 &= x0; x4 ^= x1; \ | ||
150 | x2 ^= x4; x3 ^= x1; x4 |= x0; \ | ||
151 | x4 ^= x1; \ | ||
152 | }) | ||
153 | |||
154 | #define SI0(x0, x1, x2, x3, x4) ({ \ | ||
155 | x4 = x3; x1 ^= x0; \ | ||
156 | x3 |= x1; x4 ^= x1; x0 = ~x0; \ | ||
157 | x2 ^= x3; x3 ^= x0; x0 &= x1; \ | ||
158 | x0 ^= x2; x2 &= x3; x3 ^= x4; \ | ||
159 | x2 ^= x3; x1 ^= x3; x3 &= x0; \ | ||
160 | x1 ^= x0; x0 ^= x2; x4 ^= x3; \ | ||
161 | }) | ||
162 | |||
163 | #define SI1(x0, x1, x2, x3, x4) ({ \ | ||
164 | x1 ^= x3; x4 = x0; \ | ||
165 | x0 ^= x2; x2 = ~x2; x4 |= x1; \ | ||
166 | x4 ^= x3; x3 &= x1; x1 ^= x2; \ | ||
167 | x2 &= x4; x4 ^= x1; x1 |= x3; \ | ||
168 | x3 ^= x0; x2 ^= x0; x0 |= x4; \ | ||
169 | x2 ^= x4; x1 ^= x0; \ | ||
170 | x4 ^= x1; \ | ||
171 | }) | ||
172 | |||
173 | #define SI2(x0, x1, x2, x3, x4) ({ \ | ||
174 | x2 ^= x1; x4 = x3; x3 = ~x3; \ | ||
175 | x3 |= x2; x2 ^= x4; x4 ^= x0; \ | ||
176 | x3 ^= x1; x1 |= x2; x2 ^= x0; \ | ||
177 | x1 ^= x4; x4 |= x3; x2 ^= x3; \ | ||
178 | x4 ^= x2; x2 &= x1; \ | ||
179 | x2 ^= x3; x3 ^= x4; x4 ^= x0; \ | ||
180 | }) | ||
181 | |||
182 | #define SI3(x0, x1, x2, x3, x4) ({ \ | ||
183 | x2 ^= x1; \ | ||
184 | x4 = x1; x1 &= x2; \ | ||
185 | x1 ^= x0; x0 |= x4; x4 ^= x3; \ | ||
186 | x0 ^= x3; x3 |= x1; x1 ^= x2; \ | ||
187 | x1 ^= x3; x0 ^= x2; x2 ^= x3; \ | ||
188 | x3 &= x1; x1 ^= x0; x0 &= x2; \ | ||
189 | x4 ^= x3; x3 ^= x0; x0 ^= x1; \ | ||
190 | }) | ||
191 | |||
192 | #define SI4(x0, x1, x2, x3, x4) ({ \ | ||
193 | x2 ^= x3; x4 = x0; x0 &= x1; \ | ||
194 | x0 ^= x2; x2 |= x3; x4 = ~x4; \ | ||
195 | x1 ^= x0; x0 ^= x2; x2 &= x4; \ | ||
196 | x2 ^= x0; x0 |= x4; \ | ||
197 | x0 ^= x3; x3 &= x2; \ | ||
198 | x4 ^= x3; x3 ^= x1; x1 &= x0; \ | ||
199 | x4 ^= x1; x0 ^= x3; \ | ||
200 | }) | ||
201 | |||
202 | #define SI5(x0, x1, x2, x3, x4) ({ \ | ||
203 | x4 = x1; x1 |= x2; \ | ||
204 | x2 ^= x4; x1 ^= x3; x3 &= x4; \ | ||
205 | x2 ^= x3; x3 |= x0; x0 = ~x0; \ | ||
206 | x3 ^= x2; x2 |= x0; x4 ^= x1; \ | ||
207 | x2 ^= x4; x4 &= x0; x0 ^= x1; \ | ||
208 | x1 ^= x3; x0 &= x2; x2 ^= x3; \ | ||
209 | x0 ^= x2; x2 ^= x4; x4 ^= x3; \ | ||
210 | }) | ||
211 | |||
212 | #define SI6(x0, x1, x2, x3, x4) ({ \ | ||
213 | x0 ^= x2; \ | ||
214 | x4 = x0; x0 &= x3; x2 ^= x3; \ | ||
215 | x0 ^= x2; x3 ^= x1; x2 |= x4; \ | ||
216 | x2 ^= x3; x3 &= x0; x0 = ~x0; \ | ||
217 | x3 ^= x1; x1 &= x2; x4 ^= x0; \ | ||
218 | x3 ^= x4; x4 ^= x2; x0 ^= x1; \ | ||
219 | x2 ^= x0; \ | ||
220 | }) | ||
221 | |||
222 | #define SI7(x0, x1, x2, x3, x4) ({ \ | ||
223 | x4 = x3; x3 &= x0; x0 ^= x2; \ | ||
224 | x2 |= x4; x4 ^= x1; x0 = ~x0; \ | ||
225 | x1 |= x3; x4 ^= x0; x0 &= x2; \ | ||
226 | x0 ^= x1; x1 &= x2; x3 ^= x2; \ | ||
227 | x4 ^= x3; x2 &= x3; x3 |= x0; \ | ||
228 | x1 ^= x4; x3 ^= x4; x4 &= x0; \ | ||
229 | x4 ^= x2; \ | ||
230 | }) | ||
231 | |||
232 | int __serpent_setkey(struct serpent_ctx *ctx, const u8 *key, | ||
233 | unsigned int keylen) | ||
234 | { | ||
235 | u32 *k = ctx->expkey; | ||
236 | u8 *k8 = (u8 *)k; | ||
237 | u32 r0, r1, r2, r3, r4; | ||
238 | int i; | ||
239 | |||
240 | /* Copy key, add padding */ | ||
241 | |||
242 | for (i = 0; i < keylen; ++i) | ||
243 | k8[i] = key[i]; | ||
244 | if (i < SERPENT_MAX_KEY_SIZE) | ||
245 | k8[i++] = 1; | ||
246 | while (i < SERPENT_MAX_KEY_SIZE) | ||
247 | k8[i++] = 0; | ||
248 | |||
249 | /* Expand key using polynomial */ | ||
250 | |||
251 | r0 = le32_to_cpu(k[3]); | ||
252 | r1 = le32_to_cpu(k[4]); | ||
253 | r2 = le32_to_cpu(k[5]); | ||
254 | r3 = le32_to_cpu(k[6]); | ||
255 | r4 = le32_to_cpu(k[7]); | ||
256 | |||
257 | keyiter(le32_to_cpu(k[0]), r0, r4, r2, 0, 0); | ||
258 | keyiter(le32_to_cpu(k[1]), r1, r0, r3, 1, 1); | ||
259 | keyiter(le32_to_cpu(k[2]), r2, r1, r4, 2, 2); | ||
260 | keyiter(le32_to_cpu(k[3]), r3, r2, r0, 3, 3); | ||
261 | keyiter(le32_to_cpu(k[4]), r4, r3, r1, 4, 4); | ||
262 | keyiter(le32_to_cpu(k[5]), r0, r4, r2, 5, 5); | ||
263 | keyiter(le32_to_cpu(k[6]), r1, r0, r3, 6, 6); | ||
264 | keyiter(le32_to_cpu(k[7]), r2, r1, r4, 7, 7); | ||
265 | |||
266 | keyiter(k[0], r3, r2, r0, 8, 8); | ||
267 | keyiter(k[1], r4, r3, r1, 9, 9); | ||
268 | keyiter(k[2], r0, r4, r2, 10, 10); | ||
269 | keyiter(k[3], r1, r0, r3, 11, 11); | ||
270 | keyiter(k[4], r2, r1, r4, 12, 12); | ||
271 | keyiter(k[5], r3, r2, r0, 13, 13); | ||
272 | keyiter(k[6], r4, r3, r1, 14, 14); | ||
273 | keyiter(k[7], r0, r4, r2, 15, 15); | ||
274 | keyiter(k[8], r1, r0, r3, 16, 16); | ||
275 | keyiter(k[9], r2, r1, r4, 17, 17); | ||
276 | keyiter(k[10], r3, r2, r0, 18, 18); | ||
277 | keyiter(k[11], r4, r3, r1, 19, 19); | ||
278 | keyiter(k[12], r0, r4, r2, 20, 20); | ||
279 | keyiter(k[13], r1, r0, r3, 21, 21); | ||
280 | keyiter(k[14], r2, r1, r4, 22, 22); | ||
281 | keyiter(k[15], r3, r2, r0, 23, 23); | ||
282 | keyiter(k[16], r4, r3, r1, 24, 24); | ||
283 | keyiter(k[17], r0, r4, r2, 25, 25); | ||
284 | keyiter(k[18], r1, r0, r3, 26, 26); | ||
285 | keyiter(k[19], r2, r1, r4, 27, 27); | ||
286 | keyiter(k[20], r3, r2, r0, 28, 28); | ||
287 | keyiter(k[21], r4, r3, r1, 29, 29); | ||
288 | keyiter(k[22], r0, r4, r2, 30, 30); | ||
289 | keyiter(k[23], r1, r0, r3, 31, 31); | ||
290 | |||
291 | k += 50; | ||
292 | |||
293 | keyiter(k[-26], r2, r1, r4, 32, -18); | ||
294 | keyiter(k[-25], r3, r2, r0, 33, -17); | ||
295 | keyiter(k[-24], r4, r3, r1, 34, -16); | ||
296 | keyiter(k[-23], r0, r4, r2, 35, -15); | ||
297 | keyiter(k[-22], r1, r0, r3, 36, -14); | ||
298 | keyiter(k[-21], r2, r1, r4, 37, -13); | ||
299 | keyiter(k[-20], r3, r2, r0, 38, -12); | ||
300 | keyiter(k[-19], r4, r3, r1, 39, -11); | ||
301 | keyiter(k[-18], r0, r4, r2, 40, -10); | ||
302 | keyiter(k[-17], r1, r0, r3, 41, -9); | ||
303 | keyiter(k[-16], r2, r1, r4, 42, -8); | ||
304 | keyiter(k[-15], r3, r2, r0, 43, -7); | ||
305 | keyiter(k[-14], r4, r3, r1, 44, -6); | ||
306 | keyiter(k[-13], r0, r4, r2, 45, -5); | ||
307 | keyiter(k[-12], r1, r0, r3, 46, -4); | ||
308 | keyiter(k[-11], r2, r1, r4, 47, -3); | ||
309 | keyiter(k[-10], r3, r2, r0, 48, -2); | ||
310 | keyiter(k[-9], r4, r3, r1, 49, -1); | ||
311 | keyiter(k[-8], r0, r4, r2, 50, 0); | ||
312 | keyiter(k[-7], r1, r0, r3, 51, 1); | ||
313 | keyiter(k[-6], r2, r1, r4, 52, 2); | ||
314 | keyiter(k[-5], r3, r2, r0, 53, 3); | ||
315 | keyiter(k[-4], r4, r3, r1, 54, 4); | ||
316 | keyiter(k[-3], r0, r4, r2, 55, 5); | ||
317 | keyiter(k[-2], r1, r0, r3, 56, 6); | ||
318 | keyiter(k[-1], r2, r1, r4, 57, 7); | ||
319 | keyiter(k[0], r3, r2, r0, 58, 8); | ||
320 | keyiter(k[1], r4, r3, r1, 59, 9); | ||
321 | keyiter(k[2], r0, r4, r2, 60, 10); | ||
322 | keyiter(k[3], r1, r0, r3, 61, 11); | ||
323 | keyiter(k[4], r2, r1, r4, 62, 12); | ||
324 | keyiter(k[5], r3, r2, r0, 63, 13); | ||
325 | keyiter(k[6], r4, r3, r1, 64, 14); | ||
326 | keyiter(k[7], r0, r4, r2, 65, 15); | ||
327 | keyiter(k[8], r1, r0, r3, 66, 16); | ||
328 | keyiter(k[9], r2, r1, r4, 67, 17); | ||
329 | keyiter(k[10], r3, r2, r0, 68, 18); | ||
330 | keyiter(k[11], r4, r3, r1, 69, 19); | ||
331 | keyiter(k[12], r0, r4, r2, 70, 20); | ||
332 | keyiter(k[13], r1, r0, r3, 71, 21); | ||
333 | keyiter(k[14], r2, r1, r4, 72, 22); | ||
334 | keyiter(k[15], r3, r2, r0, 73, 23); | ||
335 | keyiter(k[16], r4, r3, r1, 74, 24); | ||
336 | keyiter(k[17], r0, r4, r2, 75, 25); | ||
337 | keyiter(k[18], r1, r0, r3, 76, 26); | ||
338 | keyiter(k[19], r2, r1, r4, 77, 27); | ||
339 | keyiter(k[20], r3, r2, r0, 78, 28); | ||
340 | keyiter(k[21], r4, r3, r1, 79, 29); | ||
341 | keyiter(k[22], r0, r4, r2, 80, 30); | ||
342 | keyiter(k[23], r1, r0, r3, 81, 31); | ||
343 | |||
344 | k += 50; | ||
345 | |||
346 | keyiter(k[-26], r2, r1, r4, 82, -18); | ||
347 | keyiter(k[-25], r3, r2, r0, 83, -17); | ||
348 | keyiter(k[-24], r4, r3, r1, 84, -16); | ||
349 | keyiter(k[-23], r0, r4, r2, 85, -15); | ||
350 | keyiter(k[-22], r1, r0, r3, 86, -14); | ||
351 | keyiter(k[-21], r2, r1, r4, 87, -13); | ||
352 | keyiter(k[-20], r3, r2, r0, 88, -12); | ||
353 | keyiter(k[-19], r4, r3, r1, 89, -11); | ||
354 | keyiter(k[-18], r0, r4, r2, 90, -10); | ||
355 | keyiter(k[-17], r1, r0, r3, 91, -9); | ||
356 | keyiter(k[-16], r2, r1, r4, 92, -8); | ||
357 | keyiter(k[-15], r3, r2, r0, 93, -7); | ||
358 | keyiter(k[-14], r4, r3, r1, 94, -6); | ||
359 | keyiter(k[-13], r0, r4, r2, 95, -5); | ||
360 | keyiter(k[-12], r1, r0, r3, 96, -4); | ||
361 | keyiter(k[-11], r2, r1, r4, 97, -3); | ||
362 | keyiter(k[-10], r3, r2, r0, 98, -2); | ||
363 | keyiter(k[-9], r4, r3, r1, 99, -1); | ||
364 | keyiter(k[-8], r0, r4, r2, 100, 0); | ||
365 | keyiter(k[-7], r1, r0, r3, 101, 1); | ||
366 | keyiter(k[-6], r2, r1, r4, 102, 2); | ||
367 | keyiter(k[-5], r3, r2, r0, 103, 3); | ||
368 | keyiter(k[-4], r4, r3, r1, 104, 4); | ||
369 | keyiter(k[-3], r0, r4, r2, 105, 5); | ||
370 | keyiter(k[-2], r1, r0, r3, 106, 6); | ||
371 | keyiter(k[-1], r2, r1, r4, 107, 7); | ||
372 | keyiter(k[0], r3, r2, r0, 108, 8); | ||
373 | keyiter(k[1], r4, r3, r1, 109, 9); | ||
374 | keyiter(k[2], r0, r4, r2, 110, 10); | ||
375 | keyiter(k[3], r1, r0, r3, 111, 11); | ||
376 | keyiter(k[4], r2, r1, r4, 112, 12); | ||
377 | keyiter(k[5], r3, r2, r0, 113, 13); | ||
378 | keyiter(k[6], r4, r3, r1, 114, 14); | ||
379 | keyiter(k[7], r0, r4, r2, 115, 15); | ||
380 | keyiter(k[8], r1, r0, r3, 116, 16); | ||
381 | keyiter(k[9], r2, r1, r4, 117, 17); | ||
382 | keyiter(k[10], r3, r2, r0, 118, 18); | ||
383 | keyiter(k[11], r4, r3, r1, 119, 19); | ||
384 | keyiter(k[12], r0, r4, r2, 120, 20); | ||
385 | keyiter(k[13], r1, r0, r3, 121, 21); | ||
386 | keyiter(k[14], r2, r1, r4, 122, 22); | ||
387 | keyiter(k[15], r3, r2, r0, 123, 23); | ||
388 | keyiter(k[16], r4, r3, r1, 124, 24); | ||
389 | keyiter(k[17], r0, r4, r2, 125, 25); | ||
390 | keyiter(k[18], r1, r0, r3, 126, 26); | ||
391 | keyiter(k[19], r2, r1, r4, 127, 27); | ||
392 | keyiter(k[20], r3, r2, r0, 128, 28); | ||
393 | keyiter(k[21], r4, r3, r1, 129, 29); | ||
394 | keyiter(k[22], r0, r4, r2, 130, 30); | ||
395 | keyiter(k[23], r1, r0, r3, 131, 31); | ||
396 | |||
397 | /* Apply S-boxes */ | ||
398 | |||
399 | S3(r3, r4, r0, r1, r2); store_and_load_keys(r1, r2, r4, r3, 28, 24); | ||
400 | S4(r1, r2, r4, r3, r0); store_and_load_keys(r2, r4, r3, r0, 24, 20); | ||
401 | S5(r2, r4, r3, r0, r1); store_and_load_keys(r1, r2, r4, r0, 20, 16); | ||
402 | S6(r1, r2, r4, r0, r3); store_and_load_keys(r4, r3, r2, r0, 16, 12); | ||
403 | S7(r4, r3, r2, r0, r1); store_and_load_keys(r1, r2, r0, r4, 12, 8); | ||
404 | S0(r1, r2, r0, r4, r3); store_and_load_keys(r0, r2, r4, r1, 8, 4); | ||
405 | S1(r0, r2, r4, r1, r3); store_and_load_keys(r3, r4, r1, r0, 4, 0); | ||
406 | S2(r3, r4, r1, r0, r2); store_and_load_keys(r2, r4, r3, r0, 0, -4); | ||
407 | S3(r2, r4, r3, r0, r1); store_and_load_keys(r0, r1, r4, r2, -4, -8); | ||
408 | S4(r0, r1, r4, r2, r3); store_and_load_keys(r1, r4, r2, r3, -8, -12); | ||
409 | S5(r1, r4, r2, r3, r0); store_and_load_keys(r0, r1, r4, r3, -12, -16); | ||
410 | S6(r0, r1, r4, r3, r2); store_and_load_keys(r4, r2, r1, r3, -16, -20); | ||
411 | S7(r4, r2, r1, r3, r0); store_and_load_keys(r0, r1, r3, r4, -20, -24); | ||
412 | S0(r0, r1, r3, r4, r2); store_and_load_keys(r3, r1, r4, r0, -24, -28); | ||
413 | k -= 50; | ||
414 | S1(r3, r1, r4, r0, r2); store_and_load_keys(r2, r4, r0, r3, 22, 18); | ||
415 | S2(r2, r4, r0, r3, r1); store_and_load_keys(r1, r4, r2, r3, 18, 14); | ||
416 | S3(r1, r4, r2, r3, r0); store_and_load_keys(r3, r0, r4, r1, 14, 10); | ||
417 | S4(r3, r0, r4, r1, r2); store_and_load_keys(r0, r4, r1, r2, 10, 6); | ||
418 | S5(r0, r4, r1, r2, r3); store_and_load_keys(r3, r0, r4, r2, 6, 2); | ||
419 | S6(r3, r0, r4, r2, r1); store_and_load_keys(r4, r1, r0, r2, 2, -2); | ||
420 | S7(r4, r1, r0, r2, r3); store_and_load_keys(r3, r0, r2, r4, -2, -6); | ||
421 | S0(r3, r0, r2, r4, r1); store_and_load_keys(r2, r0, r4, r3, -6, -10); | ||
422 | S1(r2, r0, r4, r3, r1); store_and_load_keys(r1, r4, r3, r2, -10, -14); | ||
423 | S2(r1, r4, r3, r2, r0); store_and_load_keys(r0, r4, r1, r2, -14, -18); | ||
424 | S3(r0, r4, r1, r2, r3); store_and_load_keys(r2, r3, r4, r0, -18, -22); | ||
425 | k -= 50; | ||
426 | S4(r2, r3, r4, r0, r1); store_and_load_keys(r3, r4, r0, r1, 28, 24); | ||
427 | S5(r3, r4, r0, r1, r2); store_and_load_keys(r2, r3, r4, r1, 24, 20); | ||
428 | S6(r2, r3, r4, r1, r0); store_and_load_keys(r4, r0, r3, r1, 20, 16); | ||
429 | S7(r4, r0, r3, r1, r2); store_and_load_keys(r2, r3, r1, r4, 16, 12); | ||
430 | S0(r2, r3, r1, r4, r0); store_and_load_keys(r1, r3, r4, r2, 12, 8); | ||
431 | S1(r1, r3, r4, r2, r0); store_and_load_keys(r0, r4, r2, r1, 8, 4); | ||
432 | S2(r0, r4, r2, r1, r3); store_and_load_keys(r3, r4, r0, r1, 4, 0); | ||
433 | S3(r3, r4, r0, r1, r2); storekeys(r1, r2, r4, r3, 0); | ||
434 | |||
435 | return 0; | ||
436 | } | ||
437 | EXPORT_SYMBOL_GPL(__serpent_setkey); | ||
438 | |||
439 | int serpent_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) | ||
440 | { | ||
441 | return __serpent_setkey(crypto_tfm_ctx(tfm), key, keylen); | ||
442 | } | ||
443 | EXPORT_SYMBOL_GPL(serpent_setkey); | ||
444 | |||
445 | void __serpent_encrypt(struct serpent_ctx *ctx, u8 *dst, const u8 *src) | ||
446 | { | ||
447 | const u32 *k = ctx->expkey; | ||
448 | const __le32 *s = (const __le32 *)src; | ||
449 | __le32 *d = (__le32 *)dst; | ||
450 | u32 r0, r1, r2, r3, r4; | ||
451 | |||
452 | /* | ||
453 | * Note: The conversions between u8* and u32* might cause trouble | ||
454 | * on architectures with stricter alignment rules than x86 | ||
455 | */ | ||
456 | |||
457 | r0 = le32_to_cpu(s[0]); | ||
458 | r1 = le32_to_cpu(s[1]); | ||
459 | r2 = le32_to_cpu(s[2]); | ||
460 | r3 = le32_to_cpu(s[3]); | ||
461 | |||
462 | K(r0, r1, r2, r3, 0); | ||
463 | S0(r0, r1, r2, r3, r4); LK(r2, r1, r3, r0, r4, 1); | ||
464 | S1(r2, r1, r3, r0, r4); LK(r4, r3, r0, r2, r1, 2); | ||
465 | S2(r4, r3, r0, r2, r1); LK(r1, r3, r4, r2, r0, 3); | ||
466 | S3(r1, r3, r4, r2, r0); LK(r2, r0, r3, r1, r4, 4); | ||
467 | S4(r2, r0, r3, r1, r4); LK(r0, r3, r1, r4, r2, 5); | ||
468 | S5(r0, r3, r1, r4, r2); LK(r2, r0, r3, r4, r1, 6); | ||
469 | S6(r2, r0, r3, r4, r1); LK(r3, r1, r0, r4, r2, 7); | ||
470 | S7(r3, r1, r0, r4, r2); LK(r2, r0, r4, r3, r1, 8); | ||
471 | S0(r2, r0, r4, r3, r1); LK(r4, r0, r3, r2, r1, 9); | ||
472 | S1(r4, r0, r3, r2, r1); LK(r1, r3, r2, r4, r0, 10); | ||
473 | S2(r1, r3, r2, r4, r0); LK(r0, r3, r1, r4, r2, 11); | ||
474 | S3(r0, r3, r1, r4, r2); LK(r4, r2, r3, r0, r1, 12); | ||
475 | S4(r4, r2, r3, r0, r1); LK(r2, r3, r0, r1, r4, 13); | ||
476 | S5(r2, r3, r0, r1, r4); LK(r4, r2, r3, r1, r0, 14); | ||
477 | S6(r4, r2, r3, r1, r0); LK(r3, r0, r2, r1, r4, 15); | ||
478 | S7(r3, r0, r2, r1, r4); LK(r4, r2, r1, r3, r0, 16); | ||
479 | S0(r4, r2, r1, r3, r0); LK(r1, r2, r3, r4, r0, 17); | ||
480 | S1(r1, r2, r3, r4, r0); LK(r0, r3, r4, r1, r2, 18); | ||
481 | S2(r0, r3, r4, r1, r2); LK(r2, r3, r0, r1, r4, 19); | ||
482 | S3(r2, r3, r0, r1, r4); LK(r1, r4, r3, r2, r0, 20); | ||
483 | S4(r1, r4, r3, r2, r0); LK(r4, r3, r2, r0, r1, 21); | ||
484 | S5(r4, r3, r2, r0, r1); LK(r1, r4, r3, r0, r2, 22); | ||
485 | S6(r1, r4, r3, r0, r2); LK(r3, r2, r4, r0, r1, 23); | ||
486 | S7(r3, r2, r4, r0, r1); LK(r1, r4, r0, r3, r2, 24); | ||
487 | S0(r1, r4, r0, r3, r2); LK(r0, r4, r3, r1, r2, 25); | ||
488 | S1(r0, r4, r3, r1, r2); LK(r2, r3, r1, r0, r4, 26); | ||
489 | S2(r2, r3, r1, r0, r4); LK(r4, r3, r2, r0, r1, 27); | ||
490 | S3(r4, r3, r2, r0, r1); LK(r0, r1, r3, r4, r2, 28); | ||
491 | S4(r0, r1, r3, r4, r2); LK(r1, r3, r4, r2, r0, 29); | ||
492 | S5(r1, r3, r4, r2, r0); LK(r0, r1, r3, r2, r4, 30); | ||
493 | S6(r0, r1, r3, r2, r4); LK(r3, r4, r1, r2, r0, 31); | ||
494 | S7(r3, r4, r1, r2, r0); K(r0, r1, r2, r3, 32); | ||
495 | |||
496 | d[0] = cpu_to_le32(r0); | ||
497 | d[1] = cpu_to_le32(r1); | ||
498 | d[2] = cpu_to_le32(r2); | ||
499 | d[3] = cpu_to_le32(r3); | ||
500 | } | ||
501 | EXPORT_SYMBOL_GPL(__serpent_encrypt); | ||
502 | |||
503 | static void serpent_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
504 | { | ||
505 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); | ||
506 | |||
507 | __serpent_encrypt(ctx, dst, src); | ||
508 | } | ||
509 | |||
510 | void __serpent_decrypt(struct serpent_ctx *ctx, u8 *dst, const u8 *src) | ||
511 | { | ||
512 | const u32 *k = ctx->expkey; | ||
513 | const __le32 *s = (const __le32 *)src; | ||
514 | __le32 *d = (__le32 *)dst; | ||
515 | u32 r0, r1, r2, r3, r4; | ||
516 | |||
517 | r0 = le32_to_cpu(s[0]); | ||
518 | r1 = le32_to_cpu(s[1]); | ||
519 | r2 = le32_to_cpu(s[2]); | ||
520 | r3 = le32_to_cpu(s[3]); | ||
521 | |||
522 | K(r0, r1, r2, r3, 32); | ||
523 | SI7(r0, r1, r2, r3, r4); KL(r1, r3, r0, r4, r2, 31); | ||
524 | SI6(r1, r3, r0, r4, r2); KL(r0, r2, r4, r1, r3, 30); | ||
525 | SI5(r0, r2, r4, r1, r3); KL(r2, r3, r0, r4, r1, 29); | ||
526 | SI4(r2, r3, r0, r4, r1); KL(r2, r0, r1, r4, r3, 28); | ||
527 | SI3(r2, r0, r1, r4, r3); KL(r1, r2, r3, r4, r0, 27); | ||
528 | SI2(r1, r2, r3, r4, r0); KL(r2, r0, r4, r3, r1, 26); | ||
529 | SI1(r2, r0, r4, r3, r1); KL(r1, r0, r4, r3, r2, 25); | ||
530 | SI0(r1, r0, r4, r3, r2); KL(r4, r2, r0, r1, r3, 24); | ||
531 | SI7(r4, r2, r0, r1, r3); KL(r2, r1, r4, r3, r0, 23); | ||
532 | SI6(r2, r1, r4, r3, r0); KL(r4, r0, r3, r2, r1, 22); | ||
533 | SI5(r4, r0, r3, r2, r1); KL(r0, r1, r4, r3, r2, 21); | ||
534 | SI4(r0, r1, r4, r3, r2); KL(r0, r4, r2, r3, r1, 20); | ||
535 | SI3(r0, r4, r2, r3, r1); KL(r2, r0, r1, r3, r4, 19); | ||
536 | SI2(r2, r0, r1, r3, r4); KL(r0, r4, r3, r1, r2, 18); | ||
537 | SI1(r0, r4, r3, r1, r2); KL(r2, r4, r3, r1, r0, 17); | ||
538 | SI0(r2, r4, r3, r1, r0); KL(r3, r0, r4, r2, r1, 16); | ||
539 | SI7(r3, r0, r4, r2, r1); KL(r0, r2, r3, r1, r4, 15); | ||
540 | SI6(r0, r2, r3, r1, r4); KL(r3, r4, r1, r0, r2, 14); | ||
541 | SI5(r3, r4, r1, r0, r2); KL(r4, r2, r3, r1, r0, 13); | ||
542 | SI4(r4, r2, r3, r1, r0); KL(r4, r3, r0, r1, r2, 12); | ||
543 | SI3(r4, r3, r0, r1, r2); KL(r0, r4, r2, r1, r3, 11); | ||
544 | SI2(r0, r4, r2, r1, r3); KL(r4, r3, r1, r2, r0, 10); | ||
545 | SI1(r4, r3, r1, r2, r0); KL(r0, r3, r1, r2, r4, 9); | ||
546 | SI0(r0, r3, r1, r2, r4); KL(r1, r4, r3, r0, r2, 8); | ||
547 | SI7(r1, r4, r3, r0, r2); KL(r4, r0, r1, r2, r3, 7); | ||
548 | SI6(r4, r0, r1, r2, r3); KL(r1, r3, r2, r4, r0, 6); | ||
549 | SI5(r1, r3, r2, r4, r0); KL(r3, r0, r1, r2, r4, 5); | ||
550 | SI4(r3, r0, r1, r2, r4); KL(r3, r1, r4, r2, r0, 4); | ||
551 | SI3(r3, r1, r4, r2, r0); KL(r4, r3, r0, r2, r1, 3); | ||
552 | SI2(r4, r3, r0, r2, r1); KL(r3, r1, r2, r0, r4, 2); | ||
553 | SI1(r3, r1, r2, r0, r4); KL(r4, r1, r2, r0, r3, 1); | ||
554 | SI0(r4, r1, r2, r0, r3); K(r2, r3, r1, r4, 0); | ||
555 | |||
556 | d[0] = cpu_to_le32(r2); | ||
557 | d[1] = cpu_to_le32(r3); | ||
558 | d[2] = cpu_to_le32(r1); | ||
559 | d[3] = cpu_to_le32(r4); | ||
560 | } | ||
561 | EXPORT_SYMBOL_GPL(__serpent_decrypt); | ||
562 | |||
563 | static void serpent_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
564 | { | ||
565 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); | ||
566 | |||
567 | __serpent_decrypt(ctx, dst, src); | ||
568 | } | ||
569 | |||
570 | static struct crypto_alg serpent_alg = { | ||
571 | .cra_name = "serpent", | ||
572 | .cra_driver_name = "serpent-generic", | ||
573 | .cra_priority = 100, | ||
574 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
575 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
576 | .cra_ctxsize = sizeof(struct serpent_ctx), | ||
577 | .cra_alignmask = 3, | ||
578 | .cra_module = THIS_MODULE, | ||
579 | .cra_list = LIST_HEAD_INIT(serpent_alg.cra_list), | ||
580 | .cra_u = { .cipher = { | ||
581 | .cia_min_keysize = SERPENT_MIN_KEY_SIZE, | ||
582 | .cia_max_keysize = SERPENT_MAX_KEY_SIZE, | ||
583 | .cia_setkey = serpent_setkey, | ||
584 | .cia_encrypt = serpent_encrypt, | ||
585 | .cia_decrypt = serpent_decrypt } } | ||
586 | }; | ||
587 | |||
588 | static int tnepres_setkey(struct crypto_tfm *tfm, const u8 *key, | ||
589 | unsigned int keylen) | ||
590 | { | ||
591 | u8 rev_key[SERPENT_MAX_KEY_SIZE]; | ||
592 | int i; | ||
593 | |||
594 | for (i = 0; i < keylen; ++i) | ||
595 | rev_key[keylen - i - 1] = key[i]; | ||
596 | |||
597 | return serpent_setkey(tfm, rev_key, keylen); | ||
598 | } | ||
599 | |||
600 | static void tnepres_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
601 | { | ||
602 | const u32 * const s = (const u32 * const)src; | ||
603 | u32 * const d = (u32 * const)dst; | ||
604 | |||
605 | u32 rs[4], rd[4]; | ||
606 | |||
607 | rs[0] = swab32(s[3]); | ||
608 | rs[1] = swab32(s[2]); | ||
609 | rs[2] = swab32(s[1]); | ||
610 | rs[3] = swab32(s[0]); | ||
611 | |||
612 | serpent_encrypt(tfm, (u8 *)rd, (u8 *)rs); | ||
613 | |||
614 | d[0] = swab32(rd[3]); | ||
615 | d[1] = swab32(rd[2]); | ||
616 | d[2] = swab32(rd[1]); | ||
617 | d[3] = swab32(rd[0]); | ||
618 | } | ||
619 | |||
620 | static void tnepres_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
621 | { | ||
622 | const u32 * const s = (const u32 * const)src; | ||
623 | u32 * const d = (u32 * const)dst; | ||
624 | |||
625 | u32 rs[4], rd[4]; | ||
626 | |||
627 | rs[0] = swab32(s[3]); | ||
628 | rs[1] = swab32(s[2]); | ||
629 | rs[2] = swab32(s[1]); | ||
630 | rs[3] = swab32(s[0]); | ||
631 | |||
632 | serpent_decrypt(tfm, (u8 *)rd, (u8 *)rs); | ||
633 | |||
634 | d[0] = swab32(rd[3]); | ||
635 | d[1] = swab32(rd[2]); | ||
636 | d[2] = swab32(rd[1]); | ||
637 | d[3] = swab32(rd[0]); | ||
638 | } | ||
639 | |||
640 | static struct crypto_alg tnepres_alg = { | ||
641 | .cra_name = "tnepres", | ||
642 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
643 | .cra_blocksize = SERPENT_BLOCK_SIZE, | ||
644 | .cra_ctxsize = sizeof(struct serpent_ctx), | ||
645 | .cra_alignmask = 3, | ||
646 | .cra_module = THIS_MODULE, | ||
647 | .cra_list = LIST_HEAD_INIT(serpent_alg.cra_list), | ||
648 | .cra_u = { .cipher = { | ||
649 | .cia_min_keysize = SERPENT_MIN_KEY_SIZE, | ||
650 | .cia_max_keysize = SERPENT_MAX_KEY_SIZE, | ||
651 | .cia_setkey = tnepres_setkey, | ||
652 | .cia_encrypt = tnepres_encrypt, | ||
653 | .cia_decrypt = tnepres_decrypt } } | ||
654 | }; | ||
655 | |||
656 | static int __init serpent_mod_init(void) | ||
657 | { | ||
658 | int ret = crypto_register_alg(&serpent_alg); | ||
659 | |||
660 | if (ret) | ||
661 | return ret; | ||
662 | |||
663 | ret = crypto_register_alg(&tnepres_alg); | ||
664 | |||
665 | if (ret) | ||
666 | crypto_unregister_alg(&serpent_alg); | ||
667 | |||
668 | return ret; | ||
669 | } | ||
670 | |||
671 | static void __exit serpent_mod_fini(void) | ||
672 | { | ||
673 | crypto_unregister_alg(&tnepres_alg); | ||
674 | crypto_unregister_alg(&serpent_alg); | ||
675 | } | ||
676 | |||
677 | module_init(serpent_mod_init); | ||
678 | module_exit(serpent_mod_fini); | ||
679 | |||
680 | MODULE_LICENSE("GPL"); | ||
681 | MODULE_DESCRIPTION("Serpent and tnepres (kerneli compatible serpent reversed) Cipher Algorithm"); | ||
682 | MODULE_AUTHOR("Dag Arne Osvik <osvik@ii.uib.no>"); | ||
683 | MODULE_ALIAS("tnepres"); | ||
684 | MODULE_ALIAS("serpent"); | ||
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 0c4e80f34651..7736a9f05aba 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
@@ -719,6 +719,207 @@ out: | |||
719 | crypto_free_ahash(tfm); | 719 | crypto_free_ahash(tfm); |
720 | } | 720 | } |
721 | 721 | ||
722 | static inline int do_one_acipher_op(struct ablkcipher_request *req, int ret) | ||
723 | { | ||
724 | if (ret == -EINPROGRESS || ret == -EBUSY) { | ||
725 | struct tcrypt_result *tr = req->base.data; | ||
726 | |||
727 | ret = wait_for_completion_interruptible(&tr->completion); | ||
728 | if (!ret) | ||
729 | ret = tr->err; | ||
730 | INIT_COMPLETION(tr->completion); | ||
731 | } | ||
732 | |||
733 | return ret; | ||
734 | } | ||
735 | |||
736 | static int test_acipher_jiffies(struct ablkcipher_request *req, int enc, | ||
737 | int blen, int sec) | ||
738 | { | ||
739 | unsigned long start, end; | ||
740 | int bcount; | ||
741 | int ret; | ||
742 | |||
743 | for (start = jiffies, end = start + sec * HZ, bcount = 0; | ||
744 | time_before(jiffies, end); bcount++) { | ||
745 | if (enc) | ||
746 | ret = do_one_acipher_op(req, | ||
747 | crypto_ablkcipher_encrypt(req)); | ||
748 | else | ||
749 | ret = do_one_acipher_op(req, | ||
750 | crypto_ablkcipher_decrypt(req)); | ||
751 | |||
752 | if (ret) | ||
753 | return ret; | ||
754 | } | ||
755 | |||
756 | pr_cont("%d operations in %d seconds (%ld bytes)\n", | ||
757 | bcount, sec, (long)bcount * blen); | ||
758 | return 0; | ||
759 | } | ||
760 | |||
761 | static int test_acipher_cycles(struct ablkcipher_request *req, int enc, | ||
762 | int blen) | ||
763 | { | ||
764 | unsigned long cycles = 0; | ||
765 | int ret = 0; | ||
766 | int i; | ||
767 | |||
768 | /* Warm-up run. */ | ||
769 | for (i = 0; i < 4; i++) { | ||
770 | if (enc) | ||
771 | ret = do_one_acipher_op(req, | ||
772 | crypto_ablkcipher_encrypt(req)); | ||
773 | else | ||
774 | ret = do_one_acipher_op(req, | ||
775 | crypto_ablkcipher_decrypt(req)); | ||
776 | |||
777 | if (ret) | ||
778 | goto out; | ||
779 | } | ||
780 | |||
781 | /* The real thing. */ | ||
782 | for (i = 0; i < 8; i++) { | ||
783 | cycles_t start, end; | ||
784 | |||
785 | start = get_cycles(); | ||
786 | if (enc) | ||
787 | ret = do_one_acipher_op(req, | ||
788 | crypto_ablkcipher_encrypt(req)); | ||
789 | else | ||
790 | ret = do_one_acipher_op(req, | ||
791 | crypto_ablkcipher_decrypt(req)); | ||
792 | end = get_cycles(); | ||
793 | |||
794 | if (ret) | ||
795 | goto out; | ||
796 | |||
797 | cycles += end - start; | ||
798 | } | ||
799 | |||
800 | out: | ||
801 | if (ret == 0) | ||
802 | pr_cont("1 operation in %lu cycles (%d bytes)\n", | ||
803 | (cycles + 4) / 8, blen); | ||
804 | |||
805 | return ret; | ||
806 | } | ||
807 | |||
808 | static void test_acipher_speed(const char *algo, int enc, unsigned int sec, | ||
809 | struct cipher_speed_template *template, | ||
810 | unsigned int tcount, u8 *keysize) | ||
811 | { | ||
812 | unsigned int ret, i, j, iv_len; | ||
813 | struct tcrypt_result tresult; | ||
814 | const char *key; | ||
815 | char iv[128]; | ||
816 | struct ablkcipher_request *req; | ||
817 | struct crypto_ablkcipher *tfm; | ||
818 | const char *e; | ||
819 | u32 *b_size; | ||
820 | |||
821 | if (enc == ENCRYPT) | ||
822 | e = "encryption"; | ||
823 | else | ||
824 | e = "decryption"; | ||
825 | |||
826 | pr_info("\ntesting speed of async %s %s\n", algo, e); | ||
827 | |||
828 | init_completion(&tresult.completion); | ||
829 | |||
830 | tfm = crypto_alloc_ablkcipher(algo, 0, 0); | ||
831 | |||
832 | if (IS_ERR(tfm)) { | ||
833 | pr_err("failed to load transform for %s: %ld\n", algo, | ||
834 | PTR_ERR(tfm)); | ||
835 | return; | ||
836 | } | ||
837 | |||
838 | req = ablkcipher_request_alloc(tfm, GFP_KERNEL); | ||
839 | if (!req) { | ||
840 | pr_err("tcrypt: skcipher: Failed to allocate request for %s\n", | ||
841 | algo); | ||
842 | goto out; | ||
843 | } | ||
844 | |||
845 | ablkcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, | ||
846 | tcrypt_complete, &tresult); | ||
847 | |||
848 | i = 0; | ||
849 | do { | ||
850 | b_size = block_sizes; | ||
851 | |||
852 | do { | ||
853 | struct scatterlist sg[TVMEMSIZE]; | ||
854 | |||
855 | if ((*keysize + *b_size) > TVMEMSIZE * PAGE_SIZE) { | ||
856 | pr_err("template (%u) too big for " | ||
857 | "tvmem (%lu)\n", *keysize + *b_size, | ||
858 | TVMEMSIZE * PAGE_SIZE); | ||
859 | goto out_free_req; | ||
860 | } | ||
861 | |||
862 | pr_info("test %u (%d bit key, %d byte blocks): ", i, | ||
863 | *keysize * 8, *b_size); | ||
864 | |||
865 | memset(tvmem[0], 0xff, PAGE_SIZE); | ||
866 | |||
867 | /* set key, plain text and IV */ | ||
868 | key = tvmem[0]; | ||
869 | for (j = 0; j < tcount; j++) { | ||
870 | if (template[j].klen == *keysize) { | ||
871 | key = template[j].key; | ||
872 | break; | ||
873 | } | ||
874 | } | ||
875 | |||
876 | crypto_ablkcipher_clear_flags(tfm, ~0); | ||
877 | |||
878 | ret = crypto_ablkcipher_setkey(tfm, key, *keysize); | ||
879 | if (ret) { | ||
880 | pr_err("setkey() failed flags=%x\n", | ||
881 | crypto_ablkcipher_get_flags(tfm)); | ||
882 | goto out_free_req; | ||
883 | } | ||
884 | |||
885 | sg_init_table(sg, TVMEMSIZE); | ||
886 | sg_set_buf(sg, tvmem[0] + *keysize, | ||
887 | PAGE_SIZE - *keysize); | ||
888 | for (j = 1; j < TVMEMSIZE; j++) { | ||
889 | sg_set_buf(sg + j, tvmem[j], PAGE_SIZE); | ||
890 | memset(tvmem[j], 0xff, PAGE_SIZE); | ||
891 | } | ||
892 | |||
893 | iv_len = crypto_ablkcipher_ivsize(tfm); | ||
894 | if (iv_len) | ||
895 | memset(&iv, 0xff, iv_len); | ||
896 | |||
897 | ablkcipher_request_set_crypt(req, sg, sg, *b_size, iv); | ||
898 | |||
899 | if (sec) | ||
900 | ret = test_acipher_jiffies(req, enc, | ||
901 | *b_size, sec); | ||
902 | else | ||
903 | ret = test_acipher_cycles(req, enc, | ||
904 | *b_size); | ||
905 | |||
906 | if (ret) { | ||
907 | pr_err("%s() failed flags=%x\n", e, | ||
908 | crypto_ablkcipher_get_flags(tfm)); | ||
909 | break; | ||
910 | } | ||
911 | b_size++; | ||
912 | i++; | ||
913 | } while (*b_size); | ||
914 | keysize++; | ||
915 | } while (*keysize); | ||
916 | |||
917 | out_free_req: | ||
918 | ablkcipher_request_free(req); | ||
919 | out: | ||
920 | crypto_free_ablkcipher(tfm); | ||
921 | } | ||
922 | |||
722 | static void test_available(void) | 923 | static void test_available(void) |
723 | { | 924 | { |
724 | char **name = check; | 925 | char **name = check; |
@@ -789,10 +990,16 @@ static int do_test(int m) | |||
789 | ret += tcrypt_test("ecb(twofish)"); | 990 | ret += tcrypt_test("ecb(twofish)"); |
790 | ret += tcrypt_test("cbc(twofish)"); | 991 | ret += tcrypt_test("cbc(twofish)"); |
791 | ret += tcrypt_test("ctr(twofish)"); | 992 | ret += tcrypt_test("ctr(twofish)"); |
993 | ret += tcrypt_test("lrw(twofish)"); | ||
994 | ret += tcrypt_test("xts(twofish)"); | ||
792 | break; | 995 | break; |
793 | 996 | ||
794 | case 9: | 997 | case 9: |
795 | ret += tcrypt_test("ecb(serpent)"); | 998 | ret += tcrypt_test("ecb(serpent)"); |
999 | ret += tcrypt_test("cbc(serpent)"); | ||
1000 | ret += tcrypt_test("ctr(serpent)"); | ||
1001 | ret += tcrypt_test("lrw(serpent)"); | ||
1002 | ret += tcrypt_test("xts(serpent)"); | ||
796 | break; | 1003 | break; |
797 | 1004 | ||
798 | case 10: | 1005 | case 10: |
@@ -1045,6 +1252,14 @@ static int do_test(int m) | |||
1045 | speed_template_16_24_32); | 1252 | speed_template_16_24_32); |
1046 | test_cipher_speed("ctr(twofish)", DECRYPT, sec, NULL, 0, | 1253 | test_cipher_speed("ctr(twofish)", DECRYPT, sec, NULL, 0, |
1047 | speed_template_16_24_32); | 1254 | speed_template_16_24_32); |
1255 | test_cipher_speed("lrw(twofish)", ENCRYPT, sec, NULL, 0, | ||
1256 | speed_template_32_40_48); | ||
1257 | test_cipher_speed("lrw(twofish)", DECRYPT, sec, NULL, 0, | ||
1258 | speed_template_32_40_48); | ||
1259 | test_cipher_speed("xts(twofish)", ENCRYPT, sec, NULL, 0, | ||
1260 | speed_template_32_48_64); | ||
1261 | test_cipher_speed("xts(twofish)", DECRYPT, sec, NULL, 0, | ||
1262 | speed_template_32_48_64); | ||
1048 | break; | 1263 | break; |
1049 | 1264 | ||
1050 | case 203: | 1265 | case 203: |
@@ -1089,6 +1304,29 @@ static int do_test(int m) | |||
1089 | speed_template_16_32); | 1304 | speed_template_16_32); |
1090 | break; | 1305 | break; |
1091 | 1306 | ||
1307 | case 207: | ||
1308 | test_cipher_speed("ecb(serpent)", ENCRYPT, sec, NULL, 0, | ||
1309 | speed_template_16_32); | ||
1310 | test_cipher_speed("ecb(serpent)", DECRYPT, sec, NULL, 0, | ||
1311 | speed_template_16_32); | ||
1312 | test_cipher_speed("cbc(serpent)", ENCRYPT, sec, NULL, 0, | ||
1313 | speed_template_16_32); | ||
1314 | test_cipher_speed("cbc(serpent)", DECRYPT, sec, NULL, 0, | ||
1315 | speed_template_16_32); | ||
1316 | test_cipher_speed("ctr(serpent)", ENCRYPT, sec, NULL, 0, | ||
1317 | speed_template_16_32); | ||
1318 | test_cipher_speed("ctr(serpent)", DECRYPT, sec, NULL, 0, | ||
1319 | speed_template_16_32); | ||
1320 | test_cipher_speed("lrw(serpent)", ENCRYPT, sec, NULL, 0, | ||
1321 | speed_template_32_48); | ||
1322 | test_cipher_speed("lrw(serpent)", DECRYPT, sec, NULL, 0, | ||
1323 | speed_template_32_48); | ||
1324 | test_cipher_speed("xts(serpent)", ENCRYPT, sec, NULL, 0, | ||
1325 | speed_template_32_64); | ||
1326 | test_cipher_speed("xts(serpent)", DECRYPT, sec, NULL, 0, | ||
1327 | speed_template_32_64); | ||
1328 | break; | ||
1329 | |||
1092 | case 300: | 1330 | case 300: |
1093 | /* fall through */ | 1331 | /* fall through */ |
1094 | 1332 | ||
@@ -1241,6 +1479,78 @@ static int do_test(int m) | |||
1241 | case 499: | 1479 | case 499: |
1242 | break; | 1480 | break; |
1243 | 1481 | ||
1482 | case 500: | ||
1483 | test_acipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, | ||
1484 | speed_template_16_24_32); | ||
1485 | test_acipher_speed("ecb(aes)", DECRYPT, sec, NULL, 0, | ||
1486 | speed_template_16_24_32); | ||
1487 | test_acipher_speed("cbc(aes)", ENCRYPT, sec, NULL, 0, | ||
1488 | speed_template_16_24_32); | ||
1489 | test_acipher_speed("cbc(aes)", DECRYPT, sec, NULL, 0, | ||
1490 | speed_template_16_24_32); | ||
1491 | test_acipher_speed("lrw(aes)", ENCRYPT, sec, NULL, 0, | ||
1492 | speed_template_32_40_48); | ||
1493 | test_acipher_speed("lrw(aes)", DECRYPT, sec, NULL, 0, | ||
1494 | speed_template_32_40_48); | ||
1495 | test_acipher_speed("xts(aes)", ENCRYPT, sec, NULL, 0, | ||
1496 | speed_template_32_48_64); | ||
1497 | test_acipher_speed("xts(aes)", DECRYPT, sec, NULL, 0, | ||
1498 | speed_template_32_48_64); | ||
1499 | test_acipher_speed("ctr(aes)", ENCRYPT, sec, NULL, 0, | ||
1500 | speed_template_16_24_32); | ||
1501 | test_acipher_speed("ctr(aes)", DECRYPT, sec, NULL, 0, | ||
1502 | speed_template_16_24_32); | ||
1503 | break; | ||
1504 | |||
1505 | case 501: | ||
1506 | test_acipher_speed("ecb(des3_ede)", ENCRYPT, sec, | ||
1507 | des3_speed_template, DES3_SPEED_VECTORS, | ||
1508 | speed_template_24); | ||
1509 | test_acipher_speed("ecb(des3_ede)", DECRYPT, sec, | ||
1510 | des3_speed_template, DES3_SPEED_VECTORS, | ||
1511 | speed_template_24); | ||
1512 | test_acipher_speed("cbc(des3_ede)", ENCRYPT, sec, | ||
1513 | des3_speed_template, DES3_SPEED_VECTORS, | ||
1514 | speed_template_24); | ||
1515 | test_acipher_speed("cbc(des3_ede)", DECRYPT, sec, | ||
1516 | des3_speed_template, DES3_SPEED_VECTORS, | ||
1517 | speed_template_24); | ||
1518 | break; | ||
1519 | |||
1520 | case 502: | ||
1521 | test_acipher_speed("ecb(des)", ENCRYPT, sec, NULL, 0, | ||
1522 | speed_template_8); | ||
1523 | test_acipher_speed("ecb(des)", DECRYPT, sec, NULL, 0, | ||
1524 | speed_template_8); | ||
1525 | test_acipher_speed("cbc(des)", ENCRYPT, sec, NULL, 0, | ||
1526 | speed_template_8); | ||
1527 | test_acipher_speed("cbc(des)", DECRYPT, sec, NULL, 0, | ||
1528 | speed_template_8); | ||
1529 | break; | ||
1530 | |||
1531 | case 503: | ||
1532 | test_acipher_speed("ecb(serpent)", ENCRYPT, sec, NULL, 0, | ||
1533 | speed_template_16_32); | ||
1534 | test_acipher_speed("ecb(serpent)", DECRYPT, sec, NULL, 0, | ||
1535 | speed_template_16_32); | ||
1536 | test_acipher_speed("cbc(serpent)", ENCRYPT, sec, NULL, 0, | ||
1537 | speed_template_16_32); | ||
1538 | test_acipher_speed("cbc(serpent)", DECRYPT, sec, NULL, 0, | ||
1539 | speed_template_16_32); | ||
1540 | test_acipher_speed("ctr(serpent)", ENCRYPT, sec, NULL, 0, | ||
1541 | speed_template_16_32); | ||
1542 | test_acipher_speed("ctr(serpent)", DECRYPT, sec, NULL, 0, | ||
1543 | speed_template_16_32); | ||
1544 | test_acipher_speed("lrw(serpent)", ENCRYPT, sec, NULL, 0, | ||
1545 | speed_template_32_48); | ||
1546 | test_acipher_speed("lrw(serpent)", DECRYPT, sec, NULL, 0, | ||
1547 | speed_template_32_48); | ||
1548 | test_acipher_speed("xts(serpent)", ENCRYPT, sec, NULL, 0, | ||
1549 | speed_template_32_64); | ||
1550 | test_acipher_speed("xts(serpent)", DECRYPT, sec, NULL, 0, | ||
1551 | speed_template_32_64); | ||
1552 | break; | ||
1553 | |||
1244 | case 1000: | 1554 | case 1000: |
1245 | test_available(); | 1555 | test_available(); |
1246 | break; | 1556 | break; |
diff --git a/crypto/tcrypt.h b/crypto/tcrypt.h index 10cb925132c9..5be1fc8c1ab3 100644 --- a/crypto/tcrypt.h +++ b/crypto/tcrypt.h | |||
@@ -51,7 +51,9 @@ static u8 speed_template_8_32[] = {8, 32, 0}; | |||
51 | static u8 speed_template_16_32[] = {16, 32, 0}; | 51 | static u8 speed_template_16_32[] = {16, 32, 0}; |
52 | static u8 speed_template_16_24_32[] = {16, 24, 32, 0}; | 52 | static u8 speed_template_16_24_32[] = {16, 24, 32, 0}; |
53 | static u8 speed_template_32_40_48[] = {32, 40, 48, 0}; | 53 | static u8 speed_template_32_40_48[] = {32, 40, 48, 0}; |
54 | static u8 speed_template_32_48[] = {32, 48, 0}; | ||
54 | static u8 speed_template_32_48_64[] = {32, 48, 64, 0}; | 55 | static u8 speed_template_32_48_64[] = {32, 48, 64, 0}; |
56 | static u8 speed_template_32_64[] = {32, 64, 0}; | ||
55 | 57 | ||
56 | /* | 58 | /* |
57 | * Digest speed tests | 59 | * Digest speed tests |
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index e91c1eb1722a..bb54b882d738 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c | |||
@@ -1534,6 +1534,21 @@ static int alg_test_null(const struct alg_test_desc *desc, | |||
1534 | /* Please keep this list sorted by algorithm name. */ | 1534 | /* Please keep this list sorted by algorithm name. */ |
1535 | static const struct alg_test_desc alg_test_descs[] = { | 1535 | static const struct alg_test_desc alg_test_descs[] = { |
1536 | { | 1536 | { |
1537 | .alg = "__cbc-serpent-sse2", | ||
1538 | .test = alg_test_null, | ||
1539 | .suite = { | ||
1540 | .cipher = { | ||
1541 | .enc = { | ||
1542 | .vecs = NULL, | ||
1543 | .count = 0 | ||
1544 | }, | ||
1545 | .dec = { | ||
1546 | .vecs = NULL, | ||
1547 | .count = 0 | ||
1548 | } | ||
1549 | } | ||
1550 | } | ||
1551 | }, { | ||
1537 | .alg = "__driver-cbc-aes-aesni", | 1552 | .alg = "__driver-cbc-aes-aesni", |
1538 | .test = alg_test_null, | 1553 | .test = alg_test_null, |
1539 | .suite = { | 1554 | .suite = { |
@@ -1549,6 +1564,21 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
1549 | } | 1564 | } |
1550 | } | 1565 | } |
1551 | }, { | 1566 | }, { |
1567 | .alg = "__driver-cbc-serpent-sse2", | ||
1568 | .test = alg_test_null, | ||
1569 | .suite = { | ||
1570 | .cipher = { | ||
1571 | .enc = { | ||
1572 | .vecs = NULL, | ||
1573 | .count = 0 | ||
1574 | }, | ||
1575 | .dec = { | ||
1576 | .vecs = NULL, | ||
1577 | .count = 0 | ||
1578 | } | ||
1579 | } | ||
1580 | } | ||
1581 | }, { | ||
1552 | .alg = "__driver-ecb-aes-aesni", | 1582 | .alg = "__driver-ecb-aes-aesni", |
1553 | .test = alg_test_null, | 1583 | .test = alg_test_null, |
1554 | .suite = { | 1584 | .suite = { |
@@ -1564,6 +1594,21 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
1564 | } | 1594 | } |
1565 | } | 1595 | } |
1566 | }, { | 1596 | }, { |
1597 | .alg = "__driver-ecb-serpent-sse2", | ||
1598 | .test = alg_test_null, | ||
1599 | .suite = { | ||
1600 | .cipher = { | ||
1601 | .enc = { | ||
1602 | .vecs = NULL, | ||
1603 | .count = 0 | ||
1604 | }, | ||
1605 | .dec = { | ||
1606 | .vecs = NULL, | ||
1607 | .count = 0 | ||
1608 | } | ||
1609 | } | ||
1610 | } | ||
1611 | }, { | ||
1567 | .alg = "__ghash-pclmulqdqni", | 1612 | .alg = "__ghash-pclmulqdqni", |
1568 | .test = alg_test_null, | 1613 | .test = alg_test_null, |
1569 | .suite = { | 1614 | .suite = { |
@@ -1675,6 +1720,21 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
1675 | } | 1720 | } |
1676 | } | 1721 | } |
1677 | }, { | 1722 | }, { |
1723 | .alg = "cbc(serpent)", | ||
1724 | .test = alg_test_skcipher, | ||
1725 | .suite = { | ||
1726 | .cipher = { | ||
1727 | .enc = { | ||
1728 | .vecs = serpent_cbc_enc_tv_template, | ||
1729 | .count = SERPENT_CBC_ENC_TEST_VECTORS | ||
1730 | }, | ||
1731 | .dec = { | ||
1732 | .vecs = serpent_cbc_dec_tv_template, | ||
1733 | .count = SERPENT_CBC_DEC_TEST_VECTORS | ||
1734 | } | ||
1735 | } | ||
1736 | } | ||
1737 | }, { | ||
1678 | .alg = "cbc(twofish)", | 1738 | .alg = "cbc(twofish)", |
1679 | .test = alg_test_skcipher, | 1739 | .test = alg_test_skcipher, |
1680 | .suite = { | 1740 | .suite = { |
@@ -1731,6 +1791,21 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
1731 | } | 1791 | } |
1732 | } | 1792 | } |
1733 | }, { | 1793 | }, { |
1794 | .alg = "cryptd(__driver-ecb-serpent-sse2)", | ||
1795 | .test = alg_test_null, | ||
1796 | .suite = { | ||
1797 | .cipher = { | ||
1798 | .enc = { | ||
1799 | .vecs = NULL, | ||
1800 | .count = 0 | ||
1801 | }, | ||
1802 | .dec = { | ||
1803 | .vecs = NULL, | ||
1804 | .count = 0 | ||
1805 | } | ||
1806 | } | ||
1807 | } | ||
1808 | }, { | ||
1734 | .alg = "cryptd(__ghash-pclmulqdqni)", | 1809 | .alg = "cryptd(__ghash-pclmulqdqni)", |
1735 | .test = alg_test_null, | 1810 | .test = alg_test_null, |
1736 | .suite = { | 1811 | .suite = { |
@@ -1771,6 +1846,21 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
1771 | } | 1846 | } |
1772 | } | 1847 | } |
1773 | }, { | 1848 | }, { |
1849 | .alg = "ctr(serpent)", | ||
1850 | .test = alg_test_skcipher, | ||
1851 | .suite = { | ||
1852 | .cipher = { | ||
1853 | .enc = { | ||
1854 | .vecs = serpent_ctr_enc_tv_template, | ||
1855 | .count = SERPENT_CTR_ENC_TEST_VECTORS | ||
1856 | }, | ||
1857 | .dec = { | ||
1858 | .vecs = serpent_ctr_dec_tv_template, | ||
1859 | .count = SERPENT_CTR_DEC_TEST_VECTORS | ||
1860 | } | ||
1861 | } | ||
1862 | } | ||
1863 | }, { | ||
1774 | .alg = "ctr(twofish)", | 1864 | .alg = "ctr(twofish)", |
1775 | .test = alg_test_skcipher, | 1865 | .test = alg_test_skcipher, |
1776 | .suite = { | 1866 | .suite = { |
@@ -2207,6 +2297,36 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
2207 | } | 2297 | } |
2208 | } | 2298 | } |
2209 | }, { | 2299 | }, { |
2300 | .alg = "lrw(serpent)", | ||
2301 | .test = alg_test_skcipher, | ||
2302 | .suite = { | ||
2303 | .cipher = { | ||
2304 | .enc = { | ||
2305 | .vecs = serpent_lrw_enc_tv_template, | ||
2306 | .count = SERPENT_LRW_ENC_TEST_VECTORS | ||
2307 | }, | ||
2308 | .dec = { | ||
2309 | .vecs = serpent_lrw_dec_tv_template, | ||
2310 | .count = SERPENT_LRW_DEC_TEST_VECTORS | ||
2311 | } | ||
2312 | } | ||
2313 | } | ||
2314 | }, { | ||
2315 | .alg = "lrw(twofish)", | ||
2316 | .test = alg_test_skcipher, | ||
2317 | .suite = { | ||
2318 | .cipher = { | ||
2319 | .enc = { | ||
2320 | .vecs = tf_lrw_enc_tv_template, | ||
2321 | .count = TF_LRW_ENC_TEST_VECTORS | ||
2322 | }, | ||
2323 | .dec = { | ||
2324 | .vecs = tf_lrw_dec_tv_template, | ||
2325 | .count = TF_LRW_DEC_TEST_VECTORS | ||
2326 | } | ||
2327 | } | ||
2328 | } | ||
2329 | }, { | ||
2210 | .alg = "lzo", | 2330 | .alg = "lzo", |
2211 | .test = alg_test_comp, | 2331 | .test = alg_test_comp, |
2212 | .suite = { | 2332 | .suite = { |
@@ -2514,6 +2634,36 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
2514 | } | 2634 | } |
2515 | } | 2635 | } |
2516 | }, { | 2636 | }, { |
2637 | .alg = "xts(serpent)", | ||
2638 | .test = alg_test_skcipher, | ||
2639 | .suite = { | ||
2640 | .cipher = { | ||
2641 | .enc = { | ||
2642 | .vecs = serpent_xts_enc_tv_template, | ||
2643 | .count = SERPENT_XTS_ENC_TEST_VECTORS | ||
2644 | }, | ||
2645 | .dec = { | ||
2646 | .vecs = serpent_xts_dec_tv_template, | ||
2647 | .count = SERPENT_XTS_DEC_TEST_VECTORS | ||
2648 | } | ||
2649 | } | ||
2650 | } | ||
2651 | }, { | ||
2652 | .alg = "xts(twofish)", | ||
2653 | .test = alg_test_skcipher, | ||
2654 | .suite = { | ||
2655 | .cipher = { | ||
2656 | .enc = { | ||
2657 | .vecs = tf_xts_enc_tv_template, | ||
2658 | .count = TF_XTS_ENC_TEST_VECTORS | ||
2659 | }, | ||
2660 | .dec = { | ||
2661 | .vecs = tf_xts_dec_tv_template, | ||
2662 | .count = TF_XTS_DEC_TEST_VECTORS | ||
2663 | } | ||
2664 | } | ||
2665 | } | ||
2666 | }, { | ||
2517 | .alg = "zlib", | 2667 | .alg = "zlib", |
2518 | .test = alg_test_pcomp, | 2668 | .test = alg_test_pcomp, |
2519 | .suite = { | 2669 | .suite = { |
diff --git a/crypto/testmgr.h b/crypto/testmgr.h index 37b4d8f45447..43e84d32b341 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h | |||
@@ -2717,6 +2717,10 @@ static struct cipher_testvec bf_ctr_dec_tv_template[] = { | |||
2717 | #define TF_CBC_DEC_TEST_VECTORS 5 | 2717 | #define TF_CBC_DEC_TEST_VECTORS 5 |
2718 | #define TF_CTR_ENC_TEST_VECTORS 2 | 2718 | #define TF_CTR_ENC_TEST_VECTORS 2 |
2719 | #define TF_CTR_DEC_TEST_VECTORS 2 | 2719 | #define TF_CTR_DEC_TEST_VECTORS 2 |
2720 | #define TF_LRW_ENC_TEST_VECTORS 8 | ||
2721 | #define TF_LRW_DEC_TEST_VECTORS 8 | ||
2722 | #define TF_XTS_ENC_TEST_VECTORS 5 | ||
2723 | #define TF_XTS_DEC_TEST_VECTORS 5 | ||
2720 | 2724 | ||
2721 | static struct cipher_testvec tf_enc_tv_template[] = { | 2725 | static struct cipher_testvec tf_enc_tv_template[] = { |
2722 | { | 2726 | { |
@@ -3092,16 +3096,1206 @@ static struct cipher_testvec tf_ctr_dec_tv_template[] = { | |||
3092 | }, | 3096 | }, |
3093 | }; | 3097 | }; |
3094 | 3098 | ||
3099 | static struct cipher_testvec tf_lrw_enc_tv_template[] = { | ||
3100 | /* Generated from AES-LRW test vectors */ | ||
3101 | { | ||
3102 | .key = "\x45\x62\xac\x25\xf8\x28\x17\x6d" | ||
3103 | "\x4c\x26\x84\x14\xb5\x68\x01\x85" | ||
3104 | "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03" | ||
3105 | "\xee\x5a\x83\x0c\xcc\x09\x4c\x87", | ||
3106 | .klen = 32, | ||
3107 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3108 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
3109 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3110 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
3111 | .ilen = 16, | ||
3112 | .result = "\xa1\x6c\x50\x69\x26\xa4\xef\x7b" | ||
3113 | "\x7c\xc6\x91\xeb\x72\xdd\x9b\xee", | ||
3114 | .rlen = 16, | ||
3115 | }, { | ||
3116 | .key = "\x59\x70\x47\x14\xf5\x57\x47\x8c" | ||
3117 | "\xd7\x79\xe8\x0f\x54\x88\x79\x44" | ||
3118 | "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea" | ||
3119 | "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf", | ||
3120 | .klen = 32, | ||
3121 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3122 | "\x00\x00\x00\x00\x00\x00\x00\x02", | ||
3123 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3124 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
3125 | .ilen = 16, | ||
3126 | .result = "\xab\x72\x0a\xad\x3b\x0c\xf0\xc9" | ||
3127 | "\x42\x2f\xf1\xae\xf1\x3c\xb1\xbd", | ||
3128 | .rlen = 16, | ||
3129 | }, { | ||
3130 | .key = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50" | ||
3131 | "\x30\xfe\x69\xe2\x37\x7f\x98\x47" | ||
3132 | "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6" | ||
3133 | "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f", | ||
3134 | .klen = 32, | ||
3135 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3136 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
3137 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3138 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
3139 | .ilen = 16, | ||
3140 | .result = "\x85\xa7\x56\x67\x08\xfa\x42\xe1" | ||
3141 | "\x22\xe6\x82\xfc\xd9\xb4\xd7\xd4", | ||
3142 | .rlen = 16, | ||
3143 | }, { | ||
3144 | .key = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15" | ||
3145 | "\x25\x83\xf7\x3c\x1f\x01\x28\x74" | ||
3146 | "\xca\xc6\xbc\x35\x4d\x4a\x65\x54" | ||
3147 | "\x90\xae\x61\xcf\x7b\xae\xbd\xcc" | ||
3148 | "\xad\xe4\x94\xc5\x4a\x29\xae\x70", | ||
3149 | .klen = 40, | ||
3150 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3151 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
3152 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3153 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
3154 | .ilen = 16, | ||
3155 | .result = "\xd2\xaf\x69\x35\x24\x1d\x0e\x1c" | ||
3156 | "\x84\x8b\x05\xe4\xa2\x2f\x16\xf5", | ||
3157 | .rlen = 16, | ||
3158 | }, { | ||
3159 | .key = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff" | ||
3160 | "\xf8\x86\xce\xac\x93\xc5\xad\xc6" | ||
3161 | "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd" | ||
3162 | "\x52\x13\xb2\xb7\xf0\xff\x11\xd8" | ||
3163 | "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f", | ||
3164 | .klen = 40, | ||
3165 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3166 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
3167 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3168 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
3169 | .ilen = 16, | ||
3170 | .result = "\x4a\x23\x56\xd7\xff\x90\xd0\x9a" | ||
3171 | "\x0d\x7c\x26\xfc\xf0\xf0\xf6\xe4", | ||
3172 | .rlen = 16, | ||
3173 | }, { | ||
3174 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
3175 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
3176 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
3177 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
3178 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
3179 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
3180 | .klen = 48, | ||
3181 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3182 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
3183 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3184 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
3185 | .ilen = 16, | ||
3186 | .result = "\x30\xaf\x26\x05\x9d\x5d\x0a\x58" | ||
3187 | "\xe2\xe7\xce\x8a\xb2\x56\x6d\x76", | ||
3188 | .rlen = 16, | ||
3189 | }, { | ||
3190 | .key = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d" | ||
3191 | "\xd4\x70\x98\x0b\xc7\x95\x84\xc8" | ||
3192 | "\xb2\xfb\x64\xce\x60\x97\x87\x8d" | ||
3193 | "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7" | ||
3194 | "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4" | ||
3195 | "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c", | ||
3196 | .klen = 48, | ||
3197 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3198 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
3199 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3200 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
3201 | .ilen = 16, | ||
3202 | .result = "\xdf\xcf\xdc\xd2\xe1\xcf\x86\x75" | ||
3203 | "\x17\x66\x5e\x0c\x14\xa1\x3d\x40", | ||
3204 | .rlen = 16, | ||
3205 | }, { | ||
3206 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
3207 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
3208 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
3209 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
3210 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
3211 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
3212 | .klen = 48, | ||
3213 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3214 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
3215 | .input = "\x05\x11\xb7\x18\xab\xc6\x2d\xac" | ||
3216 | "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c" | ||
3217 | "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8" | ||
3218 | "\x50\x38\x1f\x71\x49\xb6\x57\xd6" | ||
3219 | "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90" | ||
3220 | "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6" | ||
3221 | "\xad\x1e\x9e\x20\x5f\x38\xbe\x04" | ||
3222 | "\xda\x10\x8e\xed\xa2\xa4\x87\xab" | ||
3223 | "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c" | ||
3224 | "\xc9\xac\x42\x31\x95\x7c\xc9\x04" | ||
3225 | "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6" | ||
3226 | "\x15\xd7\x3f\x4f\x2f\x66\x69\x03" | ||
3227 | "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65" | ||
3228 | "\x4c\x96\x12\xed\x7c\x92\x03\x01" | ||
3229 | "\x6f\xbc\x35\x93\xac\xf1\x27\xf1" | ||
3230 | "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50" | ||
3231 | "\x89\xa4\x8e\x66\x44\x85\xcc\xfd" | ||
3232 | "\x33\x14\x70\xe3\x96\xb2\xc3\xd3" | ||
3233 | "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5" | ||
3234 | "\x2d\x64\x75\xdd\xb4\x54\xe6\x74" | ||
3235 | "\x8c\xd3\x9d\x9e\x86\xab\x51\x53" | ||
3236 | "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40" | ||
3237 | "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5" | ||
3238 | "\x76\x12\x73\x44\x1a\x56\xd7\x72" | ||
3239 | "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda" | ||
3240 | "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd" | ||
3241 | "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60" | ||
3242 | "\x1a\xe2\x70\x85\x58\xc2\x1b\x09" | ||
3243 | "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9" | ||
3244 | "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8" | ||
3245 | "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8" | ||
3246 | "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10" | ||
3247 | "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1" | ||
3248 | "\x90\x3e\x76\x4a\x74\xa4\x21\x2c" | ||
3249 | "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e" | ||
3250 | "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f" | ||
3251 | "\x8d\x23\x31\x74\x84\xeb\x88\x6e" | ||
3252 | "\xcc\xb9\xbc\x22\x83\x19\x07\x22" | ||
3253 | "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78" | ||
3254 | "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5" | ||
3255 | "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41" | ||
3256 | "\x3c\xce\x8f\x42\x60\x71\xa7\x75" | ||
3257 | "\x08\x40\x65\x8a\x82\xbf\xf5\x43" | ||
3258 | "\x71\x96\xa9\x4d\x44\x8a\x20\xbe" | ||
3259 | "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65" | ||
3260 | "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9" | ||
3261 | "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4" | ||
3262 | "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a" | ||
3263 | "\x62\x73\x65\xfd\x46\x63\x25\x3d" | ||
3264 | "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf" | ||
3265 | "\x24\xf3\xb4\xac\x64\xba\xdf\x4b" | ||
3266 | "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7" | ||
3267 | "\xc5\x68\x77\x84\x32\x2b\xcc\x85" | ||
3268 | "\x74\x96\xf0\x12\x77\x61\xb9\xeb" | ||
3269 | "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8" | ||
3270 | "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24" | ||
3271 | "\xda\x39\x87\x45\xc0\x2b\xbb\x01" | ||
3272 | "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce" | ||
3273 | "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6" | ||
3274 | "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32" | ||
3275 | "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45" | ||
3276 | "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6" | ||
3277 | "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4" | ||
3278 | "\x21\xc4\xc2\x75\x67\x89\x37\x0a", | ||
3279 | .ilen = 512, | ||
3280 | .result = "\x30\x38\xeb\xaf\x12\x43\x1a\x89" | ||
3281 | "\x62\xa2\x36\xe5\xcf\x77\x1e\xd9" | ||
3282 | "\x08\xc3\x0d\xdd\x95\xab\x19\x96" | ||
3283 | "\x27\x52\x41\xc3\xca\xfb\xf6\xee" | ||
3284 | "\x40\x2d\xdf\xdd\x00\x0c\xb9\x0a" | ||
3285 | "\x3a\xf0\xc0\xd1\xda\x63\x9e\x45" | ||
3286 | "\x42\xe9\x29\xc0\xb4\x07\xb4\x31" | ||
3287 | "\x66\x77\x72\xb5\xb6\xb3\x57\x46" | ||
3288 | "\x34\x9a\xfe\x03\xaf\x6b\x36\x07" | ||
3289 | "\x63\x8e\xc2\x5d\xa6\x0f\xb6\x7d" | ||
3290 | "\xfb\x6d\x82\x51\xb6\x98\xd0\x71" | ||
3291 | "\xe7\x10\x7a\xdf\xb2\xbd\xf1\x1d" | ||
3292 | "\x72\x2b\x54\x13\xe3\x6d\x79\x37" | ||
3293 | "\xa9\x39\x2c\xdf\x21\xab\x87\xd5" | ||
3294 | "\xee\xef\x9a\x12\x50\x39\x2e\x1b" | ||
3295 | "\x7d\xe6\x6a\x27\x48\xb9\xe7\xac" | ||
3296 | "\xaa\xcd\x79\x5f\xf2\xf3\xa0\x08" | ||
3297 | "\x6f\x2c\xf4\x0e\xd1\xb8\x89\x25" | ||
3298 | "\x31\x9d\xef\xb1\x1d\x27\x55\x04" | ||
3299 | "\xc9\x8c\xb7\x68\xdc\xb6\x67\x8a" | ||
3300 | "\xdb\xcf\x22\xf2\x3b\x6f\xce\xbb" | ||
3301 | "\x26\xbe\x4f\x27\x04\x42\xd1\x44" | ||
3302 | "\x4c\x08\xa3\x95\x4c\x7f\x1a\xaf" | ||
3303 | "\x1d\x28\x14\xfd\xb1\x1a\x34\x18" | ||
3304 | "\xf5\x1e\x28\x69\x95\x6a\x5a\xba" | ||
3305 | "\x8e\xb2\x58\x1d\x28\x17\x13\x3d" | ||
3306 | "\x38\x7d\x14\x8d\xab\x5d\xf9\xe8" | ||
3307 | "\x3c\x0f\x2b\x0d\x2b\x08\xb4\x4b" | ||
3308 | "\x6b\x0d\xc8\xa7\x84\xc2\x3a\x1a" | ||
3309 | "\xb7\xbd\xda\x92\x29\xb8\x5b\x5a" | ||
3310 | "\x63\xa5\x99\x82\x09\x72\x8f\xc6" | ||
3311 | "\xa4\x62\x24\x69\x8c\x2d\x26\x00" | ||
3312 | "\x99\x83\x91\xd6\xc6\xcf\x57\x67" | ||
3313 | "\x38\xea\xf2\xfc\x29\xe0\x73\x39" | ||
3314 | "\xf9\x13\x94\x6d\xe2\x58\x28\x75" | ||
3315 | "\x3e\xae\x71\x90\x07\x70\x1c\x38" | ||
3316 | "\x5b\x4c\x1e\xb5\xa5\x3b\x20\xef" | ||
3317 | "\xb1\x4c\x3e\x1a\x72\x62\xbb\x22" | ||
3318 | "\x82\x09\xe3\x18\x3f\x4f\x48\xfc" | ||
3319 | "\xdd\xac\xfc\xb6\x09\xdb\xd2\x7b" | ||
3320 | "\xd6\xb7\x7e\x41\x2f\x14\xf5\x0e" | ||
3321 | "\xc3\xac\x4a\xed\xe7\x82\xef\x31" | ||
3322 | "\x1f\x1a\x51\x1e\x29\x60\xc8\x98" | ||
3323 | "\x93\x51\x1d\x3d\x62\x59\x83\x82" | ||
3324 | "\x0c\xf1\xd7\x8d\xac\x33\x44\x81" | ||
3325 | "\x3c\x59\xb7\xd4\x5b\x65\x82\xc4" | ||
3326 | "\xec\xdc\x24\xfd\x0e\x1a\x79\x94" | ||
3327 | "\x34\xb0\x62\xfa\x98\x49\x26\x1f" | ||
3328 | "\xf4\x9e\x40\x44\x5b\x1f\xf8\xbe" | ||
3329 | "\x36\xff\xc6\xc6\x9d\xf2\xd6\xcc" | ||
3330 | "\x63\x93\x29\xb9\x0b\x6d\xd7\x6c" | ||
3331 | "\xdb\xf6\x21\x80\xf7\x5a\x37\x15" | ||
3332 | "\x0c\xe3\x36\xc8\x74\x75\x20\x91" | ||
3333 | "\xdf\x52\x2d\x0c\xe7\x45\xff\x46" | ||
3334 | "\xb3\xf4\xec\xc2\xbd\xd3\x37\xb6" | ||
3335 | "\x26\xa2\x5d\x7d\x61\xbf\x10\x46" | ||
3336 | "\x57\x8d\x05\x96\x70\x0b\xd6\x41" | ||
3337 | "\x5c\xe9\xd3\x54\x81\x39\x3a\xdd" | ||
3338 | "\x5f\x92\x81\x6e\x35\x03\xd4\x72" | ||
3339 | "\x3d\x5a\xe7\xb9\x3b\x0c\x84\x23" | ||
3340 | "\x45\x5d\xec\x72\xc1\x52\xef\x2e" | ||
3341 | "\x81\x00\xd3\xfe\x4c\x3c\x05\x61" | ||
3342 | "\x80\x18\xc4\x6c\x03\xd3\xb7\xba" | ||
3343 | "\x11\xd7\xb8\x6e\xea\xe1\x80\x30", | ||
3344 | .rlen = 512, | ||
3345 | }, | ||
3346 | }; | ||
3347 | |||
3348 | static struct cipher_testvec tf_lrw_dec_tv_template[] = { | ||
3349 | /* Generated from AES-LRW test vectors */ | ||
3350 | /* same as enc vectors with input and result reversed */ | ||
3351 | { | ||
3352 | .key = "\x45\x62\xac\x25\xf8\x28\x17\x6d" | ||
3353 | "\x4c\x26\x84\x14\xb5\x68\x01\x85" | ||
3354 | "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03" | ||
3355 | "\xee\x5a\x83\x0c\xcc\x09\x4c\x87", | ||
3356 | .klen = 32, | ||
3357 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3358 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
3359 | .input = "\xa1\x6c\x50\x69\x26\xa4\xef\x7b" | ||
3360 | "\x7c\xc6\x91\xeb\x72\xdd\x9b\xee", | ||
3361 | .ilen = 16, | ||
3362 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3363 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
3364 | .rlen = 16, | ||
3365 | }, { | ||
3366 | .key = "\x59\x70\x47\x14\xf5\x57\x47\x8c" | ||
3367 | "\xd7\x79\xe8\x0f\x54\x88\x79\x44" | ||
3368 | "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea" | ||
3369 | "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf", | ||
3370 | .klen = 32, | ||
3371 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3372 | "\x00\x00\x00\x00\x00\x00\x00\x02", | ||
3373 | .input = "\xab\x72\x0a\xad\x3b\x0c\xf0\xc9" | ||
3374 | "\x42\x2f\xf1\xae\xf1\x3c\xb1\xbd", | ||
3375 | .ilen = 16, | ||
3376 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3377 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
3378 | .rlen = 16, | ||
3379 | }, { | ||
3380 | .key = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50" | ||
3381 | "\x30\xfe\x69\xe2\x37\x7f\x98\x47" | ||
3382 | "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6" | ||
3383 | "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f", | ||
3384 | .klen = 32, | ||
3385 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3386 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
3387 | .input = "\x85\xa7\x56\x67\x08\xfa\x42\xe1" | ||
3388 | "\x22\xe6\x82\xfc\xd9\xb4\xd7\xd4", | ||
3389 | .ilen = 16, | ||
3390 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3391 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
3392 | .rlen = 16, | ||
3393 | }, { | ||
3394 | .key = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15" | ||
3395 | "\x25\x83\xf7\x3c\x1f\x01\x28\x74" | ||
3396 | "\xca\xc6\xbc\x35\x4d\x4a\x65\x54" | ||
3397 | "\x90\xae\x61\xcf\x7b\xae\xbd\xcc" | ||
3398 | "\xad\xe4\x94\xc5\x4a\x29\xae\x70", | ||
3399 | .klen = 40, | ||
3400 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3401 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
3402 | .input = "\xd2\xaf\x69\x35\x24\x1d\x0e\x1c" | ||
3403 | "\x84\x8b\x05\xe4\xa2\x2f\x16\xf5", | ||
3404 | .ilen = 16, | ||
3405 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3406 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
3407 | .rlen = 16, | ||
3408 | }, { | ||
3409 | .key = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff" | ||
3410 | "\xf8\x86\xce\xac\x93\xc5\xad\xc6" | ||
3411 | "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd" | ||
3412 | "\x52\x13\xb2\xb7\xf0\xff\x11\xd8" | ||
3413 | "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f", | ||
3414 | .klen = 40, | ||
3415 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3416 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
3417 | .input = "\x4a\x23\x56\xd7\xff\x90\xd0\x9a" | ||
3418 | "\x0d\x7c\x26\xfc\xf0\xf0\xf6\xe4", | ||
3419 | .ilen = 16, | ||
3420 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3421 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
3422 | .rlen = 16, | ||
3423 | }, { | ||
3424 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
3425 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
3426 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
3427 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
3428 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
3429 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
3430 | .klen = 48, | ||
3431 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3432 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
3433 | .input = "\x30\xaf\x26\x05\x9d\x5d\x0a\x58" | ||
3434 | "\xe2\xe7\xce\x8a\xb2\x56\x6d\x76", | ||
3435 | .ilen = 16, | ||
3436 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3437 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
3438 | .rlen = 16, | ||
3439 | }, { | ||
3440 | .key = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d" | ||
3441 | "\xd4\x70\x98\x0b\xc7\x95\x84\xc8" | ||
3442 | "\xb2\xfb\x64\xce\x60\x97\x87\x8d" | ||
3443 | "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7" | ||
3444 | "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4" | ||
3445 | "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c", | ||
3446 | .klen = 48, | ||
3447 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3448 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
3449 | .input = "\xdf\xcf\xdc\xd2\xe1\xcf\x86\x75" | ||
3450 | "\x17\x66\x5e\x0c\x14\xa1\x3d\x40", | ||
3451 | .ilen = 16, | ||
3452 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3453 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
3454 | .rlen = 16, | ||
3455 | }, { | ||
3456 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
3457 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
3458 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
3459 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
3460 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
3461 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
3462 | .klen = 48, | ||
3463 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3464 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
3465 | .input = "\x30\x38\xeb\xaf\x12\x43\x1a\x89" | ||
3466 | "\x62\xa2\x36\xe5\xcf\x77\x1e\xd9" | ||
3467 | "\x08\xc3\x0d\xdd\x95\xab\x19\x96" | ||
3468 | "\x27\x52\x41\xc3\xca\xfb\xf6\xee" | ||
3469 | "\x40\x2d\xdf\xdd\x00\x0c\xb9\x0a" | ||
3470 | "\x3a\xf0\xc0\xd1\xda\x63\x9e\x45" | ||
3471 | "\x42\xe9\x29\xc0\xb4\x07\xb4\x31" | ||
3472 | "\x66\x77\x72\xb5\xb6\xb3\x57\x46" | ||
3473 | "\x34\x9a\xfe\x03\xaf\x6b\x36\x07" | ||
3474 | "\x63\x8e\xc2\x5d\xa6\x0f\xb6\x7d" | ||
3475 | "\xfb\x6d\x82\x51\xb6\x98\xd0\x71" | ||
3476 | "\xe7\x10\x7a\xdf\xb2\xbd\xf1\x1d" | ||
3477 | "\x72\x2b\x54\x13\xe3\x6d\x79\x37" | ||
3478 | "\xa9\x39\x2c\xdf\x21\xab\x87\xd5" | ||
3479 | "\xee\xef\x9a\x12\x50\x39\x2e\x1b" | ||
3480 | "\x7d\xe6\x6a\x27\x48\xb9\xe7\xac" | ||
3481 | "\xaa\xcd\x79\x5f\xf2\xf3\xa0\x08" | ||
3482 | "\x6f\x2c\xf4\x0e\xd1\xb8\x89\x25" | ||
3483 | "\x31\x9d\xef\xb1\x1d\x27\x55\x04" | ||
3484 | "\xc9\x8c\xb7\x68\xdc\xb6\x67\x8a" | ||
3485 | "\xdb\xcf\x22\xf2\x3b\x6f\xce\xbb" | ||
3486 | "\x26\xbe\x4f\x27\x04\x42\xd1\x44" | ||
3487 | "\x4c\x08\xa3\x95\x4c\x7f\x1a\xaf" | ||
3488 | "\x1d\x28\x14\xfd\xb1\x1a\x34\x18" | ||
3489 | "\xf5\x1e\x28\x69\x95\x6a\x5a\xba" | ||
3490 | "\x8e\xb2\x58\x1d\x28\x17\x13\x3d" | ||
3491 | "\x38\x7d\x14\x8d\xab\x5d\xf9\xe8" | ||
3492 | "\x3c\x0f\x2b\x0d\x2b\x08\xb4\x4b" | ||
3493 | "\x6b\x0d\xc8\xa7\x84\xc2\x3a\x1a" | ||
3494 | "\xb7\xbd\xda\x92\x29\xb8\x5b\x5a" | ||
3495 | "\x63\xa5\x99\x82\x09\x72\x8f\xc6" | ||
3496 | "\xa4\x62\x24\x69\x8c\x2d\x26\x00" | ||
3497 | "\x99\x83\x91\xd6\xc6\xcf\x57\x67" | ||
3498 | "\x38\xea\xf2\xfc\x29\xe0\x73\x39" | ||
3499 | "\xf9\x13\x94\x6d\xe2\x58\x28\x75" | ||
3500 | "\x3e\xae\x71\x90\x07\x70\x1c\x38" | ||
3501 | "\x5b\x4c\x1e\xb5\xa5\x3b\x20\xef" | ||
3502 | "\xb1\x4c\x3e\x1a\x72\x62\xbb\x22" | ||
3503 | "\x82\x09\xe3\x18\x3f\x4f\x48\xfc" | ||
3504 | "\xdd\xac\xfc\xb6\x09\xdb\xd2\x7b" | ||
3505 | "\xd6\xb7\x7e\x41\x2f\x14\xf5\x0e" | ||
3506 | "\xc3\xac\x4a\xed\xe7\x82\xef\x31" | ||
3507 | "\x1f\x1a\x51\x1e\x29\x60\xc8\x98" | ||
3508 | "\x93\x51\x1d\x3d\x62\x59\x83\x82" | ||
3509 | "\x0c\xf1\xd7\x8d\xac\x33\x44\x81" | ||
3510 | "\x3c\x59\xb7\xd4\x5b\x65\x82\xc4" | ||
3511 | "\xec\xdc\x24\xfd\x0e\x1a\x79\x94" | ||
3512 | "\x34\xb0\x62\xfa\x98\x49\x26\x1f" | ||
3513 | "\xf4\x9e\x40\x44\x5b\x1f\xf8\xbe" | ||
3514 | "\x36\xff\xc6\xc6\x9d\xf2\xd6\xcc" | ||
3515 | "\x63\x93\x29\xb9\x0b\x6d\xd7\x6c" | ||
3516 | "\xdb\xf6\x21\x80\xf7\x5a\x37\x15" | ||
3517 | "\x0c\xe3\x36\xc8\x74\x75\x20\x91" | ||
3518 | "\xdf\x52\x2d\x0c\xe7\x45\xff\x46" | ||
3519 | "\xb3\xf4\xec\xc2\xbd\xd3\x37\xb6" | ||
3520 | "\x26\xa2\x5d\x7d\x61\xbf\x10\x46" | ||
3521 | "\x57\x8d\x05\x96\x70\x0b\xd6\x41" | ||
3522 | "\x5c\xe9\xd3\x54\x81\x39\x3a\xdd" | ||
3523 | "\x5f\x92\x81\x6e\x35\x03\xd4\x72" | ||
3524 | "\x3d\x5a\xe7\xb9\x3b\x0c\x84\x23" | ||
3525 | "\x45\x5d\xec\x72\xc1\x52\xef\x2e" | ||
3526 | "\x81\x00\xd3\xfe\x4c\x3c\x05\x61" | ||
3527 | "\x80\x18\xc4\x6c\x03\xd3\xb7\xba" | ||
3528 | "\x11\xd7\xb8\x6e\xea\xe1\x80\x30", | ||
3529 | .ilen = 512, | ||
3530 | .result = "\x05\x11\xb7\x18\xab\xc6\x2d\xac" | ||
3531 | "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c" | ||
3532 | "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8" | ||
3533 | "\x50\x38\x1f\x71\x49\xb6\x57\xd6" | ||
3534 | "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90" | ||
3535 | "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6" | ||
3536 | "\xad\x1e\x9e\x20\x5f\x38\xbe\x04" | ||
3537 | "\xda\x10\x8e\xed\xa2\xa4\x87\xab" | ||
3538 | "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c" | ||
3539 | "\xc9\xac\x42\x31\x95\x7c\xc9\x04" | ||
3540 | "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6" | ||
3541 | "\x15\xd7\x3f\x4f\x2f\x66\x69\x03" | ||
3542 | "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65" | ||
3543 | "\x4c\x96\x12\xed\x7c\x92\x03\x01" | ||
3544 | "\x6f\xbc\x35\x93\xac\xf1\x27\xf1" | ||
3545 | "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50" | ||
3546 | "\x89\xa4\x8e\x66\x44\x85\xcc\xfd" | ||
3547 | "\x33\x14\x70\xe3\x96\xb2\xc3\xd3" | ||
3548 | "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5" | ||
3549 | "\x2d\x64\x75\xdd\xb4\x54\xe6\x74" | ||
3550 | "\x8c\xd3\x9d\x9e\x86\xab\x51\x53" | ||
3551 | "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40" | ||
3552 | "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5" | ||
3553 | "\x76\x12\x73\x44\x1a\x56\xd7\x72" | ||
3554 | "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda" | ||
3555 | "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd" | ||
3556 | "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60" | ||
3557 | "\x1a\xe2\x70\x85\x58\xc2\x1b\x09" | ||
3558 | "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9" | ||
3559 | "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8" | ||
3560 | "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8" | ||
3561 | "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10" | ||
3562 | "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1" | ||
3563 | "\x90\x3e\x76\x4a\x74\xa4\x21\x2c" | ||
3564 | "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e" | ||
3565 | "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f" | ||
3566 | "\x8d\x23\x31\x74\x84\xeb\x88\x6e" | ||
3567 | "\xcc\xb9\xbc\x22\x83\x19\x07\x22" | ||
3568 | "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78" | ||
3569 | "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5" | ||
3570 | "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41" | ||
3571 | "\x3c\xce\x8f\x42\x60\x71\xa7\x75" | ||
3572 | "\x08\x40\x65\x8a\x82\xbf\xf5\x43" | ||
3573 | "\x71\x96\xa9\x4d\x44\x8a\x20\xbe" | ||
3574 | "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65" | ||
3575 | "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9" | ||
3576 | "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4" | ||
3577 | "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a" | ||
3578 | "\x62\x73\x65\xfd\x46\x63\x25\x3d" | ||
3579 | "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf" | ||
3580 | "\x24\xf3\xb4\xac\x64\xba\xdf\x4b" | ||
3581 | "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7" | ||
3582 | "\xc5\x68\x77\x84\x32\x2b\xcc\x85" | ||
3583 | "\x74\x96\xf0\x12\x77\x61\xb9\xeb" | ||
3584 | "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8" | ||
3585 | "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24" | ||
3586 | "\xda\x39\x87\x45\xc0\x2b\xbb\x01" | ||
3587 | "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce" | ||
3588 | "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6" | ||
3589 | "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32" | ||
3590 | "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45" | ||
3591 | "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6" | ||
3592 | "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4" | ||
3593 | "\x21\xc4\xc2\x75\x67\x89\x37\x0a", | ||
3594 | .rlen = 512, | ||
3595 | }, | ||
3596 | }; | ||
3597 | |||
3598 | static struct cipher_testvec tf_xts_enc_tv_template[] = { | ||
3599 | /* Generated from AES-XTS test vectors */ | ||
3600 | { | ||
3601 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3602 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3603 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3604 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
3605 | .klen = 32, | ||
3606 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3607 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
3608 | .input = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3609 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3610 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3611 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
3612 | .ilen = 32, | ||
3613 | .result = "\x4b\xc9\x44\x4a\x11\xa3\xef\xac" | ||
3614 | "\x30\x74\xe4\x44\x52\x77\x97\x43" | ||
3615 | "\xa7\x60\xb2\x45\x2e\xf9\x00\x90" | ||
3616 | "\x9f\xaa\xfd\x89\x6e\x9d\x4a\xe0", | ||
3617 | .rlen = 32, | ||
3618 | }, { | ||
3619 | .key = "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
3620 | "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
3621 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
3622 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
3623 | .klen = 32, | ||
3624 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
3625 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
3626 | .input = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
3627 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
3628 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
3629 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
3630 | .ilen = 32, | ||
3631 | .result = "\x57\x0e\x8f\xe5\x2a\x35\x61\x4f" | ||
3632 | "\x32\xd3\xbd\x36\x05\x15\x44\x2c" | ||
3633 | "\x58\x06\xf7\xf8\x00\xa8\xb6\xd5" | ||
3634 | "\xc6\x28\x92\xdb\xd8\x34\xa2\xe9", | ||
3635 | .rlen = 32, | ||
3636 | }, { | ||
3637 | .key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8" | ||
3638 | "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0" | ||
3639 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
3640 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
3641 | .klen = 32, | ||
3642 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
3643 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
3644 | .input = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
3645 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
3646 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
3647 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
3648 | .ilen = 32, | ||
3649 | .result = "\x96\x45\x8f\x8d\x7a\x75\xb1\xde" | ||
3650 | "\x40\x0c\x89\x56\xf6\x4d\xa7\x07" | ||
3651 | "\x38\xbb\x5b\xe9\xcd\x84\xae\xb2" | ||
3652 | "\x7b\x6a\x62\xf4\x8c\xb5\x37\xea", | ||
3653 | .rlen = 32, | ||
3654 | }, { | ||
3655 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
3656 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
3657 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
3658 | "\x23\x84\x62\x64\x33\x83\x27\x95", | ||
3659 | .klen = 32, | ||
3660 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3661 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
3662 | .input = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
3663 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
3664 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
3665 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
3666 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
3667 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
3668 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3669 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
3670 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
3671 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
3672 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
3673 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
3674 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
3675 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
3676 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
3677 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
3678 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
3679 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
3680 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
3681 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
3682 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
3683 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
3684 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
3685 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
3686 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
3687 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
3688 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
3689 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
3690 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
3691 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
3692 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
3693 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
3694 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
3695 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
3696 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
3697 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
3698 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
3699 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
3700 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3701 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
3702 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
3703 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
3704 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
3705 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
3706 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
3707 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
3708 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
3709 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
3710 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
3711 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
3712 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
3713 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
3714 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
3715 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
3716 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
3717 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
3718 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
3719 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
3720 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
3721 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
3722 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
3723 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
3724 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
3725 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
3726 | .ilen = 512, | ||
3727 | .result = "\xa9\x78\xae\x1e\xea\xa2\x44\x4c" | ||
3728 | "\xa2\x7a\x64\x1f\xaf\x46\xc1\xe0" | ||
3729 | "\x6c\xb2\xf3\x92\x9a\xd6\x7d\x58" | ||
3730 | "\xb8\x2d\xb9\x5d\x58\x07\x66\x50" | ||
3731 | "\xea\x35\x35\x8c\xb2\x46\x61\x06" | ||
3732 | "\x5d\x65\xfc\x57\x8f\x69\x74\xab" | ||
3733 | "\x8a\x06\x69\xb5\x6c\xda\x66\xc7" | ||
3734 | "\x52\x90\xbb\x8e\x6d\x8b\xb5\xa2" | ||
3735 | "\x78\x1d\xc2\xa9\xc2\x73\x00\xc3" | ||
3736 | "\x32\x36\x7c\x97\x6b\x4e\x8a\x50" | ||
3737 | "\xe4\x91\x83\x96\x8f\xf4\x94\x1a" | ||
3738 | "\xa6\x27\xe1\x33\xcb\x91\xc6\x5f" | ||
3739 | "\x94\x75\xbc\xd7\x3e\x3e\x6f\x9e" | ||
3740 | "\xa9\x31\x80\x5e\xe5\xdb\xc8\x53" | ||
3741 | "\x01\x73\x68\x32\x25\x19\xfa\xfb" | ||
3742 | "\xe4\xcf\xb9\x3e\xa2\xa0\x8f\x31" | ||
3743 | "\xbf\x54\x06\x93\xa8\xb1\x0f\xb6" | ||
3744 | "\x7c\x3c\xde\x6f\x0f\xfb\x0c\x11" | ||
3745 | "\x39\x80\x39\x09\x97\x65\xf2\x83" | ||
3746 | "\xae\xe6\xa1\x6f\x47\xb8\x49\xde" | ||
3747 | "\x99\x36\x20\x7d\x97\x3b\xec\xfa" | ||
3748 | "\xb4\x33\x6e\x7a\xc7\x46\x84\x49" | ||
3749 | "\x91\xcd\xe1\x57\x0d\xed\x40\x08" | ||
3750 | "\x13\xf1\x4e\x3e\xa4\xa4\x5c\xe6" | ||
3751 | "\xd2\x0c\x20\x8f\x3e\xdf\x3f\x47" | ||
3752 | "\x9a\x2f\xde\x6d\x66\xc9\x99\x4a" | ||
3753 | "\x2d\x9e\x9d\x4b\x1a\x27\xa2\x12" | ||
3754 | "\x99\xf0\xf8\xb1\xb6\xf6\x57\xc3" | ||
3755 | "\xca\x1c\xa3\x8e\xed\x39\x28\xb5" | ||
3756 | "\x10\x1b\x4b\x08\x42\x00\x4a\xd3" | ||
3757 | "\xad\x5a\xc6\x8e\xc8\xbb\x95\xc4" | ||
3758 | "\x4b\xaa\xfe\xd5\x42\xa8\xa3\x6d" | ||
3759 | "\x3c\xf3\x34\x91\x2d\xb4\xdd\x20" | ||
3760 | "\x0c\x90\x6d\xa3\x9b\x66\x9d\x24" | ||
3761 | "\x02\xa6\xa9\x3f\x3f\x58\x5d\x47" | ||
3762 | "\x24\x65\x63\x7e\xbd\x8c\xe6\x52" | ||
3763 | "\x7d\xef\x33\x53\x63\xec\xaa\x0b" | ||
3764 | "\x64\x15\xa9\xa6\x1f\x10\x00\x38" | ||
3765 | "\x35\xa8\xe7\xbe\x23\x70\x22\xe0" | ||
3766 | "\xd3\xb9\xe6\xfd\xe6\xaa\x03\x50" | ||
3767 | "\xf3\x3c\x27\x36\x8b\xcc\xfe\x9c" | ||
3768 | "\x9c\xa3\xb3\xe7\x68\x9b\xa2\x71" | ||
3769 | "\xe0\x07\xd9\x1f\x68\x1f\xac\x5e" | ||
3770 | "\x7a\x74\x85\xa9\x6a\x90\xab\x2c" | ||
3771 | "\x38\x51\xbc\x1f\x43\x4a\x56\x1c" | ||
3772 | "\xf8\x47\x03\x4e\x67\xa8\x1f\x99" | ||
3773 | "\x04\x39\x73\x32\xb2\x86\x79\xe7" | ||
3774 | "\x14\x28\x70\xb8\xe2\x7d\x69\x85" | ||
3775 | "\xb6\x0f\xc5\xd0\xd0\x01\x5c\xe6" | ||
3776 | "\x09\x0f\x75\xf7\xb6\x81\xd2\x11" | ||
3777 | "\x20\x9c\xa1\xee\x11\x44\x79\xd0" | ||
3778 | "\xb2\x34\x77\xda\x10\x9a\x6f\x6f" | ||
3779 | "\xef\x7c\xd9\xdc\x35\xb7\x61\xdd" | ||
3780 | "\xf1\xa4\xc6\x1c\xbf\x05\x22\xac" | ||
3781 | "\xfe\x2f\x85\x00\x44\xdf\x33\x16" | ||
3782 | "\x35\xb6\xa3\xd3\x70\xdf\x69\x35" | ||
3783 | "\x6a\xc7\xb4\x99\x45\x27\xc8\x8e" | ||
3784 | "\x5a\x14\x30\xd0\x55\x3e\x4f\x64" | ||
3785 | "\x0d\x38\xe3\xdf\x8b\xa8\x93\x26" | ||
3786 | "\x75\xae\xf6\xb5\x23\x0b\x17\x31" | ||
3787 | "\xbf\x27\xb8\xb5\x94\x31\xa7\x8f" | ||
3788 | "\x43\xc4\x46\x24\x22\x4f\x8f\x7e" | ||
3789 | "\xe5\xf4\x6d\x1e\x0e\x18\x7a\xbb" | ||
3790 | "\xa6\x8f\xfb\x49\x49\xd8\x7e\x5a", | ||
3791 | .rlen = 512, | ||
3792 | }, { | ||
3793 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
3794 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
3795 | "\x62\x49\x77\x57\x24\x70\x93\x69" | ||
3796 | "\x99\x59\x57\x49\x66\x96\x76\x27" | ||
3797 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
3798 | "\x23\x84\x62\x64\x33\x83\x27\x95" | ||
3799 | "\x02\x88\x41\x97\x16\x93\x99\x37" | ||
3800 | "\x51\x05\x82\x09\x74\x94\x45\x92", | ||
3801 | .klen = 64, | ||
3802 | .iv = "\xff\x00\x00\x00\x00\x00\x00\x00" | ||
3803 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
3804 | .input = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
3805 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
3806 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
3807 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
3808 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
3809 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
3810 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3811 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
3812 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
3813 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
3814 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
3815 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
3816 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
3817 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
3818 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
3819 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
3820 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
3821 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
3822 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
3823 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
3824 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
3825 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
3826 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
3827 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
3828 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
3829 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
3830 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
3831 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
3832 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
3833 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
3834 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
3835 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
3836 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
3837 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
3838 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
3839 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
3840 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
3841 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
3842 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
3843 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
3844 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
3845 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
3846 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
3847 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
3848 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
3849 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
3850 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
3851 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
3852 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
3853 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
3854 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
3855 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
3856 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
3857 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
3858 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
3859 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
3860 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
3861 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
3862 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
3863 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
3864 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
3865 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
3866 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
3867 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
3868 | .ilen = 512, | ||
3869 | .result = "\xd7\x4b\x93\x7d\x13\xa2\xa2\xe1" | ||
3870 | "\x35\x39\x71\x88\x76\x1e\xc9\xea" | ||
3871 | "\x86\xad\xf3\x14\x48\x3d\x5e\xe9" | ||
3872 | "\xe9\x2d\xb2\x56\x59\x35\x9d\xec" | ||
3873 | "\x84\xfa\x7e\x9d\x6d\x33\x36\x8f" | ||
3874 | "\xce\xf4\xa9\x21\x0b\x5f\x96\xec" | ||
3875 | "\xcb\xf9\x57\x68\x33\x88\x39\xbf" | ||
3876 | "\x2f\xbb\x59\x03\xbd\x66\x8b\x11" | ||
3877 | "\x11\x65\x51\x2e\xb8\x67\x05\xd1" | ||
3878 | "\x27\x11\x5c\xd4\xcc\x97\xc2\xb3" | ||
3879 | "\xa9\x55\xaf\x07\x56\xd1\xdc\xf5" | ||
3880 | "\x85\xdc\x46\xe6\xf0\x24\xeb\x93" | ||
3881 | "\x4d\xf0\x9b\xf5\x73\x1c\xda\x03" | ||
3882 | "\x22\xc8\x3a\x4f\xb4\x19\x91\x09" | ||
3883 | "\x54\x0b\xf6\xfe\x17\x3d\x1a\x53" | ||
3884 | "\x72\x60\x79\xcb\x0e\x32\x8a\x77" | ||
3885 | "\xd5\xed\xdb\x33\xd7\x62\x16\x69" | ||
3886 | "\x63\xe0\xab\xb5\xf6\x9c\x5f\x3d" | ||
3887 | "\x69\x35\x61\x86\xf8\x86\xb9\x89" | ||
3888 | "\x6e\x59\x35\xac\xf6\x6b\x33\xa0" | ||
3889 | "\xea\xef\x96\x62\xd8\xa9\xcf\x56" | ||
3890 | "\xbf\xdb\x8a\xfd\xa1\x82\x77\x73" | ||
3891 | "\x3d\x94\x4a\x49\x42\x6d\x08\x60" | ||
3892 | "\xa1\xea\xab\xb6\x88\x13\x94\xb8" | ||
3893 | "\x51\x98\xdb\x35\x85\xdf\xf6\xb9" | ||
3894 | "\x8f\xcd\xdf\x80\xd3\x40\x2d\x72" | ||
3895 | "\xb8\xb2\x6c\x02\x43\x35\x22\x2a" | ||
3896 | "\x31\xed\xcd\x16\x19\xdf\x62\x0f" | ||
3897 | "\x29\xcf\x87\x04\xec\x02\x4f\xe4" | ||
3898 | "\xa2\xed\x73\xc6\x69\xd3\x7e\x89" | ||
3899 | "\x0b\x76\x10\x7c\xd6\xf9\x6a\x25" | ||
3900 | "\xed\xcc\x60\x5d\x61\x20\xc1\x97" | ||
3901 | "\x56\x91\x57\x28\xbe\x71\x0d\xcd" | ||
3902 | "\xde\xc4\x9e\x55\x91\xbe\xd1\x28" | ||
3903 | "\x9b\x90\xeb\x73\xf3\x68\x51\xc6" | ||
3904 | "\xdf\x82\xcc\xd8\x1f\xce\x5b\x27" | ||
3905 | "\xc0\x60\x5e\x33\xd6\xa7\x20\xea" | ||
3906 | "\xb2\x54\xc7\x5d\x6a\x3b\x67\x47" | ||
3907 | "\xcf\xa0\xe3\xab\x86\xaf\xc1\x42" | ||
3908 | "\xe6\xb0\x23\x4a\xaf\x53\xdf\xa0" | ||
3909 | "\xad\x12\x32\x31\x03\xf7\x21\xbe" | ||
3910 | "\x2d\xd5\x82\x42\xb6\x4a\x3d\xcd" | ||
3911 | "\xd8\x81\x77\xa9\x49\x98\x6c\x09" | ||
3912 | "\xc5\xa3\x61\x12\x62\x85\x6b\xcd" | ||
3913 | "\xb3\xf4\x20\x0c\x41\xc4\x05\x37" | ||
3914 | "\x46\x5f\xeb\x71\x8b\xf1\xaf\x6e" | ||
3915 | "\xba\xf3\x50\x2e\xfe\xa8\x37\xeb" | ||
3916 | "\xe8\x8c\x4f\xa4\x0c\xf1\x31\xc8" | ||
3917 | "\x6e\x71\x4f\xa5\xd7\x97\x73\xe0" | ||
3918 | "\x93\x4a\x2f\xda\x7b\xe0\x20\x54" | ||
3919 | "\x1f\x8d\x85\x79\x0b\x7b\x5e\x75" | ||
3920 | "\xb9\x07\x67\xcc\xc8\xe7\x21\x15" | ||
3921 | "\xa7\xc8\x98\xff\x4b\x80\x1c\x12" | ||
3922 | "\xa8\x54\xe1\x38\x52\xe6\x74\x81" | ||
3923 | "\x97\x47\xa1\x41\x0e\xc0\x50\xe3" | ||
3924 | "\x55\x0e\xc3\xa7\x70\x77\xce\x07" | ||
3925 | "\xed\x8c\x88\xe6\xa1\x5b\x14\xec" | ||
3926 | "\xe6\xde\x06\x6d\x74\xc5\xd9\xfa" | ||
3927 | "\xe5\x2f\x5a\xff\xc8\x05\xee\x27" | ||
3928 | "\x35\x61\xbf\x0b\x19\x78\x9b\xd2" | ||
3929 | "\x04\xc7\x05\xb1\x79\xb4\xff\x5f" | ||
3930 | "\xf3\xea\x67\x52\x78\xc2\xce\x70" | ||
3931 | "\xa4\x05\x0b\xb2\xb3\xa8\x30\x97" | ||
3932 | "\x37\x30\xe1\x91\x8d\xb3\x2a\xff", | ||
3933 | .rlen = 512, | ||
3934 | }, | ||
3935 | }; | ||
3936 | |||
3937 | static struct cipher_testvec tf_xts_dec_tv_template[] = { | ||
3938 | /* Generated from AES-XTS test vectors */ | ||
3939 | /* same as enc vectors with input and result reversed */ | ||
3940 | { | ||
3941 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3942 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3943 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3944 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
3945 | .klen = 32, | ||
3946 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3947 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
3948 | .input = "\x4b\xc9\x44\x4a\x11\xa3\xef\xac" | ||
3949 | "\x30\x74\xe4\x44\x52\x77\x97\x43" | ||
3950 | "\xa7\x60\xb2\x45\x2e\xf9\x00\x90" | ||
3951 | "\x9f\xaa\xfd\x89\x6e\x9d\x4a\xe0", | ||
3952 | .ilen = 32, | ||
3953 | .result = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3954 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3955 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
3956 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
3957 | .rlen = 32, | ||
3958 | }, { | ||
3959 | .key = "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
3960 | "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
3961 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
3962 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
3963 | .klen = 32, | ||
3964 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
3965 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
3966 | .input = "\x57\x0e\x8f\xe5\x2a\x35\x61\x4f" | ||
3967 | "\x32\xd3\xbd\x36\x05\x15\x44\x2c" | ||
3968 | "\x58\x06\xf7\xf8\x00\xa8\xb6\xd5" | ||
3969 | "\xc6\x28\x92\xdb\xd8\x34\xa2\xe9", | ||
3970 | .ilen = 32, | ||
3971 | .result = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
3972 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
3973 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
3974 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
3975 | .rlen = 32, | ||
3976 | }, { | ||
3977 | .key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8" | ||
3978 | "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0" | ||
3979 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
3980 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
3981 | .klen = 32, | ||
3982 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
3983 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
3984 | .input = "\x96\x45\x8f\x8d\x7a\x75\xb1\xde" | ||
3985 | "\x40\x0c\x89\x56\xf6\x4d\xa7\x07" | ||
3986 | "\x38\xbb\x5b\xe9\xcd\x84\xae\xb2" | ||
3987 | "\x7b\x6a\x62\xf4\x8c\xb5\x37\xea", | ||
3988 | .ilen = 32, | ||
3989 | .result = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
3990 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
3991 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
3992 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
3993 | .rlen = 32, | ||
3994 | }, { | ||
3995 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
3996 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
3997 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
3998 | "\x23\x84\x62\x64\x33\x83\x27\x95", | ||
3999 | .klen = 32, | ||
4000 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
4001 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
4002 | .input = "\xa9\x78\xae\x1e\xea\xa2\x44\x4c" | ||
4003 | "\xa2\x7a\x64\x1f\xaf\x46\xc1\xe0" | ||
4004 | "\x6c\xb2\xf3\x92\x9a\xd6\x7d\x58" | ||
4005 | "\xb8\x2d\xb9\x5d\x58\x07\x66\x50" | ||
4006 | "\xea\x35\x35\x8c\xb2\x46\x61\x06" | ||
4007 | "\x5d\x65\xfc\x57\x8f\x69\x74\xab" | ||
4008 | "\x8a\x06\x69\xb5\x6c\xda\x66\xc7" | ||
4009 | "\x52\x90\xbb\x8e\x6d\x8b\xb5\xa2" | ||
4010 | "\x78\x1d\xc2\xa9\xc2\x73\x00\xc3" | ||
4011 | "\x32\x36\x7c\x97\x6b\x4e\x8a\x50" | ||
4012 | "\xe4\x91\x83\x96\x8f\xf4\x94\x1a" | ||
4013 | "\xa6\x27\xe1\x33\xcb\x91\xc6\x5f" | ||
4014 | "\x94\x75\xbc\xd7\x3e\x3e\x6f\x9e" | ||
4015 | "\xa9\x31\x80\x5e\xe5\xdb\xc8\x53" | ||
4016 | "\x01\x73\x68\x32\x25\x19\xfa\xfb" | ||
4017 | "\xe4\xcf\xb9\x3e\xa2\xa0\x8f\x31" | ||
4018 | "\xbf\x54\x06\x93\xa8\xb1\x0f\xb6" | ||
4019 | "\x7c\x3c\xde\x6f\x0f\xfb\x0c\x11" | ||
4020 | "\x39\x80\x39\x09\x97\x65\xf2\x83" | ||
4021 | "\xae\xe6\xa1\x6f\x47\xb8\x49\xde" | ||
4022 | "\x99\x36\x20\x7d\x97\x3b\xec\xfa" | ||
4023 | "\xb4\x33\x6e\x7a\xc7\x46\x84\x49" | ||
4024 | "\x91\xcd\xe1\x57\x0d\xed\x40\x08" | ||
4025 | "\x13\xf1\x4e\x3e\xa4\xa4\x5c\xe6" | ||
4026 | "\xd2\x0c\x20\x8f\x3e\xdf\x3f\x47" | ||
4027 | "\x9a\x2f\xde\x6d\x66\xc9\x99\x4a" | ||
4028 | "\x2d\x9e\x9d\x4b\x1a\x27\xa2\x12" | ||
4029 | "\x99\xf0\xf8\xb1\xb6\xf6\x57\xc3" | ||
4030 | "\xca\x1c\xa3\x8e\xed\x39\x28\xb5" | ||
4031 | "\x10\x1b\x4b\x08\x42\x00\x4a\xd3" | ||
4032 | "\xad\x5a\xc6\x8e\xc8\xbb\x95\xc4" | ||
4033 | "\x4b\xaa\xfe\xd5\x42\xa8\xa3\x6d" | ||
4034 | "\x3c\xf3\x34\x91\x2d\xb4\xdd\x20" | ||
4035 | "\x0c\x90\x6d\xa3\x9b\x66\x9d\x24" | ||
4036 | "\x02\xa6\xa9\x3f\x3f\x58\x5d\x47" | ||
4037 | "\x24\x65\x63\x7e\xbd\x8c\xe6\x52" | ||
4038 | "\x7d\xef\x33\x53\x63\xec\xaa\x0b" | ||
4039 | "\x64\x15\xa9\xa6\x1f\x10\x00\x38" | ||
4040 | "\x35\xa8\xe7\xbe\x23\x70\x22\xe0" | ||
4041 | "\xd3\xb9\xe6\xfd\xe6\xaa\x03\x50" | ||
4042 | "\xf3\x3c\x27\x36\x8b\xcc\xfe\x9c" | ||
4043 | "\x9c\xa3\xb3\xe7\x68\x9b\xa2\x71" | ||
4044 | "\xe0\x07\xd9\x1f\x68\x1f\xac\x5e" | ||
4045 | "\x7a\x74\x85\xa9\x6a\x90\xab\x2c" | ||
4046 | "\x38\x51\xbc\x1f\x43\x4a\x56\x1c" | ||
4047 | "\xf8\x47\x03\x4e\x67\xa8\x1f\x99" | ||
4048 | "\x04\x39\x73\x32\xb2\x86\x79\xe7" | ||
4049 | "\x14\x28\x70\xb8\xe2\x7d\x69\x85" | ||
4050 | "\xb6\x0f\xc5\xd0\xd0\x01\x5c\xe6" | ||
4051 | "\x09\x0f\x75\xf7\xb6\x81\xd2\x11" | ||
4052 | "\x20\x9c\xa1\xee\x11\x44\x79\xd0" | ||
4053 | "\xb2\x34\x77\xda\x10\x9a\x6f\x6f" | ||
4054 | "\xef\x7c\xd9\xdc\x35\xb7\x61\xdd" | ||
4055 | "\xf1\xa4\xc6\x1c\xbf\x05\x22\xac" | ||
4056 | "\xfe\x2f\x85\x00\x44\xdf\x33\x16" | ||
4057 | "\x35\xb6\xa3\xd3\x70\xdf\x69\x35" | ||
4058 | "\x6a\xc7\xb4\x99\x45\x27\xc8\x8e" | ||
4059 | "\x5a\x14\x30\xd0\x55\x3e\x4f\x64" | ||
4060 | "\x0d\x38\xe3\xdf\x8b\xa8\x93\x26" | ||
4061 | "\x75\xae\xf6\xb5\x23\x0b\x17\x31" | ||
4062 | "\xbf\x27\xb8\xb5\x94\x31\xa7\x8f" | ||
4063 | "\x43\xc4\x46\x24\x22\x4f\x8f\x7e" | ||
4064 | "\xe5\xf4\x6d\x1e\x0e\x18\x7a\xbb" | ||
4065 | "\xa6\x8f\xfb\x49\x49\xd8\x7e\x5a", | ||
4066 | .ilen = 512, | ||
4067 | .result = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
4068 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
4069 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
4070 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
4071 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
4072 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
4073 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
4074 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
4075 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
4076 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
4077 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
4078 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
4079 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
4080 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
4081 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
4082 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
4083 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
4084 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
4085 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
4086 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
4087 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
4088 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
4089 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
4090 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
4091 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
4092 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
4093 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
4094 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
4095 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
4096 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
4097 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
4098 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
4099 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
4100 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
4101 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
4102 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
4103 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
4104 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
4105 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
4106 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
4107 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
4108 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
4109 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
4110 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
4111 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
4112 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
4113 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
4114 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
4115 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
4116 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
4117 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
4118 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
4119 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
4120 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
4121 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
4122 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
4123 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
4124 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
4125 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
4126 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
4127 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
4128 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
4129 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
4130 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
4131 | .rlen = 512, | ||
4132 | }, { | ||
4133 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
4134 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
4135 | "\x62\x49\x77\x57\x24\x70\x93\x69" | ||
4136 | "\x99\x59\x57\x49\x66\x96\x76\x27" | ||
4137 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
4138 | "\x23\x84\x62\x64\x33\x83\x27\x95" | ||
4139 | "\x02\x88\x41\x97\x16\x93\x99\x37" | ||
4140 | "\x51\x05\x82\x09\x74\x94\x45\x92", | ||
4141 | .klen = 64, | ||
4142 | .iv = "\xff\x00\x00\x00\x00\x00\x00\x00" | ||
4143 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
4144 | .input = "\xd7\x4b\x93\x7d\x13\xa2\xa2\xe1" | ||
4145 | "\x35\x39\x71\x88\x76\x1e\xc9\xea" | ||
4146 | "\x86\xad\xf3\x14\x48\x3d\x5e\xe9" | ||
4147 | "\xe9\x2d\xb2\x56\x59\x35\x9d\xec" | ||
4148 | "\x84\xfa\x7e\x9d\x6d\x33\x36\x8f" | ||
4149 | "\xce\xf4\xa9\x21\x0b\x5f\x96\xec" | ||
4150 | "\xcb\xf9\x57\x68\x33\x88\x39\xbf" | ||
4151 | "\x2f\xbb\x59\x03\xbd\x66\x8b\x11" | ||
4152 | "\x11\x65\x51\x2e\xb8\x67\x05\xd1" | ||
4153 | "\x27\x11\x5c\xd4\xcc\x97\xc2\xb3" | ||
4154 | "\xa9\x55\xaf\x07\x56\xd1\xdc\xf5" | ||
4155 | "\x85\xdc\x46\xe6\xf0\x24\xeb\x93" | ||
4156 | "\x4d\xf0\x9b\xf5\x73\x1c\xda\x03" | ||
4157 | "\x22\xc8\x3a\x4f\xb4\x19\x91\x09" | ||
4158 | "\x54\x0b\xf6\xfe\x17\x3d\x1a\x53" | ||
4159 | "\x72\x60\x79\xcb\x0e\x32\x8a\x77" | ||
4160 | "\xd5\xed\xdb\x33\xd7\x62\x16\x69" | ||
4161 | "\x63\xe0\xab\xb5\xf6\x9c\x5f\x3d" | ||
4162 | "\x69\x35\x61\x86\xf8\x86\xb9\x89" | ||
4163 | "\x6e\x59\x35\xac\xf6\x6b\x33\xa0" | ||
4164 | "\xea\xef\x96\x62\xd8\xa9\xcf\x56" | ||
4165 | "\xbf\xdb\x8a\xfd\xa1\x82\x77\x73" | ||
4166 | "\x3d\x94\x4a\x49\x42\x6d\x08\x60" | ||
4167 | "\xa1\xea\xab\xb6\x88\x13\x94\xb8" | ||
4168 | "\x51\x98\xdb\x35\x85\xdf\xf6\xb9" | ||
4169 | "\x8f\xcd\xdf\x80\xd3\x40\x2d\x72" | ||
4170 | "\xb8\xb2\x6c\x02\x43\x35\x22\x2a" | ||
4171 | "\x31\xed\xcd\x16\x19\xdf\x62\x0f" | ||
4172 | "\x29\xcf\x87\x04\xec\x02\x4f\xe4" | ||
4173 | "\xa2\xed\x73\xc6\x69\xd3\x7e\x89" | ||
4174 | "\x0b\x76\x10\x7c\xd6\xf9\x6a\x25" | ||
4175 | "\xed\xcc\x60\x5d\x61\x20\xc1\x97" | ||
4176 | "\x56\x91\x57\x28\xbe\x71\x0d\xcd" | ||
4177 | "\xde\xc4\x9e\x55\x91\xbe\xd1\x28" | ||
4178 | "\x9b\x90\xeb\x73\xf3\x68\x51\xc6" | ||
4179 | "\xdf\x82\xcc\xd8\x1f\xce\x5b\x27" | ||
4180 | "\xc0\x60\x5e\x33\xd6\xa7\x20\xea" | ||
4181 | "\xb2\x54\xc7\x5d\x6a\x3b\x67\x47" | ||
4182 | "\xcf\xa0\xe3\xab\x86\xaf\xc1\x42" | ||
4183 | "\xe6\xb0\x23\x4a\xaf\x53\xdf\xa0" | ||
4184 | "\xad\x12\x32\x31\x03\xf7\x21\xbe" | ||
4185 | "\x2d\xd5\x82\x42\xb6\x4a\x3d\xcd" | ||
4186 | "\xd8\x81\x77\xa9\x49\x98\x6c\x09" | ||
4187 | "\xc5\xa3\x61\x12\x62\x85\x6b\xcd" | ||
4188 | "\xb3\xf4\x20\x0c\x41\xc4\x05\x37" | ||
4189 | "\x46\x5f\xeb\x71\x8b\xf1\xaf\x6e" | ||
4190 | "\xba\xf3\x50\x2e\xfe\xa8\x37\xeb" | ||
4191 | "\xe8\x8c\x4f\xa4\x0c\xf1\x31\xc8" | ||
4192 | "\x6e\x71\x4f\xa5\xd7\x97\x73\xe0" | ||
4193 | "\x93\x4a\x2f\xda\x7b\xe0\x20\x54" | ||
4194 | "\x1f\x8d\x85\x79\x0b\x7b\x5e\x75" | ||
4195 | "\xb9\x07\x67\xcc\xc8\xe7\x21\x15" | ||
4196 | "\xa7\xc8\x98\xff\x4b\x80\x1c\x12" | ||
4197 | "\xa8\x54\xe1\x38\x52\xe6\x74\x81" | ||
4198 | "\x97\x47\xa1\x41\x0e\xc0\x50\xe3" | ||
4199 | "\x55\x0e\xc3\xa7\x70\x77\xce\x07" | ||
4200 | "\xed\x8c\x88\xe6\xa1\x5b\x14\xec" | ||
4201 | "\xe6\xde\x06\x6d\x74\xc5\xd9\xfa" | ||
4202 | "\xe5\x2f\x5a\xff\xc8\x05\xee\x27" | ||
4203 | "\x35\x61\xbf\x0b\x19\x78\x9b\xd2" | ||
4204 | "\x04\xc7\x05\xb1\x79\xb4\xff\x5f" | ||
4205 | "\xf3\xea\x67\x52\x78\xc2\xce\x70" | ||
4206 | "\xa4\x05\x0b\xb2\xb3\xa8\x30\x97" | ||
4207 | "\x37\x30\xe1\x91\x8d\xb3\x2a\xff", | ||
4208 | .ilen = 512, | ||
4209 | .result = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
4210 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
4211 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
4212 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
4213 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
4214 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
4215 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
4216 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
4217 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
4218 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
4219 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
4220 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
4221 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
4222 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
4223 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
4224 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
4225 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
4226 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
4227 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
4228 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
4229 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
4230 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
4231 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
4232 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
4233 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
4234 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
4235 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
4236 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
4237 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
4238 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
4239 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
4240 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
4241 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
4242 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
4243 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
4244 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
4245 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
4246 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
4247 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
4248 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
4249 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
4250 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
4251 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
4252 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
4253 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
4254 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
4255 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
4256 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
4257 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
4258 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
4259 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
4260 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
4261 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
4262 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
4263 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
4264 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
4265 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
4266 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
4267 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
4268 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
4269 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
4270 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
4271 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
4272 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
4273 | .rlen = 512, | ||
4274 | }, | ||
4275 | }; | ||
4276 | |||
3095 | /* | 4277 | /* |
3096 | * Serpent test vectors. These are backwards because Serpent writes | 4278 | * Serpent test vectors. These are backwards because Serpent writes |
3097 | * octet sequences in right-to-left mode. | 4279 | * octet sequences in right-to-left mode. |
3098 | */ | 4280 | */ |
3099 | #define SERPENT_ENC_TEST_VECTORS 4 | 4281 | #define SERPENT_ENC_TEST_VECTORS 5 |
3100 | #define SERPENT_DEC_TEST_VECTORS 4 | 4282 | #define SERPENT_DEC_TEST_VECTORS 5 |
3101 | 4283 | ||
3102 | #define TNEPRES_ENC_TEST_VECTORS 4 | 4284 | #define TNEPRES_ENC_TEST_VECTORS 4 |
3103 | #define TNEPRES_DEC_TEST_VECTORS 4 | 4285 | #define TNEPRES_DEC_TEST_VECTORS 4 |
3104 | 4286 | ||
4287 | #define SERPENT_CBC_ENC_TEST_VECTORS 1 | ||
4288 | #define SERPENT_CBC_DEC_TEST_VECTORS 1 | ||
4289 | |||
4290 | #define SERPENT_CTR_ENC_TEST_VECTORS 2 | ||
4291 | #define SERPENT_CTR_DEC_TEST_VECTORS 2 | ||
4292 | |||
4293 | #define SERPENT_LRW_ENC_TEST_VECTORS 8 | ||
4294 | #define SERPENT_LRW_DEC_TEST_VECTORS 8 | ||
4295 | |||
4296 | #define SERPENT_XTS_ENC_TEST_VECTORS 5 | ||
4297 | #define SERPENT_XTS_DEC_TEST_VECTORS 5 | ||
4298 | |||
3105 | static struct cipher_testvec serpent_enc_tv_template[] = { | 4299 | static struct cipher_testvec serpent_enc_tv_template[] = { |
3106 | { | 4300 | { |
3107 | .input = "\x00\x01\x02\x03\x04\x05\x06\x07" | 4301 | .input = "\x00\x01\x02\x03\x04\x05\x06\x07" |
@@ -3140,6 +4334,50 @@ static struct cipher_testvec serpent_enc_tv_template[] = { | |||
3140 | .result = "\xdd\xd2\x6b\x98\xa5\xff\xd8\x2c" | 4334 | .result = "\xdd\xd2\x6b\x98\xa5\xff\xd8\x2c" |
3141 | "\x05\x34\x5a\x9d\xad\xbf\xaf\x49", | 4335 | "\x05\x34\x5a\x9d\xad\xbf\xaf\x49", |
3142 | .rlen = 16, | 4336 | .rlen = 16, |
4337 | }, { /* Generated with Crypto++ */ | ||
4338 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
4339 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
4340 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
4341 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
4342 | .klen = 32, | ||
4343 | .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
4344 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
4345 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
4346 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
4347 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
4348 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
4349 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
4350 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
4351 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
4352 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
4353 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
4354 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
4355 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
4356 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
4357 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
4358 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
4359 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
4360 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A", | ||
4361 | .ilen = 144, | ||
4362 | .result = "\xFB\xB0\x5D\xDE\xC0\xFE\xFC\xEB" | ||
4363 | "\xB1\x80\x10\x43\xDE\x62\x70\xBD" | ||
4364 | "\xFA\x8A\x93\xEA\x6B\xF7\xC5\xD7" | ||
4365 | "\x0C\xD1\xBB\x29\x25\x14\x4C\x22" | ||
4366 | "\x77\xA6\x38\x00\xDB\xB9\xE2\x07" | ||
4367 | "\xD1\xAC\x82\xBA\xEA\x67\xAA\x39" | ||
4368 | "\x99\x34\x89\x5B\x54\xE9\x12\x13" | ||
4369 | "\x3B\x04\xE5\x12\x42\xC5\x79\xAB" | ||
4370 | "\x0D\xC7\x3C\x58\x2D\xA3\x98\xF6" | ||
4371 | "\xE4\x61\x9E\x17\x0B\xCE\xE8\xAA" | ||
4372 | "\xB5\x6C\x1A\x3A\x67\x52\x81\x6A" | ||
4373 | "\x04\xFF\x8A\x1B\x96\xFE\xE6\x87" | ||
4374 | "\x3C\xD4\x39\x7D\x36\x9B\x03\xD5" | ||
4375 | "\xB6\xA0\x75\x3C\x83\xE6\x1C\x73" | ||
4376 | "\x9D\x74\x2B\x77\x53\x2D\xE5\xBD" | ||
4377 | "\x69\xDA\x7A\x01\xF5\x6A\x70\x39" | ||
4378 | "\x30\xD4\x2C\xF2\x8E\x06\x4B\x39" | ||
4379 | "\xB3\x12\x1D\xB3\x17\x46\xE6\xD6", | ||
4380 | .rlen = 144, | ||
3143 | }, | 4381 | }, |
3144 | }; | 4382 | }; |
3145 | 4383 | ||
@@ -3231,6 +4469,50 @@ static struct cipher_testvec serpent_dec_tv_template[] = { | |||
3231 | .ilen = 16, | 4469 | .ilen = 16, |
3232 | .result = zeroed_string, | 4470 | .result = zeroed_string, |
3233 | .rlen = 16, | 4471 | .rlen = 16, |
4472 | }, { /* Generated with Crypto++ */ | ||
4473 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
4474 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
4475 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
4476 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
4477 | .klen = 32, | ||
4478 | .input = "\xFB\xB0\x5D\xDE\xC0\xFE\xFC\xEB" | ||
4479 | "\xB1\x80\x10\x43\xDE\x62\x70\xBD" | ||
4480 | "\xFA\x8A\x93\xEA\x6B\xF7\xC5\xD7" | ||
4481 | "\x0C\xD1\xBB\x29\x25\x14\x4C\x22" | ||
4482 | "\x77\xA6\x38\x00\xDB\xB9\xE2\x07" | ||
4483 | "\xD1\xAC\x82\xBA\xEA\x67\xAA\x39" | ||
4484 | "\x99\x34\x89\x5B\x54\xE9\x12\x13" | ||
4485 | "\x3B\x04\xE5\x12\x42\xC5\x79\xAB" | ||
4486 | "\x0D\xC7\x3C\x58\x2D\xA3\x98\xF6" | ||
4487 | "\xE4\x61\x9E\x17\x0B\xCE\xE8\xAA" | ||
4488 | "\xB5\x6C\x1A\x3A\x67\x52\x81\x6A" | ||
4489 | "\x04\xFF\x8A\x1B\x96\xFE\xE6\x87" | ||
4490 | "\x3C\xD4\x39\x7D\x36\x9B\x03\xD5" | ||
4491 | "\xB6\xA0\x75\x3C\x83\xE6\x1C\x73" | ||
4492 | "\x9D\x74\x2B\x77\x53\x2D\xE5\xBD" | ||
4493 | "\x69\xDA\x7A\x01\xF5\x6A\x70\x39" | ||
4494 | "\x30\xD4\x2C\xF2\x8E\x06\x4B\x39" | ||
4495 | "\xB3\x12\x1D\xB3\x17\x46\xE6\xD6", | ||
4496 | .ilen = 144, | ||
4497 | .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
4498 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
4499 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
4500 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
4501 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
4502 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
4503 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
4504 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
4505 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
4506 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
4507 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
4508 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
4509 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
4510 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
4511 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
4512 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
4513 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
4514 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A", | ||
4515 | .rlen = 144, | ||
3234 | }, | 4516 | }, |
3235 | }; | 4517 | }; |
3236 | 4518 | ||
@@ -3275,6 +4557,1479 @@ static struct cipher_testvec tnepres_dec_tv_template[] = { | |||
3275 | }, | 4557 | }, |
3276 | }; | 4558 | }; |
3277 | 4559 | ||
4560 | static struct cipher_testvec serpent_cbc_enc_tv_template[] = { | ||
4561 | { /* Generated with Crypto++ */ | ||
4562 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
4563 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
4564 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
4565 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
4566 | .klen = 32, | ||
4567 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" | ||
4568 | "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", | ||
4569 | .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
4570 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
4571 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
4572 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
4573 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
4574 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
4575 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
4576 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
4577 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
4578 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
4579 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
4580 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
4581 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
4582 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
4583 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
4584 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
4585 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
4586 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A", | ||
4587 | .ilen = 144, | ||
4588 | .result = "\x80\xCF\x11\x41\x1A\xB9\x4B\x9C" | ||
4589 | "\xFF\xB7\x6C\xEA\xF0\xAF\x77\x6E" | ||
4590 | "\x71\x75\x95\x9D\x4E\x1C\xCF\xAD" | ||
4591 | "\x81\x34\xE9\x8F\xAE\x5A\x91\x1C" | ||
4592 | "\x38\x63\x35\x7E\x79\x18\x0A\xE8" | ||
4593 | "\x67\x06\x76\xD5\xFF\x22\x2F\xDA" | ||
4594 | "\xB6\x2D\x57\x13\xB6\x3C\xBC\x97" | ||
4595 | "\xFE\x53\x75\x35\x97\x7F\x51\xEA" | ||
4596 | "\xDF\x5D\xE8\x9D\xCC\xD9\xAE\xE7" | ||
4597 | "\x62\x67\xFF\x04\xC2\x18\x22\x5F" | ||
4598 | "\x2E\x06\xC1\xE2\x26\xCD\xC6\x1E" | ||
4599 | "\xE5\x2C\x4E\x87\x23\xDD\xF0\x41" | ||
4600 | "\x08\xA5\xB4\x3E\x07\x1E\x0B\xBB" | ||
4601 | "\x72\x84\xF8\x0A\x3F\x38\x5E\x91" | ||
4602 | "\x15\x26\xE1\xDB\xA4\x3D\x74\xD2" | ||
4603 | "\x41\x1E\x3F\xA9\xC6\x7D\x2A\xAB" | ||
4604 | "\x27\xDF\x89\x1D\x86\x3E\xF7\x5A" | ||
4605 | "\xF6\xE3\x0F\xC7\x6B\x4C\x96\x7C", | ||
4606 | .rlen = 144, | ||
4607 | }, | ||
4608 | }; | ||
4609 | |||
4610 | static struct cipher_testvec serpent_cbc_dec_tv_template[] = { | ||
4611 | { /* Generated with Crypto++ */ | ||
4612 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
4613 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
4614 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
4615 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
4616 | .klen = 32, | ||
4617 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" | ||
4618 | "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", | ||
4619 | .input = "\x80\xCF\x11\x41\x1A\xB9\x4B\x9C" | ||
4620 | "\xFF\xB7\x6C\xEA\xF0\xAF\x77\x6E" | ||
4621 | "\x71\x75\x95\x9D\x4E\x1C\xCF\xAD" | ||
4622 | "\x81\x34\xE9\x8F\xAE\x5A\x91\x1C" | ||
4623 | "\x38\x63\x35\x7E\x79\x18\x0A\xE8" | ||
4624 | "\x67\x06\x76\xD5\xFF\x22\x2F\xDA" | ||
4625 | "\xB6\x2D\x57\x13\xB6\x3C\xBC\x97" | ||
4626 | "\xFE\x53\x75\x35\x97\x7F\x51\xEA" | ||
4627 | "\xDF\x5D\xE8\x9D\xCC\xD9\xAE\xE7" | ||
4628 | "\x62\x67\xFF\x04\xC2\x18\x22\x5F" | ||
4629 | "\x2E\x06\xC1\xE2\x26\xCD\xC6\x1E" | ||
4630 | "\xE5\x2C\x4E\x87\x23\xDD\xF0\x41" | ||
4631 | "\x08\xA5\xB4\x3E\x07\x1E\x0B\xBB" | ||
4632 | "\x72\x84\xF8\x0A\x3F\x38\x5E\x91" | ||
4633 | "\x15\x26\xE1\xDB\xA4\x3D\x74\xD2" | ||
4634 | "\x41\x1E\x3F\xA9\xC6\x7D\x2A\xAB" | ||
4635 | "\x27\xDF\x89\x1D\x86\x3E\xF7\x5A" | ||
4636 | "\xF6\xE3\x0F\xC7\x6B\x4C\x96\x7C", | ||
4637 | .ilen = 144, | ||
4638 | .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
4639 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
4640 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
4641 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
4642 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
4643 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
4644 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
4645 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
4646 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
4647 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
4648 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
4649 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
4650 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
4651 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
4652 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
4653 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
4654 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
4655 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A", | ||
4656 | .rlen = 144, | ||
4657 | }, | ||
4658 | }; | ||
4659 | |||
4660 | static struct cipher_testvec serpent_ctr_enc_tv_template[] = { | ||
4661 | { /* Generated with Crypto++ */ | ||
4662 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
4663 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
4664 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
4665 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
4666 | .klen = 32, | ||
4667 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" | ||
4668 | "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", | ||
4669 | .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
4670 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
4671 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
4672 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
4673 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
4674 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
4675 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
4676 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
4677 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
4678 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
4679 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
4680 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
4681 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
4682 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
4683 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
4684 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
4685 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
4686 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A", | ||
4687 | .ilen = 144, | ||
4688 | .result = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA" | ||
4689 | "\x37\x69\xE3\x3A\x22\x85\x48\x46" | ||
4690 | "\x70\xAA\x25\xB4\xCD\x8B\x04\x4E" | ||
4691 | "\x8D\x15\x2B\x98\xDF\x7B\x6D\xB9" | ||
4692 | "\xE0\x4A\x73\x00\x65\xB6\x1A\x0D" | ||
4693 | "\x5C\x60\xDF\x34\xDC\x60\x4C\xDF" | ||
4694 | "\xB5\x1F\x26\x8C\xDA\xC1\x11\xA8" | ||
4695 | "\x80\xFA\x37\x7A\x89\xAA\xAE\x7B" | ||
4696 | "\x92\x6E\xB9\xDC\xC9\x62\x4F\x88" | ||
4697 | "\x0A\x5D\x97\x2F\x6B\xAC\x03\x7C" | ||
4698 | "\x22\xF6\x55\x5A\xFA\x35\xA5\x17" | ||
4699 | "\xA1\x5C\x5E\x2B\x63\x2D\xB9\x91" | ||
4700 | "\x3E\x83\x26\x00\x4E\xD5\xBE\xCE" | ||
4701 | "\x79\xC4\x3D\xFC\x70\xA0\xAD\x96" | ||
4702 | "\xBA\x58\x2A\x1C\xDF\xC2\x3A\xA5" | ||
4703 | "\x7C\xB5\x12\x89\xED\xBF\xB6\x09" | ||
4704 | "\x13\x4F\x7D\x61\x3C\x5C\x27\xFC" | ||
4705 | "\x5D\xE1\x4F\xA1\xEA\xB3\xCA\xB9", | ||
4706 | .rlen = 144, | ||
4707 | }, { /* Generated with Crypto++ */ | ||
4708 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
4709 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
4710 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
4711 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
4712 | .klen = 32, | ||
4713 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" | ||
4714 | "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", | ||
4715 | .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
4716 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
4717 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
4718 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
4719 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
4720 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
4721 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
4722 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
4723 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
4724 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
4725 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
4726 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
4727 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
4728 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
4729 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
4730 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
4731 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
4732 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" | ||
4733 | "\xF1\x65\xFC", | ||
4734 | .ilen = 147, | ||
4735 | .result = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA" | ||
4736 | "\x37\x69\xE3\x3A\x22\x85\x48\x46" | ||
4737 | "\x70\xAA\x25\xB4\xCD\x8B\x04\x4E" | ||
4738 | "\x8D\x15\x2B\x98\xDF\x7B\x6D\xB9" | ||
4739 | "\xE0\x4A\x73\x00\x65\xB6\x1A\x0D" | ||
4740 | "\x5C\x60\xDF\x34\xDC\x60\x4C\xDF" | ||
4741 | "\xB5\x1F\x26\x8C\xDA\xC1\x11\xA8" | ||
4742 | "\x80\xFA\x37\x7A\x89\xAA\xAE\x7B" | ||
4743 | "\x92\x6E\xB9\xDC\xC9\x62\x4F\x88" | ||
4744 | "\x0A\x5D\x97\x2F\x6B\xAC\x03\x7C" | ||
4745 | "\x22\xF6\x55\x5A\xFA\x35\xA5\x17" | ||
4746 | "\xA1\x5C\x5E\x2B\x63\x2D\xB9\x91" | ||
4747 | "\x3E\x83\x26\x00\x4E\xD5\xBE\xCE" | ||
4748 | "\x79\xC4\x3D\xFC\x70\xA0\xAD\x96" | ||
4749 | "\xBA\x58\x2A\x1C\xDF\xC2\x3A\xA5" | ||
4750 | "\x7C\xB5\x12\x89\xED\xBF\xB6\x09" | ||
4751 | "\x13\x4F\x7D\x61\x3C\x5C\x27\xFC" | ||
4752 | "\x5D\xE1\x4F\xA1\xEA\xB3\xCA\xB9" | ||
4753 | "\xE6\xD0\x97", | ||
4754 | .rlen = 147, | ||
4755 | }, | ||
4756 | }; | ||
4757 | |||
4758 | static struct cipher_testvec serpent_ctr_dec_tv_template[] = { | ||
4759 | { /* Generated with Crypto++ */ | ||
4760 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
4761 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
4762 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
4763 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
4764 | .klen = 32, | ||
4765 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" | ||
4766 | "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", | ||
4767 | .input = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA" | ||
4768 | "\x37\x69\xE3\x3A\x22\x85\x48\x46" | ||
4769 | "\x70\xAA\x25\xB4\xCD\x8B\x04\x4E" | ||
4770 | "\x8D\x15\x2B\x98\xDF\x7B\x6D\xB9" | ||
4771 | "\xE0\x4A\x73\x00\x65\xB6\x1A\x0D" | ||
4772 | "\x5C\x60\xDF\x34\xDC\x60\x4C\xDF" | ||
4773 | "\xB5\x1F\x26\x8C\xDA\xC1\x11\xA8" | ||
4774 | "\x80\xFA\x37\x7A\x89\xAA\xAE\x7B" | ||
4775 | "\x92\x6E\xB9\xDC\xC9\x62\x4F\x88" | ||
4776 | "\x0A\x5D\x97\x2F\x6B\xAC\x03\x7C" | ||
4777 | "\x22\xF6\x55\x5A\xFA\x35\xA5\x17" | ||
4778 | "\xA1\x5C\x5E\x2B\x63\x2D\xB9\x91" | ||
4779 | "\x3E\x83\x26\x00\x4E\xD5\xBE\xCE" | ||
4780 | "\x79\xC4\x3D\xFC\x70\xA0\xAD\x96" | ||
4781 | "\xBA\x58\x2A\x1C\xDF\xC2\x3A\xA5" | ||
4782 | "\x7C\xB5\x12\x89\xED\xBF\xB6\x09" | ||
4783 | "\x13\x4F\x7D\x61\x3C\x5C\x27\xFC" | ||
4784 | "\x5D\xE1\x4F\xA1\xEA\xB3\xCA\xB9", | ||
4785 | .ilen = 144, | ||
4786 | .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
4787 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
4788 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
4789 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
4790 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
4791 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
4792 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
4793 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
4794 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
4795 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
4796 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
4797 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
4798 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
4799 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
4800 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
4801 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
4802 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
4803 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A", | ||
4804 | .rlen = 144, | ||
4805 | }, { /* Generated with Crypto++ */ | ||
4806 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
4807 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
4808 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
4809 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
4810 | .klen = 32, | ||
4811 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" | ||
4812 | "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", | ||
4813 | .input = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA" | ||
4814 | "\x37\x69\xE3\x3A\x22\x85\x48\x46" | ||
4815 | "\x70\xAA\x25\xB4\xCD\x8B\x04\x4E" | ||
4816 | "\x8D\x15\x2B\x98\xDF\x7B\x6D\xB9" | ||
4817 | "\xE0\x4A\x73\x00\x65\xB6\x1A\x0D" | ||
4818 | "\x5C\x60\xDF\x34\xDC\x60\x4C\xDF" | ||
4819 | "\xB5\x1F\x26\x8C\xDA\xC1\x11\xA8" | ||
4820 | "\x80\xFA\x37\x7A\x89\xAA\xAE\x7B" | ||
4821 | "\x92\x6E\xB9\xDC\xC9\x62\x4F\x88" | ||
4822 | "\x0A\x5D\x97\x2F\x6B\xAC\x03\x7C" | ||
4823 | "\x22\xF6\x55\x5A\xFA\x35\xA5\x17" | ||
4824 | "\xA1\x5C\x5E\x2B\x63\x2D\xB9\x91" | ||
4825 | "\x3E\x83\x26\x00\x4E\xD5\xBE\xCE" | ||
4826 | "\x79\xC4\x3D\xFC\x70\xA0\xAD\x96" | ||
4827 | "\xBA\x58\x2A\x1C\xDF\xC2\x3A\xA5" | ||
4828 | "\x7C\xB5\x12\x89\xED\xBF\xB6\x09" | ||
4829 | "\x13\x4F\x7D\x61\x3C\x5C\x27\xFC" | ||
4830 | "\x5D\xE1\x4F\xA1\xEA\xB3\xCA\xB9" | ||
4831 | "\xE6\xD0\x97", | ||
4832 | .ilen = 147, | ||
4833 | .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
4834 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
4835 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
4836 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
4837 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
4838 | "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" | ||
4839 | "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" | ||
4840 | "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" | ||
4841 | "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" | ||
4842 | "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" | ||
4843 | "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" | ||
4844 | "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" | ||
4845 | "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" | ||
4846 | "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" | ||
4847 | "\x29\xC0\x57\xEE\x62\xF9\x90\x04" | ||
4848 | "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" | ||
4849 | "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" | ||
4850 | "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" | ||
4851 | "\xF1\x65\xFC", | ||
4852 | .rlen = 147, | ||
4853 | }, | ||
4854 | }; | ||
4855 | |||
4856 | static struct cipher_testvec serpent_lrw_enc_tv_template[] = { | ||
4857 | /* Generated from AES-LRW test vectors */ | ||
4858 | { | ||
4859 | .key = "\x45\x62\xac\x25\xf8\x28\x17\x6d" | ||
4860 | "\x4c\x26\x84\x14\xb5\x68\x01\x85" | ||
4861 | "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03" | ||
4862 | "\xee\x5a\x83\x0c\xcc\x09\x4c\x87", | ||
4863 | .klen = 32, | ||
4864 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
4865 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
4866 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
4867 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
4868 | .ilen = 16, | ||
4869 | .result = "\x6f\xbf\xd4\xa4\x5d\x71\x16\x79" | ||
4870 | "\x63\x9c\xa6\x8e\x40\xbe\x0d\x8a", | ||
4871 | .rlen = 16, | ||
4872 | }, { | ||
4873 | .key = "\x59\x70\x47\x14\xf5\x57\x47\x8c" | ||
4874 | "\xd7\x79\xe8\x0f\x54\x88\x79\x44" | ||
4875 | "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea" | ||
4876 | "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf", | ||
4877 | .klen = 32, | ||
4878 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
4879 | "\x00\x00\x00\x00\x00\x00\x00\x02", | ||
4880 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
4881 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
4882 | .ilen = 16, | ||
4883 | .result = "\xfd\xb2\x66\x98\x80\x96\x55\xad" | ||
4884 | "\x08\x94\x54\x9c\x21\x7c\x69\xe3", | ||
4885 | .rlen = 16, | ||
4886 | }, { | ||
4887 | .key = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50" | ||
4888 | "\x30\xfe\x69\xe2\x37\x7f\x98\x47" | ||
4889 | "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6" | ||
4890 | "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f", | ||
4891 | .klen = 32, | ||
4892 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
4893 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
4894 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
4895 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
4896 | .ilen = 16, | ||
4897 | .result = "\x14\x5e\x3d\x70\xc0\x6e\x9c\x34" | ||
4898 | "\x5b\x5e\xcf\x0f\xe4\x8c\x21\x5c", | ||
4899 | .rlen = 16, | ||
4900 | }, { | ||
4901 | .key = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15" | ||
4902 | "\x25\x83\xf7\x3c\x1f\x01\x28\x74" | ||
4903 | "\xca\xc6\xbc\x35\x4d\x4a\x65\x54" | ||
4904 | "\x90\xae\x61\xcf\x7b\xae\xbd\xcc" | ||
4905 | "\xad\xe4\x94\xc5\x4a\x29\xae\x70", | ||
4906 | .klen = 40, | ||
4907 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
4908 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
4909 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
4910 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
4911 | .ilen = 16, | ||
4912 | .result = "\x25\x39\xaa\xa5\xf0\x65\xc8\xdc" | ||
4913 | "\x5d\x45\x95\x30\x8f\xff\x2f\x1b", | ||
4914 | .rlen = 16, | ||
4915 | }, { | ||
4916 | .key = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff" | ||
4917 | "\xf8\x86\xce\xac\x93\xc5\xad\xc6" | ||
4918 | "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd" | ||
4919 | "\x52\x13\xb2\xb7\xf0\xff\x11\xd8" | ||
4920 | "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f", | ||
4921 | .klen = 40, | ||
4922 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
4923 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
4924 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
4925 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
4926 | .ilen = 16, | ||
4927 | .result = "\x0c\x20\x20\x63\xd6\x8b\xfc\x8f" | ||
4928 | "\xc0\xe2\x17\xbb\xd2\x59\x6f\x26", | ||
4929 | .rlen = 16, | ||
4930 | }, { | ||
4931 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
4932 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
4933 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
4934 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
4935 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
4936 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
4937 | .klen = 48, | ||
4938 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
4939 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
4940 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
4941 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
4942 | .ilen = 16, | ||
4943 | .result = "\xc1\x35\x2e\x53\xf0\x96\x4d\x9c" | ||
4944 | "\x2e\x18\xe6\x99\xcd\xd3\x15\x68", | ||
4945 | .rlen = 16, | ||
4946 | }, { | ||
4947 | .key = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d" | ||
4948 | "\xd4\x70\x98\x0b\xc7\x95\x84\xc8" | ||
4949 | "\xb2\xfb\x64\xce\x60\x97\x87\x8d" | ||
4950 | "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7" | ||
4951 | "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4" | ||
4952 | "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c", | ||
4953 | .klen = 48, | ||
4954 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
4955 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
4956 | .input = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
4957 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
4958 | .ilen = 16, | ||
4959 | .result = "\x86\x0a\xc6\xa9\x1a\x9f\xe7\xe6" | ||
4960 | "\x64\x3b\x33\xd6\xd5\x84\xd6\xdf", | ||
4961 | .rlen = 16, | ||
4962 | }, { | ||
4963 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
4964 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
4965 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
4966 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
4967 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
4968 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
4969 | .klen = 48, | ||
4970 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
4971 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
4972 | .input = "\x05\x11\xb7\x18\xab\xc6\x2d\xac" | ||
4973 | "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c" | ||
4974 | "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8" | ||
4975 | "\x50\x38\x1f\x71\x49\xb6\x57\xd6" | ||
4976 | "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90" | ||
4977 | "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6" | ||
4978 | "\xad\x1e\x9e\x20\x5f\x38\xbe\x04" | ||
4979 | "\xda\x10\x8e\xed\xa2\xa4\x87\xab" | ||
4980 | "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c" | ||
4981 | "\xc9\xac\x42\x31\x95\x7c\xc9\x04" | ||
4982 | "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6" | ||
4983 | "\x15\xd7\x3f\x4f\x2f\x66\x69\x03" | ||
4984 | "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65" | ||
4985 | "\x4c\x96\x12\xed\x7c\x92\x03\x01" | ||
4986 | "\x6f\xbc\x35\x93\xac\xf1\x27\xf1" | ||
4987 | "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50" | ||
4988 | "\x89\xa4\x8e\x66\x44\x85\xcc\xfd" | ||
4989 | "\x33\x14\x70\xe3\x96\xb2\xc3\xd3" | ||
4990 | "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5" | ||
4991 | "\x2d\x64\x75\xdd\xb4\x54\xe6\x74" | ||
4992 | "\x8c\xd3\x9d\x9e\x86\xab\x51\x53" | ||
4993 | "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40" | ||
4994 | "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5" | ||
4995 | "\x76\x12\x73\x44\x1a\x56\xd7\x72" | ||
4996 | "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda" | ||
4997 | "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd" | ||
4998 | "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60" | ||
4999 | "\x1a\xe2\x70\x85\x58\xc2\x1b\x09" | ||
5000 | "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9" | ||
5001 | "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8" | ||
5002 | "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8" | ||
5003 | "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10" | ||
5004 | "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1" | ||
5005 | "\x90\x3e\x76\x4a\x74\xa4\x21\x2c" | ||
5006 | "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e" | ||
5007 | "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f" | ||
5008 | "\x8d\x23\x31\x74\x84\xeb\x88\x6e" | ||
5009 | "\xcc\xb9\xbc\x22\x83\x19\x07\x22" | ||
5010 | "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78" | ||
5011 | "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5" | ||
5012 | "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41" | ||
5013 | "\x3c\xce\x8f\x42\x60\x71\xa7\x75" | ||
5014 | "\x08\x40\x65\x8a\x82\xbf\xf5\x43" | ||
5015 | "\x71\x96\xa9\x4d\x44\x8a\x20\xbe" | ||
5016 | "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65" | ||
5017 | "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9" | ||
5018 | "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4" | ||
5019 | "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a" | ||
5020 | "\x62\x73\x65\xfd\x46\x63\x25\x3d" | ||
5021 | "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf" | ||
5022 | "\x24\xf3\xb4\xac\x64\xba\xdf\x4b" | ||
5023 | "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7" | ||
5024 | "\xc5\x68\x77\x84\x32\x2b\xcc\x85" | ||
5025 | "\x74\x96\xf0\x12\x77\x61\xb9\xeb" | ||
5026 | "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8" | ||
5027 | "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24" | ||
5028 | "\xda\x39\x87\x45\xc0\x2b\xbb\x01" | ||
5029 | "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce" | ||
5030 | "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6" | ||
5031 | "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32" | ||
5032 | "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45" | ||
5033 | "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6" | ||
5034 | "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4" | ||
5035 | "\x21\xc4\xc2\x75\x67\x89\x37\x0a", | ||
5036 | .ilen = 512, | ||
5037 | .result = "\xe3\x5a\x38\x0f\x4d\x92\x3a\x74" | ||
5038 | "\x15\xb1\x50\x8c\x9a\xd8\x99\x1d" | ||
5039 | "\x82\xec\xf1\x5f\x03\x6d\x02\x58" | ||
5040 | "\x90\x67\xfc\xdd\x8d\xe1\x38\x08" | ||
5041 | "\x7b\xc9\x9b\x4b\x04\x09\x50\x15" | ||
5042 | "\xce\xab\xda\x33\x30\x20\x12\xfa" | ||
5043 | "\x83\xc4\xa6\x9a\x2e\x7d\x90\xd9" | ||
5044 | "\xa6\xa6\x67\x43\xb4\xa7\xa8\x5c" | ||
5045 | "\xbb\x6a\x49\x2b\x8b\xf8\xd0\x22" | ||
5046 | "\xe5\x9e\xba\xe8\x8c\x67\xb8\x5b" | ||
5047 | "\x60\xbc\xf5\xa4\x95\x4e\x66\xe5" | ||
5048 | "\x6d\x8e\xa9\xf6\x65\x2e\x04\xf5" | ||
5049 | "\xba\xb5\xdb\x88\xc2\xf6\x7a\x4b" | ||
5050 | "\x89\x58\x7c\x9a\xae\x26\xe8\xb7" | ||
5051 | "\xb7\x28\xcc\xd6\xcc\xa5\x98\x4d" | ||
5052 | "\xb9\x91\xcb\xb4\xe4\x8b\x96\x47" | ||
5053 | "\x5f\x03\x8b\xdd\x94\xd1\xee\x12" | ||
5054 | "\xa7\x83\x80\xf2\xc1\x15\x74\x4f" | ||
5055 | "\x49\xf9\xb0\x7e\x6f\xdc\x73\x2f" | ||
5056 | "\xe2\xcf\xe0\x1b\x34\xa5\xa0\x52" | ||
5057 | "\xfb\x3c\x5d\x85\x91\xe6\x6d\x98" | ||
5058 | "\x04\xd6\xdd\x4c\x00\x64\xd9\x54" | ||
5059 | "\x5c\x3c\x08\x1d\x4c\x06\x9f\xb8" | ||
5060 | "\x1c\x4d\x8d\xdc\xa4\x3c\xb9\x3b" | ||
5061 | "\x9e\x85\xce\xc3\xa8\x4a\x0c\xd9" | ||
5062 | "\x04\xc3\x6f\x17\x66\xa9\x1f\x59" | ||
5063 | "\xd9\xe2\x19\x36\xa3\x88\xb8\x0b" | ||
5064 | "\x0f\x4a\x4d\xf8\xc8\x6f\xd5\x43" | ||
5065 | "\xeb\xa0\xab\x1f\x61\xc0\x06\xeb" | ||
5066 | "\x93\xb7\xb8\x6f\x0d\xbd\x07\x49" | ||
5067 | "\xb3\xac\x5d\xcf\x31\xa0\x27\x26" | ||
5068 | "\x21\xbe\x94\x2e\x19\xea\xf4\xee" | ||
5069 | "\xb5\x13\x89\xf7\x94\x0b\xef\x59" | ||
5070 | "\x44\xc5\x78\x8b\x3c\x3b\x71\x20" | ||
5071 | "\xf9\x35\x0c\x70\x74\xdc\x5b\xc2" | ||
5072 | "\xb4\x11\x0e\x2c\x61\xa1\x52\x46" | ||
5073 | "\x18\x11\x16\xc6\x86\x44\xa7\xaf" | ||
5074 | "\xd5\x0c\x7d\xa6\x9e\x25\x2d\x1b" | ||
5075 | "\x9a\x8f\x0f\xf8\x6a\x61\xa0\xea" | ||
5076 | "\x3f\x0e\x90\xd6\x8f\x83\x30\x64" | ||
5077 | "\xb5\x51\x2d\x08\x3c\xcd\x99\x36" | ||
5078 | "\x96\xd4\xb1\xb5\x48\x30\xca\x48" | ||
5079 | "\xf7\x11\xa8\xf5\x97\x8a\x6a\x6d" | ||
5080 | "\x12\x33\x2f\xc0\xe8\xda\xec\x8a" | ||
5081 | "\xe1\x88\x72\x63\xde\x20\xa3\xe1" | ||
5082 | "\x8e\xac\x84\x37\x35\xf5\xf7\x3f" | ||
5083 | "\x00\x02\x0e\xe4\xc1\x53\x68\x3f" | ||
5084 | "\xaa\xd5\xac\x52\x3d\x20\x2f\x4d" | ||
5085 | "\x7c\x83\xd0\xbd\xaa\x97\x35\x36" | ||
5086 | "\x98\x88\x59\x5d\xe7\x24\xe3\x90" | ||
5087 | "\x9d\x30\x47\xa7\xc3\x60\x35\xf4" | ||
5088 | "\xd5\xdb\x0e\x4d\x44\xc1\x81\x8b" | ||
5089 | "\xfd\xbd\xc3\x2b\xba\x68\xfe\x8d" | ||
5090 | "\x49\x5a\x3c\x8a\xa3\x01\xae\x25" | ||
5091 | "\x42\xab\xd2\x87\x1b\x35\xd6\xd2" | ||
5092 | "\xd7\x70\x1c\x1f\x72\xd1\xe1\x39" | ||
5093 | "\x1c\x58\xa2\xb4\xd0\x78\x55\x72" | ||
5094 | "\x76\x59\xea\xd9\xd7\x6e\x63\x8b" | ||
5095 | "\xcc\x9b\xa7\x74\x89\xfc\xa3\x68" | ||
5096 | "\x86\x28\xd1\xbb\x54\x8d\x66\xad" | ||
5097 | "\x2a\x92\xf9\x4e\x04\x3d\xae\xfd" | ||
5098 | "\x1b\x2b\x7f\xc3\x2f\x1a\x78\x0a" | ||
5099 | "\x5c\xc6\x84\xfe\x7c\xcb\x26\xfd" | ||
5100 | "\xd9\x51\x0f\xd7\x94\x2f\xc5\xa7", | ||
5101 | .rlen = 512, | ||
5102 | }, | ||
5103 | }; | ||
5104 | |||
5105 | static struct cipher_testvec serpent_lrw_dec_tv_template[] = { | ||
5106 | /* Generated from AES-LRW test vectors */ | ||
5107 | /* same as enc vectors with input and result reversed */ | ||
5108 | { | ||
5109 | .key = "\x45\x62\xac\x25\xf8\x28\x17\x6d" | ||
5110 | "\x4c\x26\x84\x14\xb5\x68\x01\x85" | ||
5111 | "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03" | ||
5112 | "\xee\x5a\x83\x0c\xcc\x09\x4c\x87", | ||
5113 | .klen = 32, | ||
5114 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5115 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
5116 | .input = "\x6f\xbf\xd4\xa4\x5d\x71\x16\x79" | ||
5117 | "\x63\x9c\xa6\x8e\x40\xbe\x0d\x8a", | ||
5118 | .ilen = 16, | ||
5119 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
5120 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
5121 | .rlen = 16, | ||
5122 | }, { | ||
5123 | .key = "\x59\x70\x47\x14\xf5\x57\x47\x8c" | ||
5124 | "\xd7\x79\xe8\x0f\x54\x88\x79\x44" | ||
5125 | "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea" | ||
5126 | "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf", | ||
5127 | .klen = 32, | ||
5128 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5129 | "\x00\x00\x00\x00\x00\x00\x00\x02", | ||
5130 | .input = "\xfd\xb2\x66\x98\x80\x96\x55\xad" | ||
5131 | "\x08\x94\x54\x9c\x21\x7c\x69\xe3", | ||
5132 | .ilen = 16, | ||
5133 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
5134 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
5135 | .rlen = 16, | ||
5136 | }, { | ||
5137 | .key = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50" | ||
5138 | "\x30\xfe\x69\xe2\x37\x7f\x98\x47" | ||
5139 | "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6" | ||
5140 | "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f", | ||
5141 | .klen = 32, | ||
5142 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5143 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
5144 | .input = "\x14\x5e\x3d\x70\xc0\x6e\x9c\x34" | ||
5145 | "\x5b\x5e\xcf\x0f\xe4\x8c\x21\x5c", | ||
5146 | .ilen = 16, | ||
5147 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
5148 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
5149 | .rlen = 16, | ||
5150 | }, { | ||
5151 | .key = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15" | ||
5152 | "\x25\x83\xf7\x3c\x1f\x01\x28\x74" | ||
5153 | "\xca\xc6\xbc\x35\x4d\x4a\x65\x54" | ||
5154 | "\x90\xae\x61\xcf\x7b\xae\xbd\xcc" | ||
5155 | "\xad\xe4\x94\xc5\x4a\x29\xae\x70", | ||
5156 | .klen = 40, | ||
5157 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5158 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
5159 | .input = "\x25\x39\xaa\xa5\xf0\x65\xc8\xdc" | ||
5160 | "\x5d\x45\x95\x30\x8f\xff\x2f\x1b", | ||
5161 | .ilen = 16, | ||
5162 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
5163 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
5164 | .rlen = 16, | ||
5165 | }, { | ||
5166 | .key = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff" | ||
5167 | "\xf8\x86\xce\xac\x93\xc5\xad\xc6" | ||
5168 | "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd" | ||
5169 | "\x52\x13\xb2\xb7\xf0\xff\x11\xd8" | ||
5170 | "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f", | ||
5171 | .klen = 40, | ||
5172 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5173 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
5174 | .input = "\x0c\x20\x20\x63\xd6\x8b\xfc\x8f" | ||
5175 | "\xc0\xe2\x17\xbb\xd2\x59\x6f\x26", | ||
5176 | .ilen = 16, | ||
5177 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
5178 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
5179 | .rlen = 16, | ||
5180 | }, { | ||
5181 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
5182 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
5183 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
5184 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
5185 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
5186 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
5187 | .klen = 48, | ||
5188 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5189 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
5190 | .input = "\xc1\x35\x2e\x53\xf0\x96\x4d\x9c" | ||
5191 | "\x2e\x18\xe6\x99\xcd\xd3\x15\x68", | ||
5192 | .ilen = 16, | ||
5193 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
5194 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
5195 | .rlen = 16, | ||
5196 | }, { | ||
5197 | .key = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d" | ||
5198 | "\xd4\x70\x98\x0b\xc7\x95\x84\xc8" | ||
5199 | "\xb2\xfb\x64\xce\x60\x97\x87\x8d" | ||
5200 | "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7" | ||
5201 | "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4" | ||
5202 | "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c", | ||
5203 | .klen = 48, | ||
5204 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5205 | "\x00\x00\x00\x02\x00\x00\x00\x00", | ||
5206 | .input = "\x86\x0a\xc6\xa9\x1a\x9f\xe7\xe6" | ||
5207 | "\x64\x3b\x33\xd6\xd5\x84\xd6\xdf", | ||
5208 | .ilen = 16, | ||
5209 | .result = "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
5210 | "\x38\x39\x41\x42\x43\x44\x45\x46", | ||
5211 | .rlen = 16, | ||
5212 | }, { | ||
5213 | .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" | ||
5214 | "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" | ||
5215 | "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" | ||
5216 | "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" | ||
5217 | "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" | ||
5218 | "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", | ||
5219 | .klen = 48, | ||
5220 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5221 | "\x00\x00\x00\x00\x00\x00\x00\x01", | ||
5222 | .input = "\xe3\x5a\x38\x0f\x4d\x92\x3a\x74" | ||
5223 | "\x15\xb1\x50\x8c\x9a\xd8\x99\x1d" | ||
5224 | "\x82\xec\xf1\x5f\x03\x6d\x02\x58" | ||
5225 | "\x90\x67\xfc\xdd\x8d\xe1\x38\x08" | ||
5226 | "\x7b\xc9\x9b\x4b\x04\x09\x50\x15" | ||
5227 | "\xce\xab\xda\x33\x30\x20\x12\xfa" | ||
5228 | "\x83\xc4\xa6\x9a\x2e\x7d\x90\xd9" | ||
5229 | "\xa6\xa6\x67\x43\xb4\xa7\xa8\x5c" | ||
5230 | "\xbb\x6a\x49\x2b\x8b\xf8\xd0\x22" | ||
5231 | "\xe5\x9e\xba\xe8\x8c\x67\xb8\x5b" | ||
5232 | "\x60\xbc\xf5\xa4\x95\x4e\x66\xe5" | ||
5233 | "\x6d\x8e\xa9\xf6\x65\x2e\x04\xf5" | ||
5234 | "\xba\xb5\xdb\x88\xc2\xf6\x7a\x4b" | ||
5235 | "\x89\x58\x7c\x9a\xae\x26\xe8\xb7" | ||
5236 | "\xb7\x28\xcc\xd6\xcc\xa5\x98\x4d" | ||
5237 | "\xb9\x91\xcb\xb4\xe4\x8b\x96\x47" | ||
5238 | "\x5f\x03\x8b\xdd\x94\xd1\xee\x12" | ||
5239 | "\xa7\x83\x80\xf2\xc1\x15\x74\x4f" | ||
5240 | "\x49\xf9\xb0\x7e\x6f\xdc\x73\x2f" | ||
5241 | "\xe2\xcf\xe0\x1b\x34\xa5\xa0\x52" | ||
5242 | "\xfb\x3c\x5d\x85\x91\xe6\x6d\x98" | ||
5243 | "\x04\xd6\xdd\x4c\x00\x64\xd9\x54" | ||
5244 | "\x5c\x3c\x08\x1d\x4c\x06\x9f\xb8" | ||
5245 | "\x1c\x4d\x8d\xdc\xa4\x3c\xb9\x3b" | ||
5246 | "\x9e\x85\xce\xc3\xa8\x4a\x0c\xd9" | ||
5247 | "\x04\xc3\x6f\x17\x66\xa9\x1f\x59" | ||
5248 | "\xd9\xe2\x19\x36\xa3\x88\xb8\x0b" | ||
5249 | "\x0f\x4a\x4d\xf8\xc8\x6f\xd5\x43" | ||
5250 | "\xeb\xa0\xab\x1f\x61\xc0\x06\xeb" | ||
5251 | "\x93\xb7\xb8\x6f\x0d\xbd\x07\x49" | ||
5252 | "\xb3\xac\x5d\xcf\x31\xa0\x27\x26" | ||
5253 | "\x21\xbe\x94\x2e\x19\xea\xf4\xee" | ||
5254 | "\xb5\x13\x89\xf7\x94\x0b\xef\x59" | ||
5255 | "\x44\xc5\x78\x8b\x3c\x3b\x71\x20" | ||
5256 | "\xf9\x35\x0c\x70\x74\xdc\x5b\xc2" | ||
5257 | "\xb4\x11\x0e\x2c\x61\xa1\x52\x46" | ||
5258 | "\x18\x11\x16\xc6\x86\x44\xa7\xaf" | ||
5259 | "\xd5\x0c\x7d\xa6\x9e\x25\x2d\x1b" | ||
5260 | "\x9a\x8f\x0f\xf8\x6a\x61\xa0\xea" | ||
5261 | "\x3f\x0e\x90\xd6\x8f\x83\x30\x64" | ||
5262 | "\xb5\x51\x2d\x08\x3c\xcd\x99\x36" | ||
5263 | "\x96\xd4\xb1\xb5\x48\x30\xca\x48" | ||
5264 | "\xf7\x11\xa8\xf5\x97\x8a\x6a\x6d" | ||
5265 | "\x12\x33\x2f\xc0\xe8\xda\xec\x8a" | ||
5266 | "\xe1\x88\x72\x63\xde\x20\xa3\xe1" | ||
5267 | "\x8e\xac\x84\x37\x35\xf5\xf7\x3f" | ||
5268 | "\x00\x02\x0e\xe4\xc1\x53\x68\x3f" | ||
5269 | "\xaa\xd5\xac\x52\x3d\x20\x2f\x4d" | ||
5270 | "\x7c\x83\xd0\xbd\xaa\x97\x35\x36" | ||
5271 | "\x98\x88\x59\x5d\xe7\x24\xe3\x90" | ||
5272 | "\x9d\x30\x47\xa7\xc3\x60\x35\xf4" | ||
5273 | "\xd5\xdb\x0e\x4d\x44\xc1\x81\x8b" | ||
5274 | "\xfd\xbd\xc3\x2b\xba\x68\xfe\x8d" | ||
5275 | "\x49\x5a\x3c\x8a\xa3\x01\xae\x25" | ||
5276 | "\x42\xab\xd2\x87\x1b\x35\xd6\xd2" | ||
5277 | "\xd7\x70\x1c\x1f\x72\xd1\xe1\x39" | ||
5278 | "\x1c\x58\xa2\xb4\xd0\x78\x55\x72" | ||
5279 | "\x76\x59\xea\xd9\xd7\x6e\x63\x8b" | ||
5280 | "\xcc\x9b\xa7\x74\x89\xfc\xa3\x68" | ||
5281 | "\x86\x28\xd1\xbb\x54\x8d\x66\xad" | ||
5282 | "\x2a\x92\xf9\x4e\x04\x3d\xae\xfd" | ||
5283 | "\x1b\x2b\x7f\xc3\x2f\x1a\x78\x0a" | ||
5284 | "\x5c\xc6\x84\xfe\x7c\xcb\x26\xfd" | ||
5285 | "\xd9\x51\x0f\xd7\x94\x2f\xc5\xa7", | ||
5286 | .ilen = 512, | ||
5287 | .result = "\x05\x11\xb7\x18\xab\xc6\x2d\xac" | ||
5288 | "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c" | ||
5289 | "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8" | ||
5290 | "\x50\x38\x1f\x71\x49\xb6\x57\xd6" | ||
5291 | "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90" | ||
5292 | "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6" | ||
5293 | "\xad\x1e\x9e\x20\x5f\x38\xbe\x04" | ||
5294 | "\xda\x10\x8e\xed\xa2\xa4\x87\xab" | ||
5295 | "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c" | ||
5296 | "\xc9\xac\x42\x31\x95\x7c\xc9\x04" | ||
5297 | "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6" | ||
5298 | "\x15\xd7\x3f\x4f\x2f\x66\x69\x03" | ||
5299 | "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65" | ||
5300 | "\x4c\x96\x12\xed\x7c\x92\x03\x01" | ||
5301 | "\x6f\xbc\x35\x93\xac\xf1\x27\xf1" | ||
5302 | "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50" | ||
5303 | "\x89\xa4\x8e\x66\x44\x85\xcc\xfd" | ||
5304 | "\x33\x14\x70\xe3\x96\xb2\xc3\xd3" | ||
5305 | "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5" | ||
5306 | "\x2d\x64\x75\xdd\xb4\x54\xe6\x74" | ||
5307 | "\x8c\xd3\x9d\x9e\x86\xab\x51\x53" | ||
5308 | "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40" | ||
5309 | "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5" | ||
5310 | "\x76\x12\x73\x44\x1a\x56\xd7\x72" | ||
5311 | "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda" | ||
5312 | "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd" | ||
5313 | "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60" | ||
5314 | "\x1a\xe2\x70\x85\x58\xc2\x1b\x09" | ||
5315 | "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9" | ||
5316 | "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8" | ||
5317 | "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8" | ||
5318 | "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10" | ||
5319 | "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1" | ||
5320 | "\x90\x3e\x76\x4a\x74\xa4\x21\x2c" | ||
5321 | "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e" | ||
5322 | "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f" | ||
5323 | "\x8d\x23\x31\x74\x84\xeb\x88\x6e" | ||
5324 | "\xcc\xb9\xbc\x22\x83\x19\x07\x22" | ||
5325 | "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78" | ||
5326 | "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5" | ||
5327 | "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41" | ||
5328 | "\x3c\xce\x8f\x42\x60\x71\xa7\x75" | ||
5329 | "\x08\x40\x65\x8a\x82\xbf\xf5\x43" | ||
5330 | "\x71\x96\xa9\x4d\x44\x8a\x20\xbe" | ||
5331 | "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65" | ||
5332 | "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9" | ||
5333 | "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4" | ||
5334 | "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a" | ||
5335 | "\x62\x73\x65\xfd\x46\x63\x25\x3d" | ||
5336 | "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf" | ||
5337 | "\x24\xf3\xb4\xac\x64\xba\xdf\x4b" | ||
5338 | "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7" | ||
5339 | "\xc5\x68\x77\x84\x32\x2b\xcc\x85" | ||
5340 | "\x74\x96\xf0\x12\x77\x61\xb9\xeb" | ||
5341 | "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8" | ||
5342 | "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24" | ||
5343 | "\xda\x39\x87\x45\xc0\x2b\xbb\x01" | ||
5344 | "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce" | ||
5345 | "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6" | ||
5346 | "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32" | ||
5347 | "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45" | ||
5348 | "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6" | ||
5349 | "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4" | ||
5350 | "\x21\xc4\xc2\x75\x67\x89\x37\x0a", | ||
5351 | .rlen = 512, | ||
5352 | }, | ||
5353 | }; | ||
5354 | |||
5355 | static struct cipher_testvec serpent_xts_enc_tv_template[] = { | ||
5356 | /* Generated from AES-XTS test vectors */ | ||
5357 | { | ||
5358 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5359 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5360 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5361 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
5362 | .klen = 32, | ||
5363 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5364 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
5365 | .input = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5366 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5367 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5368 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
5369 | .ilen = 32, | ||
5370 | .result = "\xe1\x08\xb8\x1d\x2c\xf5\x33\x64" | ||
5371 | "\xc8\x12\x04\xc7\xb3\x70\xe8\xc4" | ||
5372 | "\x6a\x31\xc5\xf3\x00\xca\xb9\x16" | ||
5373 | "\xde\xe2\x77\x66\xf7\xfe\x62\x08", | ||
5374 | .rlen = 32, | ||
5375 | }, { | ||
5376 | .key = "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
5377 | "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
5378 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
5379 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
5380 | .klen = 32, | ||
5381 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
5382 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
5383 | .input = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
5384 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
5385 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
5386 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
5387 | .ilen = 32, | ||
5388 | .result = "\x1a\x0a\x09\x5f\xcd\x07\x07\x98" | ||
5389 | "\x41\x86\x12\xaf\xb3\xd7\x68\x13" | ||
5390 | "\xed\x81\xcd\x06\x87\x43\x1a\xbb" | ||
5391 | "\x13\x3d\xd6\x1e\x2b\xe1\x77\xbe", | ||
5392 | .rlen = 32, | ||
5393 | }, { | ||
5394 | .key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8" | ||
5395 | "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0" | ||
5396 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
5397 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
5398 | .klen = 32, | ||
5399 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
5400 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
5401 | .input = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
5402 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
5403 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
5404 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
5405 | .ilen = 32, | ||
5406 | .result = "\xf9\x9b\x28\xb8\x5c\xaf\x8c\x61" | ||
5407 | "\xb6\x1c\x81\x8f\x2c\x87\x60\x89" | ||
5408 | "\x0d\x8d\x7a\xe8\x60\x48\xcc\x86" | ||
5409 | "\xc1\x68\x45\xaa\x00\xe9\x24\xc5", | ||
5410 | .rlen = 32, | ||
5411 | }, { | ||
5412 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
5413 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
5414 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
5415 | "\x23\x84\x62\x64\x33\x83\x27\x95", | ||
5416 | .klen = 32, | ||
5417 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5418 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
5419 | .input = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
5420 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
5421 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
5422 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
5423 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
5424 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
5425 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
5426 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
5427 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
5428 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
5429 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
5430 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
5431 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
5432 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
5433 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
5434 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
5435 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
5436 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
5437 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
5438 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
5439 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
5440 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
5441 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
5442 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
5443 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
5444 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
5445 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
5446 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
5447 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
5448 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
5449 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
5450 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
5451 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
5452 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
5453 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
5454 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
5455 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
5456 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
5457 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
5458 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
5459 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
5460 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
5461 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
5462 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
5463 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
5464 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
5465 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
5466 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
5467 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
5468 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
5469 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
5470 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
5471 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
5472 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
5473 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
5474 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
5475 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
5476 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
5477 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
5478 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
5479 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
5480 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
5481 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
5482 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
5483 | .ilen = 512, | ||
5484 | .result = "\xfe\x47\x4a\xc8\x60\x7e\xb4\x8b" | ||
5485 | "\x0d\x10\xf4\xb0\x0d\xba\xf8\x53" | ||
5486 | "\x65\x6e\x38\x4b\xdb\xaa\xb1\x9e" | ||
5487 | "\x28\xca\xb0\x22\xb3\x85\x75\xf4" | ||
5488 | "\x00\x5c\x75\x14\x06\xd6\x25\x82" | ||
5489 | "\xe6\xcb\x08\xf7\x29\x90\x23\x8e" | ||
5490 | "\xa4\x68\x57\xe4\xf0\xd8\x32\xf3" | ||
5491 | "\x80\x51\x67\xb5\x0b\x85\x69\xe8" | ||
5492 | "\x19\xfe\xc4\xc7\x3e\xea\x90\xd3" | ||
5493 | "\x8f\xa3\xf2\x0a\xac\x17\x4b\xa0" | ||
5494 | "\x63\x5a\x16\x0f\xf0\xce\x66\x1f" | ||
5495 | "\x2c\x21\x07\xf1\xa4\x03\xa3\x44" | ||
5496 | "\x41\x61\x87\x5d\x6b\xb3\xef\xd4" | ||
5497 | "\xfc\xaa\x32\x7e\x55\x58\x04\x41" | ||
5498 | "\xc9\x07\x33\xc6\xa2\x68\xd6\x5a" | ||
5499 | "\x55\x79\x4b\x6f\xcf\x89\xb9\x19" | ||
5500 | "\xe5\x54\x13\x15\xb2\x1a\xfa\x15" | ||
5501 | "\xc2\xf0\x06\x59\xfa\xa0\x25\x05" | ||
5502 | "\x58\xfa\x43\x91\x16\x85\x40\xbb" | ||
5503 | "\x0d\x34\x4d\xc5\x1e\x20\xd5\x08" | ||
5504 | "\xcd\x22\x22\x41\x11\x9f\x6c\x7c" | ||
5505 | "\x8d\x57\xc9\xba\x57\xe8\x2c\xf7" | ||
5506 | "\xa0\x42\xa8\xde\xfc\xa3\xca\x98" | ||
5507 | "\x4b\x43\xb1\xce\x4b\xbf\x01\x67" | ||
5508 | "\x6e\x29\x60\xbd\x10\x14\x84\x82" | ||
5509 | "\x83\x82\x0c\x63\x73\x92\x02\x7c" | ||
5510 | "\x55\x37\x20\x80\x17\x51\xc8\xbc" | ||
5511 | "\x46\x02\xcb\x38\x07\x6d\xe2\x85" | ||
5512 | "\xaa\x29\xaf\x24\x58\x0d\xf0\x75" | ||
5513 | "\x08\x0a\xa5\x34\x25\x16\xf3\x74" | ||
5514 | "\xa7\x0b\x97\xbe\xc1\xa9\xdc\x29" | ||
5515 | "\x1a\x0a\x56\xc1\x1a\x91\x97\x8c" | ||
5516 | "\x0b\xc7\x16\xed\x5a\x22\xa6\x2e" | ||
5517 | "\x8c\x2b\x4f\x54\x76\x47\x53\x8e" | ||
5518 | "\xe8\x00\xec\x92\xb9\x55\xe6\xa2" | ||
5519 | "\xf3\xe2\x4f\x6a\x66\x60\xd0\x87" | ||
5520 | "\xe6\xd1\xcc\xe3\x6a\xc5\x2d\x21" | ||
5521 | "\xcc\x9d\x6a\xb6\x75\xaa\xe2\x19" | ||
5522 | "\x21\x9f\xa1\x5e\x4c\xfd\x72\xf9" | ||
5523 | "\x94\x4e\x63\xc7\xae\xfc\xed\x47" | ||
5524 | "\xe2\xfe\x7a\x63\x77\xfe\x97\x82" | ||
5525 | "\xb1\x10\x6e\x36\x1d\xe1\xc4\x80" | ||
5526 | "\xec\x69\x41\xec\xa7\x8a\xe0\x2f" | ||
5527 | "\xe3\x49\x26\xa2\x41\xb2\x08\x0f" | ||
5528 | "\x28\xb4\xa7\x39\xa1\x99\x2d\x1e" | ||
5529 | "\x43\x42\x35\xd0\xcf\xec\x77\x67" | ||
5530 | "\xb2\x3b\x9e\x1c\x35\xde\x4f\x5e" | ||
5531 | "\x73\x3f\x5d\x6f\x07\x4b\x2e\x50" | ||
5532 | "\xab\x6c\x6b\xff\xea\x00\x67\xaa" | ||
5533 | "\x0e\x82\x32\xdd\x3d\xb5\xe5\x76" | ||
5534 | "\x2b\x77\x3f\xbe\x12\x75\xfb\x92" | ||
5535 | "\xc6\x89\x67\x4d\xca\xf7\xd4\x50" | ||
5536 | "\xc0\x74\x47\xcc\xd9\x0a\xd4\xc6" | ||
5537 | "\x3b\x17\x2e\xe3\x35\xbb\x53\xb5" | ||
5538 | "\x86\xad\x51\xcc\xd5\x96\xb8\xdc" | ||
5539 | "\x03\x57\xe6\x98\x52\x2f\x61\x62" | ||
5540 | "\xc4\x5c\x9c\x36\x71\x07\xfb\x94" | ||
5541 | "\xe3\x02\xc4\x2b\x08\x75\xc7\x35" | ||
5542 | "\xfb\x2e\x88\x7b\xbb\x67\x00\xe1" | ||
5543 | "\xc9\xdd\x99\xb2\x13\x53\x1a\x4e" | ||
5544 | "\x76\x87\x19\x04\x1a\x2f\x38\x3e" | ||
5545 | "\xef\x91\x64\x1d\x18\x07\x4e\x31" | ||
5546 | "\x88\x21\x7c\xb0\xa5\x12\x4c\x3c" | ||
5547 | "\xb0\x20\xbd\xda\xdf\xf9\x7c\xdd", | ||
5548 | .rlen = 512, | ||
5549 | }, { | ||
5550 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
5551 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
5552 | "\x62\x49\x77\x57\x24\x70\x93\x69" | ||
5553 | "\x99\x59\x57\x49\x66\x96\x76\x27" | ||
5554 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
5555 | "\x23\x84\x62\x64\x33\x83\x27\x95" | ||
5556 | "\x02\x88\x41\x97\x16\x93\x99\x37" | ||
5557 | "\x51\x05\x82\x09\x74\x94\x45\x92", | ||
5558 | .klen = 64, | ||
5559 | .iv = "\xff\x00\x00\x00\x00\x00\x00\x00" | ||
5560 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
5561 | .input = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
5562 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
5563 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
5564 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
5565 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
5566 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
5567 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
5568 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
5569 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
5570 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
5571 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
5572 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
5573 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
5574 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
5575 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
5576 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
5577 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
5578 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
5579 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
5580 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
5581 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
5582 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
5583 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
5584 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
5585 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
5586 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
5587 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
5588 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
5589 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
5590 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
5591 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
5592 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
5593 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
5594 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
5595 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
5596 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
5597 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
5598 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
5599 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
5600 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
5601 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
5602 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
5603 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
5604 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
5605 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
5606 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
5607 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
5608 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
5609 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
5610 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
5611 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
5612 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
5613 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
5614 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
5615 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
5616 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
5617 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
5618 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
5619 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
5620 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
5621 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
5622 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
5623 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
5624 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
5625 | .ilen = 512, | ||
5626 | .result = "\x2b\xc9\xb4\x6b\x10\x94\xa9\x32" | ||
5627 | "\xaa\xb0\x20\xc6\x44\x3d\x74\x1f" | ||
5628 | "\x75\x01\xa7\xf6\xf5\xf7\x62\x1b" | ||
5629 | "\x80\x1b\x82\xcb\x01\x59\x91\x7f" | ||
5630 | "\x80\x3a\x98\xf0\xd2\xca\xc4\xc3" | ||
5631 | "\x34\xfd\xe6\x11\xf9\x33\x45\x12" | ||
5632 | "\x48\xc5\x8c\x25\xf1\xc5\xc5\x23" | ||
5633 | "\xd3\x44\xb4\x73\xd5\x04\xc0\xb7" | ||
5634 | "\xca\x2f\xf5\xcd\xc5\xb4\xdd\xb0" | ||
5635 | "\xf4\x60\xe8\xfb\xc6\x9c\xc5\x78" | ||
5636 | "\xcd\xec\x7d\xdc\x19\x9c\x72\x64" | ||
5637 | "\x63\x0b\x38\x2e\x76\xdd\x2d\x36" | ||
5638 | "\x49\xb0\x1d\xea\x78\x9e\x00\xca" | ||
5639 | "\x20\xcc\x1b\x1e\x98\x74\xab\xed" | ||
5640 | "\x79\xf7\xd0\x6c\xd8\x93\x80\x29" | ||
5641 | "\xac\xa5\x5e\x34\xa9\xab\xa0\x55" | ||
5642 | "\x9a\xea\xaa\x95\x4d\x7b\xfe\x46" | ||
5643 | "\x26\x8a\xfd\x88\xa2\xa8\xa6\xae" | ||
5644 | "\x25\x42\x17\xbf\x76\x8f\x1c\x3d" | ||
5645 | "\xec\x9a\xda\x64\x96\xb5\x61\xff" | ||
5646 | "\x99\xeb\x12\x96\x85\x82\x9d\xd5" | ||
5647 | "\x81\x85\x14\xa8\x59\xac\x8c\x94" | ||
5648 | "\xbb\x3b\x85\x2b\xdf\xb3\x0c\xba" | ||
5649 | "\x82\xc6\x4d\xca\x86\xea\x53\x28" | ||
5650 | "\x4c\xe0\x4e\x31\xe3\x73\x2f\x79" | ||
5651 | "\x9d\x42\xe1\x03\xe3\x8b\xc4\xff" | ||
5652 | "\x05\xca\x81\x7b\xda\xa2\xde\x63" | ||
5653 | "\x3a\x10\xbe\xc2\xac\x32\xc4\x05" | ||
5654 | "\x47\x7e\xef\x67\xe2\x5f\x5b\xae" | ||
5655 | "\xed\xf1\x70\x34\x16\x9a\x07\x7b" | ||
5656 | "\xf2\x25\x2b\xb0\xf8\x3c\x15\x9a" | ||
5657 | "\xa6\x59\x55\x5f\xc1\xf4\x1e\xcd" | ||
5658 | "\x93\x1f\x06\xba\xd4\x9a\x22\x69" | ||
5659 | "\xfa\x8e\x95\x0d\xf3\x23\x59\x2c" | ||
5660 | "\xfe\x00\xba\xf0\x0e\xbc\x6d\xd6" | ||
5661 | "\x62\xf0\x7a\x0e\x83\x3e\xdb\x32" | ||
5662 | "\xfd\x43\x7d\xda\x42\x51\x87\x43" | ||
5663 | "\x9d\xf9\xef\xf4\x30\x97\xf8\x09" | ||
5664 | "\x88\xfc\x3f\x93\x70\xc1\x4a\xec" | ||
5665 | "\x27\x5f\x11\xac\x71\xc7\x48\x46" | ||
5666 | "\x2f\xf9\xdf\x8d\x9f\xf7\x2e\x56" | ||
5667 | "\x0d\x4e\xb0\x32\x76\xce\x86\x81" | ||
5668 | "\xcd\xdf\xe4\x00\xbf\xfd\x5f\x24" | ||
5669 | "\xaf\xf7\x9a\xde\xff\x18\xac\x14" | ||
5670 | "\x90\xc5\x01\x39\x34\x0f\x24\xf3" | ||
5671 | "\x13\x2f\x5e\x4f\x30\x9a\x36\x40" | ||
5672 | "\xec\xea\xbc\xcd\x9e\x0e\x5b\x23" | ||
5673 | "\x50\x88\x97\x40\x69\xb1\x37\xf5" | ||
5674 | "\xc3\x15\xf9\x3f\xb7\x79\x64\xe8" | ||
5675 | "\x7b\x10\x20\xb9\x2b\x46\x83\x5b" | ||
5676 | "\xd8\x39\xfc\xe4\xfa\x88\x52\xf2" | ||
5677 | "\x72\xb0\x97\x4e\x89\xb3\x48\x00" | ||
5678 | "\xc1\x16\x73\x50\x77\xba\xa6\x65" | ||
5679 | "\x20\x2d\xb0\x02\x27\x89\xda\x99" | ||
5680 | "\x45\xfb\xe9\xd3\x1d\x39\x2f\xd6" | ||
5681 | "\x2a\xda\x09\x12\x11\xaf\xe6\x57" | ||
5682 | "\x01\x04\x8a\xff\x86\x8b\xac\xf8" | ||
5683 | "\xee\xe4\x1c\x98\x5b\xcf\x6b\x76" | ||
5684 | "\xa3\x0e\x33\x74\x40\x18\x39\x72" | ||
5685 | "\x66\x50\x31\xfd\x70\xdf\xe8\x51" | ||
5686 | "\x96\x21\x36\xb2\x9b\xfa\x85\xd1" | ||
5687 | "\x30\x05\xc8\x92\x98\x80\xff\x7a" | ||
5688 | "\xaf\x43\x0b\xc5\x20\x41\x92\x20" | ||
5689 | "\xd4\xa0\x91\x98\x11\x5f\x4d\xb1", | ||
5690 | .rlen = 512, | ||
5691 | }, | ||
5692 | }; | ||
5693 | |||
5694 | static struct cipher_testvec serpent_xts_dec_tv_template[] = { | ||
5695 | /* Generated from AES-XTS test vectors */ | ||
5696 | /* same as enc vectors with input and result reversed */ | ||
5697 | { | ||
5698 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5699 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5700 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5701 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
5702 | .klen = 32, | ||
5703 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5704 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
5705 | .input = "\xe1\x08\xb8\x1d\x2c\xf5\x33\x64" | ||
5706 | "\xc8\x12\x04\xc7\xb3\x70\xe8\xc4" | ||
5707 | "\x6a\x31\xc5\xf3\x00\xca\xb9\x16" | ||
5708 | "\xde\xe2\x77\x66\xf7\xfe\x62\x08", | ||
5709 | .ilen = 32, | ||
5710 | .result = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5711 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5712 | "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5713 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
5714 | .rlen = 32, | ||
5715 | }, { | ||
5716 | .key = "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
5717 | "\x11\x11\x11\x11\x11\x11\x11\x11" | ||
5718 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
5719 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
5720 | .klen = 32, | ||
5721 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
5722 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
5723 | .input = "\x1a\x0a\x09\x5f\xcd\x07\x07\x98" | ||
5724 | "\x41\x86\x12\xaf\xb3\xd7\x68\x13" | ||
5725 | "\xed\x81\xcd\x06\x87\x43\x1a\xbb" | ||
5726 | "\x13\x3d\xd6\x1e\x2b\xe1\x77\xbe", | ||
5727 | .ilen = 32, | ||
5728 | .result = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
5729 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
5730 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
5731 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
5732 | .rlen = 32, | ||
5733 | }, { | ||
5734 | .key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8" | ||
5735 | "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0" | ||
5736 | "\x22\x22\x22\x22\x22\x22\x22\x22" | ||
5737 | "\x22\x22\x22\x22\x22\x22\x22\x22", | ||
5738 | .klen = 32, | ||
5739 | .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" | ||
5740 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
5741 | .input = "\xf9\x9b\x28\xb8\x5c\xaf\x8c\x61" | ||
5742 | "\xb6\x1c\x81\x8f\x2c\x87\x60\x89" | ||
5743 | "\x0d\x8d\x7a\xe8\x60\x48\xcc\x86" | ||
5744 | "\xc1\x68\x45\xaa\x00\xe9\x24\xc5", | ||
5745 | .ilen = 32, | ||
5746 | .result = "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
5747 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
5748 | "\x44\x44\x44\x44\x44\x44\x44\x44" | ||
5749 | "\x44\x44\x44\x44\x44\x44\x44\x44", | ||
5750 | .rlen = 32, | ||
5751 | }, { | ||
5752 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
5753 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
5754 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
5755 | "\x23\x84\x62\x64\x33\x83\x27\x95", | ||
5756 | .klen = 32, | ||
5757 | .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" | ||
5758 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
5759 | .input = "\xfe\x47\x4a\xc8\x60\x7e\xb4\x8b" | ||
5760 | "\x0d\x10\xf4\xb0\x0d\xba\xf8\x53" | ||
5761 | "\x65\x6e\x38\x4b\xdb\xaa\xb1\x9e" | ||
5762 | "\x28\xca\xb0\x22\xb3\x85\x75\xf4" | ||
5763 | "\x00\x5c\x75\x14\x06\xd6\x25\x82" | ||
5764 | "\xe6\xcb\x08\xf7\x29\x90\x23\x8e" | ||
5765 | "\xa4\x68\x57\xe4\xf0\xd8\x32\xf3" | ||
5766 | "\x80\x51\x67\xb5\x0b\x85\x69\xe8" | ||
5767 | "\x19\xfe\xc4\xc7\x3e\xea\x90\xd3" | ||
5768 | "\x8f\xa3\xf2\x0a\xac\x17\x4b\xa0" | ||
5769 | "\x63\x5a\x16\x0f\xf0\xce\x66\x1f" | ||
5770 | "\x2c\x21\x07\xf1\xa4\x03\xa3\x44" | ||
5771 | "\x41\x61\x87\x5d\x6b\xb3\xef\xd4" | ||
5772 | "\xfc\xaa\x32\x7e\x55\x58\x04\x41" | ||
5773 | "\xc9\x07\x33\xc6\xa2\x68\xd6\x5a" | ||
5774 | "\x55\x79\x4b\x6f\xcf\x89\xb9\x19" | ||
5775 | "\xe5\x54\x13\x15\xb2\x1a\xfa\x15" | ||
5776 | "\xc2\xf0\x06\x59\xfa\xa0\x25\x05" | ||
5777 | "\x58\xfa\x43\x91\x16\x85\x40\xbb" | ||
5778 | "\x0d\x34\x4d\xc5\x1e\x20\xd5\x08" | ||
5779 | "\xcd\x22\x22\x41\x11\x9f\x6c\x7c" | ||
5780 | "\x8d\x57\xc9\xba\x57\xe8\x2c\xf7" | ||
5781 | "\xa0\x42\xa8\xde\xfc\xa3\xca\x98" | ||
5782 | "\x4b\x43\xb1\xce\x4b\xbf\x01\x67" | ||
5783 | "\x6e\x29\x60\xbd\x10\x14\x84\x82" | ||
5784 | "\x83\x82\x0c\x63\x73\x92\x02\x7c" | ||
5785 | "\x55\x37\x20\x80\x17\x51\xc8\xbc" | ||
5786 | "\x46\x02\xcb\x38\x07\x6d\xe2\x85" | ||
5787 | "\xaa\x29\xaf\x24\x58\x0d\xf0\x75" | ||
5788 | "\x08\x0a\xa5\x34\x25\x16\xf3\x74" | ||
5789 | "\xa7\x0b\x97\xbe\xc1\xa9\xdc\x29" | ||
5790 | "\x1a\x0a\x56\xc1\x1a\x91\x97\x8c" | ||
5791 | "\x0b\xc7\x16\xed\x5a\x22\xa6\x2e" | ||
5792 | "\x8c\x2b\x4f\x54\x76\x47\x53\x8e" | ||
5793 | "\xe8\x00\xec\x92\xb9\x55\xe6\xa2" | ||
5794 | "\xf3\xe2\x4f\x6a\x66\x60\xd0\x87" | ||
5795 | "\xe6\xd1\xcc\xe3\x6a\xc5\x2d\x21" | ||
5796 | "\xcc\x9d\x6a\xb6\x75\xaa\xe2\x19" | ||
5797 | "\x21\x9f\xa1\x5e\x4c\xfd\x72\xf9" | ||
5798 | "\x94\x4e\x63\xc7\xae\xfc\xed\x47" | ||
5799 | "\xe2\xfe\x7a\x63\x77\xfe\x97\x82" | ||
5800 | "\xb1\x10\x6e\x36\x1d\xe1\xc4\x80" | ||
5801 | "\xec\x69\x41\xec\xa7\x8a\xe0\x2f" | ||
5802 | "\xe3\x49\x26\xa2\x41\xb2\x08\x0f" | ||
5803 | "\x28\xb4\xa7\x39\xa1\x99\x2d\x1e" | ||
5804 | "\x43\x42\x35\xd0\xcf\xec\x77\x67" | ||
5805 | "\xb2\x3b\x9e\x1c\x35\xde\x4f\x5e" | ||
5806 | "\x73\x3f\x5d\x6f\x07\x4b\x2e\x50" | ||
5807 | "\xab\x6c\x6b\xff\xea\x00\x67\xaa" | ||
5808 | "\x0e\x82\x32\xdd\x3d\xb5\xe5\x76" | ||
5809 | "\x2b\x77\x3f\xbe\x12\x75\xfb\x92" | ||
5810 | "\xc6\x89\x67\x4d\xca\xf7\xd4\x50" | ||
5811 | "\xc0\x74\x47\xcc\xd9\x0a\xd4\xc6" | ||
5812 | "\x3b\x17\x2e\xe3\x35\xbb\x53\xb5" | ||
5813 | "\x86\xad\x51\xcc\xd5\x96\xb8\xdc" | ||
5814 | "\x03\x57\xe6\x98\x52\x2f\x61\x62" | ||
5815 | "\xc4\x5c\x9c\x36\x71\x07\xfb\x94" | ||
5816 | "\xe3\x02\xc4\x2b\x08\x75\xc7\x35" | ||
5817 | "\xfb\x2e\x88\x7b\xbb\x67\x00\xe1" | ||
5818 | "\xc9\xdd\x99\xb2\x13\x53\x1a\x4e" | ||
5819 | "\x76\x87\x19\x04\x1a\x2f\x38\x3e" | ||
5820 | "\xef\x91\x64\x1d\x18\x07\x4e\x31" | ||
5821 | "\x88\x21\x7c\xb0\xa5\x12\x4c\x3c" | ||
5822 | "\xb0\x20\xbd\xda\xdf\xf9\x7c\xdd", | ||
5823 | .ilen = 512, | ||
5824 | .result = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
5825 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
5826 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
5827 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
5828 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
5829 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
5830 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
5831 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
5832 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
5833 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
5834 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
5835 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
5836 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
5837 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
5838 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
5839 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
5840 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
5841 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
5842 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
5843 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
5844 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
5845 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
5846 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
5847 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
5848 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
5849 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
5850 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
5851 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
5852 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
5853 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
5854 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
5855 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
5856 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
5857 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
5858 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
5859 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
5860 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
5861 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
5862 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
5863 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
5864 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
5865 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
5866 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
5867 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
5868 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
5869 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
5870 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
5871 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
5872 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
5873 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
5874 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
5875 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
5876 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
5877 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
5878 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
5879 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
5880 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
5881 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
5882 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
5883 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
5884 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
5885 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
5886 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
5887 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
5888 | .rlen = 512, | ||
5889 | }, { | ||
5890 | .key = "\x27\x18\x28\x18\x28\x45\x90\x45" | ||
5891 | "\x23\x53\x60\x28\x74\x71\x35\x26" | ||
5892 | "\x62\x49\x77\x57\x24\x70\x93\x69" | ||
5893 | "\x99\x59\x57\x49\x66\x96\x76\x27" | ||
5894 | "\x31\x41\x59\x26\x53\x58\x97\x93" | ||
5895 | "\x23\x84\x62\x64\x33\x83\x27\x95" | ||
5896 | "\x02\x88\x41\x97\x16\x93\x99\x37" | ||
5897 | "\x51\x05\x82\x09\x74\x94\x45\x92", | ||
5898 | .klen = 64, | ||
5899 | .iv = "\xff\x00\x00\x00\x00\x00\x00\x00" | ||
5900 | "\x00\x00\x00\x00\x00\x00\x00\x00", | ||
5901 | .input = "\x2b\xc9\xb4\x6b\x10\x94\xa9\x32" | ||
5902 | "\xaa\xb0\x20\xc6\x44\x3d\x74\x1f" | ||
5903 | "\x75\x01\xa7\xf6\xf5\xf7\x62\x1b" | ||
5904 | "\x80\x1b\x82\xcb\x01\x59\x91\x7f" | ||
5905 | "\x80\x3a\x98\xf0\xd2\xca\xc4\xc3" | ||
5906 | "\x34\xfd\xe6\x11\xf9\x33\x45\x12" | ||
5907 | "\x48\xc5\x8c\x25\xf1\xc5\xc5\x23" | ||
5908 | "\xd3\x44\xb4\x73\xd5\x04\xc0\xb7" | ||
5909 | "\xca\x2f\xf5\xcd\xc5\xb4\xdd\xb0" | ||
5910 | "\xf4\x60\xe8\xfb\xc6\x9c\xc5\x78" | ||
5911 | "\xcd\xec\x7d\xdc\x19\x9c\x72\x64" | ||
5912 | "\x63\x0b\x38\x2e\x76\xdd\x2d\x36" | ||
5913 | "\x49\xb0\x1d\xea\x78\x9e\x00\xca" | ||
5914 | "\x20\xcc\x1b\x1e\x98\x74\xab\xed" | ||
5915 | "\x79\xf7\xd0\x6c\xd8\x93\x80\x29" | ||
5916 | "\xac\xa5\x5e\x34\xa9\xab\xa0\x55" | ||
5917 | "\x9a\xea\xaa\x95\x4d\x7b\xfe\x46" | ||
5918 | "\x26\x8a\xfd\x88\xa2\xa8\xa6\xae" | ||
5919 | "\x25\x42\x17\xbf\x76\x8f\x1c\x3d" | ||
5920 | "\xec\x9a\xda\x64\x96\xb5\x61\xff" | ||
5921 | "\x99\xeb\x12\x96\x85\x82\x9d\xd5" | ||
5922 | "\x81\x85\x14\xa8\x59\xac\x8c\x94" | ||
5923 | "\xbb\x3b\x85\x2b\xdf\xb3\x0c\xba" | ||
5924 | "\x82\xc6\x4d\xca\x86\xea\x53\x28" | ||
5925 | "\x4c\xe0\x4e\x31\xe3\x73\x2f\x79" | ||
5926 | "\x9d\x42\xe1\x03\xe3\x8b\xc4\xff" | ||
5927 | "\x05\xca\x81\x7b\xda\xa2\xde\x63" | ||
5928 | "\x3a\x10\xbe\xc2\xac\x32\xc4\x05" | ||
5929 | "\x47\x7e\xef\x67\xe2\x5f\x5b\xae" | ||
5930 | "\xed\xf1\x70\x34\x16\x9a\x07\x7b" | ||
5931 | "\xf2\x25\x2b\xb0\xf8\x3c\x15\x9a" | ||
5932 | "\xa6\x59\x55\x5f\xc1\xf4\x1e\xcd" | ||
5933 | "\x93\x1f\x06\xba\xd4\x9a\x22\x69" | ||
5934 | "\xfa\x8e\x95\x0d\xf3\x23\x59\x2c" | ||
5935 | "\xfe\x00\xba\xf0\x0e\xbc\x6d\xd6" | ||
5936 | "\x62\xf0\x7a\x0e\x83\x3e\xdb\x32" | ||
5937 | "\xfd\x43\x7d\xda\x42\x51\x87\x43" | ||
5938 | "\x9d\xf9\xef\xf4\x30\x97\xf8\x09" | ||
5939 | "\x88\xfc\x3f\x93\x70\xc1\x4a\xec" | ||
5940 | "\x27\x5f\x11\xac\x71\xc7\x48\x46" | ||
5941 | "\x2f\xf9\xdf\x8d\x9f\xf7\x2e\x56" | ||
5942 | "\x0d\x4e\xb0\x32\x76\xce\x86\x81" | ||
5943 | "\xcd\xdf\xe4\x00\xbf\xfd\x5f\x24" | ||
5944 | "\xaf\xf7\x9a\xde\xff\x18\xac\x14" | ||
5945 | "\x90\xc5\x01\x39\x34\x0f\x24\xf3" | ||
5946 | "\x13\x2f\x5e\x4f\x30\x9a\x36\x40" | ||
5947 | "\xec\xea\xbc\xcd\x9e\x0e\x5b\x23" | ||
5948 | "\x50\x88\x97\x40\x69\xb1\x37\xf5" | ||
5949 | "\xc3\x15\xf9\x3f\xb7\x79\x64\xe8" | ||
5950 | "\x7b\x10\x20\xb9\x2b\x46\x83\x5b" | ||
5951 | "\xd8\x39\xfc\xe4\xfa\x88\x52\xf2" | ||
5952 | "\x72\xb0\x97\x4e\x89\xb3\x48\x00" | ||
5953 | "\xc1\x16\x73\x50\x77\xba\xa6\x65" | ||
5954 | "\x20\x2d\xb0\x02\x27\x89\xda\x99" | ||
5955 | "\x45\xfb\xe9\xd3\x1d\x39\x2f\xd6" | ||
5956 | "\x2a\xda\x09\x12\x11\xaf\xe6\x57" | ||
5957 | "\x01\x04\x8a\xff\x86\x8b\xac\xf8" | ||
5958 | "\xee\xe4\x1c\x98\x5b\xcf\x6b\x76" | ||
5959 | "\xa3\x0e\x33\x74\x40\x18\x39\x72" | ||
5960 | "\x66\x50\x31\xfd\x70\xdf\xe8\x51" | ||
5961 | "\x96\x21\x36\xb2\x9b\xfa\x85\xd1" | ||
5962 | "\x30\x05\xc8\x92\x98\x80\xff\x7a" | ||
5963 | "\xaf\x43\x0b\xc5\x20\x41\x92\x20" | ||
5964 | "\xd4\xa0\x91\x98\x11\x5f\x4d\xb1", | ||
5965 | .ilen = 512, | ||
5966 | .result = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
5967 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
5968 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
5969 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
5970 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
5971 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
5972 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
5973 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
5974 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
5975 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
5976 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
5977 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
5978 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
5979 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
5980 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
5981 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
5982 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
5983 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
5984 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
5985 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
5986 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
5987 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
5988 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
5989 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
5990 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
5991 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
5992 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
5993 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
5994 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
5995 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
5996 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
5997 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
5998 | "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
5999 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" | ||
6000 | "\x10\x11\x12\x13\x14\x15\x16\x17" | ||
6001 | "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" | ||
6002 | "\x20\x21\x22\x23\x24\x25\x26\x27" | ||
6003 | "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" | ||
6004 | "\x30\x31\x32\x33\x34\x35\x36\x37" | ||
6005 | "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" | ||
6006 | "\x40\x41\x42\x43\x44\x45\x46\x47" | ||
6007 | "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" | ||
6008 | "\x50\x51\x52\x53\x54\x55\x56\x57" | ||
6009 | "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" | ||
6010 | "\x60\x61\x62\x63\x64\x65\x66\x67" | ||
6011 | "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" | ||
6012 | "\x70\x71\x72\x73\x74\x75\x76\x77" | ||
6013 | "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" | ||
6014 | "\x80\x81\x82\x83\x84\x85\x86\x87" | ||
6015 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | ||
6016 | "\x90\x91\x92\x93\x94\x95\x96\x97" | ||
6017 | "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" | ||
6018 | "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" | ||
6019 | "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" | ||
6020 | "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" | ||
6021 | "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" | ||
6022 | "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" | ||
6023 | "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" | ||
6024 | "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" | ||
6025 | "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" | ||
6026 | "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" | ||
6027 | "\xe8\xe9\xea\xeb\xec\xed\xee\xef" | ||
6028 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" | ||
6029 | "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", | ||
6030 | .rlen = 512, | ||
6031 | }, | ||
6032 | }; | ||
3278 | 6033 | ||
3279 | /* Cast6 test vectors from RFC 2612 */ | 6034 | /* Cast6 test vectors from RFC 2612 */ |
3280 | #define CAST6_ENC_TEST_VECTORS 3 | 6035 | #define CAST6_ENC_TEST_VECTORS 3 |
diff --git a/crypto/twofish_common.c b/crypto/twofish_common.c index 0af216c75d7e..5f62c4f9f6e0 100644 --- a/crypto/twofish_common.c +++ b/crypto/twofish_common.c | |||
@@ -580,12 +580,9 @@ static const u8 calc_sb_tbl[512] = { | |||
580 | ctx->a[(j) + 1] = rol32(y, 9) | 580 | ctx->a[(j) + 1] = rol32(y, 9) |
581 | 581 | ||
582 | /* Perform the key setup. */ | 582 | /* Perform the key setup. */ |
583 | int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len) | 583 | int __twofish_setkey(struct twofish_ctx *ctx, const u8 *key, |
584 | unsigned int key_len, u32 *flags) | ||
584 | { | 585 | { |
585 | |||
586 | struct twofish_ctx *ctx = crypto_tfm_ctx(tfm); | ||
587 | u32 *flags = &tfm->crt_flags; | ||
588 | |||
589 | int i, j, k; | 586 | int i, j, k; |
590 | 587 | ||
591 | /* Temporaries for CALC_K. */ | 588 | /* Temporaries for CALC_K. */ |
@@ -701,7 +698,13 @@ int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len) | |||
701 | 698 | ||
702 | return 0; | 699 | return 0; |
703 | } | 700 | } |
701 | EXPORT_SYMBOL_GPL(__twofish_setkey); | ||
704 | 702 | ||
703 | int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len) | ||
704 | { | ||
705 | return __twofish_setkey(crypto_tfm_ctx(tfm), key, key_len, | ||
706 | &tfm->crt_flags); | ||
707 | } | ||
705 | EXPORT_SYMBOL_GPL(twofish_setkey); | 708 | EXPORT_SYMBOL_GPL(twofish_setkey); |
706 | 709 | ||
707 | MODULE_LICENSE("GPL"); | 710 | MODULE_LICENSE("GPL"); |
diff --git a/crypto/xts.c b/crypto/xts.c index 851705446c82..ca1608f44cb5 100644 --- a/crypto/xts.c +++ b/crypto/xts.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/scatterlist.h> | 21 | #include <linux/scatterlist.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | 23 | ||
24 | #include <crypto/xts.h> | ||
24 | #include <crypto/b128ops.h> | 25 | #include <crypto/b128ops.h> |
25 | #include <crypto/gf128mul.h> | 26 | #include <crypto/gf128mul.h> |
26 | 27 | ||
@@ -96,7 +97,7 @@ static int crypt(struct blkcipher_desc *d, | |||
96 | { | 97 | { |
97 | int err; | 98 | int err; |
98 | unsigned int avail; | 99 | unsigned int avail; |
99 | const int bs = crypto_cipher_blocksize(ctx->child); | 100 | const int bs = XTS_BLOCK_SIZE; |
100 | struct sinfo s = { | 101 | struct sinfo s = { |
101 | .tfm = crypto_cipher_tfm(ctx->child), | 102 | .tfm = crypto_cipher_tfm(ctx->child), |
102 | .fn = fn | 103 | .fn = fn |
@@ -165,6 +166,78 @@ static int decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | |||
165 | crypto_cipher_alg(ctx->child)->cia_decrypt); | 166 | crypto_cipher_alg(ctx->child)->cia_decrypt); |
166 | } | 167 | } |
167 | 168 | ||
169 | int xts_crypt(struct blkcipher_desc *desc, struct scatterlist *sdst, | ||
170 | struct scatterlist *ssrc, unsigned int nbytes, | ||
171 | struct xts_crypt_req *req) | ||
172 | { | ||
173 | const unsigned int bsize = XTS_BLOCK_SIZE; | ||
174 | const unsigned int max_blks = req->tbuflen / bsize; | ||
175 | struct blkcipher_walk walk; | ||
176 | unsigned int nblocks; | ||
177 | be128 *src, *dst, *t; | ||
178 | be128 *t_buf = req->tbuf; | ||
179 | int err, i; | ||
180 | |||
181 | BUG_ON(max_blks < 1); | ||
182 | |||
183 | blkcipher_walk_init(&walk, sdst, ssrc, nbytes); | ||
184 | |||
185 | err = blkcipher_walk_virt(desc, &walk); | ||
186 | nbytes = walk.nbytes; | ||
187 | if (!nbytes) | ||
188 | return err; | ||
189 | |||
190 | nblocks = min(nbytes / bsize, max_blks); | ||
191 | src = (be128 *)walk.src.virt.addr; | ||
192 | dst = (be128 *)walk.dst.virt.addr; | ||
193 | |||
194 | /* calculate first value of T */ | ||
195 | req->tweak_fn(req->tweak_ctx, (u8 *)&t_buf[0], walk.iv); | ||
196 | |||
197 | i = 0; | ||
198 | goto first; | ||
199 | |||
200 | for (;;) { | ||
201 | do { | ||
202 | for (i = 0; i < nblocks; i++) { | ||
203 | gf128mul_x_ble(&t_buf[i], t); | ||
204 | first: | ||
205 | t = &t_buf[i]; | ||
206 | |||
207 | /* PP <- T xor P */ | ||
208 | be128_xor(dst + i, t, src + i); | ||
209 | } | ||
210 | |||
211 | /* CC <- E(Key2,PP) */ | ||
212 | req->crypt_fn(req->crypt_ctx, (u8 *)dst, | ||
213 | nblocks * bsize); | ||
214 | |||
215 | /* C <- T xor CC */ | ||
216 | for (i = 0; i < nblocks; i++) | ||
217 | be128_xor(dst + i, dst + i, &t_buf[i]); | ||
218 | |||
219 | src += nblocks; | ||
220 | dst += nblocks; | ||
221 | nbytes -= nblocks * bsize; | ||
222 | nblocks = min(nbytes / bsize, max_blks); | ||
223 | } while (nblocks > 0); | ||
224 | |||
225 | *(be128 *)walk.iv = *t; | ||
226 | |||
227 | err = blkcipher_walk_done(desc, &walk, nbytes); | ||
228 | nbytes = walk.nbytes; | ||
229 | if (!nbytes) | ||
230 | break; | ||
231 | |||
232 | nblocks = min(nbytes / bsize, max_blks); | ||
233 | src = (be128 *)walk.src.virt.addr; | ||
234 | dst = (be128 *)walk.dst.virt.addr; | ||
235 | } | ||
236 | |||
237 | return err; | ||
238 | } | ||
239 | EXPORT_SYMBOL_GPL(xts_crypt); | ||
240 | |||
168 | static int init_tfm(struct crypto_tfm *tfm) | 241 | static int init_tfm(struct crypto_tfm *tfm) |
169 | { | 242 | { |
170 | struct crypto_cipher *cipher; | 243 | struct crypto_cipher *cipher; |
@@ -177,7 +250,7 @@ static int init_tfm(struct crypto_tfm *tfm) | |||
177 | if (IS_ERR(cipher)) | 250 | if (IS_ERR(cipher)) |
178 | return PTR_ERR(cipher); | 251 | return PTR_ERR(cipher); |
179 | 252 | ||
180 | if (crypto_cipher_blocksize(cipher) != 16) { | 253 | if (crypto_cipher_blocksize(cipher) != XTS_BLOCK_SIZE) { |
181 | *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; | 254 | *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; |
182 | crypto_free_cipher(cipher); | 255 | crypto_free_cipher(cipher); |
183 | return -EINVAL; | 256 | return -EINVAL; |
@@ -192,7 +265,7 @@ static int init_tfm(struct crypto_tfm *tfm) | |||
192 | } | 265 | } |
193 | 266 | ||
194 | /* this check isn't really needed, leave it here just in case */ | 267 | /* this check isn't really needed, leave it here just in case */ |
195 | if (crypto_cipher_blocksize(cipher) != 16) { | 268 | if (crypto_cipher_blocksize(cipher) != XTS_BLOCK_SIZE) { |
196 | crypto_free_cipher(cipher); | 269 | crypto_free_cipher(cipher); |
197 | crypto_free_cipher(ctx->child); | 270 | crypto_free_cipher(ctx->child); |
198 | *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; | 271 | *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; |