OMAP2xxx clock: fix broken cpu_mask code
[linux-ginger.git] / crypto / tcrypt.c
blobc3c9124209a1901baae3f8e6d9b1a6e437e97901
1 /*
2 * Quick & dirty crypto testing module.
4 * This will only exist until we have a better testing mechanism
5 * (e.g. a char device).
7 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
8 * Copyright (c) 2002 Jean-Francois Dive <jef@linuxbe.org>
9 * Copyright (c) 2007 Nokia Siemens Networks
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the Free
13 * Software Foundation; either version 2 of the License, or (at your option)
14 * any later version.
18 #include <crypto/hash.h>
19 #include <linux/err.h>
20 #include <linux/init.h>
21 #include <linux/module.h>
22 #include <linux/slab.h>
23 #include <linux/scatterlist.h>
24 #include <linux/string.h>
25 #include <linux/moduleparam.h>
26 #include <linux/jiffies.h>
27 #include <linux/timex.h>
28 #include <linux/interrupt.h>
29 #include "tcrypt.h"
32 * Need slab memory for testing (size in number of pages).
34 #define TVMEMSIZE 4
37 * Used by test_cipher_speed()
39 #define ENCRYPT 1
40 #define DECRYPT 0
43 * Used by test_cipher_speed()
45 static unsigned int sec;
47 static int mode;
48 static char *tvmem[TVMEMSIZE];
50 static char *check[] = {
51 "des", "md5", "des3_ede", "rot13", "sha1", "sha224", "sha256",
52 "blowfish", "twofish", "serpent", "sha384", "sha512", "md4", "aes",
53 "cast6", "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea",
54 "khazad", "wp512", "wp384", "wp256", "tnepres", "xeta", "fcrypt",
55 "camellia", "seed", "salsa20", "rmd128", "rmd160", "rmd256", "rmd320",
56 "lzo", "cts", "zlib", NULL
59 static int test_cipher_jiffies(struct blkcipher_desc *desc, int enc,
60 struct scatterlist *sg, int blen, int sec)
62 unsigned long start, end;
63 int bcount;
64 int ret;
66 for (start = jiffies, end = start + sec * HZ, bcount = 0;
67 time_before(jiffies, end); bcount++) {
68 if (enc)
69 ret = crypto_blkcipher_encrypt(desc, sg, sg, blen);
70 else
71 ret = crypto_blkcipher_decrypt(desc, sg, sg, blen);
73 if (ret)
74 return ret;
77 printk("%d operations in %d seconds (%ld bytes)\n",
78 bcount, sec, (long)bcount * blen);
79 return 0;
82 static int test_cipher_cycles(struct blkcipher_desc *desc, int enc,
83 struct scatterlist *sg, int blen)
85 unsigned long cycles = 0;
86 int ret = 0;
87 int i;
89 local_bh_disable();
90 local_irq_disable();
92 /* Warm-up run. */
93 for (i = 0; i < 4; i++) {
94 if (enc)
95 ret = crypto_blkcipher_encrypt(desc, sg, sg, blen);
96 else
97 ret = crypto_blkcipher_decrypt(desc, sg, sg, blen);
99 if (ret)
100 goto out;
103 /* The real thing. */
104 for (i = 0; i < 8; i++) {
105 cycles_t start, end;
107 start = get_cycles();
108 if (enc)
109 ret = crypto_blkcipher_encrypt(desc, sg, sg, blen);
110 else
111 ret = crypto_blkcipher_decrypt(desc, sg, sg, blen);
112 end = get_cycles();
114 if (ret)
115 goto out;
117 cycles += end - start;
120 out:
121 local_irq_enable();
122 local_bh_enable();
124 if (ret == 0)
125 printk("1 operation in %lu cycles (%d bytes)\n",
126 (cycles + 4) / 8, blen);
128 return ret;
131 static u32 block_sizes[] = { 16, 64, 256, 1024, 8192, 0 };
133 static void test_cipher_speed(const char *algo, int enc, unsigned int sec,
134 struct cipher_speed_template *template,
135 unsigned int tcount, u8 *keysize)
137 unsigned int ret, i, j, iv_len;
138 const char *key, iv[128];
139 struct crypto_blkcipher *tfm;
140 struct blkcipher_desc desc;
141 const char *e;
142 u32 *b_size;
144 if (enc == ENCRYPT)
145 e = "encryption";
146 else
147 e = "decryption";
149 printk("\ntesting speed of %s %s\n", algo, e);
151 tfm = crypto_alloc_blkcipher(algo, 0, CRYPTO_ALG_ASYNC);
153 if (IS_ERR(tfm)) {
154 printk("failed to load transform for %s: %ld\n", algo,
155 PTR_ERR(tfm));
156 return;
158 desc.tfm = tfm;
159 desc.flags = 0;
161 i = 0;
162 do {
164 b_size = block_sizes;
165 do {
166 struct scatterlist sg[TVMEMSIZE];
168 if ((*keysize + *b_size) > TVMEMSIZE * PAGE_SIZE) {
169 printk("template (%u) too big for "
170 "tvmem (%lu)\n", *keysize + *b_size,
171 TVMEMSIZE * PAGE_SIZE);
172 goto out;
175 printk("test %u (%d bit key, %d byte blocks): ", i,
176 *keysize * 8, *b_size);
178 memset(tvmem[0], 0xff, PAGE_SIZE);
180 /* set key, plain text and IV */
181 key = tvmem[0];
182 for (j = 0; j < tcount; j++) {
183 if (template[j].klen == *keysize) {
184 key = template[j].key;
185 break;
189 ret = crypto_blkcipher_setkey(tfm, key, *keysize);
190 if (ret) {
191 printk("setkey() failed flags=%x\n",
192 crypto_blkcipher_get_flags(tfm));
193 goto out;
196 sg_init_table(sg, TVMEMSIZE);
197 sg_set_buf(sg, tvmem[0] + *keysize,
198 PAGE_SIZE - *keysize);
199 for (j = 1; j < TVMEMSIZE; j++) {
200 sg_set_buf(sg + j, tvmem[j], PAGE_SIZE);
201 memset (tvmem[j], 0xff, PAGE_SIZE);
204 iv_len = crypto_blkcipher_ivsize(tfm);
205 if (iv_len) {
206 memset(&iv, 0xff, iv_len);
207 crypto_blkcipher_set_iv(tfm, iv, iv_len);
210 if (sec)
211 ret = test_cipher_jiffies(&desc, enc, sg,
212 *b_size, sec);
213 else
214 ret = test_cipher_cycles(&desc, enc, sg,
215 *b_size);
217 if (ret) {
218 printk("%s() failed flags=%x\n", e, desc.flags);
219 break;
221 b_size++;
222 i++;
223 } while (*b_size);
224 keysize++;
225 } while (*keysize);
227 out:
228 crypto_free_blkcipher(tfm);
231 static int test_hash_jiffies_digest(struct hash_desc *desc,
232 struct scatterlist *sg, int blen,
233 char *out, int sec)
235 unsigned long start, end;
236 int bcount;
237 int ret;
239 for (start = jiffies, end = start + sec * HZ, bcount = 0;
240 time_before(jiffies, end); bcount++) {
241 ret = crypto_hash_digest(desc, sg, blen, out);
242 if (ret)
243 return ret;
246 printk("%6u opers/sec, %9lu bytes/sec\n",
247 bcount / sec, ((long)bcount * blen) / sec);
249 return 0;
252 static int test_hash_jiffies(struct hash_desc *desc, struct scatterlist *sg,
253 int blen, int plen, char *out, int sec)
255 unsigned long start, end;
256 int bcount, pcount;
257 int ret;
259 if (plen == blen)
260 return test_hash_jiffies_digest(desc, sg, blen, out, sec);
262 for (start = jiffies, end = start + sec * HZ, bcount = 0;
263 time_before(jiffies, end); bcount++) {
264 ret = crypto_hash_init(desc);
265 if (ret)
266 return ret;
267 for (pcount = 0; pcount < blen; pcount += plen) {
268 ret = crypto_hash_update(desc, sg, plen);
269 if (ret)
270 return ret;
272 /* we assume there is enough space in 'out' for the result */
273 ret = crypto_hash_final(desc, out);
274 if (ret)
275 return ret;
278 printk("%6u opers/sec, %9lu bytes/sec\n",
279 bcount / sec, ((long)bcount * blen) / sec);
281 return 0;
284 static int test_hash_cycles_digest(struct hash_desc *desc,
285 struct scatterlist *sg, int blen, char *out)
287 unsigned long cycles = 0;
288 int i;
289 int ret;
291 local_bh_disable();
292 local_irq_disable();
294 /* Warm-up run. */
295 for (i = 0; i < 4; i++) {
296 ret = crypto_hash_digest(desc, sg, blen, out);
297 if (ret)
298 goto out;
301 /* The real thing. */
302 for (i = 0; i < 8; i++) {
303 cycles_t start, end;
305 start = get_cycles();
307 ret = crypto_hash_digest(desc, sg, blen, out);
308 if (ret)
309 goto out;
311 end = get_cycles();
313 cycles += end - start;
316 out:
317 local_irq_enable();
318 local_bh_enable();
320 if (ret)
321 return ret;
323 printk("%6lu cycles/operation, %4lu cycles/byte\n",
324 cycles / 8, cycles / (8 * blen));
326 return 0;
329 static int test_hash_cycles(struct hash_desc *desc, struct scatterlist *sg,
330 int blen, int plen, char *out)
332 unsigned long cycles = 0;
333 int i, pcount;
334 int ret;
336 if (plen == blen)
337 return test_hash_cycles_digest(desc, sg, blen, out);
339 local_bh_disable();
340 local_irq_disable();
342 /* Warm-up run. */
343 for (i = 0; i < 4; i++) {
344 ret = crypto_hash_init(desc);
345 if (ret)
346 goto out;
347 for (pcount = 0; pcount < blen; pcount += plen) {
348 ret = crypto_hash_update(desc, sg, plen);
349 if (ret)
350 goto out;
352 ret = crypto_hash_final(desc, out);
353 if (ret)
354 goto out;
357 /* The real thing. */
358 for (i = 0; i < 8; i++) {
359 cycles_t start, end;
361 start = get_cycles();
363 ret = crypto_hash_init(desc);
364 if (ret)
365 goto out;
366 for (pcount = 0; pcount < blen; pcount += plen) {
367 ret = crypto_hash_update(desc, sg, plen);
368 if (ret)
369 goto out;
371 ret = crypto_hash_final(desc, out);
372 if (ret)
373 goto out;
375 end = get_cycles();
377 cycles += end - start;
380 out:
381 local_irq_enable();
382 local_bh_enable();
384 if (ret)
385 return ret;
387 printk("%6lu cycles/operation, %4lu cycles/byte\n",
388 cycles / 8, cycles / (8 * blen));
390 return 0;
393 static void test_hash_speed(const char *algo, unsigned int sec,
394 struct hash_speed *speed)
396 struct scatterlist sg[TVMEMSIZE];
397 struct crypto_hash *tfm;
398 struct hash_desc desc;
399 char output[1024];
400 int i;
401 int ret;
403 printk("\ntesting speed of %s\n", algo);
405 tfm = crypto_alloc_hash(algo, 0, CRYPTO_ALG_ASYNC);
407 if (IS_ERR(tfm)) {
408 printk("failed to load transform for %s: %ld\n", algo,
409 PTR_ERR(tfm));
410 return;
413 desc.tfm = tfm;
414 desc.flags = 0;
416 if (crypto_hash_digestsize(tfm) > sizeof(output)) {
417 printk("digestsize(%u) > outputbuffer(%zu)\n",
418 crypto_hash_digestsize(tfm), sizeof(output));
419 goto out;
422 sg_init_table(sg, TVMEMSIZE);
423 for (i = 0; i < TVMEMSIZE; i++) {
424 sg_set_buf(sg + i, tvmem[i], PAGE_SIZE);
425 memset(tvmem[i], 0xff, PAGE_SIZE);
428 for (i = 0; speed[i].blen != 0; i++) {
429 if (speed[i].blen > TVMEMSIZE * PAGE_SIZE) {
430 printk("template (%u) too big for tvmem (%lu)\n",
431 speed[i].blen, TVMEMSIZE * PAGE_SIZE);
432 goto out;
435 printk("test%3u (%5u byte blocks,%5u bytes per update,%4u updates): ",
436 i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen);
438 if (sec)
439 ret = test_hash_jiffies(&desc, sg, speed[i].blen,
440 speed[i].plen, output, sec);
441 else
442 ret = test_hash_cycles(&desc, sg, speed[i].blen,
443 speed[i].plen, output);
445 if (ret) {
446 printk("hashing failed ret=%d\n", ret);
447 break;
451 out:
452 crypto_free_hash(tfm);
455 static void test_available(void)
457 char **name = check;
459 while (*name) {
460 printk("alg %s ", *name);
461 printk(crypto_has_alg(*name, 0, 0) ?
462 "found\n" : "not found\n");
463 name++;
467 static inline int tcrypt_test(const char *alg)
469 return alg_test(alg, alg, 0, 0);
472 static void do_test(int m)
474 int i;
476 switch (m) {
477 case 0:
478 for (i = 1; i < 200; i++)
479 do_test(i);
480 break;
482 case 1:
483 tcrypt_test("md5");
484 break;
486 case 2:
487 tcrypt_test("sha1");
488 break;
490 case 3:
491 tcrypt_test("ecb(des)");
492 tcrypt_test("cbc(des)");
493 break;
495 case 4:
496 tcrypt_test("ecb(des3_ede)");
497 tcrypt_test("cbc(des3_ede)");
498 break;
500 case 5:
501 tcrypt_test("md4");
502 break;
504 case 6:
505 tcrypt_test("sha256");
506 break;
508 case 7:
509 tcrypt_test("ecb(blowfish)");
510 tcrypt_test("cbc(blowfish)");
511 break;
513 case 8:
514 tcrypt_test("ecb(twofish)");
515 tcrypt_test("cbc(twofish)");
516 break;
518 case 9:
519 tcrypt_test("ecb(serpent)");
520 break;
522 case 10:
523 tcrypt_test("ecb(aes)");
524 tcrypt_test("cbc(aes)");
525 tcrypt_test("lrw(aes)");
526 tcrypt_test("xts(aes)");
527 tcrypt_test("rfc3686(ctr(aes))");
528 break;
530 case 11:
531 tcrypt_test("sha384");
532 break;
534 case 12:
535 tcrypt_test("sha512");
536 break;
538 case 13:
539 tcrypt_test("deflate");
540 break;
542 case 14:
543 tcrypt_test("ecb(cast5)");
544 break;
546 case 15:
547 tcrypt_test("ecb(cast6)");
548 break;
550 case 16:
551 tcrypt_test("ecb(arc4)");
552 break;
554 case 17:
555 tcrypt_test("michael_mic");
556 break;
558 case 18:
559 tcrypt_test("crc32c");
560 break;
562 case 19:
563 tcrypt_test("ecb(tea)");
564 break;
566 case 20:
567 tcrypt_test("ecb(xtea)");
568 break;
570 case 21:
571 tcrypt_test("ecb(khazad)");
572 break;
574 case 22:
575 tcrypt_test("wp512");
576 break;
578 case 23:
579 tcrypt_test("wp384");
580 break;
582 case 24:
583 tcrypt_test("wp256");
584 break;
586 case 25:
587 tcrypt_test("ecb(tnepres)");
588 break;
590 case 26:
591 tcrypt_test("ecb(anubis)");
592 tcrypt_test("cbc(anubis)");
593 break;
595 case 27:
596 tcrypt_test("tgr192");
597 break;
599 case 28:
601 tcrypt_test("tgr160");
602 break;
604 case 29:
605 tcrypt_test("tgr128");
606 break;
608 case 30:
609 tcrypt_test("ecb(xeta)");
610 break;
612 case 31:
613 tcrypt_test("pcbc(fcrypt)");
614 break;
616 case 32:
617 tcrypt_test("ecb(camellia)");
618 tcrypt_test("cbc(camellia)");
619 break;
620 case 33:
621 tcrypt_test("sha224");
622 break;
624 case 34:
625 tcrypt_test("salsa20");
626 break;
628 case 35:
629 tcrypt_test("gcm(aes)");
630 break;
632 case 36:
633 tcrypt_test("lzo");
634 break;
636 case 37:
637 tcrypt_test("ccm(aes)");
638 break;
640 case 38:
641 tcrypt_test("cts(cbc(aes))");
642 break;
644 case 39:
645 tcrypt_test("rmd128");
646 break;
648 case 40:
649 tcrypt_test("rmd160");
650 break;
652 case 41:
653 tcrypt_test("rmd256");
654 break;
656 case 42:
657 tcrypt_test("rmd320");
658 break;
660 case 43:
661 tcrypt_test("ecb(seed)");
662 break;
664 case 44:
665 tcrypt_test("zlib");
666 break;
668 case 100:
669 tcrypt_test("hmac(md5)");
670 break;
672 case 101:
673 tcrypt_test("hmac(sha1)");
674 break;
676 case 102:
677 tcrypt_test("hmac(sha256)");
678 break;
680 case 103:
681 tcrypt_test("hmac(sha384)");
682 break;
684 case 104:
685 tcrypt_test("hmac(sha512)");
686 break;
688 case 105:
689 tcrypt_test("hmac(sha224)");
690 break;
692 case 106:
693 tcrypt_test("xcbc(aes)");
694 break;
696 case 107:
697 tcrypt_test("hmac(rmd128)");
698 break;
700 case 108:
701 tcrypt_test("hmac(rmd160)");
702 break;
704 case 200:
705 test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0,
706 speed_template_16_24_32);
707 test_cipher_speed("ecb(aes)", DECRYPT, sec, NULL, 0,
708 speed_template_16_24_32);
709 test_cipher_speed("cbc(aes)", ENCRYPT, sec, NULL, 0,
710 speed_template_16_24_32);
711 test_cipher_speed("cbc(aes)", DECRYPT, sec, NULL, 0,
712 speed_template_16_24_32);
713 test_cipher_speed("lrw(aes)", ENCRYPT, sec, NULL, 0,
714 speed_template_32_40_48);
715 test_cipher_speed("lrw(aes)", DECRYPT, sec, NULL, 0,
716 speed_template_32_40_48);
717 test_cipher_speed("xts(aes)", ENCRYPT, sec, NULL, 0,
718 speed_template_32_48_64);
719 test_cipher_speed("xts(aes)", DECRYPT, sec, NULL, 0,
720 speed_template_32_48_64);
721 break;
723 case 201:
724 test_cipher_speed("ecb(des3_ede)", ENCRYPT, sec,
725 des3_speed_template, DES3_SPEED_VECTORS,
726 speed_template_24);
727 test_cipher_speed("ecb(des3_ede)", DECRYPT, sec,
728 des3_speed_template, DES3_SPEED_VECTORS,
729 speed_template_24);
730 test_cipher_speed("cbc(des3_ede)", ENCRYPT, sec,
731 des3_speed_template, DES3_SPEED_VECTORS,
732 speed_template_24);
733 test_cipher_speed("cbc(des3_ede)", DECRYPT, sec,
734 des3_speed_template, DES3_SPEED_VECTORS,
735 speed_template_24);
736 break;
738 case 202:
739 test_cipher_speed("ecb(twofish)", ENCRYPT, sec, NULL, 0,
740 speed_template_16_24_32);
741 test_cipher_speed("ecb(twofish)", DECRYPT, sec, NULL, 0,
742 speed_template_16_24_32);
743 test_cipher_speed("cbc(twofish)", ENCRYPT, sec, NULL, 0,
744 speed_template_16_24_32);
745 test_cipher_speed("cbc(twofish)", DECRYPT, sec, NULL, 0,
746 speed_template_16_24_32);
747 break;
749 case 203:
750 test_cipher_speed("ecb(blowfish)", ENCRYPT, sec, NULL, 0,
751 speed_template_8_32);
752 test_cipher_speed("ecb(blowfish)", DECRYPT, sec, NULL, 0,
753 speed_template_8_32);
754 test_cipher_speed("cbc(blowfish)", ENCRYPT, sec, NULL, 0,
755 speed_template_8_32);
756 test_cipher_speed("cbc(blowfish)", DECRYPT, sec, NULL, 0,
757 speed_template_8_32);
758 break;
760 case 204:
761 test_cipher_speed("ecb(des)", ENCRYPT, sec, NULL, 0,
762 speed_template_8);
763 test_cipher_speed("ecb(des)", DECRYPT, sec, NULL, 0,
764 speed_template_8);
765 test_cipher_speed("cbc(des)", ENCRYPT, sec, NULL, 0,
766 speed_template_8);
767 test_cipher_speed("cbc(des)", DECRYPT, sec, NULL, 0,
768 speed_template_8);
769 break;
771 case 205:
772 test_cipher_speed("ecb(camellia)", ENCRYPT, sec, NULL, 0,
773 speed_template_16_24_32);
774 test_cipher_speed("ecb(camellia)", DECRYPT, sec, NULL, 0,
775 speed_template_16_24_32);
776 test_cipher_speed("cbc(camellia)", ENCRYPT, sec, NULL, 0,
777 speed_template_16_24_32);
778 test_cipher_speed("cbc(camellia)", DECRYPT, sec, NULL, 0,
779 speed_template_16_24_32);
780 break;
782 case 206:
783 test_cipher_speed("salsa20", ENCRYPT, sec, NULL, 0,
784 speed_template_16_32);
785 break;
787 case 300:
788 /* fall through */
790 case 301:
791 test_hash_speed("md4", sec, generic_hash_speed_template);
792 if (mode > 300 && mode < 400) break;
794 case 302:
795 test_hash_speed("md5", sec, generic_hash_speed_template);
796 if (mode > 300 && mode < 400) break;
798 case 303:
799 test_hash_speed("sha1", sec, generic_hash_speed_template);
800 if (mode > 300 && mode < 400) break;
802 case 304:
803 test_hash_speed("sha256", sec, generic_hash_speed_template);
804 if (mode > 300 && mode < 400) break;
806 case 305:
807 test_hash_speed("sha384", sec, generic_hash_speed_template);
808 if (mode > 300 && mode < 400) break;
810 case 306:
811 test_hash_speed("sha512", sec, generic_hash_speed_template);
812 if (mode > 300 && mode < 400) break;
814 case 307:
815 test_hash_speed("wp256", sec, generic_hash_speed_template);
816 if (mode > 300 && mode < 400) break;
818 case 308:
819 test_hash_speed("wp384", sec, generic_hash_speed_template);
820 if (mode > 300 && mode < 400) break;
822 case 309:
823 test_hash_speed("wp512", sec, generic_hash_speed_template);
824 if (mode > 300 && mode < 400) break;
826 case 310:
827 test_hash_speed("tgr128", sec, generic_hash_speed_template);
828 if (mode > 300 && mode < 400) break;
830 case 311:
831 test_hash_speed("tgr160", sec, generic_hash_speed_template);
832 if (mode > 300 && mode < 400) break;
834 case 312:
835 test_hash_speed("tgr192", sec, generic_hash_speed_template);
836 if (mode > 300 && mode < 400) break;
838 case 313:
839 test_hash_speed("sha224", sec, generic_hash_speed_template);
840 if (mode > 300 && mode < 400) break;
842 case 314:
843 test_hash_speed("rmd128", sec, generic_hash_speed_template);
844 if (mode > 300 && mode < 400) break;
846 case 315:
847 test_hash_speed("rmd160", sec, generic_hash_speed_template);
848 if (mode > 300 && mode < 400) break;
850 case 316:
851 test_hash_speed("rmd256", sec, generic_hash_speed_template);
852 if (mode > 300 && mode < 400) break;
854 case 317:
855 test_hash_speed("rmd320", sec, generic_hash_speed_template);
856 if (mode > 300 && mode < 400) break;
858 case 399:
859 break;
861 case 1000:
862 test_available();
863 break;
867 static int __init tcrypt_mod_init(void)
869 int err = -ENOMEM;
870 int i;
872 for (i = 0; i < TVMEMSIZE; i++) {
873 tvmem[i] = (void *)__get_free_page(GFP_KERNEL);
874 if (!tvmem[i])
875 goto err_free_tv;
878 do_test(mode);
880 /* We intentionaly return -EAGAIN to prevent keeping
881 * the module. It does all its work from init()
882 * and doesn't offer any runtime functionality
883 * => we don't need it in the memory, do we?
884 * -- mludvig
886 err = -EAGAIN;
888 err_free_tv:
889 for (i = 0; i < TVMEMSIZE && tvmem[i]; i++)
890 free_page((unsigned long)tvmem[i]);
892 return err;
896 * If an init function is provided, an exit function must also be provided
897 * to allow module unload.
899 static void __exit tcrypt_mod_fini(void) { }
901 module_init(tcrypt_mod_init);
902 module_exit(tcrypt_mod_fini);
904 module_param(mode, int, 0);
905 module_param(sec, uint, 0);
906 MODULE_PARM_DESC(sec, "Length in seconds of speed tests "
907 "(defaults to zero which uses CPU cycles instead)");
909 MODULE_LICENSE("GPL");
910 MODULE_DESCRIPTION("Quick & dirty crypto testing module");
911 MODULE_AUTHOR("James Morris <jmorris@intercode.com.au>");