29 #include <linux/module.h>
31 #include <linux/string.h>
34 #include <linux/timex.h>
53 static unsigned int sec;
55 static char *alg =
NULL;
61 static char *
check[] = {
62 "des",
"md5",
"des3_ede",
"rot13",
"sha1",
"sha224",
"sha256",
63 "blowfish",
"twofish",
"serpent",
"sha384",
"sha512",
"md4",
"aes",
64 "cast6",
"arc4",
"michael_mic",
"deflate",
"crc32c",
"tea",
"xtea",
65 "khazad",
"wp512",
"wp384",
"wp256",
"tnepres",
"xeta",
"fcrypt",
66 "camellia",
"seed",
"salsa20",
"rmd128",
"rmd160",
"rmd256",
"rmd320",
67 "lzo",
"cts",
"zlib",
NULL
77 for (start = jiffies, end = start + sec *
HZ, bcount = 0;
80 ret = crypto_blkcipher_encrypt(desc, sg, sg, blen);
82 ret = crypto_blkcipher_decrypt(desc, sg, sg, blen);
88 printk(
"%d operations in %d seconds (%ld bytes)\n",
89 bcount, sec, (
long)bcount * blen);
93 static int test_cipher_cycles(
struct blkcipher_desc *desc,
int enc,
96 unsigned long cycles = 0;
103 for (i = 0; i < 4; i++) {
105 ret = crypto_blkcipher_encrypt(desc, sg, sg, blen);
107 ret = crypto_blkcipher_decrypt(desc, sg, sg, blen);
114 for (i = 0; i < 8; i++) {
119 ret = crypto_blkcipher_encrypt(desc, sg, sg, blen);
121 ret = crypto_blkcipher_decrypt(desc, sg, sg, blen);
127 cycles += end -
start;
134 printk(
"1 operation in %lu cycles (%d bytes)\n",
135 (cycles + 4) / 8, blen);
140 static u32 block_sizes[] = { 16, 64, 256, 1024, 8192, 0 };
142 static void test_cipher_speed(
const char *algo,
int enc,
unsigned int sec,
146 unsigned int ret,
i,
j, iv_len;
159 printk(
"\ntesting speed of %s %s\n", algo, e);
164 printk(
"failed to load transform for %s: %ld\n", algo,
174 b_size = block_sizes;
179 printk(
"template (%u) too big for "
180 "tvmem (%lu)\n", *keysize + *b_size,
185 printk(
"test %u (%d bit key, %d byte blocks): ", i,
186 *keysize * 8, *b_size);
188 memset(tvmem[0], 0xff, PAGE_SIZE);
192 for (j = 0; j < tcount; j++) {
193 if (
template[j].klen == *keysize) {
194 key =
template[
j].key;
199 ret = crypto_blkcipher_setkey(tfm, key, *keysize);
201 printk(
"setkey() failed flags=%x\n",
202 crypto_blkcipher_get_flags(tfm));
207 sg_set_buf(sg, tvmem[0] + *keysize,
208 PAGE_SIZE - *keysize);
210 sg_set_buf(sg + j, tvmem[j], PAGE_SIZE);
211 memset (tvmem[j], 0xff, PAGE_SIZE);
214 iv_len = crypto_blkcipher_ivsize(tfm);
216 memset(&iv, 0xff, iv_len);
217 crypto_blkcipher_set_iv(tfm, iv, iv_len);
221 ret = test_cipher_jiffies(&desc, enc, sg,
224 ret = test_cipher_cycles(&desc, enc, sg,
238 crypto_free_blkcipher(tfm);
241 static int test_hash_jiffies_digest(
struct hash_desc *desc,
249 for (start = jiffies, end = start + sec * HZ, bcount = 0;
251 ret = crypto_hash_digest(desc, sg, blen, out);
256 printk(
"%6u opers/sec, %9lu bytes/sec\n",
257 bcount / sec, ((
long)bcount * blen) / sec);
263 int blen,
int plen,
char *out,
int sec)
270 return test_hash_jiffies_digest(desc, sg, blen, out, sec);
272 for (start = jiffies, end = start + sec * HZ, bcount = 0;
274 ret = crypto_hash_init(desc);
277 for (pcount = 0; pcount < blen; pcount +=
plen) {
278 ret = crypto_hash_update(desc, sg, plen);
283 ret = crypto_hash_final(desc, out);
288 printk(
"%6u opers/sec, %9lu bytes/sec\n",
289 bcount / sec, ((
long)bcount * blen) / sec);
294 static int test_hash_cycles_digest(
struct hash_desc *desc,
297 unsigned long cycles = 0;
304 for (i = 0; i < 4; i++) {
305 ret = crypto_hash_digest(desc, sg, blen, out);
311 for (i = 0; i < 8; i++) {
316 ret = crypto_hash_digest(desc, sg, blen, out);
322 cycles += end -
start;
331 printk(
"%6lu cycles/operation, %4lu cycles/byte\n",
332 cycles / 8, cycles / (8 * blen));
338 int blen,
int plen,
char *out)
340 unsigned long cycles = 0;
345 return test_hash_cycles_digest(desc, sg, blen, out);
350 for (i = 0; i < 4; i++) {
351 ret = crypto_hash_init(desc);
354 for (pcount = 0; pcount < blen; pcount +=
plen) {
355 ret = crypto_hash_update(desc, sg, plen);
359 ret = crypto_hash_final(desc, out);
365 for (i = 0; i < 8; i++) {
370 ret = crypto_hash_init(desc);
373 for (pcount = 0; pcount < blen; pcount +=
plen) {
374 ret = crypto_hash_update(desc, sg, plen);
378 ret = crypto_hash_final(desc, out);
384 cycles += end -
start;
393 printk(
"%6lu cycles/operation, %4lu cycles/byte\n",
394 cycles / 8, cycles / (8 * blen));
399 static void test_hash_sg_init(
struct scatterlist *sg)
405 sg_set_buf(sg + i, tvmem[i], PAGE_SIZE);
406 memset(tvmem[i], 0xff, PAGE_SIZE);
410 static void test_hash_speed(
const char *algo,
unsigned int sec,
433 if (crypto_hash_digestsize(tfm) >
sizeof(output)) {
435 crypto_hash_digestsize(tfm),
sizeof(output));
439 test_hash_sg_init(sg);
440 for (i = 0; speed[
i].
blen != 0; i++) {
441 if (speed[i].blen > TVMEMSIZE * PAGE_SIZE) {
443 "template (%u) too big for tvmem (%lu)\n",
444 speed[i].blen, TVMEMSIZE * PAGE_SIZE);
449 crypto_hash_setkey(tfm, tvmem[0], speed[i].klen);
452 "(%5u byte blocks,%5u bytes per update,%4u updates): ",
453 i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen);
456 ret = test_hash_jiffies(&desc, sg, speed[i].blen,
457 speed[i].plen, output, sec);
459 ret = test_hash_cycles(&desc, sg, speed[i].blen,
460 speed[i].plen, output);
469 crypto_free_hash(tfm);
501 static int test_ahash_jiffies_digest(
struct ahash_request *req,
int blen,
508 for (start = jiffies, end = start + sec * HZ, bcount = 0;
515 printk(
"%6u opers/sec, %9lu bytes/sec\n",
516 bcount / sec, ((
long)bcount * blen) / sec);
521 static int test_ahash_jiffies(
struct ahash_request *req,
int blen,
522 int plen,
char *out,
int sec)
529 return test_ahash_jiffies_digest(req, blen, out, sec);
531 for (start = jiffies, end = start + sec * HZ, bcount = 0;
533 ret = crypto_ahash_init(req);
536 for (pcount = 0; pcount < blen; pcount +=
plen) {
537 ret = do_one_ahash_op(req, crypto_ahash_update(req));
547 pr_cont(
"%6u opers/sec, %9lu bytes/sec\n",
548 bcount / sec, ((
long)bcount * blen) / sec);
553 static int test_ahash_cycles_digest(
struct ahash_request *req,
int blen,
556 unsigned long cycles = 0;
560 for (i = 0; i < 4; i++) {
567 for (i = 0; i < 8; i++) {
578 cycles += end -
start;
585 pr_cont(
"%6lu cycles/operation, %4lu cycles/byte\n",
586 cycles / 8, cycles / (8 * blen));
591 static int test_ahash_cycles(
struct ahash_request *req,
int blen,
594 unsigned long cycles = 0;
598 return test_ahash_cycles_digest(req, blen, out);
601 for (i = 0; i < 4; i++) {
602 ret = crypto_ahash_init(req);
605 for (pcount = 0; pcount < blen; pcount +=
plen) {
606 ret = do_one_ahash_op(req, crypto_ahash_update(req));
616 for (i = 0; i < 8; i++) {
621 ret = crypto_ahash_init(req);
624 for (pcount = 0; pcount < blen; pcount +=
plen) {
625 ret = do_one_ahash_op(req, crypto_ahash_update(req));
635 cycles += end -
start;
642 pr_cont(
"%6lu cycles/operation, %4lu cycles/byte\n",
643 cycles / 8, cycles / (8 * blen));
648 static void test_ahash_speed(
const char *algo,
unsigned int sec,
655 static char output[1024];
662 pr_err(
"failed to load transform for %s: %ld\n",
667 if (crypto_ahash_digestsize(tfm) >
sizeof(output)) {
668 pr_err(
"digestsize(%u) > outputbuffer(%zu)\n",
669 crypto_ahash_digestsize(tfm),
sizeof(output));
673 test_hash_sg_init(sg);
676 pr_err(
"ahash request allocation failure\n");
682 tcrypt_complete, &tresult);
684 for (i = 0; speed[
i].
blen != 0; i++) {
685 if (speed[i].blen > TVMEMSIZE * PAGE_SIZE) {
686 pr_err(
"template (%u) too big for tvmem (%lu)\n",
687 speed[i].blen, TVMEMSIZE * PAGE_SIZE);
692 "(%5u byte blocks,%5u bytes per update,%4u updates): ",
693 i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen);
695 ahash_request_set_crypt(req, sg, output, speed[i].plen);
698 ret = test_ahash_jiffies(req, speed[i].blen,
699 speed[i].plen, output, sec);
701 ret = test_ahash_cycles(req, speed[i].blen,
702 speed[i].plen, output);
705 pr_err(
"hashing failed ret=%d\n", ret);
710 ahash_request_free(req);
713 crypto_free_ahash(tfm);
737 for (start = jiffies, end = start + sec * HZ, bcount = 0;
740 ret = do_one_acipher_op(req,
741 crypto_ablkcipher_encrypt(req));
743 ret = do_one_acipher_op(req,
744 crypto_ablkcipher_decrypt(req));
750 pr_cont(
"%d operations in %d seconds (%ld bytes)\n",
751 bcount, sec, (
long)bcount * blen);
758 unsigned long cycles = 0;
763 for (i = 0; i < 4; i++) {
765 ret = do_one_acipher_op(req,
766 crypto_ablkcipher_encrypt(req));
768 ret = do_one_acipher_op(req,
769 crypto_ablkcipher_decrypt(req));
776 for (i = 0; i < 8; i++) {
781 ret = do_one_acipher_op(req,
782 crypto_ablkcipher_encrypt(req));
784 ret = do_one_acipher_op(req,
785 crypto_ablkcipher_decrypt(req));
791 cycles += end -
start;
796 pr_cont(
"1 operation in %lu cycles (%d bytes)\n",
797 (cycles + 4) / 8, blen);
802 static void test_acipher_speed(
const char *algo,
int enc,
unsigned int sec,
804 unsigned int tcount,
u8 *keysize)
806 unsigned int ret,
i,
j,
k, iv_len;
820 pr_info(
"\ntesting speed of async %s %s\n", algo, e);
827 pr_err(
"failed to load transform for %s: %ld\n", algo,
832 req = ablkcipher_request_alloc(tfm,
GFP_KERNEL);
834 pr_err(
"tcrypt: skcipher: Failed to allocate request for %s\n",
840 tcrypt_complete, &tresult);
844 b_size = block_sizes;
849 if ((*keysize + *b_size) > TVMEMSIZE * PAGE_SIZE) {
850 pr_err(
"template (%u) too big for "
851 "tvmem (%lu)\n", *keysize + *b_size,
852 TVMEMSIZE * PAGE_SIZE);
856 pr_info(
"test %u (%d bit key, %d byte blocks): ", i,
857 *keysize * 8, *b_size);
859 memset(tvmem[0], 0xff, PAGE_SIZE);
863 for (j = 0; j < tcount; j++) {
864 if (
template[j].klen == *keysize) {
865 key =
template[
j].key;
870 crypto_ablkcipher_clear_flags(tfm, ~0);
872 ret = crypto_ablkcipher_setkey(tfm, key, *keysize);
874 pr_err(
"setkey() failed flags=%x\n",
875 crypto_ablkcipher_get_flags(tfm));
881 k = *keysize + *b_size;
883 sg_set_buf(sg, tvmem[0] + *keysize,
884 PAGE_SIZE - *keysize);
887 while (k > PAGE_SIZE) {
888 sg_set_buf(sg + j, tvmem[j], PAGE_SIZE);
889 memset(tvmem[j], 0xff, PAGE_SIZE);
893 sg_set_buf(sg + j, tvmem[j], k);
894 memset(tvmem[j], 0xff, k);
896 sg_set_buf(sg, tvmem[0] + *keysize, *b_size);
899 iv_len = crypto_ablkcipher_ivsize(tfm);
901 memset(&iv, 0xff, iv_len);
903 ablkcipher_request_set_crypt(req, sg, sg, *b_size, iv);
906 ret = test_acipher_jiffies(req, enc,
909 ret = test_acipher_cycles(req, enc,
913 pr_err(
"%s() failed flags=%x\n", e,
914 crypto_ablkcipher_get_flags(tfm));
924 ablkcipher_request_free(req);
926 crypto_free_ablkcipher(tfm);
929 static void test_available(
void)
936 "found\n" :
"not found\n");
941 static inline int tcrypt_test(
const char *alg)
952 static int do_test(
int m)
959 for (i = 1; i < 200; i++)
964 ret += tcrypt_test(
"md5");
968 ret += tcrypt_test(
"sha1");
972 ret += tcrypt_test(
"ecb(des)");
973 ret += tcrypt_test(
"cbc(des)");
977 ret += tcrypt_test(
"ecb(des3_ede)");
978 ret += tcrypt_test(
"cbc(des3_ede)");
982 ret += tcrypt_test(
"md4");
986 ret += tcrypt_test(
"sha256");
990 ret += tcrypt_test(
"ecb(blowfish)");
991 ret += tcrypt_test(
"cbc(blowfish)");
992 ret += tcrypt_test(
"ctr(blowfish)");
996 ret += tcrypt_test(
"ecb(twofish)");
997 ret += tcrypt_test(
"cbc(twofish)");
998 ret += tcrypt_test(
"ctr(twofish)");
999 ret += tcrypt_test(
"lrw(twofish)");
1000 ret += tcrypt_test(
"xts(twofish)");
1004 ret += tcrypt_test(
"ecb(serpent)");
1005 ret += tcrypt_test(
"cbc(serpent)");
1006 ret += tcrypt_test(
"ctr(serpent)");
1007 ret += tcrypt_test(
"lrw(serpent)");
1008 ret += tcrypt_test(
"xts(serpent)");
1012 ret += tcrypt_test(
"ecb(aes)");
1013 ret += tcrypt_test(
"cbc(aes)");
1014 ret += tcrypt_test(
"lrw(aes)");
1015 ret += tcrypt_test(
"xts(aes)");
1016 ret += tcrypt_test(
"ctr(aes)");
1017 ret += tcrypt_test(
"rfc3686(ctr(aes))");
1021 ret += tcrypt_test(
"sha384");
1025 ret += tcrypt_test(
"sha512");
1029 ret += tcrypt_test(
"deflate");
1033 ret += tcrypt_test(
"ecb(cast5)");
1034 ret += tcrypt_test(
"cbc(cast5)");
1035 ret += tcrypt_test(
"ctr(cast5)");
1039 ret += tcrypt_test(
"ecb(cast6)");
1040 ret += tcrypt_test(
"cbc(cast6)");
1041 ret += tcrypt_test(
"ctr(cast6)");
1042 ret += tcrypt_test(
"lrw(cast6)");
1043 ret += tcrypt_test(
"xts(cast6)");
1047 ret += tcrypt_test(
"ecb(arc4)");
1051 ret += tcrypt_test(
"michael_mic");
1055 ret += tcrypt_test(
"crc32c");
1059 ret += tcrypt_test(
"ecb(tea)");
1063 ret += tcrypt_test(
"ecb(xtea)");
1067 ret += tcrypt_test(
"ecb(khazad)");
1071 ret += tcrypt_test(
"wp512");
1075 ret += tcrypt_test(
"wp384");
1079 ret += tcrypt_test(
"wp256");
1083 ret += tcrypt_test(
"ecb(tnepres)");
1087 ret += tcrypt_test(
"ecb(anubis)");
1088 ret += tcrypt_test(
"cbc(anubis)");
1092 ret += tcrypt_test(
"tgr192");
1097 ret += tcrypt_test(
"tgr160");
1101 ret += tcrypt_test(
"tgr128");
1105 ret += tcrypt_test(
"ecb(xeta)");
1109 ret += tcrypt_test(
"pcbc(fcrypt)");
1113 ret += tcrypt_test(
"ecb(camellia)");
1114 ret += tcrypt_test(
"cbc(camellia)");
1115 ret += tcrypt_test(
"ctr(camellia)");
1116 ret += tcrypt_test(
"lrw(camellia)");
1117 ret += tcrypt_test(
"xts(camellia)");
1120 ret += tcrypt_test(
"sha224");
1124 ret += tcrypt_test(
"salsa20");
1128 ret += tcrypt_test(
"gcm(aes)");
1132 ret += tcrypt_test(
"lzo");
1136 ret += tcrypt_test(
"ccm(aes)");
1140 ret += tcrypt_test(
"cts(cbc(aes))");
1144 ret += tcrypt_test(
"rmd128");
1148 ret += tcrypt_test(
"rmd160");
1152 ret += tcrypt_test(
"rmd256");
1156 ret += tcrypt_test(
"rmd320");
1160 ret += tcrypt_test(
"ecb(seed)");
1164 ret += tcrypt_test(
"zlib");
1168 ret += tcrypt_test(
"rfc4309(ccm(aes))");
1172 ret += tcrypt_test(
"ghash");
1176 ret += tcrypt_test(
"hmac(md5)");
1180 ret += tcrypt_test(
"hmac(sha1)");
1184 ret += tcrypt_test(
"hmac(sha256)");
1188 ret += tcrypt_test(
"hmac(sha384)");
1192 ret += tcrypt_test(
"hmac(sha512)");
1196 ret += tcrypt_test(
"hmac(sha224)");
1200 ret += tcrypt_test(
"xcbc(aes)");
1204 ret += tcrypt_test(
"hmac(rmd128)");
1208 ret += tcrypt_test(
"hmac(rmd160)");
1212 ret += tcrypt_test(
"vmac(aes)");
1215 ret += tcrypt_test(
"hmac(crc32)");
1219 ret += tcrypt_test(
"ansi_cprng");
1223 ret += tcrypt_test(
"rfc4106(gcm(aes))");
1227 test_cipher_speed(
"ecb(aes)",
ENCRYPT, sec,
NULL, 0,
1228 speed_template_16_24_32);
1229 test_cipher_speed(
"ecb(aes)",
DECRYPT, sec,
NULL, 0,
1230 speed_template_16_24_32);
1231 test_cipher_speed(
"cbc(aes)",
ENCRYPT, sec,
NULL, 0,
1232 speed_template_16_24_32);
1233 test_cipher_speed(
"cbc(aes)",
DECRYPT, sec,
NULL, 0,
1234 speed_template_16_24_32);
1235 test_cipher_speed(
"lrw(aes)",
ENCRYPT, sec,
NULL, 0,
1236 speed_template_32_40_48);
1237 test_cipher_speed(
"lrw(aes)",
DECRYPT, sec,
NULL, 0,
1238 speed_template_32_40_48);
1239 test_cipher_speed(
"xts(aes)",
ENCRYPT, sec,
NULL, 0,
1240 speed_template_32_48_64);
1241 test_cipher_speed(
"xts(aes)",
DECRYPT, sec,
NULL, 0,
1242 speed_template_32_48_64);
1243 test_cipher_speed(
"ctr(aes)",
ENCRYPT, sec,
NULL, 0,
1244 speed_template_16_24_32);
1245 test_cipher_speed(
"ctr(aes)",
DECRYPT, sec,
NULL, 0,
1246 speed_template_16_24_32);
1250 test_cipher_speed(
"ecb(des3_ede)",
ENCRYPT, sec,
1253 test_cipher_speed(
"ecb(des3_ede)",
DECRYPT, sec,
1256 test_cipher_speed(
"cbc(des3_ede)",
ENCRYPT, sec,
1259 test_cipher_speed(
"cbc(des3_ede)",
DECRYPT, sec,
1265 test_cipher_speed(
"ecb(twofish)",
ENCRYPT, sec,
NULL, 0,
1266 speed_template_16_24_32);
1267 test_cipher_speed(
"ecb(twofish)",
DECRYPT, sec,
NULL, 0,
1268 speed_template_16_24_32);
1269 test_cipher_speed(
"cbc(twofish)",
ENCRYPT, sec,
NULL, 0,
1270 speed_template_16_24_32);
1271 test_cipher_speed(
"cbc(twofish)",
DECRYPT, sec,
NULL, 0,
1272 speed_template_16_24_32);
1273 test_cipher_speed(
"ctr(twofish)",
ENCRYPT, sec,
NULL, 0,
1274 speed_template_16_24_32);
1275 test_cipher_speed(
"ctr(twofish)",
DECRYPT, sec,
NULL, 0,
1276 speed_template_16_24_32);
1277 test_cipher_speed(
"lrw(twofish)",
ENCRYPT, sec,
NULL, 0,
1278 speed_template_32_40_48);
1279 test_cipher_speed(
"lrw(twofish)",
DECRYPT, sec,
NULL, 0,
1280 speed_template_32_40_48);
1281 test_cipher_speed(
"xts(twofish)",
ENCRYPT, sec,
NULL, 0,
1282 speed_template_32_48_64);
1283 test_cipher_speed(
"xts(twofish)",
DECRYPT, sec,
NULL, 0,
1284 speed_template_32_48_64);
1288 test_cipher_speed(
"ecb(blowfish)",
ENCRYPT, sec,
NULL, 0,
1289 speed_template_8_32);
1290 test_cipher_speed(
"ecb(blowfish)",
DECRYPT, sec,
NULL, 0,
1291 speed_template_8_32);
1292 test_cipher_speed(
"cbc(blowfish)",
ENCRYPT, sec,
NULL, 0,
1293 speed_template_8_32);
1294 test_cipher_speed(
"cbc(blowfish)",
DECRYPT, sec,
NULL, 0,
1295 speed_template_8_32);
1296 test_cipher_speed(
"ctr(blowfish)",
ENCRYPT, sec,
NULL, 0,
1297 speed_template_8_32);
1298 test_cipher_speed(
"ctr(blowfish)",
DECRYPT, sec,
NULL, 0,
1299 speed_template_8_32);
1303 test_cipher_speed(
"ecb(des)",
ENCRYPT, sec,
NULL, 0,
1305 test_cipher_speed(
"ecb(des)",
DECRYPT, sec,
NULL, 0,
1307 test_cipher_speed(
"cbc(des)",
ENCRYPT, sec,
NULL, 0,
1309 test_cipher_speed(
"cbc(des)",
DECRYPT, sec,
NULL, 0,
1314 test_cipher_speed(
"ecb(camellia)",
ENCRYPT, sec,
NULL, 0,
1315 speed_template_16_24_32);
1316 test_cipher_speed(
"ecb(camellia)",
DECRYPT, sec,
NULL, 0,
1317 speed_template_16_24_32);
1318 test_cipher_speed(
"cbc(camellia)",
ENCRYPT, sec,
NULL, 0,
1319 speed_template_16_24_32);
1320 test_cipher_speed(
"cbc(camellia)",
DECRYPT, sec,
NULL, 0,
1321 speed_template_16_24_32);
1322 test_cipher_speed(
"ctr(camellia)",
ENCRYPT, sec,
NULL, 0,
1323 speed_template_16_24_32);
1324 test_cipher_speed(
"ctr(camellia)",
DECRYPT, sec,
NULL, 0,
1325 speed_template_16_24_32);
1326 test_cipher_speed(
"lrw(camellia)",
ENCRYPT, sec,
NULL, 0,
1327 speed_template_32_40_48);
1328 test_cipher_speed(
"lrw(camellia)",
DECRYPT, sec,
NULL, 0,
1329 speed_template_32_40_48);
1330 test_cipher_speed(
"xts(camellia)",
ENCRYPT, sec,
NULL, 0,
1331 speed_template_32_48_64);
1332 test_cipher_speed(
"xts(camellia)",
DECRYPT, sec,
NULL, 0,
1333 speed_template_32_48_64);
1337 test_cipher_speed(
"salsa20",
ENCRYPT, sec,
NULL, 0,
1338 speed_template_16_32);
1342 test_cipher_speed(
"ecb(serpent)",
ENCRYPT, sec,
NULL, 0,
1343 speed_template_16_32);
1344 test_cipher_speed(
"ecb(serpent)",
DECRYPT, sec,
NULL, 0,
1345 speed_template_16_32);
1346 test_cipher_speed(
"cbc(serpent)",
ENCRYPT, sec,
NULL, 0,
1347 speed_template_16_32);
1348 test_cipher_speed(
"cbc(serpent)",
DECRYPT, sec,
NULL, 0,
1349 speed_template_16_32);
1350 test_cipher_speed(
"ctr(serpent)",
ENCRYPT, sec,
NULL, 0,
1351 speed_template_16_32);
1352 test_cipher_speed(
"ctr(serpent)",
DECRYPT, sec,
NULL, 0,
1353 speed_template_16_32);
1354 test_cipher_speed(
"lrw(serpent)",
ENCRYPT, sec,
NULL, 0,
1355 speed_template_32_48);
1356 test_cipher_speed(
"lrw(serpent)",
DECRYPT, sec,
NULL, 0,
1357 speed_template_32_48);
1358 test_cipher_speed(
"xts(serpent)",
ENCRYPT, sec,
NULL, 0,
1359 speed_template_32_64);
1360 test_cipher_speed(
"xts(serpent)",
DECRYPT, sec,
NULL, 0,
1361 speed_template_32_64);
1365 test_cipher_speed(
"ecb(arc4)",
ENCRYPT, sec,
NULL, 0,
1370 test_cipher_speed(
"ecb(cast5)",
ENCRYPT, sec,
NULL, 0,
1371 speed_template_8_16);
1372 test_cipher_speed(
"ecb(cast5)",
DECRYPT, sec,
NULL, 0,
1373 speed_template_8_16);
1374 test_cipher_speed(
"cbc(cast5)",
ENCRYPT, sec,
NULL, 0,
1375 speed_template_8_16);
1376 test_cipher_speed(
"cbc(cast5)",
DECRYPT, sec,
NULL, 0,
1377 speed_template_8_16);
1378 test_cipher_speed(
"ctr(cast5)",
ENCRYPT, sec,
NULL, 0,
1379 speed_template_8_16);
1380 test_cipher_speed(
"ctr(cast5)",
DECRYPT, sec,
NULL, 0,
1381 speed_template_8_16);
1385 test_cipher_speed(
"ecb(cast6)",
ENCRYPT, sec,
NULL, 0,
1386 speed_template_16_32);
1387 test_cipher_speed(
"ecb(cast6)",
DECRYPT, sec,
NULL, 0,
1388 speed_template_16_32);
1389 test_cipher_speed(
"cbc(cast6)",
ENCRYPT, sec,
NULL, 0,
1390 speed_template_16_32);
1391 test_cipher_speed(
"cbc(cast6)",
DECRYPT, sec,
NULL, 0,
1392 speed_template_16_32);
1393 test_cipher_speed(
"ctr(cast6)",
ENCRYPT, sec,
NULL, 0,
1394 speed_template_16_32);
1395 test_cipher_speed(
"ctr(cast6)",
DECRYPT, sec,
NULL, 0,
1396 speed_template_16_32);
1397 test_cipher_speed(
"lrw(cast6)",
ENCRYPT, sec,
NULL, 0,
1398 speed_template_32_48);
1399 test_cipher_speed(
"lrw(cast6)",
DECRYPT, sec,
NULL, 0,
1400 speed_template_32_48);
1401 test_cipher_speed(
"xts(cast6)",
ENCRYPT, sec,
NULL, 0,
1402 speed_template_32_64);
1403 test_cipher_speed(
"xts(cast6)",
DECRYPT, sec,
NULL, 0,
1404 speed_template_32_64);
1411 test_hash_speed(
"md4", sec, generic_hash_speed_template);
1412 if (
mode > 300 &&
mode < 400)
break;
1415 test_hash_speed(
"md5", sec, generic_hash_speed_template);
1416 if (
mode > 300 &&
mode < 400)
break;
1419 test_hash_speed(
"sha1", sec, generic_hash_speed_template);
1420 if (
mode > 300 &&
mode < 400)
break;
1423 test_hash_speed(
"sha256", sec, generic_hash_speed_template);
1424 if (
mode > 300 &&
mode < 400)
break;
1427 test_hash_speed(
"sha384", sec, generic_hash_speed_template);
1428 if (
mode > 300 &&
mode < 400)
break;
1431 test_hash_speed(
"sha512", sec, generic_hash_speed_template);
1432 if (
mode > 300 &&
mode < 400)
break;
1435 test_hash_speed(
"wp256", sec, generic_hash_speed_template);
1436 if (
mode > 300 &&
mode < 400)
break;
1439 test_hash_speed(
"wp384", sec, generic_hash_speed_template);
1440 if (
mode > 300 &&
mode < 400)
break;
1443 test_hash_speed(
"wp512", sec, generic_hash_speed_template);
1444 if (
mode > 300 &&
mode < 400)
break;
1447 test_hash_speed(
"tgr128", sec, generic_hash_speed_template);
1448 if (
mode > 300 &&
mode < 400)
break;
1451 test_hash_speed(
"tgr160", sec, generic_hash_speed_template);
1452 if (
mode > 300 &&
mode < 400)
break;
1455 test_hash_speed(
"tgr192", sec, generic_hash_speed_template);
1456 if (
mode > 300 &&
mode < 400)
break;
1459 test_hash_speed(
"sha224", sec, generic_hash_speed_template);
1460 if (
mode > 300 &&
mode < 400)
break;
1463 test_hash_speed(
"rmd128", sec, generic_hash_speed_template);
1464 if (
mode > 300 &&
mode < 400)
break;
1467 test_hash_speed(
"rmd160", sec, generic_hash_speed_template);
1468 if (
mode > 300 &&
mode < 400)
break;
1471 test_hash_speed(
"rmd256", sec, generic_hash_speed_template);
1472 if (
mode > 300 &&
mode < 400)
break;
1475 test_hash_speed(
"rmd320", sec, generic_hash_speed_template);
1476 if (
mode > 300 &&
mode < 400)
break;
1479 test_hash_speed(
"ghash-generic", sec, hash_speed_template_16);
1480 if (
mode > 300 &&
mode < 400)
break;
1489 test_ahash_speed(
"md4", sec, generic_hash_speed_template);
1490 if (
mode > 400 &&
mode < 500)
break;
1493 test_ahash_speed(
"md5", sec, generic_hash_speed_template);
1494 if (
mode > 400 &&
mode < 500)
break;
1497 test_ahash_speed(
"sha1", sec, generic_hash_speed_template);
1498 if (
mode > 400 &&
mode < 500)
break;
1501 test_ahash_speed(
"sha256", sec, generic_hash_speed_template);
1502 if (
mode > 400 &&
mode < 500)
break;
1505 test_ahash_speed(
"sha384", sec, generic_hash_speed_template);
1506 if (
mode > 400 &&
mode < 500)
break;
1509 test_ahash_speed(
"sha512", sec, generic_hash_speed_template);
1510 if (
mode > 400 &&
mode < 500)
break;
1513 test_ahash_speed(
"wp256", sec, generic_hash_speed_template);
1514 if (
mode > 400 &&
mode < 500)
break;
1517 test_ahash_speed(
"wp384", sec, generic_hash_speed_template);
1518 if (
mode > 400 &&
mode < 500)
break;
1521 test_ahash_speed(
"wp512", sec, generic_hash_speed_template);
1522 if (
mode > 400 &&
mode < 500)
break;
1525 test_ahash_speed(
"tgr128", sec, generic_hash_speed_template);
1526 if (
mode > 400 &&
mode < 500)
break;
1529 test_ahash_speed(
"tgr160", sec, generic_hash_speed_template);
1530 if (
mode > 400 &&
mode < 500)
break;
1533 test_ahash_speed(
"tgr192", sec, generic_hash_speed_template);
1534 if (
mode > 400 &&
mode < 500)
break;
1537 test_ahash_speed(
"sha224", sec, generic_hash_speed_template);
1538 if (
mode > 400 &&
mode < 500)
break;
1541 test_ahash_speed(
"rmd128", sec, generic_hash_speed_template);
1542 if (
mode > 400 &&
mode < 500)
break;
1545 test_ahash_speed(
"rmd160", sec, generic_hash_speed_template);
1546 if (
mode > 400 &&
mode < 500)
break;
1549 test_ahash_speed(
"rmd256", sec, generic_hash_speed_template);
1550 if (
mode > 400 &&
mode < 500)
break;
1553 test_ahash_speed(
"rmd320", sec, generic_hash_speed_template);
1554 if (
mode > 400 &&
mode < 500)
break;
1560 test_acipher_speed(
"ecb(aes)",
ENCRYPT, sec,
NULL, 0,
1561 speed_template_16_24_32);
1562 test_acipher_speed(
"ecb(aes)",
DECRYPT, sec,
NULL, 0,
1563 speed_template_16_24_32);
1564 test_acipher_speed(
"cbc(aes)",
ENCRYPT, sec,
NULL, 0,
1565 speed_template_16_24_32);
1566 test_acipher_speed(
"cbc(aes)",
DECRYPT, sec,
NULL, 0,
1567 speed_template_16_24_32);
1568 test_acipher_speed(
"lrw(aes)",
ENCRYPT, sec,
NULL, 0,
1569 speed_template_32_40_48);
1570 test_acipher_speed(
"lrw(aes)",
DECRYPT, sec,
NULL, 0,
1571 speed_template_32_40_48);
1572 test_acipher_speed(
"xts(aes)",
ENCRYPT, sec,
NULL, 0,
1573 speed_template_32_48_64);
1574 test_acipher_speed(
"xts(aes)",
DECRYPT, sec,
NULL, 0,
1575 speed_template_32_48_64);
1576 test_acipher_speed(
"ctr(aes)",
ENCRYPT, sec,
NULL, 0,
1577 speed_template_16_24_32);
1578 test_acipher_speed(
"ctr(aes)",
DECRYPT, sec,
NULL, 0,
1579 speed_template_16_24_32);
1580 test_acipher_speed(
"cfb(aes)",
ENCRYPT, sec,
NULL, 0,
1581 speed_template_16_24_32);
1582 test_acipher_speed(
"cfb(aes)",
DECRYPT, sec,
NULL, 0,
1583 speed_template_16_24_32);
1584 test_acipher_speed(
"ofb(aes)",
ENCRYPT, sec,
NULL, 0,
1585 speed_template_16_24_32);
1586 test_acipher_speed(
"ofb(aes)",
DECRYPT, sec,
NULL, 0,
1587 speed_template_16_24_32);
1591 test_acipher_speed(
"ecb(des3_ede)",
ENCRYPT, sec,
1594 test_acipher_speed(
"ecb(des3_ede)",
DECRYPT, sec,
1597 test_acipher_speed(
"cbc(des3_ede)",
ENCRYPT, sec,
1600 test_acipher_speed(
"cbc(des3_ede)",
DECRYPT, sec,
1603 test_acipher_speed(
"cfb(des3_ede)",
ENCRYPT, sec,
1606 test_acipher_speed(
"cfb(des3_ede)",
DECRYPT, sec,
1609 test_acipher_speed(
"ofb(des3_ede)",
ENCRYPT, sec,
1612 test_acipher_speed(
"ofb(des3_ede)",
DECRYPT, sec,
1618 test_acipher_speed(
"ecb(des)",
ENCRYPT, sec,
NULL, 0,
1620 test_acipher_speed(
"ecb(des)",
DECRYPT, sec,
NULL, 0,
1622 test_acipher_speed(
"cbc(des)",
ENCRYPT, sec,
NULL, 0,
1624 test_acipher_speed(
"cbc(des)",
DECRYPT, sec,
NULL, 0,
1626 test_acipher_speed(
"cfb(des)",
ENCRYPT, sec,
NULL, 0,
1628 test_acipher_speed(
"cfb(des)",
DECRYPT, sec,
NULL, 0,
1630 test_acipher_speed(
"ofb(des)",
ENCRYPT, sec,
NULL, 0,
1632 test_acipher_speed(
"ofb(des)",
DECRYPT, sec,
NULL, 0,
1637 test_acipher_speed(
"ecb(serpent)",
ENCRYPT, sec,
NULL, 0,
1638 speed_template_16_32);
1639 test_acipher_speed(
"ecb(serpent)",
DECRYPT, sec,
NULL, 0,
1640 speed_template_16_32);
1641 test_acipher_speed(
"cbc(serpent)",
ENCRYPT, sec,
NULL, 0,
1642 speed_template_16_32);
1643 test_acipher_speed(
"cbc(serpent)",
DECRYPT, sec,
NULL, 0,
1644 speed_template_16_32);
1645 test_acipher_speed(
"ctr(serpent)",
ENCRYPT, sec,
NULL, 0,
1646 speed_template_16_32);
1647 test_acipher_speed(
"ctr(serpent)",
DECRYPT, sec,
NULL, 0,
1648 speed_template_16_32);
1649 test_acipher_speed(
"lrw(serpent)",
ENCRYPT, sec,
NULL, 0,
1650 speed_template_32_48);
1651 test_acipher_speed(
"lrw(serpent)",
DECRYPT, sec,
NULL, 0,
1652 speed_template_32_48);
1653 test_acipher_speed(
"xts(serpent)",
ENCRYPT, sec,
NULL, 0,
1654 speed_template_32_64);
1655 test_acipher_speed(
"xts(serpent)",
DECRYPT, sec,
NULL, 0,
1656 speed_template_32_64);
1660 test_acipher_speed(
"ecb(twofish)",
ENCRYPT, sec,
NULL, 0,
1661 speed_template_16_24_32);
1662 test_acipher_speed(
"ecb(twofish)",
DECRYPT, sec,
NULL, 0,
1663 speed_template_16_24_32);
1664 test_acipher_speed(
"cbc(twofish)",
ENCRYPT, sec,
NULL, 0,
1665 speed_template_16_24_32);
1666 test_acipher_speed(
"cbc(twofish)",
DECRYPT, sec,
NULL, 0,
1667 speed_template_16_24_32);
1668 test_acipher_speed(
"ctr(twofish)",
ENCRYPT, sec,
NULL, 0,
1669 speed_template_16_24_32);
1670 test_acipher_speed(
"ctr(twofish)",
DECRYPT, sec,
NULL, 0,
1671 speed_template_16_24_32);
1672 test_acipher_speed(
"lrw(twofish)",
ENCRYPT, sec,
NULL, 0,
1673 speed_template_32_40_48);
1674 test_acipher_speed(
"lrw(twofish)",
DECRYPT, sec,
NULL, 0,
1675 speed_template_32_40_48);
1676 test_acipher_speed(
"xts(twofish)",
ENCRYPT, sec,
NULL, 0,
1677 speed_template_32_48_64);
1678 test_acipher_speed(
"xts(twofish)",
DECRYPT, sec,
NULL, 0,
1679 speed_template_32_48_64);
1683 test_acipher_speed(
"ecb(arc4)",
ENCRYPT, sec,
NULL, 0,
1688 test_acipher_speed(
"ecb(cast5)",
ENCRYPT, sec,
NULL, 0,
1689 speed_template_8_16);
1690 test_acipher_speed(
"ecb(cast5)",
DECRYPT, sec,
NULL, 0,
1691 speed_template_8_16);
1692 test_acipher_speed(
"cbc(cast5)",
ENCRYPT, sec,
NULL, 0,
1693 speed_template_8_16);
1694 test_acipher_speed(
"cbc(cast5)",
DECRYPT, sec,
NULL, 0,
1695 speed_template_8_16);
1696 test_acipher_speed(
"ctr(cast5)",
ENCRYPT, sec,
NULL, 0,
1697 speed_template_8_16);
1698 test_acipher_speed(
"ctr(cast5)",
DECRYPT, sec,
NULL, 0,
1699 speed_template_8_16);
1703 test_acipher_speed(
"ecb(cast6)",
ENCRYPT, sec,
NULL, 0,
1704 speed_template_16_32);
1705 test_acipher_speed(
"ecb(cast6)",
DECRYPT, sec,
NULL, 0,
1706 speed_template_16_32);
1707 test_acipher_speed(
"cbc(cast6)",
ENCRYPT, sec,
NULL, 0,
1708 speed_template_16_32);
1709 test_acipher_speed(
"cbc(cast6)",
DECRYPT, sec,
NULL, 0,
1710 speed_template_16_32);
1711 test_acipher_speed(
"ctr(cast6)",
ENCRYPT, sec,
NULL, 0,
1712 speed_template_16_32);
1713 test_acipher_speed(
"ctr(cast6)",
DECRYPT, sec,
NULL, 0,
1714 speed_template_16_32);
1715 test_acipher_speed(
"lrw(cast6)",
ENCRYPT, sec,
NULL, 0,
1716 speed_template_32_48);
1717 test_acipher_speed(
"lrw(cast6)",
DECRYPT, sec,
NULL, 0,
1718 speed_template_32_48);
1719 test_acipher_speed(
"xts(cast6)",
ENCRYPT, sec,
NULL, 0,
1720 speed_template_32_64);
1721 test_acipher_speed(
"xts(cast6)",
DECRYPT, sec,
NULL, 0,
1722 speed_template_32_64);
1739 static int __init tcrypt_mod_init(
void)
1751 err = do_alg_test(alg,
type,
mask);
1753 err = do_test(
mode);
1771 for (i = 0; i < TVMEMSIZE && tvmem[
i]; i++)
1781 static void __exit tcrypt_mod_fini(
void) { }
1792 "(defaults to zero which uses CPU cycles instead)");