Blame view
crypto/tcrypt.c
44.7 KB
ef2736fc7 [CRYPTO]: White s... |
1 |
/* |
1da177e4c Linux-2.6.12-rc2 |
2 3 4 5 6 7 8 |
* Quick & dirty crypto testing module. * * This will only exist until we have a better testing mechanism * (e.g. a char device). * * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> * Copyright (c) 2002 Jean-Francois Dive <jef@linuxbe.org> |
e3a4ea4fd [CRYPTO] tcrypt: ... |
9 |
* Copyright (c) 2007 Nokia Siemens Networks |
1da177e4c Linux-2.6.12-rc2 |
10 |
* |
69435b94d crypto: rfc4106 -... |
11 12 13 14 15 16 17 |
* Updated RFC4106 AES-GCM testing. * Authors: Aidan O'Mahony (aidan.o.mahony@intel.com) * Adrian Hoban <adrian.hoban@intel.com> * Gabriele Paoloni <gabriele.paoloni@intel.com> * Tadeusz Struk (tadeusz.struk@intel.com) * Copyright (c) 2010, Intel Corporation. * |
1da177e4c Linux-2.6.12-rc2 |
18 19 |
* This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free |
ef2736fc7 [CRYPTO]: White s... |
20 |
* Software Foundation; either version 2 of the License, or (at your option) |
1da177e4c Linux-2.6.12-rc2 |
21 22 |
* any later version. * |
1da177e4c Linux-2.6.12-rc2 |
23 |
*/ |
18e33e6d5 crypto: hash - Mo... |
24 |
#include <crypto/hash.h> |
cba83564d [CRYPTO] tcrypt: ... |
25 |
#include <linux/err.h> |
1da177e4c Linux-2.6.12-rc2 |
26 |
#include <linux/init.h> |
5a0e3ad6a include cleanup: ... |
27 |
#include <linux/gfp.h> |
1da177e4c Linux-2.6.12-rc2 |
28 |
#include <linux/module.h> |
378f058cc [PATCH] Use sg_se... |
29 |
#include <linux/scatterlist.h> |
1da177e4c Linux-2.6.12-rc2 |
30 |
#include <linux/string.h> |
1da177e4c Linux-2.6.12-rc2 |
31 |
#include <linux/moduleparam.h> |
ebfd9bcf1 [CRYPTO]: Add cip... |
32 |
#include <linux/jiffies.h> |
6a17944ca [CRYPTO]: Use CPU... |
33 34 |
#include <linux/timex.h> #include <linux/interrupt.h> |
1da177e4c Linux-2.6.12-rc2 |
35 |
#include "tcrypt.h" |
4e033a6bc crypto: tcrypt - ... |
36 |
#include "internal.h" |
1da177e4c Linux-2.6.12-rc2 |
37 38 |
/* |
f139cfa7c crypto: tcrypt - ... |
39 |
* Need slab memory for testing (size in number of pages). |
1da177e4c Linux-2.6.12-rc2 |
40 |
*/ |
f139cfa7c crypto: tcrypt - ... |
41 |
#define TVMEMSIZE 4 |
1da177e4c Linux-2.6.12-rc2 |
42 43 |
/* |
da7f033dd crypto: cryptomgr... |
44 |
* Used by test_cipher_speed() |
1da177e4c Linux-2.6.12-rc2 |
45 46 47 |
*/ #define ENCRYPT 1 #define DECRYPT 0 |
1da177e4c Linux-2.6.12-rc2 |
48 |
|
ebfd9bcf1 [CRYPTO]: Add cip... |
49 50 51 |
/* * Used by test_cipher_speed() */ |
6a17944ca [CRYPTO]: Use CPU... |
52 |
static unsigned int sec; |
ebfd9bcf1 [CRYPTO]: Add cip... |
53 |
|
a873a5f1c crypto: tcrypt - ... |
54 55 |
static char *alg = NULL; static u32 type; |
7be380f72 crypto: tcrypt - ... |
56 |
static u32 mask; |
1da177e4c Linux-2.6.12-rc2 |
57 |
static int mode; |
f139cfa7c crypto: tcrypt - ... |
58 |
static char *tvmem[TVMEMSIZE]; |
1da177e4c Linux-2.6.12-rc2 |
59 60 |
static char *check[] = { |
cd12fb906 [CRYPTO] sha256-g... |
61 62 63 |
"des", "md5", "des3_ede", "rot13", "sha1", "sha224", "sha256", "blowfish", "twofish", "serpent", "sha384", "sha512", "md4", "aes", "cast6", "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea", |
90831639a [CRYPTO] fcrypt: ... |
64 |
"khazad", "wp512", "wp384", "wp256", "tnepres", "xeta", "fcrypt", |
2998db37b [CRYPTO] tcrypt: ... |
65 |
"camellia", "seed", "salsa20", "rmd128", "rmd160", "rmd256", "rmd320", |
0c01aed50 crypto: testmgr -... |
66 |
"lzo", "cts", "zlib", NULL |
1da177e4c Linux-2.6.12-rc2 |
67 |
}; |
f139cfa7c crypto: tcrypt - ... |
68 69 |
static int test_cipher_jiffies(struct blkcipher_desc *desc, int enc, struct scatterlist *sg, int blen, int sec) |
6a17944ca [CRYPTO]: Use CPU... |
70 |
{ |
6a17944ca [CRYPTO]: Use CPU... |
71 72 73 |
unsigned long start, end; int bcount; int ret; |
6a17944ca [CRYPTO]: Use CPU... |
74 75 76 |
for (start = jiffies, end = start + sec * HZ, bcount = 0; time_before(jiffies, end); bcount++) { if (enc) |
cba83564d [CRYPTO] tcrypt: ... |
77 |
ret = crypto_blkcipher_encrypt(desc, sg, sg, blen); |
6a17944ca [CRYPTO]: Use CPU... |
78 |
else |
cba83564d [CRYPTO] tcrypt: ... |
79 |
ret = crypto_blkcipher_decrypt(desc, sg, sg, blen); |
6a17944ca [CRYPTO]: Use CPU... |
80 81 82 83 84 85 86 87 88 89 |
if (ret) return ret; } printk("%d operations in %d seconds (%ld bytes) ", bcount, sec, (long)bcount * blen); return 0; } |
f139cfa7c crypto: tcrypt - ... |
90 91 |
static int test_cipher_cycles(struct blkcipher_desc *desc, int enc, struct scatterlist *sg, int blen) |
6a17944ca [CRYPTO]: Use CPU... |
92 |
{ |
6a17944ca [CRYPTO]: Use CPU... |
93 94 95 |
unsigned long cycles = 0; int ret = 0; int i; |
6a17944ca [CRYPTO]: Use CPU... |
96 97 98 99 100 |
local_irq_disable(); /* Warm-up run. */ for (i = 0; i < 4; i++) { if (enc) |
cba83564d [CRYPTO] tcrypt: ... |
101 |
ret = crypto_blkcipher_encrypt(desc, sg, sg, blen); |
6a17944ca [CRYPTO]: Use CPU... |
102 |
else |
cba83564d [CRYPTO] tcrypt: ... |
103 |
ret = crypto_blkcipher_decrypt(desc, sg, sg, blen); |
6a17944ca [CRYPTO]: Use CPU... |
104 105 106 107 108 109 110 111 112 113 114 |
if (ret) goto out; } /* The real thing. */ for (i = 0; i < 8; i++) { cycles_t start, end; start = get_cycles(); if (enc) |
cba83564d [CRYPTO] tcrypt: ... |
115 |
ret = crypto_blkcipher_encrypt(desc, sg, sg, blen); |
6a17944ca [CRYPTO]: Use CPU... |
116 |
else |
cba83564d [CRYPTO] tcrypt: ... |
117 |
ret = crypto_blkcipher_decrypt(desc, sg, sg, blen); |
6a17944ca [CRYPTO]: Use CPU... |
118 119 120 121 122 123 124 125 126 127 |
end = get_cycles(); if (ret) goto out; cycles += end - start; } out: local_irq_enable(); |
6a17944ca [CRYPTO]: Use CPU... |
128 129 130 131 132 133 134 135 |
if (ret == 0) printk("1 operation in %lu cycles (%d bytes) ", (cycles + 4) / 8, blen); return ret; } |
d5dc39274 [CRYPTO] tcrypt: ... |
136 |
static u32 block_sizes[] = { 16, 64, 256, 1024, 8192, 0 }; |
01b323245 crypto: tcrypt - ... |
137 |
static void test_cipher_speed(const char *algo, int enc, unsigned int sec, |
da7f033dd crypto: cryptomgr... |
138 |
struct cipher_speed_template *template, |
d5dc39274 [CRYPTO] tcrypt: ... |
139 |
unsigned int tcount, u8 *keysize) |
ebfd9bcf1 [CRYPTO]: Add cip... |
140 |
{ |
dce907c00 [CRYPTO]: Use tem... |
141 |
unsigned int ret, i, j, iv_len; |
f07ef1de9 crypto: tcrypt - ... |
142 143 |
const char *key; char iv[128]; |
cba83564d [CRYPTO] tcrypt: ... |
144 145 146 |
struct crypto_blkcipher *tfm; struct blkcipher_desc desc; const char *e; |
d5dc39274 [CRYPTO] tcrypt: ... |
147 |
u32 *b_size; |
ebfd9bcf1 [CRYPTO]: Add cip... |
148 149 150 151 152 |
if (enc == ENCRYPT) e = "encryption"; else e = "decryption"; |
ebfd9bcf1 [CRYPTO]: Add cip... |
153 |
|
cba83564d [CRYPTO] tcrypt: ... |
154 155 156 |
printk(" testing speed of %s %s ", algo, e); |
ebfd9bcf1 [CRYPTO]: Add cip... |
157 |
|
cba83564d [CRYPTO] tcrypt: ... |
158 |
tfm = crypto_alloc_blkcipher(algo, 0, CRYPTO_ALG_ASYNC); |
ebfd9bcf1 [CRYPTO]: Add cip... |
159 |
|
cba83564d [CRYPTO] tcrypt: ... |
160 161 162 163 |
if (IS_ERR(tfm)) { printk("failed to load transform for %s: %ld ", algo, PTR_ERR(tfm)); |
ebfd9bcf1 [CRYPTO]: Add cip... |
164 165 |
return; } |
cba83564d [CRYPTO] tcrypt: ... |
166 167 |
desc.tfm = tfm; desc.flags = 0; |
ebfd9bcf1 [CRYPTO]: Add cip... |
168 |
|
d5dc39274 [CRYPTO] tcrypt: ... |
169 170 |
i = 0; do { |
ebfd9bcf1 [CRYPTO]: Add cip... |
171 |
|
d5dc39274 [CRYPTO] tcrypt: ... |
172 173 |
b_size = block_sizes; do { |
f139cfa7c crypto: tcrypt - ... |
174 |
struct scatterlist sg[TVMEMSIZE]; |
ebfd9bcf1 [CRYPTO]: Add cip... |
175 |
|
f139cfa7c crypto: tcrypt - ... |
176 177 178 179 180 |
if ((*keysize + *b_size) > TVMEMSIZE * PAGE_SIZE) { printk("template (%u) too big for " "tvmem (%lu) ", *keysize + *b_size, TVMEMSIZE * PAGE_SIZE); |
d5dc39274 [CRYPTO] tcrypt: ... |
181 182 |
goto out; } |
ebfd9bcf1 [CRYPTO]: Add cip... |
183 |
|
d5dc39274 [CRYPTO] tcrypt: ... |
184 185 |
printk("test %u (%d bit key, %d byte blocks): ", i, *keysize * 8, *b_size); |
f139cfa7c crypto: tcrypt - ... |
186 |
memset(tvmem[0], 0xff, PAGE_SIZE); |
d5dc39274 [CRYPTO] tcrypt: ... |
187 188 |
/* set key, plain text and IV */ |
da7f033dd crypto: cryptomgr... |
189 |
key = tvmem[0]; |
d5dc39274 [CRYPTO] tcrypt: ... |
190 191 192 193 194 |
for (j = 0; j < tcount; j++) { if (template[j].klen == *keysize) { key = template[j].key; break; } |
dce907c00 [CRYPTO]: Use tem... |
195 |
} |
ebfd9bcf1 [CRYPTO]: Add cip... |
196 |
|
d5dc39274 [CRYPTO] tcrypt: ... |
197 198 199 200 201 202 203 |
ret = crypto_blkcipher_setkey(tfm, key, *keysize); if (ret) { printk("setkey() failed flags=%x ", crypto_blkcipher_get_flags(tfm)); goto out; } |
ebfd9bcf1 [CRYPTO]: Add cip... |
204 |
|
f139cfa7c crypto: tcrypt - ... |
205 206 207 208 209 210 211 |
sg_init_table(sg, TVMEMSIZE); sg_set_buf(sg, tvmem[0] + *keysize, PAGE_SIZE - *keysize); for (j = 1; j < TVMEMSIZE; j++) { sg_set_buf(sg + j, tvmem[j], PAGE_SIZE); memset (tvmem[j], 0xff, PAGE_SIZE); } |
d5dc39274 [CRYPTO] tcrypt: ... |
212 213 214 215 216 |
iv_len = crypto_blkcipher_ivsize(tfm); if (iv_len) { memset(&iv, 0xff, iv_len); crypto_blkcipher_set_iv(tfm, iv, iv_len); } |
ebfd9bcf1 [CRYPTO]: Add cip... |
217 |
|
d5dc39274 [CRYPTO] tcrypt: ... |
218 |
if (sec) |
f139cfa7c crypto: tcrypt - ... |
219 220 |
ret = test_cipher_jiffies(&desc, enc, sg, *b_size, sec); |
d5dc39274 [CRYPTO] tcrypt: ... |
221 |
else |
f139cfa7c crypto: tcrypt - ... |
222 223 |
ret = test_cipher_cycles(&desc, enc, sg, *b_size); |
ebfd9bcf1 [CRYPTO]: Add cip... |
224 |
|
d5dc39274 [CRYPTO] tcrypt: ... |
225 226 227 228 229 230 231 232 233 234 |
if (ret) { printk("%s() failed flags=%x ", e, desc.flags); break; } b_size++; i++; } while (*b_size); keysize++; } while (*keysize); |
ebfd9bcf1 [CRYPTO]: Add cip... |
235 236 |
out: |
cba83564d [CRYPTO] tcrypt: ... |
237 |
crypto_free_blkcipher(tfm); |
ebfd9bcf1 [CRYPTO]: Add cip... |
238 |
} |
f139cfa7c crypto: tcrypt - ... |
239 240 |
static int test_hash_jiffies_digest(struct hash_desc *desc, struct scatterlist *sg, int blen, |
e9d41164e [CRYPTO] tcrypt: ... |
241 242 |
char *out, int sec) { |
e9d41164e [CRYPTO] tcrypt: ... |
243 244 245 246 247 248 |
unsigned long start, end; int bcount; int ret; for (start = jiffies, end = start + sec * HZ, bcount = 0; time_before(jiffies, end); bcount++) { |
e9d41164e [CRYPTO] tcrypt: ... |
249 250 251 252 253 254 255 256 257 258 259 |
ret = crypto_hash_digest(desc, sg, blen, out); if (ret) return ret; } printk("%6u opers/sec, %9lu bytes/sec ", bcount / sec, ((long)bcount * blen) / sec); return 0; } |
f139cfa7c crypto: tcrypt - ... |
260 261 |
static int test_hash_jiffies(struct hash_desc *desc, struct scatterlist *sg, int blen, int plen, char *out, int sec) |
e80579285 [CRYPTO] tcrypt: ... |
262 |
{ |
e80579285 [CRYPTO] tcrypt: ... |
263 264 |
unsigned long start, end; int bcount, pcount; |
e9d41164e [CRYPTO] tcrypt: ... |
265 266 267 |
int ret; if (plen == blen) |
f139cfa7c crypto: tcrypt - ... |
268 |
return test_hash_jiffies_digest(desc, sg, blen, out, sec); |
a5a613a42 [CRYPTO] tcrypt: ... |
269 |
|
e80579285 [CRYPTO] tcrypt: ... |
270 271 |
for (start = jiffies, end = start + sec * HZ, bcount = 0; time_before(jiffies, end); bcount++) { |
e9d41164e [CRYPTO] tcrypt: ... |
272 273 274 |
ret = crypto_hash_init(desc); if (ret) return ret; |
e80579285 [CRYPTO] tcrypt: ... |
275 |
for (pcount = 0; pcount < blen; pcount += plen) { |
e9d41164e [CRYPTO] tcrypt: ... |
276 277 278 |
ret = crypto_hash_update(desc, sg, plen); if (ret) return ret; |
e80579285 [CRYPTO] tcrypt: ... |
279 280 |
} /* we assume there is enough space in 'out' for the result */ |
e9d41164e [CRYPTO] tcrypt: ... |
281 282 283 |
ret = crypto_hash_final(desc, out); if (ret) return ret; |
e80579285 [CRYPTO] tcrypt: ... |
284 285 286 287 288 |
} printk("%6u opers/sec, %9lu bytes/sec ", bcount / sec, ((long)bcount * blen) / sec); |
e9d41164e [CRYPTO] tcrypt: ... |
289 290 |
return 0; } |
f139cfa7c crypto: tcrypt - ... |
291 292 |
static int test_hash_cycles_digest(struct hash_desc *desc, struct scatterlist *sg, int blen, char *out) |
e9d41164e [CRYPTO] tcrypt: ... |
293 |
{ |
e9d41164e [CRYPTO] tcrypt: ... |
294 295 296 |
unsigned long cycles = 0; int i; int ret; |
e9d41164e [CRYPTO] tcrypt: ... |
297 298 299 300 |
local_irq_disable(); /* Warm-up run. */ for (i = 0; i < 4; i++) { |
e9d41164e [CRYPTO] tcrypt: ... |
301 302 303 304 305 306 307 308 309 310 |
ret = crypto_hash_digest(desc, sg, blen, out); if (ret) goto out; } /* The real thing. */ for (i = 0; i < 8; i++) { cycles_t start, end; start = get_cycles(); |
e9d41164e [CRYPTO] tcrypt: ... |
311 312 313 314 315 316 317 318 319 320 321 |
ret = crypto_hash_digest(desc, sg, blen, out); if (ret) goto out; end = get_cycles(); cycles += end - start; } out: local_irq_enable(); |
e9d41164e [CRYPTO] tcrypt: ... |
322 323 324 325 326 327 328 329 330 |
if (ret) return ret; printk("%6lu cycles/operation, %4lu cycles/byte ", cycles / 8, cycles / (8 * blen)); return 0; |
e80579285 [CRYPTO] tcrypt: ... |
331 |
} |
f139cfa7c crypto: tcrypt - ... |
332 333 |
static int test_hash_cycles(struct hash_desc *desc, struct scatterlist *sg, int blen, int plen, char *out) |
e80579285 [CRYPTO] tcrypt: ... |
334 |
{ |
e80579285 [CRYPTO] tcrypt: ... |
335 336 |
unsigned long cycles = 0; int i, pcount; |
e9d41164e [CRYPTO] tcrypt: ... |
337 338 339 |
int ret; if (plen == blen) |
f139cfa7c crypto: tcrypt - ... |
340 |
return test_hash_cycles_digest(desc, sg, blen, out); |
a5a613a42 [CRYPTO] tcrypt: ... |
341 |
|
e80579285 [CRYPTO] tcrypt: ... |
342 343 344 345 |
local_irq_disable(); /* Warm-up run. */ for (i = 0; i < 4; i++) { |
e9d41164e [CRYPTO] tcrypt: ... |
346 347 348 |
ret = crypto_hash_init(desc); if (ret) goto out; |
e80579285 [CRYPTO] tcrypt: ... |
349 |
for (pcount = 0; pcount < blen; pcount += plen) { |
e9d41164e [CRYPTO] tcrypt: ... |
350 351 352 |
ret = crypto_hash_update(desc, sg, plen); if (ret) goto out; |
e80579285 [CRYPTO] tcrypt: ... |
353 |
} |
29059d12e [CRYPTO] tcrypt: ... |
354 |
ret = crypto_hash_final(desc, out); |
e9d41164e [CRYPTO] tcrypt: ... |
355 356 |
if (ret) goto out; |
e80579285 [CRYPTO] tcrypt: ... |
357 358 359 360 361 |
} /* The real thing. */ for (i = 0; i < 8; i++) { cycles_t start, end; |
e80579285 [CRYPTO] tcrypt: ... |
362 |
start = get_cycles(); |
e9d41164e [CRYPTO] tcrypt: ... |
363 364 365 |
ret = crypto_hash_init(desc); if (ret) goto out; |
e80579285 [CRYPTO] tcrypt: ... |
366 |
for (pcount = 0; pcount < blen; pcount += plen) { |
e9d41164e [CRYPTO] tcrypt: ... |
367 368 369 |
ret = crypto_hash_update(desc, sg, plen); if (ret) goto out; |
e80579285 [CRYPTO] tcrypt: ... |
370 |
} |
e9d41164e [CRYPTO] tcrypt: ... |
371 372 373 |
ret = crypto_hash_final(desc, out); if (ret) goto out; |
e80579285 [CRYPTO] tcrypt: ... |
374 375 376 377 378 |
end = get_cycles(); cycles += end - start; } |
e9d41164e [CRYPTO] tcrypt: ... |
379 |
out: |
e80579285 [CRYPTO] tcrypt: ... |
380 |
local_irq_enable(); |
e80579285 [CRYPTO] tcrypt: ... |
381 |
|
e9d41164e [CRYPTO] tcrypt: ... |
382 383 |
if (ret) return ret; |
e80579285 [CRYPTO] tcrypt: ... |
384 385 386 |
printk("%6lu cycles/operation, %4lu cycles/byte ", cycles / 8, cycles / (8 * blen)); |
e9d41164e [CRYPTO] tcrypt: ... |
387 |
return 0; |
e80579285 [CRYPTO] tcrypt: ... |
388 |
} |
beb63da73 crypto: tcrypt - ... |
389 390 391 392 393 394 395 396 397 398 |
static void test_hash_sg_init(struct scatterlist *sg) { int i; sg_init_table(sg, TVMEMSIZE); for (i = 0; i < TVMEMSIZE; i++) { sg_set_buf(sg + i, tvmem[i], PAGE_SIZE); memset(tvmem[i], 0xff, PAGE_SIZE); } } |
01b323245 crypto: tcrypt - ... |
399 400 |
static void test_hash_speed(const char *algo, unsigned int sec, struct hash_speed *speed) |
e80579285 [CRYPTO] tcrypt: ... |
401 |
{ |
f139cfa7c crypto: tcrypt - ... |
402 |
struct scatterlist sg[TVMEMSIZE]; |
e9d41164e [CRYPTO] tcrypt: ... |
403 404 |
struct crypto_hash *tfm; struct hash_desc desc; |
376bacb0a crypto: tcrypt - ... |
405 |
static char output[1024]; |
e80579285 [CRYPTO] tcrypt: ... |
406 |
int i; |
e9d41164e [CRYPTO] tcrypt: ... |
407 |
int ret; |
e80579285 [CRYPTO] tcrypt: ... |
408 |
|
376bacb0a crypto: tcrypt - ... |
409 410 411 |
printk(KERN_INFO " testing speed of %s ", algo); |
e80579285 [CRYPTO] tcrypt: ... |
412 |
|
e9d41164e [CRYPTO] tcrypt: ... |
413 |
tfm = crypto_alloc_hash(algo, 0, CRYPTO_ALG_ASYNC); |
e80579285 [CRYPTO] tcrypt: ... |
414 |
|
e9d41164e [CRYPTO] tcrypt: ... |
415 |
if (IS_ERR(tfm)) { |
376bacb0a crypto: tcrypt - ... |
416 417 |
printk(KERN_ERR "failed to load transform for %s: %ld ", algo, |
e9d41164e [CRYPTO] tcrypt: ... |
418 |
PTR_ERR(tfm)); |
e80579285 [CRYPTO] tcrypt: ... |
419 420 |
return; } |
e9d41164e [CRYPTO] tcrypt: ... |
421 422 423 424 |
desc.tfm = tfm; desc.flags = 0; if (crypto_hash_digestsize(tfm) > sizeof(output)) { |
376bacb0a crypto: tcrypt - ... |
425 426 |
printk(KERN_ERR "digestsize(%u) > outputbuffer(%zu) ", |
e9d41164e [CRYPTO] tcrypt: ... |
427 |
crypto_hash_digestsize(tfm), sizeof(output)); |
e80579285 [CRYPTO] tcrypt: ... |
428 429 |
goto out; } |
beb63da73 crypto: tcrypt - ... |
430 |
test_hash_sg_init(sg); |
e80579285 [CRYPTO] tcrypt: ... |
431 |
for (i = 0; speed[i].blen != 0; i++) { |
f139cfa7c crypto: tcrypt - ... |
432 |
if (speed[i].blen > TVMEMSIZE * PAGE_SIZE) { |
376bacb0a crypto: tcrypt - ... |
433 434 435 |
printk(KERN_ERR "template (%u) too big for tvmem (%lu) ", |
f139cfa7c crypto: tcrypt - ... |
436 |
speed[i].blen, TVMEMSIZE * PAGE_SIZE); |
e80579285 [CRYPTO] tcrypt: ... |
437 438 |
goto out; } |
18bcc9194 crypto: tcrypt - ... |
439 440 |
if (speed[i].klen) crypto_hash_setkey(tfm, tvmem[0], speed[i].klen); |
376bacb0a crypto: tcrypt - ... |
441 442 |
printk(KERN_INFO "test%3u " "(%5u byte blocks,%5u bytes per update,%4u updates): ", |
e80579285 [CRYPTO] tcrypt: ... |
443 |
i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen); |
e80579285 [CRYPTO] tcrypt: ... |
444 |
if (sec) |
f139cfa7c crypto: tcrypt - ... |
445 |
ret = test_hash_jiffies(&desc, sg, speed[i].blen, |
e9d41164e [CRYPTO] tcrypt: ... |
446 |
speed[i].plen, output, sec); |
e80579285 [CRYPTO] tcrypt: ... |
447 |
else |
f139cfa7c crypto: tcrypt - ... |
448 |
ret = test_hash_cycles(&desc, sg, speed[i].blen, |
e9d41164e [CRYPTO] tcrypt: ... |
449 450 451 |
speed[i].plen, output); if (ret) { |
376bacb0a crypto: tcrypt - ... |
452 453 |
printk(KERN_ERR "hashing failed ret=%d ", ret); |
e9d41164e [CRYPTO] tcrypt: ... |
454 455 |
break; } |
e80579285 [CRYPTO] tcrypt: ... |
456 457 458 |
} out: |
e9d41164e [CRYPTO] tcrypt: ... |
459 |
crypto_free_hash(tfm); |
e80579285 [CRYPTO] tcrypt: ... |
460 |
} |
beb63da73 crypto: tcrypt - ... |
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 |
struct tcrypt_result { struct completion completion; int err; }; static void tcrypt_complete(struct crypto_async_request *req, int err) { struct tcrypt_result *res = req->data; if (err == -EINPROGRESS) return; res->err = err; complete(&res->completion); } static inline int do_one_ahash_op(struct ahash_request *req, int ret) { if (ret == -EINPROGRESS || ret == -EBUSY) { struct tcrypt_result *tr = req->base.data; ret = wait_for_completion_interruptible(&tr->completion); if (!ret) ret = tr->err; INIT_COMPLETION(tr->completion); } return ret; } static int test_ahash_jiffies_digest(struct ahash_request *req, int blen, char *out, int sec) { unsigned long start, end; int bcount; int ret; for (start = jiffies, end = start + sec * HZ, bcount = 0; time_before(jiffies, end); bcount++) { ret = do_one_ahash_op(req, crypto_ahash_digest(req)); if (ret) return ret; } printk("%6u opers/sec, %9lu bytes/sec ", bcount / sec, ((long)bcount * blen) / sec); return 0; } static int test_ahash_jiffies(struct ahash_request *req, int blen, int plen, char *out, int sec) { unsigned long start, end; int bcount, pcount; int ret; if (plen == blen) return test_ahash_jiffies_digest(req, blen, out, sec); for (start = jiffies, end = start + sec * HZ, bcount = 0; time_before(jiffies, end); bcount++) { ret = crypto_ahash_init(req); if (ret) return ret; for (pcount = 0; pcount < blen; pcount += plen) { ret = do_one_ahash_op(req, crypto_ahash_update(req)); if (ret) return ret; } /* we assume there is enough space in 'out' for the result */ ret = do_one_ahash_op(req, crypto_ahash_final(req)); if (ret) return ret; } pr_cont("%6u opers/sec, %9lu bytes/sec ", bcount / sec, ((long)bcount * blen) / sec); return 0; } static int test_ahash_cycles_digest(struct ahash_request *req, int blen, char *out) { unsigned long cycles = 0; int ret, i; /* Warm-up run. */ for (i = 0; i < 4; i++) { ret = do_one_ahash_op(req, crypto_ahash_digest(req)); if (ret) goto out; } /* The real thing. */ for (i = 0; i < 8; i++) { cycles_t start, end; start = get_cycles(); ret = do_one_ahash_op(req, crypto_ahash_digest(req)); if (ret) goto out; end = get_cycles(); cycles += end - start; } out: if (ret) return ret; pr_cont("%6lu cycles/operation, %4lu cycles/byte ", cycles / 8, cycles / (8 * blen)); return 0; } static int test_ahash_cycles(struct ahash_request *req, int blen, int plen, char *out) { unsigned long cycles = 0; int i, pcount, ret; if (plen == blen) return test_ahash_cycles_digest(req, blen, out); /* Warm-up run. */ for (i = 0; i < 4; i++) { ret = crypto_ahash_init(req); if (ret) goto out; for (pcount = 0; pcount < blen; pcount += plen) { ret = do_one_ahash_op(req, crypto_ahash_update(req)); if (ret) goto out; } ret = do_one_ahash_op(req, crypto_ahash_final(req)); if (ret) goto out; } /* The real thing. */ for (i = 0; i < 8; i++) { cycles_t start, end; start = get_cycles(); ret = crypto_ahash_init(req); if (ret) goto out; for (pcount = 0; pcount < blen; pcount += plen) { ret = do_one_ahash_op(req, crypto_ahash_update(req)); if (ret) goto out; } ret = do_one_ahash_op(req, crypto_ahash_final(req)); if (ret) goto out; end = get_cycles(); cycles += end - start; } out: if (ret) return ret; pr_cont("%6lu cycles/operation, %4lu cycles/byte ", cycles / 8, cycles / (8 * blen)); return 0; } static void test_ahash_speed(const char *algo, unsigned int sec, struct hash_speed *speed) { struct scatterlist sg[TVMEMSIZE]; struct tcrypt_result tresult; struct ahash_request *req; struct crypto_ahash *tfm; static char output[1024]; int i, ret; printk(KERN_INFO " testing speed of async %s ", algo); tfm = crypto_alloc_ahash(algo, 0, 0); if (IS_ERR(tfm)) { pr_err("failed to load transform for %s: %ld ", algo, PTR_ERR(tfm)); return; } if (crypto_ahash_digestsize(tfm) > sizeof(output)) { pr_err("digestsize(%u) > outputbuffer(%zu) ", crypto_ahash_digestsize(tfm), sizeof(output)); goto out; } test_hash_sg_init(sg); req = ahash_request_alloc(tfm, GFP_KERNEL); if (!req) { pr_err("ahash request allocation failure "); goto out; } init_completion(&tresult.completion); ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, tcrypt_complete, &tresult); for (i = 0; speed[i].blen != 0; i++) { if (speed[i].blen > TVMEMSIZE * PAGE_SIZE) { pr_err("template (%u) too big for tvmem (%lu) ", speed[i].blen, TVMEMSIZE * PAGE_SIZE); break; } pr_info("test%3u " "(%5u byte blocks,%5u bytes per update,%4u updates): ", i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen); ahash_request_set_crypt(req, sg, output, speed[i].plen); if (sec) ret = test_ahash_jiffies(req, speed[i].blen, speed[i].plen, output, sec); else ret = test_ahash_cycles(req, speed[i].blen, speed[i].plen, output); if (ret) { pr_err("hashing failed ret=%d ", ret); break; } } ahash_request_free(req); out: crypto_free_ahash(tfm); } |
3f3baf359 crypto: tcrypt - ... |
715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 |
static inline int do_one_acipher_op(struct ablkcipher_request *req, int ret) { if (ret == -EINPROGRESS || ret == -EBUSY) { struct tcrypt_result *tr = req->base.data; ret = wait_for_completion_interruptible(&tr->completion); if (!ret) ret = tr->err; INIT_COMPLETION(tr->completion); } return ret; } static int test_acipher_jiffies(struct ablkcipher_request *req, int enc, int blen, int sec) { unsigned long start, end; int bcount; int ret; for (start = jiffies, end = start + sec * HZ, bcount = 0; time_before(jiffies, end); bcount++) { if (enc) ret = do_one_acipher_op(req, crypto_ablkcipher_encrypt(req)); else ret = do_one_acipher_op(req, crypto_ablkcipher_decrypt(req)); if (ret) return ret; } pr_cont("%d operations in %d seconds (%ld bytes) ", bcount, sec, (long)bcount * blen); return 0; } static int test_acipher_cycles(struct ablkcipher_request *req, int enc, int blen) { unsigned long cycles = 0; int ret = 0; int i; /* Warm-up run. */ for (i = 0; i < 4; i++) { if (enc) ret = do_one_acipher_op(req, crypto_ablkcipher_encrypt(req)); else ret = do_one_acipher_op(req, crypto_ablkcipher_decrypt(req)); if (ret) goto out; } /* The real thing. */ for (i = 0; i < 8; i++) { cycles_t start, end; start = get_cycles(); if (enc) ret = do_one_acipher_op(req, crypto_ablkcipher_encrypt(req)); else ret = do_one_acipher_op(req, crypto_ablkcipher_decrypt(req)); end = get_cycles(); if (ret) goto out; cycles += end - start; } out: if (ret == 0) pr_cont("1 operation in %lu cycles (%d bytes) ", (cycles + 4) / 8, blen); return ret; } static void test_acipher_speed(const char *algo, int enc, unsigned int sec, struct cipher_speed_template *template, unsigned int tcount, u8 *keysize) { |
de1975334 crypto: atmel - a... |
807 |
unsigned int ret, i, j, k, iv_len; |
3f3baf359 crypto: tcrypt - ... |
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 |
struct tcrypt_result tresult; const char *key; char iv[128]; struct ablkcipher_request *req; struct crypto_ablkcipher *tfm; const char *e; u32 *b_size; if (enc == ENCRYPT) e = "encryption"; else e = "decryption"; pr_info(" testing speed of async %s %s ", algo, e); init_completion(&tresult.completion); tfm = crypto_alloc_ablkcipher(algo, 0, 0); if (IS_ERR(tfm)) { pr_err("failed to load transform for %s: %ld ", algo, PTR_ERR(tfm)); return; } req = ablkcipher_request_alloc(tfm, GFP_KERNEL); if (!req) { pr_err("tcrypt: skcipher: Failed to allocate request for %s ", algo); goto out; } ablkcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, tcrypt_complete, &tresult); i = 0; do { b_size = block_sizes; do { struct scatterlist sg[TVMEMSIZE]; if ((*keysize + *b_size) > TVMEMSIZE * PAGE_SIZE) { pr_err("template (%u) too big for " "tvmem (%lu) ", *keysize + *b_size, TVMEMSIZE * PAGE_SIZE); goto out_free_req; } pr_info("test %u (%d bit key, %d byte blocks): ", i, *keysize * 8, *b_size); memset(tvmem[0], 0xff, PAGE_SIZE); /* set key, plain text and IV */ key = tvmem[0]; for (j = 0; j < tcount; j++) { if (template[j].klen == *keysize) { key = template[j].key; break; } } crypto_ablkcipher_clear_flags(tfm, ~0); ret = crypto_ablkcipher_setkey(tfm, key, *keysize); if (ret) { pr_err("setkey() failed flags=%x ", crypto_ablkcipher_get_flags(tfm)); goto out_free_req; } sg_init_table(sg, TVMEMSIZE); |
de1975334 crypto: atmel - a... |
887 888 889 890 |
k = *keysize + *b_size; if (k > PAGE_SIZE) { sg_set_buf(sg, tvmem[0] + *keysize, |
3f3baf359 crypto: tcrypt - ... |
891 |
PAGE_SIZE - *keysize); |
de1975334 crypto: atmel - a... |
892 893 894 895 896 897 898 899 900 901 902 903 |
k -= PAGE_SIZE; j = 1; while (k > PAGE_SIZE) { sg_set_buf(sg + j, tvmem[j], PAGE_SIZE); memset(tvmem[j], 0xff, PAGE_SIZE); j++; k -= PAGE_SIZE; } sg_set_buf(sg + j, tvmem[j], k); memset(tvmem[j], 0xff, k); } else { sg_set_buf(sg, tvmem[0] + *keysize, *b_size); |
3f3baf359 crypto: tcrypt - ... |
904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 |
} iv_len = crypto_ablkcipher_ivsize(tfm); if (iv_len) memset(&iv, 0xff, iv_len); ablkcipher_request_set_crypt(req, sg, sg, *b_size, iv); if (sec) ret = test_acipher_jiffies(req, enc, *b_size, sec); else ret = test_acipher_cycles(req, enc, *b_size); if (ret) { pr_err("%s() failed flags=%x ", e, crypto_ablkcipher_get_flags(tfm)); break; } b_size++; i++; } while (*b_size); keysize++; } while (*keysize); out_free_req: ablkcipher_request_free(req); out: crypto_free_ablkcipher(tfm); } |
ef2736fc7 [CRYPTO]: White s... |
936 |
static void test_available(void) |
1da177e4c Linux-2.6.12-rc2 |
937 938 |
{ char **name = check; |
ef2736fc7 [CRYPTO]: White s... |
939 |
|
1da177e4c Linux-2.6.12-rc2 |
940 941 |
while (*name) { printk("alg %s ", *name); |
6158efc09 [CRYPTO] tcrypt: ... |
942 |
printk(crypto_has_alg(*name, 0, 0) ? |
e4d5b79c6 [CRYPTO] users: U... |
943 944 945 |
"found " : "not found "); |
1da177e4c Linux-2.6.12-rc2 |
946 |
name++; |
ef2736fc7 [CRYPTO]: White s... |
947 |
} |
1da177e4c Linux-2.6.12-rc2 |
948 |
} |
01b323245 crypto: tcrypt - ... |
949 950 |
static inline int tcrypt_test(const char *alg) { |
4e033a6bc crypto: tcrypt - ... |
951 952 953 954 955 956 957 |
int ret; ret = alg_test(alg, alg, 0, 0); /* non-fips algs return -EINVAL in fips mode */ if (fips_enabled && ret == -EINVAL) ret = 0; return ret; |
01b323245 crypto: tcrypt - ... |
958 |
} |
4e033a6bc crypto: tcrypt - ... |
959 |
static int do_test(int m) |
01b323245 crypto: tcrypt - ... |
960 961 |
{ int i; |
4e033a6bc crypto: tcrypt - ... |
962 |
int ret = 0; |
01b323245 crypto: tcrypt - ... |
963 964 |
switch (m) { |
1da177e4c Linux-2.6.12-rc2 |
965 |
case 0: |
01b323245 crypto: tcrypt - ... |
966 |
for (i = 1; i < 200; i++) |
4e033a6bc crypto: tcrypt - ... |
967 |
ret += do_test(i); |
1da177e4c Linux-2.6.12-rc2 |
968 969 970 |
break; case 1: |
4e033a6bc crypto: tcrypt - ... |
971 |
ret += tcrypt_test("md5"); |
1da177e4c Linux-2.6.12-rc2 |
972 973 974 |
break; case 2: |
4e033a6bc crypto: tcrypt - ... |
975 |
ret += tcrypt_test("sha1"); |
1da177e4c Linux-2.6.12-rc2 |
976 977 978 |
break; case 3: |
4e033a6bc crypto: tcrypt - ... |
979 980 |
ret += tcrypt_test("ecb(des)"); ret += tcrypt_test("cbc(des)"); |
8163fc30d crypto: testmgr -... |
981 |
ret += tcrypt_test("ctr(des)"); |
1da177e4c Linux-2.6.12-rc2 |
982 983 984 |
break; case 4: |
4e033a6bc crypto: tcrypt - ... |
985 986 |
ret += tcrypt_test("ecb(des3_ede)"); ret += tcrypt_test("cbc(des3_ede)"); |
e080b17a8 crypto: testmgr -... |
987 |
ret += tcrypt_test("ctr(des3_ede)"); |
1da177e4c Linux-2.6.12-rc2 |
988 989 990 |
break; case 5: |
4e033a6bc crypto: tcrypt - ... |
991 |
ret += tcrypt_test("md4"); |
1da177e4c Linux-2.6.12-rc2 |
992 |
break; |
ef2736fc7 [CRYPTO]: White s... |
993 |
|
1da177e4c Linux-2.6.12-rc2 |
994 |
case 6: |
4e033a6bc crypto: tcrypt - ... |
995 |
ret += tcrypt_test("sha256"); |
1da177e4c Linux-2.6.12-rc2 |
996 |
break; |
ef2736fc7 [CRYPTO]: White s... |
997 |
|
1da177e4c Linux-2.6.12-rc2 |
998 |
case 7: |
4e033a6bc crypto: tcrypt - ... |
999 1000 |
ret += tcrypt_test("ecb(blowfish)"); ret += tcrypt_test("cbc(blowfish)"); |
85b63e342 crypto: testmgr -... |
1001 |
ret += tcrypt_test("ctr(blowfish)"); |
1da177e4c Linux-2.6.12-rc2 |
1002 1003 1004 |
break; case 8: |
4e033a6bc crypto: tcrypt - ... |
1005 1006 |
ret += tcrypt_test("ecb(twofish)"); ret += tcrypt_test("cbc(twofish)"); |
573da6208 crypto: testmgr -... |
1007 |
ret += tcrypt_test("ctr(twofish)"); |
bee3a90ef crypto: tcrypt - ... |
1008 |
ret += tcrypt_test("lrw(twofish)"); |
131f75416 crypto: tcrypt - ... |
1009 |
ret += tcrypt_test("xts(twofish)"); |
1da177e4c Linux-2.6.12-rc2 |
1010 |
break; |
ef2736fc7 [CRYPTO]: White s... |
1011 |
|
1da177e4c Linux-2.6.12-rc2 |
1012 |
case 9: |
4e033a6bc crypto: tcrypt - ... |
1013 |
ret += tcrypt_test("ecb(serpent)"); |
9d25917d4 crypto: testmgr -... |
1014 1015 |
ret += tcrypt_test("cbc(serpent)"); ret += tcrypt_test("ctr(serpent)"); |
87aae4bfb crypto: tcrypt - ... |
1016 |
ret += tcrypt_test("lrw(serpent)"); |
5209c07ac crypto: tcrypt - ... |
1017 |
ret += tcrypt_test("xts(serpent)"); |
1da177e4c Linux-2.6.12-rc2 |
1018 1019 1020 |
break; case 10: |
4e033a6bc crypto: tcrypt - ... |
1021 1022 1023 1024 1025 1026 |
ret += tcrypt_test("ecb(aes)"); ret += tcrypt_test("cbc(aes)"); ret += tcrypt_test("lrw(aes)"); ret += tcrypt_test("xts(aes)"); ret += tcrypt_test("ctr(aes)"); ret += tcrypt_test("rfc3686(ctr(aes))"); |
1da177e4c Linux-2.6.12-rc2 |
1027 1028 1029 |
break; case 11: |
4e033a6bc crypto: tcrypt - ... |
1030 |
ret += tcrypt_test("sha384"); |
1da177e4c Linux-2.6.12-rc2 |
1031 |
break; |
ef2736fc7 [CRYPTO]: White s... |
1032 |
|
1da177e4c Linux-2.6.12-rc2 |
1033 |
case 12: |
4e033a6bc crypto: tcrypt - ... |
1034 |
ret += tcrypt_test("sha512"); |
1da177e4c Linux-2.6.12-rc2 |
1035 1036 1037 |
break; case 13: |
4e033a6bc crypto: tcrypt - ... |
1038 |
ret += tcrypt_test("deflate"); |
1da177e4c Linux-2.6.12-rc2 |
1039 1040 1041 |
break; case 14: |
4e033a6bc crypto: tcrypt - ... |
1042 |
ret += tcrypt_test("ecb(cast5)"); |
a2c582609 crypto: testmgr -... |
1043 1044 |
ret += tcrypt_test("cbc(cast5)"); ret += tcrypt_test("ctr(cast5)"); |
1da177e4c Linux-2.6.12-rc2 |
1045 1046 1047 |
break; case 15: |
4e033a6bc crypto: tcrypt - ... |
1048 |
ret += tcrypt_test("ecb(cast6)"); |
9b8b04051 crypto: testmgr -... |
1049 1050 1051 1052 |
ret += tcrypt_test("cbc(cast6)"); ret += tcrypt_test("ctr(cast6)"); ret += tcrypt_test("lrw(cast6)"); ret += tcrypt_test("xts(cast6)"); |
1da177e4c Linux-2.6.12-rc2 |
1053 1054 1055 |
break; case 16: |
4e033a6bc crypto: tcrypt - ... |
1056 |
ret += tcrypt_test("ecb(arc4)"); |
1da177e4c Linux-2.6.12-rc2 |
1057 1058 1059 |
break; case 17: |
4e033a6bc crypto: tcrypt - ... |
1060 |
ret += tcrypt_test("michael_mic"); |
1da177e4c Linux-2.6.12-rc2 |
1061 1062 1063 |
break; case 18: |
4e033a6bc crypto: tcrypt - ... |
1064 |
ret += tcrypt_test("crc32c"); |
1da177e4c Linux-2.6.12-rc2 |
1065 1066 1067 |
break; case 19: |
4e033a6bc crypto: tcrypt - ... |
1068 |
ret += tcrypt_test("ecb(tea)"); |
1da177e4c Linux-2.6.12-rc2 |
1069 1070 1071 |
break; case 20: |
4e033a6bc crypto: tcrypt - ... |
1072 |
ret += tcrypt_test("ecb(xtea)"); |
1da177e4c Linux-2.6.12-rc2 |
1073 1074 1075 |
break; case 21: |
4e033a6bc crypto: tcrypt - ... |
1076 |
ret += tcrypt_test("ecb(khazad)"); |
1da177e4c Linux-2.6.12-rc2 |
1077 1078 1079 |
break; case 22: |
4e033a6bc crypto: tcrypt - ... |
1080 |
ret += tcrypt_test("wp512"); |
1da177e4c Linux-2.6.12-rc2 |
1081 1082 1083 |
break; case 23: |
4e033a6bc crypto: tcrypt - ... |
1084 |
ret += tcrypt_test("wp384"); |
1da177e4c Linux-2.6.12-rc2 |
1085 1086 1087 |
break; case 24: |
4e033a6bc crypto: tcrypt - ... |
1088 |
ret += tcrypt_test("wp256"); |
1da177e4c Linux-2.6.12-rc2 |
1089 1090 1091 |
break; case 25: |
4e033a6bc crypto: tcrypt - ... |
1092 |
ret += tcrypt_test("ecb(tnepres)"); |
1da177e4c Linux-2.6.12-rc2 |
1093 1094 1095 |
break; case 26: |
4e033a6bc crypto: tcrypt - ... |
1096 1097 |
ret += tcrypt_test("ecb(anubis)"); ret += tcrypt_test("cbc(anubis)"); |
1da177e4c Linux-2.6.12-rc2 |
1098 1099 1100 |
break; case 27: |
4e033a6bc crypto: tcrypt - ... |
1101 |
ret += tcrypt_test("tgr192"); |
1da177e4c Linux-2.6.12-rc2 |
1102 1103 1104 |
break; case 28: |
4e033a6bc crypto: tcrypt - ... |
1105 |
ret += tcrypt_test("tgr160"); |
1da177e4c Linux-2.6.12-rc2 |
1106 1107 1108 |
break; case 29: |
4e033a6bc crypto: tcrypt - ... |
1109 |
ret += tcrypt_test("tgr128"); |
1da177e4c Linux-2.6.12-rc2 |
1110 |
break; |
2998db37b [CRYPTO] tcrypt: ... |
1111 |
|
fb4f10ed5 [CRYPTO]: Fix XTE... |
1112 |
case 30: |
4e033a6bc crypto: tcrypt - ... |
1113 |
ret += tcrypt_test("ecb(xeta)"); |
fb4f10ed5 [CRYPTO]: Fix XTE... |
1114 |
break; |
1da177e4c Linux-2.6.12-rc2 |
1115 |
|
90831639a [CRYPTO] fcrypt: ... |
1116 |
case 31: |
4e033a6bc crypto: tcrypt - ... |
1117 |
ret += tcrypt_test("pcbc(fcrypt)"); |
90831639a [CRYPTO] fcrypt: ... |
1118 |
break; |
02ab5a705 [CRYPTO] camellia... |
1119 |
case 32: |
4e033a6bc crypto: tcrypt - ... |
1120 1121 |
ret += tcrypt_test("ecb(camellia)"); ret += tcrypt_test("cbc(camellia)"); |
54216bbd7 crypto: tcrypt - ... |
1122 1123 1124 |
ret += tcrypt_test("ctr(camellia)"); ret += tcrypt_test("lrw(camellia)"); ret += tcrypt_test("xts(camellia)"); |
02ab5a705 [CRYPTO] camellia... |
1125 |
break; |
93b5e86a6 crypto: add CMAC ... |
1126 |
|
cd12fb906 [CRYPTO] sha256-g... |
1127 |
case 33: |
4e033a6bc crypto: tcrypt - ... |
1128 |
ret += tcrypt_test("sha224"); |
cd12fb906 [CRYPTO] sha256-g... |
1129 |
break; |
02ab5a705 [CRYPTO] camellia... |
1130 |
|
2407d6087 [CRYPTO] salsa20:... |
1131 |
case 34: |
4e033a6bc crypto: tcrypt - ... |
1132 |
ret += tcrypt_test("salsa20"); |
2407d6087 [CRYPTO] salsa20:... |
1133 |
break; |
8df213d9b [CRYPTO] tcrypt: ... |
1134 |
case 35: |
4e033a6bc crypto: tcrypt - ... |
1135 |
ret += tcrypt_test("gcm(aes)"); |
8df213d9b [CRYPTO] tcrypt: ... |
1136 |
break; |
0b77abb3b [CRYPTO] lzo: Add... |
1137 |
case 36: |
4e033a6bc crypto: tcrypt - ... |
1138 |
ret += tcrypt_test("lzo"); |
0b77abb3b [CRYPTO] lzo: Add... |
1139 |
break; |
93cc74e07 [CRYPTO] tcrypt: ... |
1140 |
case 37: |
4e033a6bc crypto: tcrypt - ... |
1141 |
ret += tcrypt_test("ccm(aes)"); |
93cc74e07 [CRYPTO] tcrypt: ... |
1142 |
break; |
76cb95217 [CRYPTO] cts: Add... |
1143 |
case 38: |
4e033a6bc crypto: tcrypt - ... |
1144 |
ret += tcrypt_test("cts(cbc(aes))"); |
76cb95217 [CRYPTO] cts: Add... |
1145 |
break; |
fd4adf1a0 [CRYPTO] tcrypt: ... |
1146 |
case 39: |
4e033a6bc crypto: tcrypt - ... |
1147 |
ret += tcrypt_test("rmd128"); |
fd4adf1a0 [CRYPTO] tcrypt: ... |
1148 1149 1150 |
break; case 40: |
4e033a6bc crypto: tcrypt - ... |
1151 |
ret += tcrypt_test("rmd160"); |
fd4adf1a0 [CRYPTO] tcrypt: ... |
1152 |
break; |
2998db37b [CRYPTO] tcrypt: ... |
1153 |
case 41: |
4e033a6bc crypto: tcrypt - ... |
1154 |
ret += tcrypt_test("rmd256"); |
2998db37b [CRYPTO] tcrypt: ... |
1155 1156 1157 |
break; case 42: |
4e033a6bc crypto: tcrypt - ... |
1158 |
ret += tcrypt_test("rmd320"); |
01b323245 crypto: tcrypt - ... |
1159 1160 1161 |
break; case 43: |
4e033a6bc crypto: tcrypt - ... |
1162 |
ret += tcrypt_test("ecb(seed)"); |
2998db37b [CRYPTO] tcrypt: ... |
1163 |
break; |
0c01aed50 crypto: testmgr -... |
1164 |
case 44: |
4e033a6bc crypto: tcrypt - ... |
1165 |
ret += tcrypt_test("zlib"); |
0c01aed50 crypto: testmgr -... |
1166 |
break; |
5d667322a crypto: testmgr -... |
1167 |
case 45: |
4e033a6bc crypto: tcrypt - ... |
1168 |
ret += tcrypt_test("rfc4309(ccm(aes))"); |
5d667322a crypto: testmgr -... |
1169 |
break; |
54216bbd7 crypto: tcrypt - ... |
1170 1171 1172 |
case 46: ret += tcrypt_test("ghash"); break; |
1da177e4c Linux-2.6.12-rc2 |
1173 |
case 100: |
4e033a6bc crypto: tcrypt - ... |
1174 |
ret += tcrypt_test("hmac(md5)"); |
1da177e4c Linux-2.6.12-rc2 |
1175 |
break; |
ef2736fc7 [CRYPTO]: White s... |
1176 |
|
1da177e4c Linux-2.6.12-rc2 |
1177 |
case 101: |
4e033a6bc crypto: tcrypt - ... |
1178 |
ret += tcrypt_test("hmac(sha1)"); |
1da177e4c Linux-2.6.12-rc2 |
1179 |
break; |
ef2736fc7 [CRYPTO]: White s... |
1180 |
|
1da177e4c Linux-2.6.12-rc2 |
1181 |
case 102: |
4e033a6bc crypto: tcrypt - ... |
1182 |
ret += tcrypt_test("hmac(sha256)"); |
1da177e4c Linux-2.6.12-rc2 |
1183 |
break; |
a28091ae1 [CRYPTO] tcrypt: ... |
1184 |
case 103: |
4e033a6bc crypto: tcrypt - ... |
1185 |
ret += tcrypt_test("hmac(sha384)"); |
a28091ae1 [CRYPTO] tcrypt: ... |
1186 1187 1188 |
break; case 104: |
4e033a6bc crypto: tcrypt - ... |
1189 |
ret += tcrypt_test("hmac(sha512)"); |
a28091ae1 [CRYPTO] tcrypt: ... |
1190 |
break; |
38ed9ab23 [CRYPTO] tcrypt: ... |
1191 |
|
cd12fb906 [CRYPTO] sha256-g... |
1192 |
case 105: |
4e033a6bc crypto: tcrypt - ... |
1193 |
ret += tcrypt_test("hmac(sha224)"); |
cd12fb906 [CRYPTO] sha256-g... |
1194 |
break; |
1da177e4c Linux-2.6.12-rc2 |
1195 |
|
38ed9ab23 [CRYPTO] tcrypt: ... |
1196 |
case 106: |
4e033a6bc crypto: tcrypt - ... |
1197 |
ret += tcrypt_test("xcbc(aes)"); |
38ed9ab23 [CRYPTO] tcrypt: ... |
1198 |
break; |
fd4adf1a0 [CRYPTO] tcrypt: ... |
1199 |
case 107: |
4e033a6bc crypto: tcrypt - ... |
1200 |
ret += tcrypt_test("hmac(rmd128)"); |
fd4adf1a0 [CRYPTO] tcrypt: ... |
1201 1202 1203 |
break; case 108: |
4e033a6bc crypto: tcrypt - ... |
1204 |
ret += tcrypt_test("hmac(rmd160)"); |
fd4adf1a0 [CRYPTO] tcrypt: ... |
1205 |
break; |
f1939f7c5 crypto: vmac - Ne... |
1206 1207 1208 |
case 109: ret += tcrypt_test("vmac(aes)"); break; |
93b5e86a6 crypto: add CMAC ... |
1209 |
|
a482b081a crypto: testmgr -... |
1210 1211 1212 |
case 110: ret += tcrypt_test("hmac(crc32)"); break; |
f1939f7c5 crypto: vmac - Ne... |
1213 |
|
e08ca2da3 crypto: testmgr -... |
1214 |
case 150: |
4e033a6bc crypto: tcrypt - ... |
1215 |
ret += tcrypt_test("ansi_cprng"); |
e08ca2da3 crypto: testmgr -... |
1216 |
break; |
69435b94d crypto: rfc4106 -... |
1217 1218 1219 |
case 151: ret += tcrypt_test("rfc4106(gcm(aes))"); break; |
e9b7441a9 crypto: testmgr -... |
1220 1221 1222 |
case 152: ret += tcrypt_test("rfc4543(gcm(aes))"); break; |
93b5e86a6 crypto: add CMAC ... |
1223 1224 1225 1226 1227 1228 1229 |
case 153: ret += tcrypt_test("cmac(aes)"); break; case 154: ret += tcrypt_test("cmac(des3_ede)"); break; |
ebfd9bcf1 [CRYPTO]: Add cip... |
1230 |
case 200: |
cba83564d [CRYPTO] tcrypt: ... |
1231 |
test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1232 |
speed_template_16_24_32); |
cba83564d [CRYPTO] tcrypt: ... |
1233 |
test_cipher_speed("ecb(aes)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1234 |
speed_template_16_24_32); |
cba83564d [CRYPTO] tcrypt: ... |
1235 |
test_cipher_speed("cbc(aes)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1236 |
speed_template_16_24_32); |
cba83564d [CRYPTO] tcrypt: ... |
1237 |
test_cipher_speed("cbc(aes)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1238 |
speed_template_16_24_32); |
f3d1044cd [CRYPTO] tcrypt: ... |
1239 |
test_cipher_speed("lrw(aes)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1240 |
speed_template_32_40_48); |
f3d1044cd [CRYPTO] tcrypt: ... |
1241 |
test_cipher_speed("lrw(aes)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1242 |
speed_template_32_40_48); |
f19f5111c [CRYPTO] xts: XTS... |
1243 |
test_cipher_speed("xts(aes)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1244 |
speed_template_32_48_64); |
f19f5111c [CRYPTO] xts: XTS... |
1245 |
test_cipher_speed("xts(aes)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1246 |
speed_template_32_48_64); |
9996e3421 crypto: tcrypt - ... |
1247 1248 1249 1250 |
test_cipher_speed("ctr(aes)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_cipher_speed("ctr(aes)", DECRYPT, sec, NULL, 0, speed_template_16_24_32); |
ebfd9bcf1 [CRYPTO]: Add cip... |
1251 1252 1253 |
break; case 201: |
cba83564d [CRYPTO] tcrypt: ... |
1254 |
test_cipher_speed("ecb(des3_ede)", ENCRYPT, sec, |
da7f033dd crypto: cryptomgr... |
1255 |
des3_speed_template, DES3_SPEED_VECTORS, |
477035c2a [CRYPTO] tcrypt: ... |
1256 |
speed_template_24); |
cba83564d [CRYPTO] tcrypt: ... |
1257 |
test_cipher_speed("ecb(des3_ede)", DECRYPT, sec, |
da7f033dd crypto: cryptomgr... |
1258 |
des3_speed_template, DES3_SPEED_VECTORS, |
477035c2a [CRYPTO] tcrypt: ... |
1259 |
speed_template_24); |
cba83564d [CRYPTO] tcrypt: ... |
1260 |
test_cipher_speed("cbc(des3_ede)", ENCRYPT, sec, |
da7f033dd crypto: cryptomgr... |
1261 |
des3_speed_template, DES3_SPEED_VECTORS, |
477035c2a [CRYPTO] tcrypt: ... |
1262 |
speed_template_24); |
cba83564d [CRYPTO] tcrypt: ... |
1263 |
test_cipher_speed("cbc(des3_ede)", DECRYPT, sec, |
da7f033dd crypto: cryptomgr... |
1264 |
des3_speed_template, DES3_SPEED_VECTORS, |
477035c2a [CRYPTO] tcrypt: ... |
1265 |
speed_template_24); |
ebfd9bcf1 [CRYPTO]: Add cip... |
1266 1267 1268 |
break; case 202: |
cba83564d [CRYPTO] tcrypt: ... |
1269 |
test_cipher_speed("ecb(twofish)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1270 |
speed_template_16_24_32); |
cba83564d [CRYPTO] tcrypt: ... |
1271 |
test_cipher_speed("ecb(twofish)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1272 |
speed_template_16_24_32); |
cba83564d [CRYPTO] tcrypt: ... |
1273 |
test_cipher_speed("cbc(twofish)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1274 |
speed_template_16_24_32); |
cba83564d [CRYPTO] tcrypt: ... |
1275 |
test_cipher_speed("cbc(twofish)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1276 |
speed_template_16_24_32); |
ee5002a54 crypto: tcrypt - ... |
1277 1278 1279 1280 |
test_cipher_speed("ctr(twofish)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_cipher_speed("ctr(twofish)", DECRYPT, sec, NULL, 0, speed_template_16_24_32); |
bee3a90ef crypto: tcrypt - ... |
1281 1282 1283 1284 |
test_cipher_speed("lrw(twofish)", ENCRYPT, sec, NULL, 0, speed_template_32_40_48); test_cipher_speed("lrw(twofish)", DECRYPT, sec, NULL, 0, speed_template_32_40_48); |
131f75416 crypto: tcrypt - ... |
1285 1286 1287 1288 |
test_cipher_speed("xts(twofish)", ENCRYPT, sec, NULL, 0, speed_template_32_48_64); test_cipher_speed("xts(twofish)", DECRYPT, sec, NULL, 0, speed_template_32_48_64); |
ebfd9bcf1 [CRYPTO]: Add cip... |
1289 1290 1291 |
break; case 203: |
cba83564d [CRYPTO] tcrypt: ... |
1292 |
test_cipher_speed("ecb(blowfish)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1293 |
speed_template_8_32); |
cba83564d [CRYPTO] tcrypt: ... |
1294 |
test_cipher_speed("ecb(blowfish)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1295 |
speed_template_8_32); |
cba83564d [CRYPTO] tcrypt: ... |
1296 |
test_cipher_speed("cbc(blowfish)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1297 |
speed_template_8_32); |
cba83564d [CRYPTO] tcrypt: ... |
1298 |
test_cipher_speed("cbc(blowfish)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1299 |
speed_template_8_32); |
7d47b86cf crypto: tcrypt - ... |
1300 1301 1302 1303 |
test_cipher_speed("ctr(blowfish)", ENCRYPT, sec, NULL, 0, speed_template_8_32); test_cipher_speed("ctr(blowfish)", DECRYPT, sec, NULL, 0, speed_template_8_32); |
ebfd9bcf1 [CRYPTO]: Add cip... |
1304 1305 1306 |
break; case 204: |
cba83564d [CRYPTO] tcrypt: ... |
1307 |
test_cipher_speed("ecb(des)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1308 |
speed_template_8); |
cba83564d [CRYPTO] tcrypt: ... |
1309 |
test_cipher_speed("ecb(des)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1310 |
speed_template_8); |
cba83564d [CRYPTO] tcrypt: ... |
1311 |
test_cipher_speed("cbc(des)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1312 |
speed_template_8); |
cba83564d [CRYPTO] tcrypt: ... |
1313 |
test_cipher_speed("cbc(des)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1314 |
speed_template_8); |
ebfd9bcf1 [CRYPTO]: Add cip... |
1315 |
break; |
02ab5a705 [CRYPTO] camellia... |
1316 1317 |
case 205: test_cipher_speed("ecb(camellia)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1318 |
speed_template_16_24_32); |
02ab5a705 [CRYPTO] camellia... |
1319 |
test_cipher_speed("ecb(camellia)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1320 |
speed_template_16_24_32); |
02ab5a705 [CRYPTO] camellia... |
1321 |
test_cipher_speed("cbc(camellia)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1322 |
speed_template_16_24_32); |
02ab5a705 [CRYPTO] camellia... |
1323 |
test_cipher_speed("cbc(camellia)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1324 |
speed_template_16_24_32); |
4de593378 crypto: tcrypt - ... |
1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 |
test_cipher_speed("ctr(camellia)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_cipher_speed("ctr(camellia)", DECRYPT, sec, NULL, 0, speed_template_16_24_32); test_cipher_speed("lrw(camellia)", ENCRYPT, sec, NULL, 0, speed_template_32_40_48); test_cipher_speed("lrw(camellia)", DECRYPT, sec, NULL, 0, speed_template_32_40_48); test_cipher_speed("xts(camellia)", ENCRYPT, sec, NULL, 0, speed_template_32_48_64); test_cipher_speed("xts(camellia)", DECRYPT, sec, NULL, 0, speed_template_32_48_64); |
02ab5a705 [CRYPTO] camellia... |
1337 |
break; |
5de8f1b56 [CRYPTO] tcrypt: ... |
1338 1339 |
case 206: test_cipher_speed("salsa20", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
1340 |
speed_template_16_32); |
5de8f1b56 [CRYPTO] tcrypt: ... |
1341 |
break; |
7fb7fe446 crypto: tcrypt - ... |
1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 |
case 207: test_cipher_speed("ecb(serpent)", ENCRYPT, sec, NULL, 0, speed_template_16_32); test_cipher_speed("ecb(serpent)", DECRYPT, sec, NULL, 0, speed_template_16_32); test_cipher_speed("cbc(serpent)", ENCRYPT, sec, NULL, 0, speed_template_16_32); test_cipher_speed("cbc(serpent)", DECRYPT, sec, NULL, 0, speed_template_16_32); test_cipher_speed("ctr(serpent)", ENCRYPT, sec, NULL, 0, speed_template_16_32); test_cipher_speed("ctr(serpent)", DECRYPT, sec, NULL, 0, speed_template_16_32); |
87aae4bfb crypto: tcrypt - ... |
1355 1356 1357 1358 |
test_cipher_speed("lrw(serpent)", ENCRYPT, sec, NULL, 0, speed_template_32_48); test_cipher_speed("lrw(serpent)", DECRYPT, sec, NULL, 0, speed_template_32_48); |
5209c07ac crypto: tcrypt - ... |
1359 1360 1361 1362 |
test_cipher_speed("xts(serpent)", ENCRYPT, sec, NULL, 0, speed_template_32_64); test_cipher_speed("xts(serpent)", DECRYPT, sec, NULL, 0, speed_template_32_64); |
7fb7fe446 crypto: tcrypt - ... |
1363 |
break; |
31b4cd290 crypto: testmgr -... |
1364 1365 1366 1367 |
case 208: test_cipher_speed("ecb(arc4)", ENCRYPT, sec, NULL, 0, speed_template_8); break; |
a2c582609 crypto: testmgr -... |
1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 |
case 209: test_cipher_speed("ecb(cast5)", ENCRYPT, sec, NULL, 0, speed_template_8_16); test_cipher_speed("ecb(cast5)", DECRYPT, sec, NULL, 0, speed_template_8_16); test_cipher_speed("cbc(cast5)", ENCRYPT, sec, NULL, 0, speed_template_8_16); test_cipher_speed("cbc(cast5)", DECRYPT, sec, NULL, 0, speed_template_8_16); test_cipher_speed("ctr(cast5)", ENCRYPT, sec, NULL, 0, speed_template_8_16); test_cipher_speed("ctr(cast5)", DECRYPT, sec, NULL, 0, speed_template_8_16); break; |
9b8b04051 crypto: testmgr -... |
1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 |
case 210: test_cipher_speed("ecb(cast6)", ENCRYPT, sec, NULL, 0, speed_template_16_32); test_cipher_speed("ecb(cast6)", DECRYPT, sec, NULL, 0, speed_template_16_32); test_cipher_speed("cbc(cast6)", ENCRYPT, sec, NULL, 0, speed_template_16_32); test_cipher_speed("cbc(cast6)", DECRYPT, sec, NULL, 0, speed_template_16_32); test_cipher_speed("ctr(cast6)", ENCRYPT, sec, NULL, 0, speed_template_16_32); test_cipher_speed("ctr(cast6)", DECRYPT, sec, NULL, 0, speed_template_16_32); test_cipher_speed("lrw(cast6)", ENCRYPT, sec, NULL, 0, speed_template_32_48); test_cipher_speed("lrw(cast6)", DECRYPT, sec, NULL, 0, speed_template_32_48); test_cipher_speed("xts(cast6)", ENCRYPT, sec, NULL, 0, speed_template_32_64); test_cipher_speed("xts(cast6)", DECRYPT, sec, NULL, 0, speed_template_32_64); break; |
e80579285 [CRYPTO] tcrypt: ... |
1404 1405 1406 1407 |
case 300: /* fall through */ case 301: |
e9d41164e [CRYPTO] tcrypt: ... |
1408 |
test_hash_speed("md4", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
1409 1410 1411 |
if (mode > 300 && mode < 400) break; case 302: |
e9d41164e [CRYPTO] tcrypt: ... |
1412 |
test_hash_speed("md5", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
1413 1414 1415 |
if (mode > 300 && mode < 400) break; case 303: |
e9d41164e [CRYPTO] tcrypt: ... |
1416 |
test_hash_speed("sha1", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
1417 1418 1419 |
if (mode > 300 && mode < 400) break; case 304: |
e9d41164e [CRYPTO] tcrypt: ... |
1420 |
test_hash_speed("sha256", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
1421 1422 1423 |
if (mode > 300 && mode < 400) break; case 305: |
e9d41164e [CRYPTO] tcrypt: ... |
1424 |
test_hash_speed("sha384", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
1425 1426 1427 |
if (mode > 300 && mode < 400) break; case 306: |
e9d41164e [CRYPTO] tcrypt: ... |
1428 |
test_hash_speed("sha512", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
1429 1430 1431 |
if (mode > 300 && mode < 400) break; case 307: |
e9d41164e [CRYPTO] tcrypt: ... |
1432 |
test_hash_speed("wp256", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
1433 1434 1435 |
if (mode > 300 && mode < 400) break; case 308: |
e9d41164e [CRYPTO] tcrypt: ... |
1436 |
test_hash_speed("wp384", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
1437 1438 1439 |
if (mode > 300 && mode < 400) break; case 309: |
e9d41164e [CRYPTO] tcrypt: ... |
1440 |
test_hash_speed("wp512", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
1441 1442 1443 |
if (mode > 300 && mode < 400) break; case 310: |
e9d41164e [CRYPTO] tcrypt: ... |
1444 |
test_hash_speed("tgr128", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
1445 1446 1447 |
if (mode > 300 && mode < 400) break; case 311: |
e9d41164e [CRYPTO] tcrypt: ... |
1448 |
test_hash_speed("tgr160", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
1449 1450 1451 |
if (mode > 300 && mode < 400) break; case 312: |
e9d41164e [CRYPTO] tcrypt: ... |
1452 |
test_hash_speed("tgr192", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
1453 |
if (mode > 300 && mode < 400) break; |
cd12fb906 [CRYPTO] sha256-g... |
1454 1455 1456 |
case 313: test_hash_speed("sha224", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
fd4adf1a0 [CRYPTO] tcrypt: ... |
1457 1458 1459 1460 1461 1462 1463 |
case 314: test_hash_speed("rmd128", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; case 315: test_hash_speed("rmd160", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
2998db37b [CRYPTO] tcrypt: ... |
1464 1465 1466 1467 1468 1469 1470 |
case 316: test_hash_speed("rmd256", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; case 317: test_hash_speed("rmd320", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
18bcc9194 crypto: tcrypt - ... |
1471 1472 1473 |
case 318: test_hash_speed("ghash-generic", sec, hash_speed_template_16); if (mode > 300 && mode < 400) break; |
e3899e4df crypto: tcrypt - ... |
1474 1475 1476 |
case 319: test_hash_speed("crc32c", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
e80579285 [CRYPTO] tcrypt: ... |
1477 1478 |
case 399: break; |
beb63da73 crypto: tcrypt - ... |
1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 |
case 400: /* fall through */ case 401: test_ahash_speed("md4", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 402: test_ahash_speed("md5", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 403: test_ahash_speed("sha1", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 404: test_ahash_speed("sha256", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 405: test_ahash_speed("sha384", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 406: test_ahash_speed("sha512", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 407: test_ahash_speed("wp256", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 408: test_ahash_speed("wp384", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 409: test_ahash_speed("wp512", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 410: test_ahash_speed("tgr128", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 411: test_ahash_speed("tgr160", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 412: test_ahash_speed("tgr192", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 413: test_ahash_speed("sha224", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 414: test_ahash_speed("rmd128", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 415: test_ahash_speed("rmd160", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 416: test_ahash_speed("rmd256", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 417: test_ahash_speed("rmd320", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; case 499: break; |
3f3baf359 crypto: tcrypt - ... |
1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 |
case 500: test_acipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("ecb(aes)", DECRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("cbc(aes)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("cbc(aes)", DECRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("lrw(aes)", ENCRYPT, sec, NULL, 0, speed_template_32_40_48); test_acipher_speed("lrw(aes)", DECRYPT, sec, NULL, 0, speed_template_32_40_48); test_acipher_speed("xts(aes)", ENCRYPT, sec, NULL, 0, speed_template_32_48_64); test_acipher_speed("xts(aes)", DECRYPT, sec, NULL, 0, speed_template_32_48_64); test_acipher_speed("ctr(aes)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("ctr(aes)", DECRYPT, sec, NULL, 0, speed_template_16_24_32); |
de1975334 crypto: atmel - a... |
1573 1574 1575 1576 1577 1578 1579 1580 |
test_acipher_speed("cfb(aes)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("cfb(aes)", DECRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("ofb(aes)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("ofb(aes)", DECRYPT, sec, NULL, 0, speed_template_16_24_32); |
69d3150cf crypto: ctr - mak... |
1581 1582 1583 1584 |
test_acipher_speed("rfc3686(ctr(aes))", ENCRYPT, sec, NULL, 0, speed_template_20_28_36); test_acipher_speed("rfc3686(ctr(aes))", DECRYPT, sec, NULL, 0, speed_template_20_28_36); |
3f3baf359 crypto: tcrypt - ... |
1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 |
break; case 501: test_acipher_speed("ecb(des3_ede)", ENCRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24); test_acipher_speed("ecb(des3_ede)", DECRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24); test_acipher_speed("cbc(des3_ede)", ENCRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24); test_acipher_speed("cbc(des3_ede)", DECRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24); |
de1975334 crypto: atmel - a... |
1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 |
test_acipher_speed("cfb(des3_ede)", ENCRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24); test_acipher_speed("cfb(des3_ede)", DECRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24); test_acipher_speed("ofb(des3_ede)", ENCRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24); test_acipher_speed("ofb(des3_ede)", DECRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24); |
3f3baf359 crypto: tcrypt - ... |
1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 |
break; case 502: test_acipher_speed("ecb(des)", ENCRYPT, sec, NULL, 0, speed_template_8); test_acipher_speed("ecb(des)", DECRYPT, sec, NULL, 0, speed_template_8); test_acipher_speed("cbc(des)", ENCRYPT, sec, NULL, 0, speed_template_8); test_acipher_speed("cbc(des)", DECRYPT, sec, NULL, 0, speed_template_8); |
de1975334 crypto: atmel - a... |
1623 1624 1625 1626 1627 1628 1629 1630 |
test_acipher_speed("cfb(des)", ENCRYPT, sec, NULL, 0, speed_template_8); test_acipher_speed("cfb(des)", DECRYPT, sec, NULL, 0, speed_template_8); test_acipher_speed("ofb(des)", ENCRYPT, sec, NULL, 0, speed_template_8); test_acipher_speed("ofb(des)", DECRYPT, sec, NULL, 0, speed_template_8); |
3f3baf359 crypto: tcrypt - ... |
1631 |
break; |
7fb7fe446 crypto: tcrypt - ... |
1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 |
case 503: test_acipher_speed("ecb(serpent)", ENCRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("ecb(serpent)", DECRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("cbc(serpent)", ENCRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("cbc(serpent)", DECRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("ctr(serpent)", ENCRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("ctr(serpent)", DECRYPT, sec, NULL, 0, speed_template_16_32); |
87aae4bfb crypto: tcrypt - ... |
1645 1646 1647 1648 |
test_acipher_speed("lrw(serpent)", ENCRYPT, sec, NULL, 0, speed_template_32_48); test_acipher_speed("lrw(serpent)", DECRYPT, sec, NULL, 0, speed_template_32_48); |
5209c07ac crypto: tcrypt - ... |
1649 1650 1651 1652 |
test_acipher_speed("xts(serpent)", ENCRYPT, sec, NULL, 0, speed_template_32_64); test_acipher_speed("xts(serpent)", DECRYPT, sec, NULL, 0, speed_template_32_64); |
7fb7fe446 crypto: tcrypt - ... |
1653 |
break; |
107778b59 crypto: twofish -... |
1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 |
case 504: test_acipher_speed("ecb(twofish)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("ecb(twofish)", DECRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("cbc(twofish)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("cbc(twofish)", DECRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("ctr(twofish)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("ctr(twofish)", DECRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("lrw(twofish)", ENCRYPT, sec, NULL, 0, speed_template_32_40_48); test_acipher_speed("lrw(twofish)", DECRYPT, sec, NULL, 0, speed_template_32_40_48); test_acipher_speed("xts(twofish)", ENCRYPT, sec, NULL, 0, speed_template_32_48_64); test_acipher_speed("xts(twofish)", DECRYPT, sec, NULL, 0, speed_template_32_48_64); break; |
31b4cd290 crypto: testmgr -... |
1676 1677 1678 1679 |
case 505: test_acipher_speed("ecb(arc4)", ENCRYPT, sec, NULL, 0, speed_template_8); break; |
a2c582609 crypto: testmgr -... |
1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 |
case 506: test_acipher_speed("ecb(cast5)", ENCRYPT, sec, NULL, 0, speed_template_8_16); test_acipher_speed("ecb(cast5)", DECRYPT, sec, NULL, 0, speed_template_8_16); test_acipher_speed("cbc(cast5)", ENCRYPT, sec, NULL, 0, speed_template_8_16); test_acipher_speed("cbc(cast5)", DECRYPT, sec, NULL, 0, speed_template_8_16); test_acipher_speed("ctr(cast5)", ENCRYPT, sec, NULL, 0, speed_template_8_16); test_acipher_speed("ctr(cast5)", DECRYPT, sec, NULL, 0, speed_template_8_16); break; |
9b8b04051 crypto: testmgr -... |
1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 |
case 507: test_acipher_speed("ecb(cast6)", ENCRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("ecb(cast6)", DECRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("cbc(cast6)", ENCRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("cbc(cast6)", DECRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("ctr(cast6)", ENCRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("ctr(cast6)", DECRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("lrw(cast6)", ENCRYPT, sec, NULL, 0, speed_template_32_48); test_acipher_speed("lrw(cast6)", DECRYPT, sec, NULL, 0, speed_template_32_48); test_acipher_speed("xts(cast6)", ENCRYPT, sec, NULL, 0, speed_template_32_64); test_acipher_speed("xts(cast6)", DECRYPT, sec, NULL, 0, speed_template_32_64); break; |
bf9c51818 crypto: tcrypt - ... |
1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 |
case 508: test_acipher_speed("ecb(camellia)", ENCRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("ecb(camellia)", DECRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("cbc(camellia)", ENCRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("cbc(camellia)", DECRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("ctr(camellia)", ENCRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("ctr(camellia)", DECRYPT, sec, NULL, 0, speed_template_16_32); test_acipher_speed("lrw(camellia)", ENCRYPT, sec, NULL, 0, speed_template_32_48); test_acipher_speed("lrw(camellia)", DECRYPT, sec, NULL, 0, speed_template_32_48); test_acipher_speed("xts(camellia)", ENCRYPT, sec, NULL, 0, speed_template_32_64); test_acipher_speed("xts(camellia)", DECRYPT, sec, NULL, 0, speed_template_32_64); break; |
ad8b7c3e9 crypto: tcrypt - ... |
1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 |
case 509: test_acipher_speed("ecb(blowfish)", ENCRYPT, sec, NULL, 0, speed_template_8_32); test_acipher_speed("ecb(blowfish)", DECRYPT, sec, NULL, 0, speed_template_8_32); test_acipher_speed("cbc(blowfish)", ENCRYPT, sec, NULL, 0, speed_template_8_32); test_acipher_speed("cbc(blowfish)", DECRYPT, sec, NULL, 0, speed_template_8_32); test_acipher_speed("ctr(blowfish)", ENCRYPT, sec, NULL, 0, speed_template_8_32); test_acipher_speed("ctr(blowfish)", DECRYPT, sec, NULL, 0, speed_template_8_32); break; |
1da177e4c Linux-2.6.12-rc2 |
1752 1753 1754 |
case 1000: test_available(); break; |
1da177e4c Linux-2.6.12-rc2 |
1755 |
} |
4e033a6bc crypto: tcrypt - ... |
1756 1757 |
return ret; |
1da177e4c Linux-2.6.12-rc2 |
1758 |
} |
7be380f72 crypto: tcrypt - ... |
1759 |
static int do_alg_test(const char *alg, u32 type, u32 mask) |
a873a5f1c crypto: tcrypt - ... |
1760 |
{ |
7be380f72 crypto: tcrypt - ... |
1761 1762 |
return crypto_has_alg(alg, type, mask ?: CRYPTO_ALG_TYPE_MASK) ? 0 : -ENOENT; |
a873a5f1c crypto: tcrypt - ... |
1763 |
} |
3af5b90bd [CRYPTO] all: Cle... |
1764 |
static int __init tcrypt_mod_init(void) |
1da177e4c Linux-2.6.12-rc2 |
1765 |
{ |
e3a4ea4fd [CRYPTO] tcrypt: ... |
1766 |
int err = -ENOMEM; |
f139cfa7c crypto: tcrypt - ... |
1767 |
int i; |
e3a4ea4fd [CRYPTO] tcrypt: ... |
1768 |
|
f139cfa7c crypto: tcrypt - ... |
1769 1770 1771 1772 1773 |
for (i = 0; i < TVMEMSIZE; i++) { tvmem[i] = (void *)__get_free_page(GFP_KERNEL); if (!tvmem[i]) goto err_free_tv; } |
1da177e4c Linux-2.6.12-rc2 |
1774 |
|
a873a5f1c crypto: tcrypt - ... |
1775 |
if (alg) |
7be380f72 crypto: tcrypt - ... |
1776 |
err = do_alg_test(alg, type, mask); |
a873a5f1c crypto: tcrypt - ... |
1777 1778 |
else err = do_test(mode); |
4e033a6bc crypto: tcrypt - ... |
1779 1780 1781 1782 1783 |
if (err) { printk(KERN_ERR "tcrypt: one or more tests failed! "); goto err_free_tv; } |
14fdf477a [CRYPTO] tcrypt: ... |
1784 |
|
4e033a6bc crypto: tcrypt - ... |
1785 1786 1787 1788 |
/* We intentionaly return -EAGAIN to prevent keeping the module, * unless we're running in fips mode. It does all its work from * init() and doesn't offer any runtime functionality, but in * the fips case, checking for a successful load is helpful. |
14fdf477a [CRYPTO] tcrypt: ... |
1789 1790 1791 |
* => we don't need it in the memory, do we? * -- mludvig */ |
4e033a6bc crypto: tcrypt - ... |
1792 1793 |
if (!fips_enabled) err = -EAGAIN; |
e3a4ea4fd [CRYPTO] tcrypt: ... |
1794 |
|
f139cfa7c crypto: tcrypt - ... |
1795 1796 1797 |
err_free_tv: for (i = 0; i < TVMEMSIZE && tvmem[i]; i++) free_page((unsigned long)tvmem[i]); |
e3a4ea4fd [CRYPTO] tcrypt: ... |
1798 1799 |
return err; |
1da177e4c Linux-2.6.12-rc2 |
1800 1801 1802 1803 1804 1805 |
} /* * If an init function is provided, an exit function must also be provided * to allow module unload. */ |
3af5b90bd [CRYPTO] all: Cle... |
1806 |
static void __exit tcrypt_mod_fini(void) { } |
1da177e4c Linux-2.6.12-rc2 |
1807 |
|
3af5b90bd [CRYPTO] all: Cle... |
1808 1809 |
module_init(tcrypt_mod_init); module_exit(tcrypt_mod_fini); |
1da177e4c Linux-2.6.12-rc2 |
1810 |
|
a873a5f1c crypto: tcrypt - ... |
1811 1812 |
module_param(alg, charp, 0); module_param(type, uint, 0); |
7be380f72 crypto: tcrypt - ... |
1813 |
module_param(mask, uint, 0); |
1da177e4c Linux-2.6.12-rc2 |
1814 |
module_param(mode, int, 0); |
ebfd9bcf1 [CRYPTO]: Add cip... |
1815 |
module_param(sec, uint, 0); |
6a17944ca [CRYPTO]: Use CPU... |
1816 1817 |
MODULE_PARM_DESC(sec, "Length in seconds of speed tests " "(defaults to zero which uses CPU cycles instead)"); |
1da177e4c Linux-2.6.12-rc2 |
1818 1819 1820 1821 |
MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Quick & dirty crypto testing module"); MODULE_AUTHOR("James Morris <jmorris@intercode.com.au>"); |