diff options
Diffstat (limited to 'crypto/tcrypt.c')
-rw-r--r-- | crypto/tcrypt.c | 198 |
1 files changed, 146 insertions, 52 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 6beabc5abd07..59821a22d752 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
@@ -13,15 +13,9 @@ | |||
13 | * Software Foundation; either version 2 of the License, or (at your option) | 13 | * Software Foundation; either version 2 of the License, or (at your option) |
14 | * any later version. | 14 | * any later version. |
15 | * | 15 | * |
16 | * 2007-11-13 Added GCM tests | ||
17 | * 2007-11-13 Added AEAD support | ||
18 | * 2007-11-06 Added SHA-224 and SHA-224-HMAC tests | ||
19 | * 2006-12-07 Added SHA384 HMAC and SHA512 HMAC tests | ||
20 | * 2004-08-09 Added cipher speed tests (Reyk Floeter <reyk@vantronix.net>) | ||
21 | * 2003-09-14 Rewritten by Kartikey Mahendra Bhatt | ||
22 | * | ||
23 | */ | 16 | */ |
24 | 17 | ||
18 | #include <crypto/hash.h> | ||
25 | #include <linux/err.h> | 19 | #include <linux/err.h> |
26 | #include <linux/init.h> | 20 | #include <linux/init.h> |
27 | #include <linux/module.h> | 21 | #include <linux/module.h> |
@@ -30,7 +24,6 @@ | |||
30 | #include <linux/scatterlist.h> | 24 | #include <linux/scatterlist.h> |
31 | #include <linux/string.h> | 25 | #include <linux/string.h> |
32 | #include <linux/crypto.h> | 26 | #include <linux/crypto.h> |
33 | #include <linux/highmem.h> | ||
34 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
35 | #include <linux/jiffies.h> | 28 | #include <linux/jiffies.h> |
36 | #include <linux/timex.h> | 29 | #include <linux/timex.h> |
@@ -38,7 +31,7 @@ | |||
38 | #include "tcrypt.h" | 31 | #include "tcrypt.h" |
39 | 32 | ||
40 | /* | 33 | /* |
41 | * Need to kmalloc() memory for testing kmap(). | 34 | * Need to kmalloc() memory for testing. |
42 | */ | 35 | */ |
43 | #define TVMEMSIZE 16384 | 36 | #define TVMEMSIZE 16384 |
44 | #define XBUFSIZE 32768 | 37 | #define XBUFSIZE 32768 |
@@ -46,7 +39,7 @@ | |||
46 | /* | 39 | /* |
47 | * Indexes into the xbuf to simulate cross-page access. | 40 | * Indexes into the xbuf to simulate cross-page access. |
48 | */ | 41 | */ |
49 | #define IDX1 37 | 42 | #define IDX1 32 |
50 | #define IDX2 32400 | 43 | #define IDX2 32400 |
51 | #define IDX3 1 | 44 | #define IDX3 1 |
52 | #define IDX4 8193 | 45 | #define IDX4 8193 |
@@ -83,7 +76,8 @@ static char *check[] = { | |||
83 | "blowfish", "twofish", "serpent", "sha384", "sha512", "md4", "aes", | 76 | "blowfish", "twofish", "serpent", "sha384", "sha512", "md4", "aes", |
84 | "cast6", "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea", | 77 | "cast6", "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea", |
85 | "khazad", "wp512", "wp384", "wp256", "tnepres", "xeta", "fcrypt", | 78 | "khazad", "wp512", "wp384", "wp256", "tnepres", "xeta", "fcrypt", |
86 | "camellia", "seed", "salsa20", "lzo", "cts", NULL | 79 | "camellia", "seed", "salsa20", "rmd128", "rmd160", "rmd256", "rmd320", |
80 | "lzo", "cts", NULL | ||
87 | }; | 81 | }; |
88 | 82 | ||
89 | static void hexdump(unsigned char *buf, unsigned int len) | 83 | static void hexdump(unsigned char *buf, unsigned int len) |
@@ -110,22 +104,30 @@ static void test_hash(char *algo, struct hash_testvec *template, | |||
110 | unsigned int i, j, k, temp; | 104 | unsigned int i, j, k, temp; |
111 | struct scatterlist sg[8]; | 105 | struct scatterlist sg[8]; |
112 | char result[64]; | 106 | char result[64]; |
113 | struct crypto_hash *tfm; | 107 | struct crypto_ahash *tfm; |
114 | struct hash_desc desc; | 108 | struct ahash_request *req; |
109 | struct tcrypt_result tresult; | ||
115 | int ret; | 110 | int ret; |
116 | void *hash_buff; | 111 | void *hash_buff; |
117 | 112 | ||
118 | printk("\ntesting %s\n", algo); | 113 | printk("\ntesting %s\n", algo); |
119 | 114 | ||
120 | tfm = crypto_alloc_hash(algo, 0, CRYPTO_ALG_ASYNC); | 115 | init_completion(&tresult.completion); |
116 | |||
117 | tfm = crypto_alloc_ahash(algo, 0, 0); | ||
121 | if (IS_ERR(tfm)) { | 118 | if (IS_ERR(tfm)) { |
122 | printk("failed to load transform for %s: %ld\n", algo, | 119 | printk("failed to load transform for %s: %ld\n", algo, |
123 | PTR_ERR(tfm)); | 120 | PTR_ERR(tfm)); |
124 | return; | 121 | return; |
125 | } | 122 | } |
126 | 123 | ||
127 | desc.tfm = tfm; | 124 | req = ahash_request_alloc(tfm, GFP_KERNEL); |
128 | desc.flags = 0; | 125 | if (!req) { |
126 | printk(KERN_ERR "failed to allocate request for %s\n", algo); | ||
127 | goto out_noreq; | ||
128 | } | ||
129 | ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, | ||
130 | tcrypt_complete, &tresult); | ||
129 | 131 | ||
130 | for (i = 0; i < tcount; i++) { | 132 | for (i = 0; i < tcount; i++) { |
131 | printk("test %u:\n", i + 1); | 133 | printk("test %u:\n", i + 1); |
@@ -139,8 +141,9 @@ static void test_hash(char *algo, struct hash_testvec *template, | |||
139 | sg_init_one(&sg[0], hash_buff, template[i].psize); | 141 | sg_init_one(&sg[0], hash_buff, template[i].psize); |
140 | 142 | ||
141 | if (template[i].ksize) { | 143 | if (template[i].ksize) { |
142 | ret = crypto_hash_setkey(tfm, template[i].key, | 144 | crypto_ahash_clear_flags(tfm, ~0); |
143 | template[i].ksize); | 145 | ret = crypto_ahash_setkey(tfm, template[i].key, |
146 | template[i].ksize); | ||
144 | if (ret) { | 147 | if (ret) { |
145 | printk("setkey() failed ret=%d\n", ret); | 148 | printk("setkey() failed ret=%d\n", ret); |
146 | kfree(hash_buff); | 149 | kfree(hash_buff); |
@@ -148,17 +151,30 @@ static void test_hash(char *algo, struct hash_testvec *template, | |||
148 | } | 151 | } |
149 | } | 152 | } |
150 | 153 | ||
151 | ret = crypto_hash_digest(&desc, sg, template[i].psize, result); | 154 | ahash_request_set_crypt(req, sg, result, template[i].psize); |
152 | if (ret) { | 155 | ret = crypto_ahash_digest(req); |
156 | switch (ret) { | ||
157 | case 0: | ||
158 | break; | ||
159 | case -EINPROGRESS: | ||
160 | case -EBUSY: | ||
161 | ret = wait_for_completion_interruptible( | ||
162 | &tresult.completion); | ||
163 | if (!ret && !(ret = tresult.err)) { | ||
164 | INIT_COMPLETION(tresult.completion); | ||
165 | break; | ||
166 | } | ||
167 | /* fall through */ | ||
168 | default: | ||
153 | printk("digest () failed ret=%d\n", ret); | 169 | printk("digest () failed ret=%d\n", ret); |
154 | kfree(hash_buff); | 170 | kfree(hash_buff); |
155 | goto out; | 171 | goto out; |
156 | } | 172 | } |
157 | 173 | ||
158 | hexdump(result, crypto_hash_digestsize(tfm)); | 174 | hexdump(result, crypto_ahash_digestsize(tfm)); |
159 | printk("%s\n", | 175 | printk("%s\n", |
160 | memcmp(result, template[i].digest, | 176 | memcmp(result, template[i].digest, |
161 | crypto_hash_digestsize(tfm)) ? | 177 | crypto_ahash_digestsize(tfm)) ? |
162 | "fail" : "pass"); | 178 | "fail" : "pass"); |
163 | kfree(hash_buff); | 179 | kfree(hash_buff); |
164 | } | 180 | } |
@@ -187,8 +203,9 @@ static void test_hash(char *algo, struct hash_testvec *template, | |||
187 | } | 203 | } |
188 | 204 | ||
189 | if (template[i].ksize) { | 205 | if (template[i].ksize) { |
190 | ret = crypto_hash_setkey(tfm, template[i].key, | 206 | crypto_ahash_clear_flags(tfm, ~0); |
191 | template[i].ksize); | 207 | ret = crypto_ahash_setkey(tfm, template[i].key, |
208 | template[i].ksize); | ||
192 | 209 | ||
193 | if (ret) { | 210 | if (ret) { |
194 | printk("setkey() failed ret=%d\n", ret); | 211 | printk("setkey() failed ret=%d\n", ret); |
@@ -196,29 +213,44 @@ static void test_hash(char *algo, struct hash_testvec *template, | |||
196 | } | 213 | } |
197 | } | 214 | } |
198 | 215 | ||
199 | ret = crypto_hash_digest(&desc, sg, template[i].psize, | 216 | ahash_request_set_crypt(req, sg, result, |
200 | result); | 217 | template[i].psize); |
201 | if (ret) { | 218 | ret = crypto_ahash_digest(req); |
219 | switch (ret) { | ||
220 | case 0: | ||
221 | break; | ||
222 | case -EINPROGRESS: | ||
223 | case -EBUSY: | ||
224 | ret = wait_for_completion_interruptible( | ||
225 | &tresult.completion); | ||
226 | if (!ret && !(ret = tresult.err)) { | ||
227 | INIT_COMPLETION(tresult.completion); | ||
228 | break; | ||
229 | } | ||
230 | /* fall through */ | ||
231 | default: | ||
202 | printk("digest () failed ret=%d\n", ret); | 232 | printk("digest () failed ret=%d\n", ret); |
203 | goto out; | 233 | goto out; |
204 | } | 234 | } |
205 | 235 | ||
206 | hexdump(result, crypto_hash_digestsize(tfm)); | 236 | hexdump(result, crypto_ahash_digestsize(tfm)); |
207 | printk("%s\n", | 237 | printk("%s\n", |
208 | memcmp(result, template[i].digest, | 238 | memcmp(result, template[i].digest, |
209 | crypto_hash_digestsize(tfm)) ? | 239 | crypto_ahash_digestsize(tfm)) ? |
210 | "fail" : "pass"); | 240 | "fail" : "pass"); |
211 | } | 241 | } |
212 | } | 242 | } |
213 | 243 | ||
214 | out: | 244 | out: |
215 | crypto_free_hash(tfm); | 245 | ahash_request_free(req); |
246 | out_noreq: | ||
247 | crypto_free_ahash(tfm); | ||
216 | } | 248 | } |
217 | 249 | ||
218 | static void test_aead(char *algo, int enc, struct aead_testvec *template, | 250 | static void test_aead(char *algo, int enc, struct aead_testvec *template, |
219 | unsigned int tcount) | 251 | unsigned int tcount) |
220 | { | 252 | { |
221 | unsigned int ret, i, j, k, temp; | 253 | unsigned int ret, i, j, k, n, temp; |
222 | char *q; | 254 | char *q; |
223 | struct crypto_aead *tfm; | 255 | struct crypto_aead *tfm; |
224 | char *key; | 256 | char *key; |
@@ -344,13 +376,12 @@ static void test_aead(char *algo, int enc, struct aead_testvec *template, | |||
344 | goto next_one; | 376 | goto next_one; |
345 | } | 377 | } |
346 | 378 | ||
347 | q = kmap(sg_page(&sg[0])) + sg[0].offset; | 379 | q = input; |
348 | hexdump(q, template[i].rlen); | 380 | hexdump(q, template[i].rlen); |
349 | 381 | ||
350 | printk(KERN_INFO "enc/dec: %s\n", | 382 | printk(KERN_INFO "enc/dec: %s\n", |
351 | memcmp(q, template[i].result, | 383 | memcmp(q, template[i].result, |
352 | template[i].rlen) ? "fail" : "pass"); | 384 | template[i].rlen) ? "fail" : "pass"); |
353 | kunmap(sg_page(&sg[0])); | ||
354 | next_one: | 385 | next_one: |
355 | if (!template[i].key) | 386 | if (!template[i].key) |
356 | kfree(key); | 387 | kfree(key); |
@@ -360,7 +391,6 @@ next_one: | |||
360 | } | 391 | } |
361 | 392 | ||
362 | printk(KERN_INFO "\ntesting %s %s across pages (chunking)\n", algo, e); | 393 | printk(KERN_INFO "\ntesting %s %s across pages (chunking)\n", algo, e); |
363 | memset(xbuf, 0, XBUFSIZE); | ||
364 | memset(axbuf, 0, XBUFSIZE); | 394 | memset(axbuf, 0, XBUFSIZE); |
365 | 395 | ||
366 | for (i = 0, j = 0; i < tcount; i++) { | 396 | for (i = 0, j = 0; i < tcount; i++) { |
@@ -388,6 +418,7 @@ next_one: | |||
388 | goto out; | 418 | goto out; |
389 | } | 419 | } |
390 | 420 | ||
421 | memset(xbuf, 0, XBUFSIZE); | ||
391 | sg_init_table(sg, template[i].np); | 422 | sg_init_table(sg, template[i].np); |
392 | for (k = 0, temp = 0; k < template[i].np; k++) { | 423 | for (k = 0, temp = 0; k < template[i].np; k++) { |
393 | memcpy(&xbuf[IDX[k]], | 424 | memcpy(&xbuf[IDX[k]], |
@@ -450,7 +481,7 @@ next_one: | |||
450 | 481 | ||
451 | for (k = 0, temp = 0; k < template[i].np; k++) { | 482 | for (k = 0, temp = 0; k < template[i].np; k++) { |
452 | printk(KERN_INFO "page %u\n", k); | 483 | printk(KERN_INFO "page %u\n", k); |
453 | q = kmap(sg_page(&sg[k])) + sg[k].offset; | 484 | q = &axbuf[IDX[k]]; |
454 | hexdump(q, template[i].tap[k]); | 485 | hexdump(q, template[i].tap[k]); |
455 | printk(KERN_INFO "%s\n", | 486 | printk(KERN_INFO "%s\n", |
456 | memcmp(q, template[i].result + temp, | 487 | memcmp(q, template[i].result + temp, |
@@ -459,8 +490,15 @@ next_one: | |||
459 | 0 : authsize)) ? | 490 | 0 : authsize)) ? |
460 | "fail" : "pass"); | 491 | "fail" : "pass"); |
461 | 492 | ||
493 | for (n = 0; q[template[i].tap[k] + n]; n++) | ||
494 | ; | ||
495 | if (n) { | ||
496 | printk("Result buffer corruption %u " | ||
497 | "bytes:\n", n); | ||
498 | hexdump(&q[template[i].tap[k]], n); | ||
499 | } | ||
500 | |||
462 | temp += template[i].tap[k]; | 501 | temp += template[i].tap[k]; |
463 | kunmap(sg_page(&sg[k])); | ||
464 | } | 502 | } |
465 | } | 503 | } |
466 | } | 504 | } |
@@ -473,7 +511,7 @@ out: | |||
473 | static void test_cipher(char *algo, int enc, | 511 | static void test_cipher(char *algo, int enc, |
474 | struct cipher_testvec *template, unsigned int tcount) | 512 | struct cipher_testvec *template, unsigned int tcount) |
475 | { | 513 | { |
476 | unsigned int ret, i, j, k, temp; | 514 | unsigned int ret, i, j, k, n, temp; |
477 | char *q; | 515 | char *q; |
478 | struct crypto_ablkcipher *tfm; | 516 | struct crypto_ablkcipher *tfm; |
479 | struct ablkcipher_request *req; | 517 | struct ablkcipher_request *req; |
@@ -569,29 +607,21 @@ static void test_cipher(char *algo, int enc, | |||
569 | goto out; | 607 | goto out; |
570 | } | 608 | } |
571 | 609 | ||
572 | q = kmap(sg_page(&sg[0])) + sg[0].offset; | 610 | q = data; |
573 | hexdump(q, template[i].rlen); | 611 | hexdump(q, template[i].rlen); |
574 | 612 | ||
575 | printk("%s\n", | 613 | printk("%s\n", |
576 | memcmp(q, template[i].result, | 614 | memcmp(q, template[i].result, |
577 | template[i].rlen) ? "fail" : "pass"); | 615 | template[i].rlen) ? "fail" : "pass"); |
578 | kunmap(sg_page(&sg[0])); | ||
579 | } | 616 | } |
580 | kfree(data); | 617 | kfree(data); |
581 | } | 618 | } |
582 | 619 | ||
583 | printk("\ntesting %s %s across pages (chunking)\n", algo, e); | 620 | printk("\ntesting %s %s across pages (chunking)\n", algo, e); |
584 | memset(xbuf, 0, XBUFSIZE); | ||
585 | 621 | ||
586 | j = 0; | 622 | j = 0; |
587 | for (i = 0; i < tcount; i++) { | 623 | for (i = 0; i < tcount; i++) { |
588 | 624 | ||
589 | data = kzalloc(template[i].ilen, GFP_KERNEL); | ||
590 | if (!data) | ||
591 | continue; | ||
592 | |||
593 | memcpy(data, template[i].input, template[i].ilen); | ||
594 | |||
595 | if (template[i].iv) | 625 | if (template[i].iv) |
596 | memcpy(iv, template[i].iv, MAX_IVLEN); | 626 | memcpy(iv, template[i].iv, MAX_IVLEN); |
597 | else | 627 | else |
@@ -602,6 +632,7 @@ static void test_cipher(char *algo, int enc, | |||
602 | printk("test %u (%d bit key):\n", | 632 | printk("test %u (%d bit key):\n", |
603 | j, template[i].klen * 8); | 633 | j, template[i].klen * 8); |
604 | 634 | ||
635 | memset(xbuf, 0, XBUFSIZE); | ||
605 | crypto_ablkcipher_clear_flags(tfm, ~0); | 636 | crypto_ablkcipher_clear_flags(tfm, ~0); |
606 | if (template[i].wk) | 637 | if (template[i].wk) |
607 | crypto_ablkcipher_set_flags( | 638 | crypto_ablkcipher_set_flags( |
@@ -613,10 +644,8 @@ static void test_cipher(char *algo, int enc, | |||
613 | printk("setkey() failed flags=%x\n", | 644 | printk("setkey() failed flags=%x\n", |
614 | crypto_ablkcipher_get_flags(tfm)); | 645 | crypto_ablkcipher_get_flags(tfm)); |
615 | 646 | ||
616 | if (!template[i].fail) { | 647 | if (!template[i].fail) |
617 | kfree(data); | ||
618 | goto out; | 648 | goto out; |
619 | } | ||
620 | } | 649 | } |
621 | 650 | ||
622 | temp = 0; | 651 | temp = 0; |
@@ -657,14 +686,21 @@ static void test_cipher(char *algo, int enc, | |||
657 | temp = 0; | 686 | temp = 0; |
658 | for (k = 0; k < template[i].np; k++) { | 687 | for (k = 0; k < template[i].np; k++) { |
659 | printk("page %u\n", k); | 688 | printk("page %u\n", k); |
660 | q = kmap(sg_page(&sg[k])) + sg[k].offset; | 689 | q = &xbuf[IDX[k]]; |
661 | hexdump(q, template[i].tap[k]); | 690 | hexdump(q, template[i].tap[k]); |
662 | printk("%s\n", | 691 | printk("%s\n", |
663 | memcmp(q, template[i].result + temp, | 692 | memcmp(q, template[i].result + temp, |
664 | template[i].tap[k]) ? "fail" : | 693 | template[i].tap[k]) ? "fail" : |
665 | "pass"); | 694 | "pass"); |
695 | |||
696 | for (n = 0; q[template[i].tap[k] + n]; n++) | ||
697 | ; | ||
698 | if (n) { | ||
699 | printk("Result buffer corruption %u " | ||
700 | "bytes:\n", n); | ||
701 | hexdump(&q[template[i].tap[k]], n); | ||
702 | } | ||
666 | temp += template[i].tap[k]; | 703 | temp += template[i].tap[k]; |
667 | kunmap(sg_page(&sg[k])); | ||
668 | } | 704 | } |
669 | } | 705 | } |
670 | } | 706 | } |
@@ -1180,6 +1216,14 @@ static void do_test(void) | |||
1180 | test_cipher("ecb(des3_ede)", DECRYPT, des3_ede_dec_tv_template, | 1216 | test_cipher("ecb(des3_ede)", DECRYPT, des3_ede_dec_tv_template, |
1181 | DES3_EDE_DEC_TEST_VECTORS); | 1217 | DES3_EDE_DEC_TEST_VECTORS); |
1182 | 1218 | ||
1219 | test_cipher("cbc(des3_ede)", ENCRYPT, | ||
1220 | des3_ede_cbc_enc_tv_template, | ||
1221 | DES3_EDE_CBC_ENC_TEST_VECTORS); | ||
1222 | |||
1223 | test_cipher("cbc(des3_ede)", DECRYPT, | ||
1224 | des3_ede_cbc_dec_tv_template, | ||
1225 | DES3_EDE_CBC_DEC_TEST_VECTORS); | ||
1226 | |||
1183 | test_hash("md4", md4_tv_template, MD4_TEST_VECTORS); | 1227 | test_hash("md4", md4_tv_template, MD4_TEST_VECTORS); |
1184 | 1228 | ||
1185 | test_hash("sha224", sha224_tv_template, SHA224_TEST_VECTORS); | 1229 | test_hash("sha224", sha224_tv_template, SHA224_TEST_VECTORS); |
@@ -1390,6 +1434,14 @@ static void do_test(void) | |||
1390 | DES3_EDE_ENC_TEST_VECTORS); | 1434 | DES3_EDE_ENC_TEST_VECTORS); |
1391 | test_cipher("ecb(des3_ede)", DECRYPT, des3_ede_dec_tv_template, | 1435 | test_cipher("ecb(des3_ede)", DECRYPT, des3_ede_dec_tv_template, |
1392 | DES3_EDE_DEC_TEST_VECTORS); | 1436 | DES3_EDE_DEC_TEST_VECTORS); |
1437 | |||
1438 | test_cipher("cbc(des3_ede)", ENCRYPT, | ||
1439 | des3_ede_cbc_enc_tv_template, | ||
1440 | DES3_EDE_CBC_ENC_TEST_VECTORS); | ||
1441 | |||
1442 | test_cipher("cbc(des3_ede)", DECRYPT, | ||
1443 | des3_ede_cbc_dec_tv_template, | ||
1444 | DES3_EDE_CBC_DEC_TEST_VECTORS); | ||
1393 | break; | 1445 | break; |
1394 | 1446 | ||
1395 | case 5: | 1447 | case 5: |
@@ -1558,7 +1610,7 @@ static void do_test(void) | |||
1558 | case 29: | 1610 | case 29: |
1559 | test_hash("tgr128", tgr128_tv_template, TGR128_TEST_VECTORS); | 1611 | test_hash("tgr128", tgr128_tv_template, TGR128_TEST_VECTORS); |
1560 | break; | 1612 | break; |
1561 | 1613 | ||
1562 | case 30: | 1614 | case 30: |
1563 | test_cipher("ecb(xeta)", ENCRYPT, xeta_enc_tv_template, | 1615 | test_cipher("ecb(xeta)", ENCRYPT, xeta_enc_tv_template, |
1564 | XETA_ENC_TEST_VECTORS); | 1616 | XETA_ENC_TEST_VECTORS); |
@@ -1623,6 +1675,22 @@ static void do_test(void) | |||
1623 | CTS_MODE_DEC_TEST_VECTORS); | 1675 | CTS_MODE_DEC_TEST_VECTORS); |
1624 | break; | 1676 | break; |
1625 | 1677 | ||
1678 | case 39: | ||
1679 | test_hash("rmd128", rmd128_tv_template, RMD128_TEST_VECTORS); | ||
1680 | break; | ||
1681 | |||
1682 | case 40: | ||
1683 | test_hash("rmd160", rmd160_tv_template, RMD160_TEST_VECTORS); | ||
1684 | break; | ||
1685 | |||
1686 | case 41: | ||
1687 | test_hash("rmd256", rmd256_tv_template, RMD256_TEST_VECTORS); | ||
1688 | break; | ||
1689 | |||
1690 | case 42: | ||
1691 | test_hash("rmd320", rmd320_tv_template, RMD320_TEST_VECTORS); | ||
1692 | break; | ||
1693 | |||
1626 | case 100: | 1694 | case 100: |
1627 | test_hash("hmac(md5)", hmac_md5_tv_template, | 1695 | test_hash("hmac(md5)", hmac_md5_tv_template, |
1628 | HMAC_MD5_TEST_VECTORS); | 1696 | HMAC_MD5_TEST_VECTORS); |
@@ -1658,6 +1726,16 @@ static void do_test(void) | |||
1658 | XCBC_AES_TEST_VECTORS); | 1726 | XCBC_AES_TEST_VECTORS); |
1659 | break; | 1727 | break; |
1660 | 1728 | ||
1729 | case 107: | ||
1730 | test_hash("hmac(rmd128)", hmac_rmd128_tv_template, | ||
1731 | HMAC_RMD128_TEST_VECTORS); | ||
1732 | break; | ||
1733 | |||
1734 | case 108: | ||
1735 | test_hash("hmac(rmd160)", hmac_rmd160_tv_template, | ||
1736 | HMAC_RMD160_TEST_VECTORS); | ||
1737 | break; | ||
1738 | |||
1661 | case 200: | 1739 | case 200: |
1662 | test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, | 1740 | test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, |
1663 | speed_template_16_24_32); | 1741 | speed_template_16_24_32); |
@@ -1796,6 +1874,22 @@ static void do_test(void) | |||
1796 | test_hash_speed("sha224", sec, generic_hash_speed_template); | 1874 | test_hash_speed("sha224", sec, generic_hash_speed_template); |
1797 | if (mode > 300 && mode < 400) break; | 1875 | if (mode > 300 && mode < 400) break; |
1798 | 1876 | ||
1877 | case 314: | ||
1878 | test_hash_speed("rmd128", sec, generic_hash_speed_template); | ||
1879 | if (mode > 300 && mode < 400) break; | ||
1880 | |||
1881 | case 315: | ||
1882 | test_hash_speed("rmd160", sec, generic_hash_speed_template); | ||
1883 | if (mode > 300 && mode < 400) break; | ||
1884 | |||
1885 | case 316: | ||
1886 | test_hash_speed("rmd256", sec, generic_hash_speed_template); | ||
1887 | if (mode > 300 && mode < 400) break; | ||
1888 | |||
1889 | case 317: | ||
1890 | test_hash_speed("rmd320", sec, generic_hash_speed_template); | ||
1891 | if (mode > 300 && mode < 400) break; | ||
1892 | |||
1799 | case 399: | 1893 | case 399: |
1800 | break; | 1894 | break; |
1801 | 1895 | ||