Blame view
crypto/tcrypt.c
76.6 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 |
*/ |
76512f2d8 crypto: tcrypt - ... |
24 |
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
1ce5a04d9 crypto: tcrypt - ... |
25 |
#include <crypto/aead.h> |
18e33e6d5 crypto: hash - Mo... |
26 |
#include <crypto/hash.h> |
7166e589d crypto: tcrypt - ... |
27 |
#include <crypto/skcipher.h> |
cba83564d [CRYPTO] tcrypt: ... |
28 |
#include <linux/err.h> |
daf0944cf crypto: tcrypt - ... |
29 |
#include <linux/fips.h> |
1da177e4c Linux-2.6.12-rc2 |
30 |
#include <linux/init.h> |
5a0e3ad6a include cleanup: ... |
31 |
#include <linux/gfp.h> |
1da177e4c Linux-2.6.12-rc2 |
32 |
#include <linux/module.h> |
378f058cc [PATCH] Use sg_se... |
33 |
#include <linux/scatterlist.h> |
1da177e4c Linux-2.6.12-rc2 |
34 |
#include <linux/string.h> |
1da177e4c Linux-2.6.12-rc2 |
35 |
#include <linux/moduleparam.h> |
ebfd9bcf1 [CRYPTO]: Add cip... |
36 |
#include <linux/jiffies.h> |
6a17944ca [CRYPTO]: Use CPU... |
37 38 |
#include <linux/timex.h> #include <linux/interrupt.h> |
1da177e4c Linux-2.6.12-rc2 |
39 40 41 |
#include "tcrypt.h" /* |
f139cfa7c crypto: tcrypt - ... |
42 |
* Need slab memory for testing (size in number of pages). |
1da177e4c Linux-2.6.12-rc2 |
43 |
*/ |
f139cfa7c crypto: tcrypt - ... |
44 |
#define TVMEMSIZE 4 |
1da177e4c Linux-2.6.12-rc2 |
45 46 |
/* |
da7f033dd crypto: cryptomgr... |
47 |
* Used by test_cipher_speed() |
1da177e4c Linux-2.6.12-rc2 |
48 49 50 |
*/ #define ENCRYPT 1 #define DECRYPT 0 |
1da177e4c Linux-2.6.12-rc2 |
51 |
|
f074f7b10 crypto: tcrypt - ... |
52 |
#define MAX_DIGEST_SIZE 64 |
ebfd9bcf1 [CRYPTO]: Add cip... |
53 |
/* |
263a8df0d crypto: tcrypt - ... |
54 55 56 57 58 |
* return a string with the driver name */ #define get_driver_name(tfm_type, tfm) crypto_tfm_alg_driver_name(tfm_type ## _tfm(tfm)) /* |
ebfd9bcf1 [CRYPTO]: Add cip... |
59 60 |
* Used by test_cipher_speed() */ |
6a17944ca [CRYPTO]: Use CPU... |
61 |
static unsigned int sec; |
ebfd9bcf1 [CRYPTO]: Add cip... |
62 |
|
a873a5f1c crypto: tcrypt - ... |
63 64 |
static char *alg = NULL; static u32 type; |
7be380f72 crypto: tcrypt - ... |
65 |
static u32 mask; |
1da177e4c Linux-2.6.12-rc2 |
66 |
static int mode; |
8fcdc8685 crypto: tcrypt - ... |
67 |
static u32 num_mb = 8; |
f139cfa7c crypto: tcrypt - ... |
68 |
static char *tvmem[TVMEMSIZE]; |
1da177e4c Linux-2.6.12-rc2 |
69 70 |
static char *check[] = { |
b7e275304 crypto: sm3 - add... |
71 |
"des", "md5", "des3_ede", "rot13", "sha1", "sha224", "sha256", "sm3", |
cd12fb906 [CRYPTO] sha256-g... |
72 73 |
"blowfish", "twofish", "serpent", "sha384", "sha512", "md4", "aes", "cast6", "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea", |
90831639a [CRYPTO] fcrypt: ... |
74 |
"khazad", "wp512", "wp384", "wp256", "tnepres", "xeta", "fcrypt", |
2998db37b [CRYPTO] tcrypt: ... |
75 |
"camellia", "seed", "salsa20", "rmd128", "rmd160", "rmd256", "rmd320", |
b4cc28a99 MLK-19365: crypto... |
76 |
"lzo", "cts", "sha3-224", "sha3-256", "sha3-384", "sha3-512", NULL |
1da177e4c Linux-2.6.12-rc2 |
77 |
}; |
427988d98 crypto: tcrypt - ... |
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
static u32 block_sizes[] = { 16, 64, 256, 1024, 8192, 0 }; static u32 aead_sizes[] = { 16, 64, 256, 512, 1024, 2048, 4096, 8192, 0 }; #define XBUFSIZE 8 #define MAX_IVLEN 32 static int testmgr_alloc_buf(char *buf[XBUFSIZE]) { int i; for (i = 0; i < XBUFSIZE; i++) { buf[i] = (void *)__get_free_page(GFP_KERNEL); if (!buf[i]) goto err_free_buf; } return 0; err_free_buf: while (i-- > 0) free_page((unsigned long)buf[i]); return -ENOMEM; } static void testmgr_free_buf(char *buf[XBUFSIZE]) { int i; for (i = 0; i < XBUFSIZE; i++) free_page((unsigned long)buf[i]); } static void sg_init_aead(struct scatterlist *sg, char *xbuf[XBUFSIZE], unsigned int buflen, const void *assoc, unsigned int aad_size) { int np = (buflen + PAGE_SIZE - 1)/PAGE_SIZE; int k, rem; if (np > XBUFSIZE) { rem = PAGE_SIZE; np = XBUFSIZE; } else { rem = buflen % PAGE_SIZE; } sg_init_table(sg, np + 1); sg_set_buf(&sg[0], assoc, aad_size); if (rem) np--; for (k = 0; k < np; k++) sg_set_buf(&sg[k + 1], xbuf[k], PAGE_SIZE); if (rem) sg_set_buf(&sg[k + 1], xbuf[k], rem); } |
1425d2d17 crypto: tcrypt - ... |
137 138 |
static inline int do_one_aead_op(struct aead_request *req, int ret) { |
646710419 crypto: tcrypt - ... |
139 |
struct crypto_wait *wait = req->base.data; |
1425d2d17 crypto: tcrypt - ... |
140 |
|
646710419 crypto: tcrypt - ... |
141 |
return crypto_wait_req(ret, wait); |
1425d2d17 crypto: tcrypt - ... |
142 |
} |
427988d98 crypto: tcrypt - ... |
143 144 145 146 147 148 149 150 151 152 153 |
struct test_mb_aead_data { struct scatterlist sg[XBUFSIZE]; struct scatterlist sgout[XBUFSIZE]; struct aead_request *req; struct crypto_wait wait; char *xbuf[XBUFSIZE]; char *xoutbuf[XBUFSIZE]; char *axbuf[XBUFSIZE]; }; static int do_mult_aead_op(struct test_mb_aead_data *data, int enc, |
4e234eed5 crypto: tcrypt - ... |
154 |
u32 num_mb, int *rc) |
427988d98 crypto: tcrypt - ... |
155 |
{ |
4e234eed5 crypto: tcrypt - ... |
156 |
int i, err = 0; |
427988d98 crypto: tcrypt - ... |
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
/* Fire up a bunch of concurrent requests */ for (i = 0; i < num_mb; i++) { if (enc == ENCRYPT) rc[i] = crypto_aead_encrypt(data[i].req); else rc[i] = crypto_aead_decrypt(data[i].req); } /* Wait for all requests to finish */ for (i = 0; i < num_mb; i++) { rc[i] = crypto_wait_req(rc[i], &data[i].wait); if (rc[i]) { pr_info("concurrent request %d error %d ", i, rc[i]); err = rc[i]; } } return err; } static int test_mb_aead_jiffies(struct test_mb_aead_data *data, int enc, int blen, int secs, u32 num_mb) |
53f52d7ae crypto: tcrypt - ... |
182 183 184 |
{ unsigned long start, end; int bcount; |
4e234eed5 crypto: tcrypt - ... |
185 186 187 188 189 190 |
int ret = 0; int *rc; rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL); if (!rc) return -ENOMEM; |
53f52d7ae crypto: tcrypt - ... |
191 |
|
3e3dc25fe crypto: Resolve s... |
192 |
for (start = jiffies, end = start + secs * HZ, bcount = 0; |
53f52d7ae crypto: tcrypt - ... |
193 |
time_before(jiffies, end); bcount++) { |
4e234eed5 crypto: tcrypt - ... |
194 |
ret = do_mult_aead_op(data, enc, num_mb, rc); |
53f52d7ae crypto: tcrypt - ... |
195 |
if (ret) |
4e234eed5 crypto: tcrypt - ... |
196 |
goto out; |
53f52d7ae crypto: tcrypt - ... |
197 |
} |
427988d98 crypto: tcrypt - ... |
198 199 200 |
pr_cont("%d operations in %d seconds (%ld bytes) ", bcount * num_mb, secs, (long)bcount * blen * num_mb); |
4e234eed5 crypto: tcrypt - ... |
201 202 203 204 |
out: kfree(rc); return ret; |
53f52d7ae crypto: tcrypt - ... |
205 |
} |
427988d98 crypto: tcrypt - ... |
206 207 |
static int test_mb_aead_cycles(struct test_mb_aead_data *data, int enc, int blen, u32 num_mb) |
53f52d7ae crypto: tcrypt - ... |
208 209 210 211 |
{ unsigned long cycles = 0; int ret = 0; int i; |
4e234eed5 crypto: tcrypt - ... |
212 213 214 215 216 |
int *rc; rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL); if (!rc) return -ENOMEM; |
53f52d7ae crypto: tcrypt - ... |
217 |
|
53f52d7ae crypto: tcrypt - ... |
218 219 |
/* Warm-up run. */ for (i = 0; i < 4; i++) { |
4e234eed5 crypto: tcrypt - ... |
220 |
ret = do_mult_aead_op(data, enc, num_mb, rc); |
53f52d7ae crypto: tcrypt - ... |
221 222 223 224 225 226 227 228 229 |
if (ret) goto out; } /* The real thing. */ for (i = 0; i < 8; i++) { cycles_t start, end; start = get_cycles(); |
4e234eed5 crypto: tcrypt - ... |
230 |
ret = do_mult_aead_op(data, enc, num_mb, rc); |
53f52d7ae crypto: tcrypt - ... |
231 232 233 234 235 236 237 |
end = get_cycles(); if (ret) goto out; cycles += end - start; } |
4e234eed5 crypto: tcrypt - ... |
238 239 240 |
pr_cont("1 operation in %lu cycles (%d bytes) ", (cycles + 4) / (8 * num_mb), blen); |
53f52d7ae crypto: tcrypt - ... |
241 |
|
4e234eed5 crypto: tcrypt - ... |
242 243 |
out: kfree(rc); |
53f52d7ae crypto: tcrypt - ... |
244 245 |
return ret; } |
427988d98 crypto: tcrypt - ... |
246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
static void test_mb_aead_speed(const char *algo, int enc, int secs, struct aead_speed_template *template, unsigned int tcount, u8 authsize, unsigned int aad_size, u8 *keysize, u32 num_mb) { struct test_mb_aead_data *data; struct crypto_aead *tfm; unsigned int i, j, iv_len; const char *key; const char *e; void *assoc; u32 *b_size; char *iv; int ret; |
53f52d7ae crypto: tcrypt - ... |
260 |
|
53f52d7ae crypto: tcrypt - ... |
261 |
|
427988d98 crypto: tcrypt - ... |
262 263 264 265 266 |
if (aad_size >= PAGE_SIZE) { pr_err("associate data length (%u) too big ", aad_size); return; } |
53f52d7ae crypto: tcrypt - ... |
267 |
|
427988d98 crypto: tcrypt - ... |
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
iv = kzalloc(MAX_IVLEN, GFP_KERNEL); if (!iv) return; if (enc == ENCRYPT) e = "encryption"; else e = "decryption"; data = kcalloc(num_mb, sizeof(*data), GFP_KERNEL); if (!data) goto out_free_iv; tfm = crypto_alloc_aead(algo, 0, 0); if (IS_ERR(tfm)) { pr_err("failed to load transform for %s: %ld ", algo, PTR_ERR(tfm)); goto out_free_data; |
53f52d7ae crypto: tcrypt - ... |
287 |
} |
427988d98 crypto: tcrypt - ... |
288 |
ret = crypto_aead_setauthsize(tfm, authsize); |
53f52d7ae crypto: tcrypt - ... |
289 |
|
427988d98 crypto: tcrypt - ... |
290 291 292 293 294 295 |
for (i = 0; i < num_mb; ++i) if (testmgr_alloc_buf(data[i].xbuf)) { while (i--) testmgr_free_buf(data[i].xbuf); goto out_free_tfm; } |
53f52d7ae crypto: tcrypt - ... |
296 |
|
427988d98 crypto: tcrypt - ... |
297 298 299 300 301 302 303 304 305 306 |
for (i = 0; i < num_mb; ++i) if (testmgr_alloc_buf(data[i].axbuf)) { while (i--) testmgr_free_buf(data[i].axbuf); goto out_free_xbuf; } for (i = 0; i < num_mb; ++i) if (testmgr_alloc_buf(data[i].xoutbuf)) { while (i--) |
c6ba4f3e6 crypto: tcrypt - ... |
307 |
testmgr_free_buf(data[i].xoutbuf); |
427988d98 crypto: tcrypt - ... |
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
goto out_free_axbuf; } for (i = 0; i < num_mb; ++i) { data[i].req = aead_request_alloc(tfm, GFP_KERNEL); if (!data[i].req) { pr_err("alg: skcipher: Failed to allocate request for %s ", algo); while (i--) aead_request_free(data[i].req); goto out_free_xoutbuf; } } for (i = 0; i < num_mb; ++i) { crypto_init_wait(&data[i].wait); aead_request_set_callback(data[i].req, CRYPTO_TFM_REQ_MAY_BACKLOG, crypto_req_done, &data[i].wait); } pr_info(" testing speed of multibuffer %s (%s) %s ", algo, get_driver_name(crypto_aead, tfm), e); i = 0; do { b_size = aead_sizes; do { if (*b_size + authsize > XBUFSIZE * PAGE_SIZE) { |
38dbe2d19 crypto: tcrypt - ... |
340 341 |
pr_err("template (%u) too big for buffer (%lu) ", |
427988d98 crypto: tcrypt - ... |
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
authsize + *b_size, XBUFSIZE * PAGE_SIZE); goto out; } pr_info("test %u (%d bit key, %d byte blocks): ", i, *keysize * 8, *b_size); /* Set up tfm global state, i.e. the key */ memset(tvmem[0], 0xff, PAGE_SIZE); key = tvmem[0]; for (j = 0; j < tcount; j++) { if (template[j].klen == *keysize) { key = template[j].key; break; } } crypto_aead_clear_flags(tfm, ~0); ret = crypto_aead_setkey(tfm, key, *keysize); if (ret) { pr_err("setkey() failed flags=%x ", crypto_aead_get_flags(tfm)); goto out; } iv_len = crypto_aead_ivsize(tfm); if (iv_len) memset(iv, 0xff, iv_len); /* Now setup per request stuff, i.e. buffers */ for (j = 0; j < num_mb; ++j) { struct test_mb_aead_data *cur = &data[j]; assoc = cur->axbuf[0]; memset(assoc, 0xff, aad_size); sg_init_aead(cur->sg, cur->xbuf, *b_size + (enc ? 0 : authsize), assoc, aad_size); sg_init_aead(cur->sgout, cur->xoutbuf, *b_size + (enc ? authsize : 0), assoc, aad_size); aead_request_set_ad(cur->req, aad_size); if (!enc) { aead_request_set_crypt(cur->req, cur->sgout, cur->sg, *b_size, iv); ret = crypto_aead_encrypt(cur->req); ret = do_one_aead_op(cur->req, ret); if (ret) { pr_err("calculating auth failed failed (%d) ", ret); break; } } aead_request_set_crypt(cur->req, cur->sg, cur->sgout, *b_size + (enc ? 0 : authsize), iv); } |
2af632996 crypto: tcrypt - ... |
416 |
if (secs) { |
427988d98 crypto: tcrypt - ... |
417 418 |
ret = test_mb_aead_jiffies(data, enc, *b_size, secs, num_mb); |
2af632996 crypto: tcrypt - ... |
419 420 |
cond_resched(); } else { |
427988d98 crypto: tcrypt - ... |
421 422 |
ret = test_mb_aead_cycles(data, enc, *b_size, num_mb); |
2af632996 crypto: tcrypt - ... |
423 |
} |
427988d98 crypto: tcrypt - ... |
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 |
if (ret) { pr_err("%s() failed return code=%d ", e, ret); break; } b_size++; i++; } while (*b_size); keysize++; } while (*keysize); out: for (i = 0; i < num_mb; ++i) aead_request_free(data[i].req); out_free_xoutbuf: for (i = 0; i < num_mb; ++i) testmgr_free_buf(data[i].xoutbuf); out_free_axbuf: for (i = 0; i < num_mb; ++i) testmgr_free_buf(data[i].axbuf); out_free_xbuf: for (i = 0; i < num_mb; ++i) testmgr_free_buf(data[i].xbuf); out_free_tfm: crypto_free_aead(tfm); out_free_data: kfree(data); out_free_iv: kfree(iv); |
53f52d7ae crypto: tcrypt - ... |
454 |
} |
427988d98 crypto: tcrypt - ... |
455 456 |
static int test_aead_jiffies(struct aead_request *req, int enc, int blen, int secs) |
53f52d7ae crypto: tcrypt - ... |
457 |
{ |
427988d98 crypto: tcrypt - ... |
458 459 460 |
unsigned long start, end; int bcount; int ret; |
53f52d7ae crypto: tcrypt - ... |
461 |
|
427988d98 crypto: tcrypt - ... |
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 |
for (start = jiffies, end = start + secs * HZ, bcount = 0; time_before(jiffies, end); bcount++) { if (enc) ret = do_one_aead_op(req, crypto_aead_encrypt(req)); else ret = do_one_aead_op(req, crypto_aead_decrypt(req)); if (ret) return ret; } printk("%d operations in %d seconds (%ld bytes) ", bcount, secs, (long)bcount * blen); return 0; |
53f52d7ae crypto: tcrypt - ... |
477 |
} |
427988d98 crypto: tcrypt - ... |
478 |
static int test_aead_cycles(struct aead_request *req, int enc, int blen) |
53f52d7ae crypto: tcrypt - ... |
479 |
{ |
427988d98 crypto: tcrypt - ... |
480 481 482 |
unsigned long cycles = 0; int ret = 0; int i; |
53f52d7ae crypto: tcrypt - ... |
483 |
|
427988d98 crypto: tcrypt - ... |
484 485 486 487 488 489 490 491 492 |
/* Warm-up run. */ for (i = 0; i < 4; i++) { if (enc) ret = do_one_aead_op(req, crypto_aead_encrypt(req)); else ret = do_one_aead_op(req, crypto_aead_decrypt(req)); if (ret) goto out; |
53f52d7ae crypto: tcrypt - ... |
493 |
} |
c47689931 crypto: tcrypt - ... |
494 |
|
427988d98 crypto: tcrypt - ... |
495 496 497 |
/* The real thing. */ for (i = 0; i < 8; i++) { cycles_t start, end; |
5601e014f crypto: tcrypt - ... |
498 |
|
427988d98 crypto: tcrypt - ... |
499 500 501 502 503 504 |
start = get_cycles(); if (enc) ret = do_one_aead_op(req, crypto_aead_encrypt(req)); else ret = do_one_aead_op(req, crypto_aead_decrypt(req)); end = get_cycles(); |
5601e014f crypto: tcrypt - ... |
505 |
|
427988d98 crypto: tcrypt - ... |
506 507 |
if (ret) goto out; |
c47689931 crypto: tcrypt - ... |
508 |
|
427988d98 crypto: tcrypt - ... |
509 510 511 512 513 514 515 516 517 518 |
cycles += end - start; } out: if (ret == 0) printk("1 operation in %lu cycles (%d bytes) ", (cycles + 4) / 8, blen); return ret; |
53f52d7ae crypto: tcrypt - ... |
519 |
} |
3e3dc25fe crypto: Resolve s... |
520 |
static void test_aead_speed(const char *algo, int enc, unsigned int secs, |
53f52d7ae crypto: tcrypt - ... |
521 522 523 524 525 526 527 528 529 530 |
struct aead_speed_template *template, unsigned int tcount, u8 authsize, unsigned int aad_size, u8 *keysize) { unsigned int i, j; struct crypto_aead *tfm; int ret = -ENOMEM; const char *key; struct aead_request *req; struct scatterlist *sg; |
53f52d7ae crypto: tcrypt - ... |
531 532 533 |
struct scatterlist *sgout; const char *e; void *assoc; |
96692a730 crypto: tcrypt - ... |
534 |
char *iv; |
53f52d7ae crypto: tcrypt - ... |
535 536 537 538 539 |
char *xbuf[XBUFSIZE]; char *xoutbuf[XBUFSIZE]; char *axbuf[XBUFSIZE]; unsigned int *b_size; unsigned int iv_len; |
646710419 crypto: tcrypt - ... |
540 |
struct crypto_wait wait; |
53f52d7ae crypto: tcrypt - ... |
541 |
|
96692a730 crypto: tcrypt - ... |
542 543 544 |
iv = kzalloc(MAX_IVLEN, GFP_KERNEL); if (!iv) return; |
ac5f863f8 crypto: tcrypt - ... |
545 546 547 |
if (aad_size >= PAGE_SIZE) { pr_err("associate data length (%u) too big ", aad_size); |
96692a730 crypto: tcrypt - ... |
548 |
goto out_noxbuf; |
ac5f863f8 crypto: tcrypt - ... |
549 |
} |
53f52d7ae crypto: tcrypt - ... |
550 551 552 553 554 555 556 557 558 559 560 |
if (enc == ENCRYPT) e = "encryption"; else e = "decryption"; if (testmgr_alloc_buf(xbuf)) goto out_noxbuf; if (testmgr_alloc_buf(axbuf)) goto out_noaxbuf; if (testmgr_alloc_buf(xoutbuf)) goto out_nooutbuf; |
a3f2185a2 crypto: tcrypt - ... |
561 |
sg = kmalloc(sizeof(*sg) * 9 * 2, GFP_KERNEL); |
53f52d7ae crypto: tcrypt - ... |
562 563 |
if (!sg) goto out_nosg; |
a3f2185a2 crypto: tcrypt - ... |
564 |
sgout = &sg[9]; |
53f52d7ae crypto: tcrypt - ... |
565 |
|
5e4b8c1fc crypto: aead - Re... |
566 |
tfm = crypto_alloc_aead(algo, 0, 0); |
53f52d7ae crypto: tcrypt - ... |
567 568 569 570 571 |
if (IS_ERR(tfm)) { pr_err("alg: aead: Failed to load transform for %s: %ld ", algo, PTR_ERR(tfm)); |
a2ea6ed6a crypto: tcrypt - ... |
572 |
goto out_notfm; |
53f52d7ae crypto: tcrypt - ... |
573 |
} |
646710419 crypto: tcrypt - ... |
574 |
crypto_init_wait(&wait); |
263a8df0d crypto: tcrypt - ... |
575 576 577 578 |
printk(KERN_INFO " testing speed of %s (%s) %s ", algo, get_driver_name(crypto_aead, tfm), e); |
53f52d7ae crypto: tcrypt - ... |
579 580 581 582 583 |
req = aead_request_alloc(tfm, GFP_KERNEL); if (!req) { pr_err("alg: aead: Failed to allocate request for %s ", algo); |
6af1f93e2 crypto: tcrypt - ... |
584 |
goto out_noreq; |
53f52d7ae crypto: tcrypt - ... |
585 |
} |
1425d2d17 crypto: tcrypt - ... |
586 |
aead_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, |
646710419 crypto: tcrypt - ... |
587 |
crypto_req_done, &wait); |
1425d2d17 crypto: tcrypt - ... |
588 |
|
53f52d7ae crypto: tcrypt - ... |
589 590 591 592 593 |
i = 0; do { b_size = aead_sizes; do { assoc = axbuf[0]; |
ac5f863f8 crypto: tcrypt - ... |
594 |
memset(assoc, 0xff, aad_size); |
53f52d7ae crypto: tcrypt - ... |
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 |
if ((*keysize + *b_size) > TVMEMSIZE * PAGE_SIZE) { pr_err("template (%u) too big for tvmem (%lu) ", *keysize + *b_size, TVMEMSIZE * PAGE_SIZE); goto out; } key = tvmem[0]; for (j = 0; j < tcount; j++) { if (template[j].klen == *keysize) { key = template[j].key; break; } } ret = crypto_aead_setkey(tfm, key, *keysize); ret = crypto_aead_setauthsize(tfm, authsize); iv_len = crypto_aead_ivsize(tfm); if (iv_len) |
96692a730 crypto: tcrypt - ... |
616 |
memset(iv, 0xff, iv_len); |
53f52d7ae crypto: tcrypt - ... |
617 618 619 620 621 622 623 624 625 626 627 628 629 630 |
crypto_aead_clear_flags(tfm, ~0); printk(KERN_INFO "test %u (%d bit key, %d byte blocks): ", i, *keysize * 8, *b_size); memset(tvmem[0], 0xff, PAGE_SIZE); if (ret) { pr_err("setkey() failed flags=%x ", crypto_aead_get_flags(tfm)); goto out; } |
5601e014f crypto: tcrypt - ... |
631 632 |
sg_init_aead(sg, xbuf, *b_size + (enc ? 0 : authsize), assoc, aad_size); |
53f52d7ae crypto: tcrypt - ... |
633 |
|
31267270a crypto: tcrypt - ... |
634 |
sg_init_aead(sgout, xoutbuf, |
5601e014f crypto: tcrypt - ... |
635 636 |
*b_size + (enc ? authsize : 0), assoc, aad_size); |
31267270a crypto: tcrypt - ... |
637 |
|
4431bd495 crypto: tcrypt - ... |
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 |
aead_request_set_ad(req, aad_size); if (!enc) { /* * For decryption we need a proper auth so * we do the encryption path once with buffers * reversed (input <-> output) to calculate it */ aead_request_set_crypt(req, sgout, sg, *b_size, iv); ret = do_one_aead_op(req, crypto_aead_encrypt(req)); if (ret) { pr_err("calculating auth failed failed (%d) ", ret); break; } } |
7aacbfcb3 crypto: tcrypt - ... |
659 660 661 |
aead_request_set_crypt(req, sg, sgout, *b_size + (enc ? 0 : authsize), iv); |
53f52d7ae crypto: tcrypt - ... |
662 |
|
2af632996 crypto: tcrypt - ... |
663 |
if (secs) { |
3e3dc25fe crypto: Resolve s... |
664 665 |
ret = test_aead_jiffies(req, enc, *b_size, secs); |
2af632996 crypto: tcrypt - ... |
666 667 |
cond_resched(); } else { |
53f52d7ae crypto: tcrypt - ... |
668 |
ret = test_aead_cycles(req, enc, *b_size); |
2af632996 crypto: tcrypt - ... |
669 |
} |
53f52d7ae crypto: tcrypt - ... |
670 671 672 673 674 675 676 677 678 679 680 681 682 |
if (ret) { pr_err("%s() failed return code=%d ", e, ret); break; } b_size++; i++; } while (*b_size); keysize++; } while (*keysize); out: |
6af1f93e2 crypto: tcrypt - ... |
683 684 |
aead_request_free(req); out_noreq: |
53f52d7ae crypto: tcrypt - ... |
685 |
crypto_free_aead(tfm); |
a2ea6ed6a crypto: tcrypt - ... |
686 |
out_notfm: |
53f52d7ae crypto: tcrypt - ... |
687 688 689 690 691 692 693 694 |
kfree(sg); out_nosg: testmgr_free_buf(xoutbuf); out_nooutbuf: testmgr_free_buf(axbuf); out_noaxbuf: testmgr_free_buf(xbuf); out_noxbuf: |
96692a730 crypto: tcrypt - ... |
695 |
kfree(iv); |
53f52d7ae crypto: tcrypt - ... |
696 |
} |
d5dc39274 [CRYPTO] tcrypt: ... |
697 |
|
beb63da73 crypto: tcrypt - ... |
698 699 700 701 702 703 704 705 706 707 |
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); } } |
beb63da73 crypto: tcrypt - ... |
708 709 |
static inline int do_one_ahash_op(struct ahash_request *req, int ret) { |
646710419 crypto: tcrypt - ... |
710 |
struct crypto_wait *wait = req->base.data; |
beb63da73 crypto: tcrypt - ... |
711 |
|
646710419 crypto: tcrypt - ... |
712 |
return crypto_wait_req(ret, wait); |
beb63da73 crypto: tcrypt - ... |
713 |
} |
72259deb3 crypto: tcrypt - ... |
714 |
struct test_mb_ahash_data { |
7c3f13238 crypto: tcrypt - ... |
715 |
struct scatterlist sg[XBUFSIZE]; |
72259deb3 crypto: tcrypt - ... |
716 717 |
char result[64]; struct ahash_request *req; |
646710419 crypto: tcrypt - ... |
718 |
struct crypto_wait wait; |
72259deb3 crypto: tcrypt - ... |
719 720 |
char *xbuf[XBUFSIZE]; }; |
087bcd225 crypto: tcrypt - ... |
721 |
|
4e234eed5 crypto: tcrypt - ... |
722 723 |
static inline int do_mult_ahash_op(struct test_mb_ahash_data *data, u32 num_mb, int *rc) |
b34a0f67b crypto: tcrypt - ... |
724 |
{ |
4e234eed5 crypto: tcrypt - ... |
725 |
int i, err = 0; |
b34a0f67b crypto: tcrypt - ... |
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 |
/* Fire up a bunch of concurrent requests */ for (i = 0; i < num_mb; i++) rc[i] = crypto_ahash_digest(data[i].req); /* Wait for all requests to finish */ for (i = 0; i < num_mb; i++) { rc[i] = crypto_wait_req(rc[i], &data[i].wait); if (rc[i]) { pr_info("concurrent request %d error %d ", i, rc[i]); err = rc[i]; } } return err; } static int test_mb_ahash_jiffies(struct test_mb_ahash_data *data, int blen, int secs, u32 num_mb) { unsigned long start, end; int bcount; |
4e234eed5 crypto: tcrypt - ... |
750 751 752 753 754 755 |
int ret = 0; int *rc; rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL); if (!rc) return -ENOMEM; |
b34a0f67b crypto: tcrypt - ... |
756 757 758 |
for (start = jiffies, end = start + secs * HZ, bcount = 0; time_before(jiffies, end); bcount++) { |
4e234eed5 crypto: tcrypt - ... |
759 |
ret = do_mult_ahash_op(data, num_mb, rc); |
b34a0f67b crypto: tcrypt - ... |
760 |
if (ret) |
4e234eed5 crypto: tcrypt - ... |
761 |
goto out; |
b34a0f67b crypto: tcrypt - ... |
762 763 764 765 766 |
} pr_cont("%d operations in %d seconds (%ld bytes) ", bcount * num_mb, secs, (long)bcount * blen * num_mb); |
4e234eed5 crypto: tcrypt - ... |
767 768 769 770 |
out: kfree(rc); return ret; |
b34a0f67b crypto: tcrypt - ... |
771 772 773 774 775 776 777 778 |
} static int test_mb_ahash_cycles(struct test_mb_ahash_data *data, int blen, u32 num_mb) { unsigned long cycles = 0; int ret = 0; int i; |
4e234eed5 crypto: tcrypt - ... |
779 780 781 782 783 |
int *rc; rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL); if (!rc) return -ENOMEM; |
b34a0f67b crypto: tcrypt - ... |
784 785 786 |
/* Warm-up run. */ for (i = 0; i < 4; i++) { |
4e234eed5 crypto: tcrypt - ... |
787 |
ret = do_mult_ahash_op(data, num_mb, rc); |
b34a0f67b crypto: tcrypt - ... |
788 789 790 791 792 793 794 795 796 |
if (ret) goto out; } /* The real thing. */ for (i = 0; i < 8; i++) { cycles_t start, end; start = get_cycles(); |
4e234eed5 crypto: tcrypt - ... |
797 |
ret = do_mult_ahash_op(data, num_mb, rc); |
b34a0f67b crypto: tcrypt - ... |
798 799 800 801 802 803 804 |
end = get_cycles(); if (ret) goto out; cycles += end - start; } |
4e234eed5 crypto: tcrypt - ... |
805 806 807 |
pr_cont("1 operation in %lu cycles (%d bytes) ", (cycles + 4) / (8 * num_mb), blen); |
b34a0f67b crypto: tcrypt - ... |
808 |
|
4e234eed5 crypto: tcrypt - ... |
809 810 |
out: kfree(rc); |
b34a0f67b crypto: tcrypt - ... |
811 812 813 814 |
return ret; } static void test_mb_ahash_speed(const char *algo, unsigned int secs, |
8fcdc8685 crypto: tcrypt - ... |
815 |
struct hash_speed *speed, u32 num_mb) |
087bcd225 crypto: tcrypt - ... |
816 |
{ |
72259deb3 crypto: tcrypt - ... |
817 |
struct test_mb_ahash_data *data; |
087bcd225 crypto: tcrypt - ... |
818 |
struct crypto_ahash *tfm; |
72259deb3 crypto: tcrypt - ... |
819 820 |
unsigned int i, j, k; int ret; |
8fcdc8685 crypto: tcrypt - ... |
821 |
data = kcalloc(num_mb, sizeof(*data), GFP_KERNEL); |
72259deb3 crypto: tcrypt - ... |
822 823 |
if (!data) return; |
087bcd225 crypto: tcrypt - ... |
824 825 826 827 828 829 |
tfm = crypto_alloc_ahash(algo, 0, 0); if (IS_ERR(tfm)) { pr_err("failed to load transform for %s: %ld ", algo, PTR_ERR(tfm)); |
72259deb3 crypto: tcrypt - ... |
830 |
goto free_data; |
087bcd225 crypto: tcrypt - ... |
831 |
} |
72259deb3 crypto: tcrypt - ... |
832 |
|
8fcdc8685 crypto: tcrypt - ... |
833 |
for (i = 0; i < num_mb; ++i) { |
72259deb3 crypto: tcrypt - ... |
834 835 |
if (testmgr_alloc_buf(data[i].xbuf)) goto out; |
087bcd225 crypto: tcrypt - ... |
836 |
|
646710419 crypto: tcrypt - ... |
837 |
crypto_init_wait(&data[i].wait); |
087bcd225 crypto: tcrypt - ... |
838 |
|
72259deb3 crypto: tcrypt - ... |
839 840 |
data[i].req = ahash_request_alloc(tfm, GFP_KERNEL); if (!data[i].req) { |
f83f5b12e crypto: tcrypt - ... |
841 842 843 |
pr_err("alg: hash: Failed to allocate request for %s ", algo); |
72259deb3 crypto: tcrypt - ... |
844 |
goto out; |
087bcd225 crypto: tcrypt - ... |
845 |
} |
087bcd225 crypto: tcrypt - ... |
846 |
|
646710419 crypto: tcrypt - ... |
847 848 |
ahash_request_set_callback(data[i].req, 0, crypto_req_done, &data[i].wait); |
7c3f13238 crypto: tcrypt - ... |
849 850 851 852 853 854 |
sg_init_table(data[i].sg, XBUFSIZE); for (j = 0; j < XBUFSIZE; j++) { sg_set_buf(data[i].sg + j, data[i].xbuf[j], PAGE_SIZE); memset(data[i].xbuf[j], 0xff, PAGE_SIZE); } |
087bcd225 crypto: tcrypt - ... |
855 |
} |
72259deb3 crypto: tcrypt - ... |
856 857 858 859 |
pr_info(" testing speed of multibuffer %s (%s) ", algo, get_driver_name(crypto_ahash, tfm)); |
087bcd225 crypto: tcrypt - ... |
860 861 |
for (i = 0; speed[i].blen != 0; i++) { |
72259deb3 crypto: tcrypt - ... |
862 863 864 |
/* For some reason this only tests digests. */ if (speed[i].blen != speed[i].plen) continue; |
7c3f13238 crypto: tcrypt - ... |
865 |
if (speed[i].blen > XBUFSIZE * PAGE_SIZE) { |
f83f5b12e crypto: tcrypt - ... |
866 867 |
pr_err("template (%u) too big for tvmem (%lu) ", |
7c3f13238 crypto: tcrypt - ... |
868 |
speed[i].blen, XBUFSIZE * PAGE_SIZE); |
f83f5b12e crypto: tcrypt - ... |
869 |
goto out; |
087bcd225 crypto: tcrypt - ... |
870 871 872 873 |
} if (speed[i].klen) crypto_ahash_setkey(tfm, tvmem[0], speed[i].klen); |
8fcdc8685 crypto: tcrypt - ... |
874 |
for (k = 0; k < num_mb; k++) |
72259deb3 crypto: tcrypt - ... |
875 876 |
ahash_request_set_crypt(data[k].req, data[k].sg, data[k].result, speed[i].blen); |
087bcd225 crypto: tcrypt - ... |
877 |
|
72259deb3 crypto: tcrypt - ... |
878 879 |
pr_info("test%3u " "(%5u byte blocks,%5u bytes per update,%4u updates): ", |
087bcd225 crypto: tcrypt - ... |
880 881 |
i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen); |
2af632996 crypto: tcrypt - ... |
882 |
if (secs) { |
b34a0f67b crypto: tcrypt - ... |
883 884 |
ret = test_mb_ahash_jiffies(data, speed[i].blen, secs, num_mb); |
2af632996 crypto: tcrypt - ... |
885 886 |
cond_resched(); } else { |
b34a0f67b crypto: tcrypt - ... |
887 |
ret = test_mb_ahash_cycles(data, speed[i].blen, num_mb); |
2af632996 crypto: tcrypt - ... |
888 |
} |
087bcd225 crypto: tcrypt - ... |
889 |
|
72259deb3 crypto: tcrypt - ... |
890 891 892 893 894 895 |
if (ret) { pr_err("At least one hashing failed ret=%d ", ret); break; } |
087bcd225 crypto: tcrypt - ... |
896 |
} |
087bcd225 crypto: tcrypt - ... |
897 898 |
out: |
8fcdc8685 crypto: tcrypt - ... |
899 |
for (k = 0; k < num_mb; ++k) |
72259deb3 crypto: tcrypt - ... |
900 |
ahash_request_free(data[k].req); |
8fcdc8685 crypto: tcrypt - ... |
901 |
for (k = 0; k < num_mb; ++k) |
72259deb3 crypto: tcrypt - ... |
902 903 904 905 906 907 |
testmgr_free_buf(data[k].xbuf); crypto_free_ahash(tfm); free_data: kfree(data); |
087bcd225 crypto: tcrypt - ... |
908 |
} |
beb63da73 crypto: tcrypt - ... |
909 |
static int test_ahash_jiffies_digest(struct ahash_request *req, int blen, |
3e3dc25fe crypto: Resolve s... |
910 |
char *out, int secs) |
beb63da73 crypto: tcrypt - ... |
911 912 913 914 |
{ unsigned long start, end; int bcount; int ret; |
3e3dc25fe crypto: Resolve s... |
915 |
for (start = jiffies, end = start + secs * HZ, bcount = 0; |
beb63da73 crypto: tcrypt - ... |
916 917 918 919 920 921 922 923 |
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 ", |
3e3dc25fe crypto: Resolve s... |
924 |
bcount / secs, ((long)bcount * blen) / secs); |
beb63da73 crypto: tcrypt - ... |
925 926 927 928 929 |
return 0; } static int test_ahash_jiffies(struct ahash_request *req, int blen, |
3e3dc25fe crypto: Resolve s... |
930 |
int plen, char *out, int secs) |
beb63da73 crypto: tcrypt - ... |
931 932 933 934 935 936 |
{ unsigned long start, end; int bcount, pcount; int ret; if (plen == blen) |
3e3dc25fe crypto: Resolve s... |
937 |
return test_ahash_jiffies_digest(req, blen, out, secs); |
beb63da73 crypto: tcrypt - ... |
938 |
|
3e3dc25fe crypto: Resolve s... |
939 |
for (start = jiffies, end = start + secs * HZ, bcount = 0; |
beb63da73 crypto: tcrypt - ... |
940 |
time_before(jiffies, end); bcount++) { |
43a9607d8 crypto: tcrypt - ... |
941 |
ret = do_one_ahash_op(req, crypto_ahash_init(req)); |
beb63da73 crypto: tcrypt - ... |
942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 |
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 ", |
3e3dc25fe crypto: Resolve s... |
957 |
bcount / secs, ((long)bcount * blen) / secs); |
beb63da73 crypto: tcrypt - ... |
958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 |
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++) { |
43a9607d8 crypto: tcrypt - ... |
1012 |
ret = do_one_ahash_op(req, crypto_ahash_init(req)); |
beb63da73 crypto: tcrypt - ... |
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 |
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(); |
43a9607d8 crypto: tcrypt - ... |
1030 |
ret = do_one_ahash_op(req, crypto_ahash_init(req)); |
beb63da73 crypto: tcrypt - ... |
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 |
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; } |
0660511c0 crypto: tcrypt - ... |
1057 1058 |
static void test_ahash_speed_common(const char *algo, unsigned int secs, struct hash_speed *speed, unsigned mask) |
beb63da73 crypto: tcrypt - ... |
1059 1060 |
{ struct scatterlist sg[TVMEMSIZE]; |
646710419 crypto: tcrypt - ... |
1061 |
struct crypto_wait wait; |
beb63da73 crypto: tcrypt - ... |
1062 1063 |
struct ahash_request *req; struct crypto_ahash *tfm; |
f074f7b10 crypto: tcrypt - ... |
1064 |
char *output; |
beb63da73 crypto: tcrypt - ... |
1065 |
int i, ret; |
0660511c0 crypto: tcrypt - ... |
1066 |
tfm = crypto_alloc_ahash(algo, 0, mask); |
beb63da73 crypto: tcrypt - ... |
1067 1068 1069 1070 1071 1072 |
if (IS_ERR(tfm)) { pr_err("failed to load transform for %s: %ld ", algo, PTR_ERR(tfm)); return; } |
263a8df0d crypto: tcrypt - ... |
1073 1074 1075 1076 |
printk(KERN_INFO " testing speed of async %s (%s) ", algo, get_driver_name(crypto_ahash, tfm)); |
f074f7b10 crypto: tcrypt - ... |
1077 1078 1079 1080 |
if (crypto_ahash_digestsize(tfm) > MAX_DIGEST_SIZE) { pr_err("digestsize(%u) > %d ", crypto_ahash_digestsize(tfm), MAX_DIGEST_SIZE); |
beb63da73 crypto: tcrypt - ... |
1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 |
goto out; } test_hash_sg_init(sg); req = ahash_request_alloc(tfm, GFP_KERNEL); if (!req) { pr_err("ahash request allocation failure "); goto out; } |
646710419 crypto: tcrypt - ... |
1091 |
crypto_init_wait(&wait); |
beb63da73 crypto: tcrypt - ... |
1092 |
ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, |
646710419 crypto: tcrypt - ... |
1093 |
crypto_req_done, &wait); |
beb63da73 crypto: tcrypt - ... |
1094 |
|
f074f7b10 crypto: tcrypt - ... |
1095 1096 1097 |
output = kmalloc(MAX_DIGEST_SIZE, GFP_KERNEL); if (!output) goto out_nomem; |
beb63da73 crypto: tcrypt - ... |
1098 1099 1100 1101 1102 1103 1104 |
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; } |
94c7bb659 crypto: tcrypt - ... |
1105 1106 |
if (speed[i].klen) crypto_ahash_setkey(tfm, tvmem[0], speed[i].klen); |
beb63da73 crypto: tcrypt - ... |
1107 1108 1109 1110 1111 |
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); |
2af632996 crypto: tcrypt - ... |
1112 |
if (secs) { |
beb63da73 crypto: tcrypt - ... |
1113 |
ret = test_ahash_jiffies(req, speed[i].blen, |
3e3dc25fe crypto: Resolve s... |
1114 |
speed[i].plen, output, secs); |
2af632996 crypto: tcrypt - ... |
1115 1116 |
cond_resched(); } else { |
beb63da73 crypto: tcrypt - ... |
1117 1118 |
ret = test_ahash_cycles(req, speed[i].blen, speed[i].plen, output); |
2af632996 crypto: tcrypt - ... |
1119 |
} |
beb63da73 crypto: tcrypt - ... |
1120 1121 1122 1123 1124 1125 1126 |
if (ret) { pr_err("hashing failed ret=%d ", ret); break; } } |
f074f7b10 crypto: tcrypt - ... |
1127 1128 1129 |
kfree(output); out_nomem: |
beb63da73 crypto: tcrypt - ... |
1130 1131 1132 1133 1134 |
ahash_request_free(req); out: crypto_free_ahash(tfm); } |
0660511c0 crypto: tcrypt - ... |
1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 |
static void test_ahash_speed(const char *algo, unsigned int secs, struct hash_speed *speed) { return test_ahash_speed_common(algo, secs, speed, 0); } static void test_hash_speed(const char *algo, unsigned int secs, struct hash_speed *speed) { return test_ahash_speed_common(algo, secs, speed, CRYPTO_ALG_ASYNC); } |
e161c5930 crypto: tcrypt - ... |
1146 1147 1148 1149 1150 1151 1152 1153 |
struct test_mb_skcipher_data { struct scatterlist sg[XBUFSIZE]; struct skcipher_request *req; struct crypto_wait wait; char *xbuf[XBUFSIZE]; }; static int do_mult_acipher_op(struct test_mb_skcipher_data *data, int enc, |
4e234eed5 crypto: tcrypt - ... |
1154 |
u32 num_mb, int *rc) |
e161c5930 crypto: tcrypt - ... |
1155 |
{ |
4e234eed5 crypto: tcrypt - ... |
1156 |
int i, err = 0; |
e161c5930 crypto: tcrypt - ... |
1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 |
/* Fire up a bunch of concurrent requests */ for (i = 0; i < num_mb; i++) { if (enc == ENCRYPT) rc[i] = crypto_skcipher_encrypt(data[i].req); else rc[i] = crypto_skcipher_decrypt(data[i].req); } /* Wait for all requests to finish */ for (i = 0; i < num_mb; i++) { rc[i] = crypto_wait_req(rc[i], &data[i].wait); if (rc[i]) { pr_info("concurrent request %d error %d ", i, rc[i]); err = rc[i]; } } return err; } static int test_mb_acipher_jiffies(struct test_mb_skcipher_data *data, int enc, int blen, int secs, u32 num_mb) { unsigned long start, end; int bcount; |
4e234eed5 crypto: tcrypt - ... |
1185 1186 1187 1188 1189 1190 |
int ret = 0; int *rc; rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL); if (!rc) return -ENOMEM; |
e161c5930 crypto: tcrypt - ... |
1191 1192 1193 |
for (start = jiffies, end = start + secs * HZ, bcount = 0; time_before(jiffies, end); bcount++) { |
4e234eed5 crypto: tcrypt - ... |
1194 |
ret = do_mult_acipher_op(data, enc, num_mb, rc); |
e161c5930 crypto: tcrypt - ... |
1195 |
if (ret) |
4e234eed5 crypto: tcrypt - ... |
1196 |
goto out; |
e161c5930 crypto: tcrypt - ... |
1197 1198 1199 1200 1201 |
} pr_cont("%d operations in %d seconds (%ld bytes) ", bcount * num_mb, secs, (long)bcount * blen * num_mb); |
4e234eed5 crypto: tcrypt - ... |
1202 1203 1204 1205 |
out: kfree(rc); return ret; |
e161c5930 crypto: tcrypt - ... |
1206 1207 1208 1209 1210 1211 1212 1213 |
} static int test_mb_acipher_cycles(struct test_mb_skcipher_data *data, int enc, int blen, u32 num_mb) { unsigned long cycles = 0; int ret = 0; int i; |
4e234eed5 crypto: tcrypt - ... |
1214 1215 1216 1217 1218 |
int *rc; rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL); if (!rc) return -ENOMEM; |
e161c5930 crypto: tcrypt - ... |
1219 1220 1221 |
/* Warm-up run. */ for (i = 0; i < 4; i++) { |
4e234eed5 crypto: tcrypt - ... |
1222 |
ret = do_mult_acipher_op(data, enc, num_mb, rc); |
e161c5930 crypto: tcrypt - ... |
1223 1224 1225 1226 1227 1228 1229 1230 1231 |
if (ret) goto out; } /* The real thing. */ for (i = 0; i < 8; i++) { cycles_t start, end; start = get_cycles(); |
4e234eed5 crypto: tcrypt - ... |
1232 |
ret = do_mult_acipher_op(data, enc, num_mb, rc); |
e161c5930 crypto: tcrypt - ... |
1233 1234 1235 1236 1237 1238 1239 |
end = get_cycles(); if (ret) goto out; cycles += end - start; } |
4e234eed5 crypto: tcrypt - ... |
1240 1241 1242 |
pr_cont("1 operation in %lu cycles (%d bytes) ", (cycles + 4) / (8 * num_mb), blen); |
e161c5930 crypto: tcrypt - ... |
1243 |
|
4e234eed5 crypto: tcrypt - ... |
1244 1245 |
out: kfree(rc); |
e161c5930 crypto: tcrypt - ... |
1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 |
return ret; } static void test_mb_skcipher_speed(const char *algo, int enc, int secs, struct cipher_speed_template *template, unsigned int tcount, u8 *keysize, u32 num_mb) { struct test_mb_skcipher_data *data; struct crypto_skcipher *tfm; unsigned int i, j, iv_len; const char *key; const char *e; u32 *b_size; char iv[128]; int ret; if (enc == ENCRYPT) e = "encryption"; else e = "decryption"; data = kcalloc(num_mb, sizeof(*data), GFP_KERNEL); if (!data) return; tfm = crypto_alloc_skcipher(algo, 0, 0); if (IS_ERR(tfm)) { pr_err("failed to load transform for %s: %ld ", algo, PTR_ERR(tfm)); goto out_free_data; } for (i = 0; i < num_mb; ++i) if (testmgr_alloc_buf(data[i].xbuf)) { while (i--) testmgr_free_buf(data[i].xbuf); goto out_free_tfm; } for (i = 0; i < num_mb; ++i) if (testmgr_alloc_buf(data[i].xbuf)) { while (i--) testmgr_free_buf(data[i].xbuf); goto out_free_tfm; } for (i = 0; i < num_mb; ++i) { data[i].req = skcipher_request_alloc(tfm, GFP_KERNEL); if (!data[i].req) { pr_err("alg: skcipher: Failed to allocate request for %s ", algo); while (i--) skcipher_request_free(data[i].req); goto out_free_xbuf; } } for (i = 0; i < num_mb; ++i) { skcipher_request_set_callback(data[i].req, CRYPTO_TFM_REQ_MAY_BACKLOG, crypto_req_done, &data[i].wait); crypto_init_wait(&data[i].wait); } pr_info(" testing speed of multibuffer %s (%s) %s ", algo, get_driver_name(crypto_skcipher, tfm), e); i = 0; do { b_size = block_sizes; do { if (*b_size > XBUFSIZE * PAGE_SIZE) { |
38dbe2d19 crypto: tcrypt - ... |
1324 1325 |
pr_err("template (%u) too big for buffer (%lu) ", |
e161c5930 crypto: tcrypt - ... |
1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 |
*b_size, XBUFSIZE * PAGE_SIZE); goto out; } pr_info("test %u (%d bit key, %d byte blocks): ", i, *keysize * 8, *b_size); /* Set up tfm global state, i.e. the key */ memset(tvmem[0], 0xff, PAGE_SIZE); key = tvmem[0]; for (j = 0; j < tcount; j++) { if (template[j].klen == *keysize) { key = template[j].key; break; } } crypto_skcipher_clear_flags(tfm, ~0); ret = crypto_skcipher_setkey(tfm, key, *keysize); if (ret) { pr_err("setkey() failed flags=%x ", crypto_skcipher_get_flags(tfm)); goto out; } iv_len = crypto_skcipher_ivsize(tfm); if (iv_len) memset(&iv, 0xff, iv_len); /* Now setup per request stuff, i.e. buffers */ for (j = 0; j < num_mb; ++j) { struct test_mb_skcipher_data *cur = &data[j]; unsigned int k = *b_size; unsigned int pages = DIV_ROUND_UP(k, PAGE_SIZE); unsigned int p = 0; sg_init_table(cur->sg, pages); while (k > PAGE_SIZE) { sg_set_buf(cur->sg + p, cur->xbuf[p], PAGE_SIZE); memset(cur->xbuf[p], 0xff, PAGE_SIZE); p++; k -= PAGE_SIZE; } sg_set_buf(cur->sg + p, cur->xbuf[p], k); memset(cur->xbuf[p], 0xff, k); skcipher_request_set_crypt(cur->req, cur->sg, cur->sg, *b_size, iv); } |
2af632996 crypto: tcrypt - ... |
1383 |
if (secs) { |
e161c5930 crypto: tcrypt - ... |
1384 1385 1386 |
ret = test_mb_acipher_jiffies(data, enc, *b_size, secs, num_mb); |
2af632996 crypto: tcrypt - ... |
1387 1388 |
cond_resched(); } else { |
e161c5930 crypto: tcrypt - ... |
1389 1390 |
ret = test_mb_acipher_cycles(data, enc, *b_size, num_mb); |
2af632996 crypto: tcrypt - ... |
1391 |
} |
e161c5930 crypto: tcrypt - ... |
1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 |
if (ret) { pr_err("%s() failed flags=%x ", e, crypto_skcipher_get_flags(tfm)); break; } b_size++; i++; } while (*b_size); keysize++; } while (*keysize); out: for (i = 0; i < num_mb; ++i) skcipher_request_free(data[i].req); out_free_xbuf: for (i = 0; i < num_mb; ++i) testmgr_free_buf(data[i].xbuf); out_free_tfm: crypto_free_skcipher(tfm); out_free_data: kfree(data); } |
7166e589d crypto: tcrypt - ... |
1416 |
static inline int do_one_acipher_op(struct skcipher_request *req, int ret) |
3f3baf359 crypto: tcrypt - ... |
1417 |
{ |
646710419 crypto: tcrypt - ... |
1418 |
struct crypto_wait *wait = req->base.data; |
3f3baf359 crypto: tcrypt - ... |
1419 |
|
646710419 crypto: tcrypt - ... |
1420 |
return crypto_wait_req(ret, wait); |
3f3baf359 crypto: tcrypt - ... |
1421 |
} |
7166e589d crypto: tcrypt - ... |
1422 |
static int test_acipher_jiffies(struct skcipher_request *req, int enc, |
3e3dc25fe crypto: Resolve s... |
1423 |
int blen, int secs) |
3f3baf359 crypto: tcrypt - ... |
1424 1425 1426 1427 |
{ unsigned long start, end; int bcount; int ret; |
3e3dc25fe crypto: Resolve s... |
1428 |
for (start = jiffies, end = start + secs * HZ, bcount = 0; |
3f3baf359 crypto: tcrypt - ... |
1429 1430 1431 |
time_before(jiffies, end); bcount++) { if (enc) ret = do_one_acipher_op(req, |
7166e589d crypto: tcrypt - ... |
1432 |
crypto_skcipher_encrypt(req)); |
3f3baf359 crypto: tcrypt - ... |
1433 1434 |
else ret = do_one_acipher_op(req, |
7166e589d crypto: tcrypt - ... |
1435 |
crypto_skcipher_decrypt(req)); |
3f3baf359 crypto: tcrypt - ... |
1436 1437 1438 1439 1440 1441 1442 |
if (ret) return ret; } pr_cont("%d operations in %d seconds (%ld bytes) ", |
3e3dc25fe crypto: Resolve s... |
1443 |
bcount, secs, (long)bcount * blen); |
3f3baf359 crypto: tcrypt - ... |
1444 1445 |
return 0; } |
7166e589d crypto: tcrypt - ... |
1446 |
static int test_acipher_cycles(struct skcipher_request *req, int enc, |
3f3baf359 crypto: tcrypt - ... |
1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 |
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, |
7166e589d crypto: tcrypt - ... |
1457 |
crypto_skcipher_encrypt(req)); |
3f3baf359 crypto: tcrypt - ... |
1458 1459 |
else ret = do_one_acipher_op(req, |
7166e589d crypto: tcrypt - ... |
1460 |
crypto_skcipher_decrypt(req)); |
3f3baf359 crypto: tcrypt - ... |
1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 |
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, |
7166e589d crypto: tcrypt - ... |
1473 |
crypto_skcipher_encrypt(req)); |
3f3baf359 crypto: tcrypt - ... |
1474 1475 |
else ret = do_one_acipher_op(req, |
7166e589d crypto: tcrypt - ... |
1476 |
crypto_skcipher_decrypt(req)); |
3f3baf359 crypto: tcrypt - ... |
1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 |
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; } |
7166e589d crypto: tcrypt - ... |
1493 1494 1495 |
static void test_skcipher_speed(const char *algo, int enc, unsigned int secs, struct cipher_speed_template *template, unsigned int tcount, u8 *keysize, bool async) |
3f3baf359 crypto: tcrypt - ... |
1496 |
{ |
de1975334 crypto: atmel - a... |
1497 |
unsigned int ret, i, j, k, iv_len; |
646710419 crypto: tcrypt - ... |
1498 |
struct crypto_wait wait; |
3f3baf359 crypto: tcrypt - ... |
1499 1500 |
const char *key; char iv[128]; |
7166e589d crypto: tcrypt - ... |
1501 1502 |
struct skcipher_request *req; struct crypto_skcipher *tfm; |
3f3baf359 crypto: tcrypt - ... |
1503 1504 1505 1506 1507 1508 1509 |
const char *e; u32 *b_size; if (enc == ENCRYPT) e = "encryption"; else e = "decryption"; |
646710419 crypto: tcrypt - ... |
1510 |
crypto_init_wait(&wait); |
3f3baf359 crypto: tcrypt - ... |
1511 |
|
7166e589d crypto: tcrypt - ... |
1512 |
tfm = crypto_alloc_skcipher(algo, 0, async ? 0 : CRYPTO_ALG_ASYNC); |
3f3baf359 crypto: tcrypt - ... |
1513 1514 1515 1516 1517 1518 1519 |
if (IS_ERR(tfm)) { pr_err("failed to load transform for %s: %ld ", algo, PTR_ERR(tfm)); return; } |
263a8df0d crypto: tcrypt - ... |
1520 1521 1522 |
pr_info(" testing speed of async %s (%s) %s ", algo, |
7166e589d crypto: tcrypt - ... |
1523 |
get_driver_name(crypto_skcipher, tfm), e); |
263a8df0d crypto: tcrypt - ... |
1524 |
|
7166e589d crypto: tcrypt - ... |
1525 |
req = skcipher_request_alloc(tfm, GFP_KERNEL); |
3f3baf359 crypto: tcrypt - ... |
1526 1527 1528 1529 1530 1531 |
if (!req) { pr_err("tcrypt: skcipher: Failed to allocate request for %s ", algo); goto out; } |
7166e589d crypto: tcrypt - ... |
1532 |
skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, |
646710419 crypto: tcrypt - ... |
1533 |
crypto_req_done, &wait); |
3f3baf359 crypto: tcrypt - ... |
1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 |
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; } } |
7166e589d crypto: tcrypt - ... |
1563 |
crypto_skcipher_clear_flags(tfm, ~0); |
3f3baf359 crypto: tcrypt - ... |
1564 |
|
7166e589d crypto: tcrypt - ... |
1565 |
ret = crypto_skcipher_setkey(tfm, key, *keysize); |
3f3baf359 crypto: tcrypt - ... |
1566 1567 1568 |
if (ret) { pr_err("setkey() failed flags=%x ", |
7166e589d crypto: tcrypt - ... |
1569 |
crypto_skcipher_get_flags(tfm)); |
3f3baf359 crypto: tcrypt - ... |
1570 1571 |
goto out_free_req; } |
de1975334 crypto: atmel - a... |
1572 |
k = *keysize + *b_size; |
007ee8dec crypto: tcrypt - ... |
1573 |
sg_init_table(sg, DIV_ROUND_UP(k, PAGE_SIZE)); |
de1975334 crypto: atmel - a... |
1574 1575 |
if (k > PAGE_SIZE) { sg_set_buf(sg, tvmem[0] + *keysize, |
3f3baf359 crypto: tcrypt - ... |
1576 |
PAGE_SIZE - *keysize); |
de1975334 crypto: atmel - a... |
1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 |
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 - ... |
1589 |
} |
7166e589d crypto: tcrypt - ... |
1590 |
iv_len = crypto_skcipher_ivsize(tfm); |
3f3baf359 crypto: tcrypt - ... |
1591 1592 |
if (iv_len) memset(&iv, 0xff, iv_len); |
7166e589d crypto: tcrypt - ... |
1593 |
skcipher_request_set_crypt(req, sg, sg, *b_size, iv); |
3f3baf359 crypto: tcrypt - ... |
1594 |
|
2af632996 crypto: tcrypt - ... |
1595 |
if (secs) { |
3f3baf359 crypto: tcrypt - ... |
1596 |
ret = test_acipher_jiffies(req, enc, |
3e3dc25fe crypto: Resolve s... |
1597 |
*b_size, secs); |
2af632996 crypto: tcrypt - ... |
1598 1599 |
cond_resched(); } else { |
3f3baf359 crypto: tcrypt - ... |
1600 1601 |
ret = test_acipher_cycles(req, enc, *b_size); |
2af632996 crypto: tcrypt - ... |
1602 |
} |
3f3baf359 crypto: tcrypt - ... |
1603 1604 1605 1606 |
if (ret) { pr_err("%s() failed flags=%x ", e, |
7166e589d crypto: tcrypt - ... |
1607 |
crypto_skcipher_get_flags(tfm)); |
3f3baf359 crypto: tcrypt - ... |
1608 1609 1610 1611 1612 1613 1614 1615 1616 |
break; } b_size++; i++; } while (*b_size); keysize++; } while (*keysize); out_free_req: |
7166e589d crypto: tcrypt - ... |
1617 |
skcipher_request_free(req); |
3f3baf359 crypto: tcrypt - ... |
1618 |
out: |
7166e589d crypto: tcrypt - ... |
1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 |
crypto_free_skcipher(tfm); } static void test_acipher_speed(const char *algo, int enc, unsigned int secs, struct cipher_speed_template *template, unsigned int tcount, u8 *keysize) { return test_skcipher_speed(algo, enc, secs, template, tcount, keysize, true); } static void test_cipher_speed(const char *algo, int enc, unsigned int secs, struct cipher_speed_template *template, unsigned int tcount, u8 *keysize) { return test_skcipher_speed(algo, enc, secs, template, tcount, keysize, false); |
3f3baf359 crypto: tcrypt - ... |
1636 |
} |
ef2736fc7 [CRYPTO]: White s... |
1637 |
static void test_available(void) |
1da177e4c Linux-2.6.12-rc2 |
1638 1639 |
{ char **name = check; |
ef2736fc7 [CRYPTO]: White s... |
1640 |
|
1da177e4c Linux-2.6.12-rc2 |
1641 1642 |
while (*name) { printk("alg %s ", *name); |
6158efc09 [CRYPTO] tcrypt: ... |
1643 |
printk(crypto_has_alg(*name, 0, 0) ? |
e4d5b79c6 [CRYPTO] users: U... |
1644 1645 1646 |
"found " : "not found "); |
1da177e4c Linux-2.6.12-rc2 |
1647 |
name++; |
ef2736fc7 [CRYPTO]: White s... |
1648 |
} |
1da177e4c Linux-2.6.12-rc2 |
1649 |
} |
01b323245 crypto: tcrypt - ... |
1650 1651 |
static inline int tcrypt_test(const char *alg) { |
4e033a6bc crypto: tcrypt - ... |
1652 |
int ret; |
76512f2d8 crypto: tcrypt - ... |
1653 1654 |
pr_debug("testing %s ", alg); |
4e033a6bc crypto: tcrypt - ... |
1655 1656 1657 1658 1659 |
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 - ... |
1660 |
} |
4e234eed5 crypto: tcrypt - ... |
1661 |
static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb) |
01b323245 crypto: tcrypt - ... |
1662 1663 |
{ int i; |
4e033a6bc crypto: tcrypt - ... |
1664 |
int ret = 0; |
01b323245 crypto: tcrypt - ... |
1665 1666 |
switch (m) { |
1da177e4c Linux-2.6.12-rc2 |
1667 |
case 0: |
8606813a6 crypto: tcrypt - ... |
1668 1669 1670 1671 1672 1673 |
if (alg) { if (!crypto_has_alg(alg, type, mask ?: CRYPTO_ALG_TYPE_MASK)) ret = -ENOENT; break; } |
01b323245 crypto: tcrypt - ... |
1674 |
for (i = 1; i < 200; i++) |
4e234eed5 crypto: tcrypt - ... |
1675 |
ret += do_test(NULL, 0, 0, i, num_mb); |
1da177e4c Linux-2.6.12-rc2 |
1676 1677 1678 |
break; case 1: |
4e033a6bc crypto: tcrypt - ... |
1679 |
ret += tcrypt_test("md5"); |
1da177e4c Linux-2.6.12-rc2 |
1680 1681 1682 |
break; case 2: |
4e033a6bc crypto: tcrypt - ... |
1683 |
ret += tcrypt_test("sha1"); |
1da177e4c Linux-2.6.12-rc2 |
1684 1685 1686 |
break; case 3: |
4e033a6bc crypto: tcrypt - ... |
1687 1688 |
ret += tcrypt_test("ecb(des)"); ret += tcrypt_test("cbc(des)"); |
8163fc30d crypto: testmgr -... |
1689 |
ret += tcrypt_test("ctr(des)"); |
1da177e4c Linux-2.6.12-rc2 |
1690 1691 1692 |
break; case 4: |
4e033a6bc crypto: tcrypt - ... |
1693 1694 |
ret += tcrypt_test("ecb(des3_ede)"); ret += tcrypt_test("cbc(des3_ede)"); |
e080b17a8 crypto: testmgr -... |
1695 |
ret += tcrypt_test("ctr(des3_ede)"); |
1da177e4c Linux-2.6.12-rc2 |
1696 1697 1698 |
break; case 5: |
4e033a6bc crypto: tcrypt - ... |
1699 |
ret += tcrypt_test("md4"); |
1da177e4c Linux-2.6.12-rc2 |
1700 |
break; |
ef2736fc7 [CRYPTO]: White s... |
1701 |
|
1da177e4c Linux-2.6.12-rc2 |
1702 |
case 6: |
4e033a6bc crypto: tcrypt - ... |
1703 |
ret += tcrypt_test("sha256"); |
1da177e4c Linux-2.6.12-rc2 |
1704 |
break; |
ef2736fc7 [CRYPTO]: White s... |
1705 |
|
1da177e4c Linux-2.6.12-rc2 |
1706 |
case 7: |
4e033a6bc crypto: tcrypt - ... |
1707 1708 |
ret += tcrypt_test("ecb(blowfish)"); ret += tcrypt_test("cbc(blowfish)"); |
85b63e342 crypto: testmgr -... |
1709 |
ret += tcrypt_test("ctr(blowfish)"); |
1da177e4c Linux-2.6.12-rc2 |
1710 1711 1712 |
break; case 8: |
4e033a6bc crypto: tcrypt - ... |
1713 1714 |
ret += tcrypt_test("ecb(twofish)"); ret += tcrypt_test("cbc(twofish)"); |
573da6208 crypto: testmgr -... |
1715 |
ret += tcrypt_test("ctr(twofish)"); |
bee3a90ef crypto: tcrypt - ... |
1716 |
ret += tcrypt_test("lrw(twofish)"); |
131f75416 crypto: tcrypt - ... |
1717 |
ret += tcrypt_test("xts(twofish)"); |
1da177e4c Linux-2.6.12-rc2 |
1718 |
break; |
ef2736fc7 [CRYPTO]: White s... |
1719 |
|
1da177e4c Linux-2.6.12-rc2 |
1720 |
case 9: |
4e033a6bc crypto: tcrypt - ... |
1721 |
ret += tcrypt_test("ecb(serpent)"); |
9d25917d4 crypto: testmgr -... |
1722 1723 |
ret += tcrypt_test("cbc(serpent)"); ret += tcrypt_test("ctr(serpent)"); |
87aae4bfb crypto: tcrypt - ... |
1724 |
ret += tcrypt_test("lrw(serpent)"); |
5209c07ac crypto: tcrypt - ... |
1725 |
ret += tcrypt_test("xts(serpent)"); |
1da177e4c Linux-2.6.12-rc2 |
1726 1727 1728 |
break; case 10: |
4e033a6bc crypto: tcrypt - ... |
1729 1730 1731 1732 1733 1734 |
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))"); |
d8e4b24ff crypto: testmgr -... |
1735 |
ret += tcrypt_test("cfb(aes)"); |
1da177e4c Linux-2.6.12-rc2 |
1736 1737 1738 |
break; case 11: |
4e033a6bc crypto: tcrypt - ... |
1739 |
ret += tcrypt_test("sha384"); |
1da177e4c Linux-2.6.12-rc2 |
1740 |
break; |
ef2736fc7 [CRYPTO]: White s... |
1741 |
|
1da177e4c Linux-2.6.12-rc2 |
1742 |
case 12: |
4e033a6bc crypto: tcrypt - ... |
1743 |
ret += tcrypt_test("sha512"); |
1da177e4c Linux-2.6.12-rc2 |
1744 1745 1746 |
break; case 13: |
4e033a6bc crypto: tcrypt - ... |
1747 |
ret += tcrypt_test("deflate"); |
1da177e4c Linux-2.6.12-rc2 |
1748 1749 1750 |
break; case 14: |
4e033a6bc crypto: tcrypt - ... |
1751 |
ret += tcrypt_test("ecb(cast5)"); |
a2c582609 crypto: testmgr -... |
1752 1753 |
ret += tcrypt_test("cbc(cast5)"); ret += tcrypt_test("ctr(cast5)"); |
1da177e4c Linux-2.6.12-rc2 |
1754 1755 1756 |
break; case 15: |
4e033a6bc crypto: tcrypt - ... |
1757 |
ret += tcrypt_test("ecb(cast6)"); |
9b8b04051 crypto: testmgr -... |
1758 1759 1760 1761 |
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 |
1762 1763 1764 |
break; case 16: |
4e033a6bc crypto: tcrypt - ... |
1765 |
ret += tcrypt_test("ecb(arc4)"); |
1da177e4c Linux-2.6.12-rc2 |
1766 1767 1768 |
break; case 17: |
4e033a6bc crypto: tcrypt - ... |
1769 |
ret += tcrypt_test("michael_mic"); |
1da177e4c Linux-2.6.12-rc2 |
1770 1771 1772 |
break; case 18: |
4e033a6bc crypto: tcrypt - ... |
1773 |
ret += tcrypt_test("crc32c"); |
1da177e4c Linux-2.6.12-rc2 |
1774 1775 1776 |
break; case 19: |
4e033a6bc crypto: tcrypt - ... |
1777 |
ret += tcrypt_test("ecb(tea)"); |
1da177e4c Linux-2.6.12-rc2 |
1778 1779 1780 |
break; case 20: |
4e033a6bc crypto: tcrypt - ... |
1781 |
ret += tcrypt_test("ecb(xtea)"); |
1da177e4c Linux-2.6.12-rc2 |
1782 1783 1784 |
break; case 21: |
4e033a6bc crypto: tcrypt - ... |
1785 |
ret += tcrypt_test("ecb(khazad)"); |
1da177e4c Linux-2.6.12-rc2 |
1786 1787 1788 |
break; case 22: |
4e033a6bc crypto: tcrypt - ... |
1789 |
ret += tcrypt_test("wp512"); |
1da177e4c Linux-2.6.12-rc2 |
1790 1791 1792 |
break; case 23: |
4e033a6bc crypto: tcrypt - ... |
1793 |
ret += tcrypt_test("wp384"); |
1da177e4c Linux-2.6.12-rc2 |
1794 1795 1796 |
break; case 24: |
4e033a6bc crypto: tcrypt - ... |
1797 |
ret += tcrypt_test("wp256"); |
1da177e4c Linux-2.6.12-rc2 |
1798 1799 1800 |
break; case 25: |
4e033a6bc crypto: tcrypt - ... |
1801 |
ret += tcrypt_test("ecb(tnepres)"); |
1da177e4c Linux-2.6.12-rc2 |
1802 1803 1804 |
break; case 26: |
4e033a6bc crypto: tcrypt - ... |
1805 1806 |
ret += tcrypt_test("ecb(anubis)"); ret += tcrypt_test("cbc(anubis)"); |
1da177e4c Linux-2.6.12-rc2 |
1807 1808 1809 |
break; case 27: |
4e033a6bc crypto: tcrypt - ... |
1810 |
ret += tcrypt_test("tgr192"); |
1da177e4c Linux-2.6.12-rc2 |
1811 1812 1813 |
break; case 28: |
4e033a6bc crypto: tcrypt - ... |
1814 |
ret += tcrypt_test("tgr160"); |
1da177e4c Linux-2.6.12-rc2 |
1815 1816 1817 |
break; case 29: |
4e033a6bc crypto: tcrypt - ... |
1818 |
ret += tcrypt_test("tgr128"); |
1da177e4c Linux-2.6.12-rc2 |
1819 |
break; |
2998db37b [CRYPTO] tcrypt: ... |
1820 |
|
fb4f10ed5 [CRYPTO]: Fix XTE... |
1821 |
case 30: |
4e033a6bc crypto: tcrypt - ... |
1822 |
ret += tcrypt_test("ecb(xeta)"); |
fb4f10ed5 [CRYPTO]: Fix XTE... |
1823 |
break; |
1da177e4c Linux-2.6.12-rc2 |
1824 |
|
90831639a [CRYPTO] fcrypt: ... |
1825 |
case 31: |
4e033a6bc crypto: tcrypt - ... |
1826 |
ret += tcrypt_test("pcbc(fcrypt)"); |
90831639a [CRYPTO] fcrypt: ... |
1827 |
break; |
02ab5a705 [CRYPTO] camellia... |
1828 |
case 32: |
4e033a6bc crypto: tcrypt - ... |
1829 1830 |
ret += tcrypt_test("ecb(camellia)"); ret += tcrypt_test("cbc(camellia)"); |
54216bbd7 crypto: tcrypt - ... |
1831 1832 1833 |
ret += tcrypt_test("ctr(camellia)"); ret += tcrypt_test("lrw(camellia)"); ret += tcrypt_test("xts(camellia)"); |
02ab5a705 [CRYPTO] camellia... |
1834 |
break; |
93b5e86a6 crypto: add CMAC ... |
1835 |
|
cd12fb906 [CRYPTO] sha256-g... |
1836 |
case 33: |
4e033a6bc crypto: tcrypt - ... |
1837 |
ret += tcrypt_test("sha224"); |
cd12fb906 [CRYPTO] sha256-g... |
1838 |
break; |
02ab5a705 [CRYPTO] camellia... |
1839 |
|
2407d6087 [CRYPTO] salsa20:... |
1840 |
case 34: |
4e033a6bc crypto: tcrypt - ... |
1841 |
ret += tcrypt_test("salsa20"); |
2407d6087 [CRYPTO] salsa20:... |
1842 |
break; |
8df213d9b [CRYPTO] tcrypt: ... |
1843 |
case 35: |
4e033a6bc crypto: tcrypt - ... |
1844 |
ret += tcrypt_test("gcm(aes)"); |
8df213d9b [CRYPTO] tcrypt: ... |
1845 |
break; |
0b77abb3b [CRYPTO] lzo: Add... |
1846 |
case 36: |
4e033a6bc crypto: tcrypt - ... |
1847 |
ret += tcrypt_test("lzo"); |
0b77abb3b [CRYPTO] lzo: Add... |
1848 |
break; |
93cc74e07 [CRYPTO] tcrypt: ... |
1849 |
case 37: |
4e033a6bc crypto: tcrypt - ... |
1850 |
ret += tcrypt_test("ccm(aes)"); |
93cc74e07 [CRYPTO] tcrypt: ... |
1851 |
break; |
76cb95217 [CRYPTO] cts: Add... |
1852 |
case 38: |
4e033a6bc crypto: tcrypt - ... |
1853 |
ret += tcrypt_test("cts(cbc(aes))"); |
76cb95217 [CRYPTO] cts: Add... |
1854 |
break; |
fd4adf1a0 [CRYPTO] tcrypt: ... |
1855 |
case 39: |
4e033a6bc crypto: tcrypt - ... |
1856 |
ret += tcrypt_test("rmd128"); |
fd4adf1a0 [CRYPTO] tcrypt: ... |
1857 1858 1859 |
break; case 40: |
4e033a6bc crypto: tcrypt - ... |
1860 |
ret += tcrypt_test("rmd160"); |
fd4adf1a0 [CRYPTO] tcrypt: ... |
1861 |
break; |
2998db37b [CRYPTO] tcrypt: ... |
1862 |
case 41: |
4e033a6bc crypto: tcrypt - ... |
1863 |
ret += tcrypt_test("rmd256"); |
2998db37b [CRYPTO] tcrypt: ... |
1864 1865 1866 |
break; case 42: |
4e033a6bc crypto: tcrypt - ... |
1867 |
ret += tcrypt_test("rmd320"); |
01b323245 crypto: tcrypt - ... |
1868 1869 1870 |
break; case 43: |
4e033a6bc crypto: tcrypt - ... |
1871 |
ret += tcrypt_test("ecb(seed)"); |
2998db37b [CRYPTO] tcrypt: ... |
1872 |
break; |
5d667322a crypto: testmgr -... |
1873 |
case 45: |
4e033a6bc crypto: tcrypt - ... |
1874 |
ret += tcrypt_test("rfc4309(ccm(aes))"); |
5d667322a crypto: testmgr -... |
1875 |
break; |
54216bbd7 crypto: tcrypt - ... |
1876 1877 1878 |
case 46: ret += tcrypt_test("ghash"); break; |
68411521c Reinstate "crypto... |
1879 1880 1881 |
case 47: ret += tcrypt_test("crct10dif"); break; |
79cc6ab89 crypto: sha3 - Ad... |
1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 |
case 48: ret += tcrypt_test("sha3-224"); break; case 49: ret += tcrypt_test("sha3-256"); break; case 50: ret += tcrypt_test("sha3-384"); break; case 51: ret += tcrypt_test("sha3-512"); break; |
b7e275304 crypto: sm3 - add... |
1897 1898 1899 |
case 52: ret += tcrypt_test("sm3"); break; |
1da177e4c Linux-2.6.12-rc2 |
1900 |
case 100: |
4e033a6bc crypto: tcrypt - ... |
1901 |
ret += tcrypt_test("hmac(md5)"); |
1da177e4c Linux-2.6.12-rc2 |
1902 |
break; |
ef2736fc7 [CRYPTO]: White s... |
1903 |
|
1da177e4c Linux-2.6.12-rc2 |
1904 |
case 101: |
4e033a6bc crypto: tcrypt - ... |
1905 |
ret += tcrypt_test("hmac(sha1)"); |
1da177e4c Linux-2.6.12-rc2 |
1906 |
break; |
ef2736fc7 [CRYPTO]: White s... |
1907 |
|
1da177e4c Linux-2.6.12-rc2 |
1908 |
case 102: |
4e033a6bc crypto: tcrypt - ... |
1909 |
ret += tcrypt_test("hmac(sha256)"); |
1da177e4c Linux-2.6.12-rc2 |
1910 |
break; |
a28091ae1 [CRYPTO] tcrypt: ... |
1911 |
case 103: |
4e033a6bc crypto: tcrypt - ... |
1912 |
ret += tcrypt_test("hmac(sha384)"); |
a28091ae1 [CRYPTO] tcrypt: ... |
1913 1914 1915 |
break; case 104: |
4e033a6bc crypto: tcrypt - ... |
1916 |
ret += tcrypt_test("hmac(sha512)"); |
a28091ae1 [CRYPTO] tcrypt: ... |
1917 |
break; |
38ed9ab23 [CRYPTO] tcrypt: ... |
1918 |
|
cd12fb906 [CRYPTO] sha256-g... |
1919 |
case 105: |
4e033a6bc crypto: tcrypt - ... |
1920 |
ret += tcrypt_test("hmac(sha224)"); |
cd12fb906 [CRYPTO] sha256-g... |
1921 |
break; |
1da177e4c Linux-2.6.12-rc2 |
1922 |
|
38ed9ab23 [CRYPTO] tcrypt: ... |
1923 |
case 106: |
4e033a6bc crypto: tcrypt - ... |
1924 |
ret += tcrypt_test("xcbc(aes)"); |
38ed9ab23 [CRYPTO] tcrypt: ... |
1925 |
break; |
fd4adf1a0 [CRYPTO] tcrypt: ... |
1926 |
case 107: |
4e033a6bc crypto: tcrypt - ... |
1927 |
ret += tcrypt_test("hmac(rmd128)"); |
fd4adf1a0 [CRYPTO] tcrypt: ... |
1928 1929 1930 |
break; case 108: |
4e033a6bc crypto: tcrypt - ... |
1931 |
ret += tcrypt_test("hmac(rmd160)"); |
fd4adf1a0 [CRYPTO] tcrypt: ... |
1932 |
break; |
f1939f7c5 crypto: vmac - Ne... |
1933 |
case 109: |
0917b8731 crypto: vmac - re... |
1934 |
ret += tcrypt_test("vmac64(aes)"); |
f1939f7c5 crypto: vmac - Ne... |
1935 |
break; |
93b5e86a6 crypto: add CMAC ... |
1936 |
|
98eca72fa crypto: sha3 - Ad... |
1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 |
case 111: ret += tcrypt_test("hmac(sha3-224)"); break; case 112: ret += tcrypt_test("hmac(sha3-256)"); break; case 113: ret += tcrypt_test("hmac(sha3-384)"); break; case 114: ret += tcrypt_test("hmac(sha3-512)"); break; |
e08ca2da3 crypto: testmgr -... |
1952 |
case 150: |
4e033a6bc crypto: tcrypt - ... |
1953 |
ret += tcrypt_test("ansi_cprng"); |
e08ca2da3 crypto: testmgr -... |
1954 |
break; |
69435b94d crypto: rfc4106 -... |
1955 1956 1957 |
case 151: ret += tcrypt_test("rfc4106(gcm(aes))"); break; |
e9b7441a9 crypto: testmgr -... |
1958 1959 1960 |
case 152: ret += tcrypt_test("rfc4543(gcm(aes))"); break; |
93b5e86a6 crypto: add CMAC ... |
1961 1962 1963 1964 1965 1966 1967 |
case 153: ret += tcrypt_test("cmac(aes)"); break; case 154: ret += tcrypt_test("cmac(des3_ede)"); break; |
bbf9c8934 crypto: caam - fi... |
1968 1969 1970 |
case 155: ret += tcrypt_test("authenc(hmac(sha1),cbc(aes))"); break; |
bca4feb0d crypto: testmgr -... |
1971 1972 1973 1974 1975 1976 1977 |
case 156: ret += tcrypt_test("authenc(hmac(md5),ecb(cipher_null))"); break; case 157: ret += tcrypt_test("authenc(hmac(sha1),ecb(cipher_null))"); break; |
5208ed2ca crypto: testmgr -... |
1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 |
case 181: ret += tcrypt_test("authenc(hmac(sha1),cbc(des))"); break; case 182: ret += tcrypt_test("authenc(hmac(sha1),cbc(des3_ede))"); break; case 183: ret += tcrypt_test("authenc(hmac(sha224),cbc(des))"); break; case 184: ret += tcrypt_test("authenc(hmac(sha224),cbc(des3_ede))"); break; case 185: ret += tcrypt_test("authenc(hmac(sha256),cbc(des))"); break; case 186: ret += tcrypt_test("authenc(hmac(sha256),cbc(des3_ede))"); break; case 187: ret += tcrypt_test("authenc(hmac(sha384),cbc(des))"); break; case 188: ret += tcrypt_test("authenc(hmac(sha384),cbc(des3_ede))"); break; case 189: ret += tcrypt_test("authenc(hmac(sha512),cbc(des))"); break; case 190: ret += tcrypt_test("authenc(hmac(sha512),cbc(des3_ede))"); break; |
cd83a8a7c crypto: testmgr -... |
2008 2009 2010 |
case 191: ret += tcrypt_test("ecb(sm4)"); break; |
ebfd9bcf1 [CRYPTO]: Add cip... |
2011 |
case 200: |
cba83564d [CRYPTO] tcrypt: ... |
2012 |
test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2013 |
speed_template_16_24_32); |
cba83564d [CRYPTO] tcrypt: ... |
2014 |
test_cipher_speed("ecb(aes)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2015 |
speed_template_16_24_32); |
cba83564d [CRYPTO] tcrypt: ... |
2016 |
test_cipher_speed("cbc(aes)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2017 |
speed_template_16_24_32); |
cba83564d [CRYPTO] tcrypt: ... |
2018 |
test_cipher_speed("cbc(aes)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2019 |
speed_template_16_24_32); |
f3d1044cd [CRYPTO] tcrypt: ... |
2020 |
test_cipher_speed("lrw(aes)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2021 |
speed_template_32_40_48); |
f3d1044cd [CRYPTO] tcrypt: ... |
2022 |
test_cipher_speed("lrw(aes)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2023 |
speed_template_32_40_48); |
f19f5111c [CRYPTO] xts: XTS... |
2024 |
test_cipher_speed("xts(aes)", ENCRYPT, sec, NULL, 0, |
b66ad0b7a crypto: tcrypt - ... |
2025 |
speed_template_32_64); |
f19f5111c [CRYPTO] xts: XTS... |
2026 |
test_cipher_speed("xts(aes)", DECRYPT, sec, NULL, 0, |
b66ad0b7a crypto: tcrypt - ... |
2027 |
speed_template_32_64); |
1503a24f5 crypto: tcrypt - ... |
2028 2029 2030 2031 |
test_cipher_speed("cts(cbc(aes))", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_cipher_speed("cts(cbc(aes))", DECRYPT, sec, NULL, 0, speed_template_16_24_32); |
9996e3421 crypto: tcrypt - ... |
2032 2033 2034 2035 |
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); |
d8e4b24ff crypto: testmgr -... |
2036 2037 2038 2039 |
test_cipher_speed("cfb(aes)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_cipher_speed("cfb(aes)", DECRYPT, sec, NULL, 0, speed_template_16_24_32); |
ebfd9bcf1 [CRYPTO]: Add cip... |
2040 2041 2042 |
break; case 201: |
cba83564d [CRYPTO] tcrypt: ... |
2043 |
test_cipher_speed("ecb(des3_ede)", ENCRYPT, sec, |
da7f033dd crypto: cryptomgr... |
2044 |
des3_speed_template, DES3_SPEED_VECTORS, |
477035c2a [CRYPTO] tcrypt: ... |
2045 |
speed_template_24); |
cba83564d [CRYPTO] tcrypt: ... |
2046 |
test_cipher_speed("ecb(des3_ede)", DECRYPT, sec, |
da7f033dd crypto: cryptomgr... |
2047 |
des3_speed_template, DES3_SPEED_VECTORS, |
477035c2a [CRYPTO] tcrypt: ... |
2048 |
speed_template_24); |
cba83564d [CRYPTO] tcrypt: ... |
2049 |
test_cipher_speed("cbc(des3_ede)", ENCRYPT, sec, |
da7f033dd crypto: cryptomgr... |
2050 |
des3_speed_template, DES3_SPEED_VECTORS, |
477035c2a [CRYPTO] tcrypt: ... |
2051 |
speed_template_24); |
cba83564d [CRYPTO] tcrypt: ... |
2052 |
test_cipher_speed("cbc(des3_ede)", DECRYPT, sec, |
da7f033dd crypto: cryptomgr... |
2053 |
des3_speed_template, DES3_SPEED_VECTORS, |
477035c2a [CRYPTO] tcrypt: ... |
2054 |
speed_template_24); |
87131507e crypto: tcrypt - ... |
2055 2056 2057 2058 2059 2060 |
test_cipher_speed("ctr(des3_ede)", ENCRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24); test_cipher_speed("ctr(des3_ede)", DECRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24); |
ebfd9bcf1 [CRYPTO]: Add cip... |
2061 2062 2063 |
break; case 202: |
cba83564d [CRYPTO] tcrypt: ... |
2064 |
test_cipher_speed("ecb(twofish)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2065 |
speed_template_16_24_32); |
cba83564d [CRYPTO] tcrypt: ... |
2066 |
test_cipher_speed("ecb(twofish)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2067 |
speed_template_16_24_32); |
cba83564d [CRYPTO] tcrypt: ... |
2068 |
test_cipher_speed("cbc(twofish)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2069 |
speed_template_16_24_32); |
cba83564d [CRYPTO] tcrypt: ... |
2070 |
test_cipher_speed("cbc(twofish)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2071 |
speed_template_16_24_32); |
ee5002a54 crypto: tcrypt - ... |
2072 2073 2074 2075 |
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 - ... |
2076 2077 2078 2079 |
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 - ... |
2080 2081 2082 2083 |
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... |
2084 2085 2086 |
break; case 203: |
cba83564d [CRYPTO] tcrypt: ... |
2087 |
test_cipher_speed("ecb(blowfish)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2088 |
speed_template_8_32); |
cba83564d [CRYPTO] tcrypt: ... |
2089 |
test_cipher_speed("ecb(blowfish)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2090 |
speed_template_8_32); |
cba83564d [CRYPTO] tcrypt: ... |
2091 |
test_cipher_speed("cbc(blowfish)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2092 |
speed_template_8_32); |
cba83564d [CRYPTO] tcrypt: ... |
2093 |
test_cipher_speed("cbc(blowfish)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2094 |
speed_template_8_32); |
7d47b86cf crypto: tcrypt - ... |
2095 2096 2097 2098 |
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... |
2099 2100 2101 |
break; case 204: |
cba83564d [CRYPTO] tcrypt: ... |
2102 |
test_cipher_speed("ecb(des)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2103 |
speed_template_8); |
cba83564d [CRYPTO] tcrypt: ... |
2104 |
test_cipher_speed("ecb(des)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2105 |
speed_template_8); |
cba83564d [CRYPTO] tcrypt: ... |
2106 |
test_cipher_speed("cbc(des)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2107 |
speed_template_8); |
cba83564d [CRYPTO] tcrypt: ... |
2108 |
test_cipher_speed("cbc(des)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2109 |
speed_template_8); |
ebfd9bcf1 [CRYPTO]: Add cip... |
2110 |
break; |
02ab5a705 [CRYPTO] camellia... |
2111 2112 |
case 205: test_cipher_speed("ecb(camellia)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2113 |
speed_template_16_24_32); |
02ab5a705 [CRYPTO] camellia... |
2114 |
test_cipher_speed("ecb(camellia)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2115 |
speed_template_16_24_32); |
02ab5a705 [CRYPTO] camellia... |
2116 |
test_cipher_speed("cbc(camellia)", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2117 |
speed_template_16_24_32); |
02ab5a705 [CRYPTO] camellia... |
2118 |
test_cipher_speed("cbc(camellia)", DECRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2119 |
speed_template_16_24_32); |
4de593378 crypto: tcrypt - ... |
2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 |
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... |
2132 |
break; |
5de8f1b56 [CRYPTO] tcrypt: ... |
2133 2134 |
case 206: test_cipher_speed("salsa20", ENCRYPT, sec, NULL, 0, |
477035c2a [CRYPTO] tcrypt: ... |
2135 |
speed_template_16_32); |
5de8f1b56 [CRYPTO] tcrypt: ... |
2136 |
break; |
7fb7fe446 crypto: tcrypt - ... |
2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 |
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 - ... |
2150 2151 2152 2153 |
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 - ... |
2154 2155 2156 2157 |
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 - ... |
2158 |
break; |
31b4cd290 crypto: testmgr -... |
2159 2160 2161 2162 |
case 208: test_cipher_speed("ecb(arc4)", ENCRYPT, sec, NULL, 0, speed_template_8); break; |
a2c582609 crypto: testmgr -... |
2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 |
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 -... |
2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 |
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; |
53f52d7ae crypto: tcrypt - ... |
2199 2200 |
case 211: test_aead_speed("rfc4106(gcm(aes))", ENCRYPT, sec, |
34a1c740e crypto: tcrypt - ... |
2201 |
NULL, 0, 16, 16, aead_speed_template_20); |
1425d2d17 crypto: tcrypt - ... |
2202 |
test_aead_speed("gcm(aes)", ENCRYPT, sec, |
f18611da8 crypto: tcrypt - ... |
2203 |
NULL, 0, 16, 8, speed_template_16_24_32); |
4431bd495 crypto: tcrypt - ... |
2204 2205 2206 2207 |
test_aead_speed("rfc4106(gcm(aes))", DECRYPT, sec, NULL, 0, 16, 16, aead_speed_template_20); test_aead_speed("gcm(aes)", DECRYPT, sec, NULL, 0, 16, 8, speed_template_16_24_32); |
53f52d7ae crypto: tcrypt - ... |
2208 |
break; |
4e4aab63d crypto: tcrypt - ... |
2209 2210 |
case 212: test_aead_speed("rfc4309(ccm(aes))", ENCRYPT, sec, |
34a1c740e crypto: tcrypt - ... |
2211 |
NULL, 0, 16, 16, aead_speed_template_19); |
4431bd495 crypto: tcrypt - ... |
2212 2213 |
test_aead_speed("rfc4309(ccm(aes))", DECRYPT, sec, NULL, 0, 16, 16, aead_speed_template_19); |
4e4aab63d crypto: tcrypt - ... |
2214 |
break; |
2dce063a3 crypto: tcrypt - ... |
2215 2216 2217 |
case 213: test_aead_speed("rfc7539esp(chacha20,poly1305)", ENCRYPT, sec, NULL, 0, 16, 8, aead_speed_template_36); |
4431bd495 crypto: tcrypt - ... |
2218 2219 |
test_aead_speed("rfc7539esp(chacha20,poly1305)", DECRYPT, sec, NULL, 0, 16, 8, aead_speed_template_36); |
2dce063a3 crypto: tcrypt - ... |
2220 2221 2222 2223 2224 2225 |
break; case 214: test_cipher_speed("chacha20", ENCRYPT, sec, NULL, 0, speed_template_32); break; |
427988d98 crypto: tcrypt - ... |
2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 |
case 215: test_mb_aead_speed("rfc4106(gcm(aes))", ENCRYPT, sec, NULL, 0, 16, 16, aead_speed_template_20, num_mb); test_mb_aead_speed("gcm(aes)", ENCRYPT, sec, NULL, 0, 16, 8, speed_template_16_24_32, num_mb); test_mb_aead_speed("rfc4106(gcm(aes))", DECRYPT, sec, NULL, 0, 16, 16, aead_speed_template_20, num_mb); test_mb_aead_speed("gcm(aes)", DECRYPT, sec, NULL, 0, 16, 8, speed_template_16_24_32, num_mb); break; case 216: test_mb_aead_speed("rfc4309(ccm(aes))", ENCRYPT, sec, NULL, 0, 16, 16, aead_speed_template_19, num_mb); test_mb_aead_speed("rfc4309(ccm(aes))", DECRYPT, sec, NULL, 0, 16, 16, aead_speed_template_19, num_mb); break; case 217: test_mb_aead_speed("rfc7539esp(chacha20,poly1305)", ENCRYPT, sec, NULL, 0, 16, 8, aead_speed_template_36, num_mb); test_mb_aead_speed("rfc7539esp(chacha20,poly1305)", DECRYPT, sec, NULL, 0, 16, 8, aead_speed_template_36, num_mb); break; |
e80579285 [CRYPTO] tcrypt: ... |
2252 |
case 300: |
8606813a6 crypto: tcrypt - ... |
2253 2254 2255 2256 |
if (alg) { test_hash_speed(alg, sec, generic_hash_speed_template); break; } |
e80579285 [CRYPTO] tcrypt: ... |
2257 |
/* fall through */ |
e80579285 [CRYPTO] tcrypt: ... |
2258 |
case 301: |
e9d41164e [CRYPTO] tcrypt: ... |
2259 |
test_hash_speed("md4", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
2260 |
if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2261 |
/* fall through */ |
e80579285 [CRYPTO] tcrypt: ... |
2262 |
case 302: |
e9d41164e [CRYPTO] tcrypt: ... |
2263 |
test_hash_speed("md5", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
2264 |
if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2265 |
/* fall through */ |
e80579285 [CRYPTO] tcrypt: ... |
2266 |
case 303: |
e9d41164e [CRYPTO] tcrypt: ... |
2267 |
test_hash_speed("sha1", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
2268 |
if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2269 |
/* fall through */ |
e80579285 [CRYPTO] tcrypt: ... |
2270 |
case 304: |
e9d41164e [CRYPTO] tcrypt: ... |
2271 |
test_hash_speed("sha256", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
2272 |
if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2273 |
/* fall through */ |
e80579285 [CRYPTO] tcrypt: ... |
2274 |
case 305: |
e9d41164e [CRYPTO] tcrypt: ... |
2275 |
test_hash_speed("sha384", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
2276 |
if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2277 |
/* fall through */ |
e80579285 [CRYPTO] tcrypt: ... |
2278 |
case 306: |
e9d41164e [CRYPTO] tcrypt: ... |
2279 |
test_hash_speed("sha512", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
2280 |
if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2281 |
/* fall through */ |
e80579285 [CRYPTO] tcrypt: ... |
2282 |
case 307: |
e9d41164e [CRYPTO] tcrypt: ... |
2283 |
test_hash_speed("wp256", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
2284 |
if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2285 |
/* fall through */ |
e80579285 [CRYPTO] tcrypt: ... |
2286 |
case 308: |
e9d41164e [CRYPTO] tcrypt: ... |
2287 |
test_hash_speed("wp384", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
2288 |
if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2289 |
/* fall through */ |
e80579285 [CRYPTO] tcrypt: ... |
2290 |
case 309: |
e9d41164e [CRYPTO] tcrypt: ... |
2291 |
test_hash_speed("wp512", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
2292 |
if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2293 |
/* fall through */ |
e80579285 [CRYPTO] tcrypt: ... |
2294 |
case 310: |
e9d41164e [CRYPTO] tcrypt: ... |
2295 |
test_hash_speed("tgr128", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
2296 |
if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2297 |
/* fall through */ |
e80579285 [CRYPTO] tcrypt: ... |
2298 |
case 311: |
e9d41164e [CRYPTO] tcrypt: ... |
2299 |
test_hash_speed("tgr160", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
2300 |
if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2301 |
/* fall through */ |
e80579285 [CRYPTO] tcrypt: ... |
2302 |
case 312: |
e9d41164e [CRYPTO] tcrypt: ... |
2303 |
test_hash_speed("tgr192", sec, generic_hash_speed_template); |
e80579285 [CRYPTO] tcrypt: ... |
2304 |
if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2305 |
/* fall through */ |
cd12fb906 [CRYPTO] sha256-g... |
2306 2307 2308 |
case 313: test_hash_speed("sha224", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2309 |
/* fall through */ |
fd4adf1a0 [CRYPTO] tcrypt: ... |
2310 2311 2312 |
case 314: test_hash_speed("rmd128", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2313 |
/* fall through */ |
fd4adf1a0 [CRYPTO] tcrypt: ... |
2314 2315 2316 |
case 315: test_hash_speed("rmd160", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2317 |
/* fall through */ |
2998db37b [CRYPTO] tcrypt: ... |
2318 2319 2320 |
case 316: test_hash_speed("rmd256", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2321 |
/* fall through */ |
2998db37b [CRYPTO] tcrypt: ... |
2322 2323 2324 |
case 317: test_hash_speed("rmd320", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2325 |
/* fall through */ |
18bcc9194 crypto: tcrypt - ... |
2326 2327 2328 |
case 318: test_hash_speed("ghash-generic", sec, hash_speed_template_16); if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2329 |
/* fall through */ |
e3899e4df crypto: tcrypt - ... |
2330 2331 2332 |
case 319: test_hash_speed("crc32c", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2333 |
/* fall through */ |
68411521c Reinstate "crypto... |
2334 2335 2336 |
case 320: test_hash_speed("crct10dif", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2337 |
/* fall through */ |
2dce063a3 crypto: tcrypt - ... |
2338 2339 2340 |
case 321: test_hash_speed("poly1305", sec, poly1305_speed_template); if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2341 |
/* fall through */ |
79cc6ab89 crypto: sha3 - Ad... |
2342 2343 2344 |
case 322: test_hash_speed("sha3-224", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2345 |
/* fall through */ |
79cc6ab89 crypto: sha3 - Ad... |
2346 2347 2348 |
case 323: test_hash_speed("sha3-256", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2349 |
/* fall through */ |
79cc6ab89 crypto: sha3 - Ad... |
2350 2351 2352 |
case 324: test_hash_speed("sha3-384", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2353 |
/* fall through */ |
79cc6ab89 crypto: sha3 - Ad... |
2354 2355 2356 |
case 325: test_hash_speed("sha3-512", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2357 |
/* fall through */ |
b7e275304 crypto: sm3 - add... |
2358 2359 2360 |
case 326: test_hash_speed("sm3", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; |
59517226a crypto: tcrypt - ... |
2361 |
/* fall through */ |
e80579285 [CRYPTO] tcrypt: ... |
2362 2363 |
case 399: break; |
beb63da73 crypto: tcrypt - ... |
2364 |
case 400: |
8606813a6 crypto: tcrypt - ... |
2365 2366 2367 2368 |
if (alg) { test_ahash_speed(alg, sec, generic_hash_speed_template); break; } |
beb63da73 crypto: tcrypt - ... |
2369 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2370 2371 2372 |
case 401: test_ahash_speed("md4", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2373 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2374 2375 2376 |
case 402: test_ahash_speed("md5", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2377 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2378 2379 2380 |
case 403: test_ahash_speed("sha1", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2381 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2382 2383 2384 |
case 404: test_ahash_speed("sha256", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2385 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2386 2387 2388 |
case 405: test_ahash_speed("sha384", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2389 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2390 2391 2392 |
case 406: test_ahash_speed("sha512", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2393 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2394 2395 2396 |
case 407: test_ahash_speed("wp256", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2397 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2398 2399 2400 |
case 408: test_ahash_speed("wp384", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2401 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2402 2403 2404 |
case 409: test_ahash_speed("wp512", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2405 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2406 2407 2408 |
case 410: test_ahash_speed("tgr128", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2409 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2410 2411 2412 |
case 411: test_ahash_speed("tgr160", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2413 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2414 2415 2416 |
case 412: test_ahash_speed("tgr192", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2417 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2418 2419 2420 |
case 413: test_ahash_speed("sha224", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2421 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2422 2423 2424 |
case 414: test_ahash_speed("rmd128", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2425 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2426 2427 2428 |
case 415: test_ahash_speed("rmd160", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2429 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2430 2431 2432 |
case 416: test_ahash_speed("rmd256", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2433 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2434 2435 2436 |
case 417: test_ahash_speed("rmd320", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2437 |
/* fall through */ |
79cc6ab89 crypto: sha3 - Ad... |
2438 2439 2440 |
case 418: test_ahash_speed("sha3-224", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2441 |
/* fall through */ |
79cc6ab89 crypto: sha3 - Ad... |
2442 2443 2444 |
case 419: test_ahash_speed("sha3-256", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2445 |
/* fall through */ |
79cc6ab89 crypto: sha3 - Ad... |
2446 2447 2448 |
case 420: test_ahash_speed("sha3-384", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2449 |
/* fall through */ |
79cc6ab89 crypto: sha3 - Ad... |
2450 2451 2452 |
case 421: test_ahash_speed("sha3-512", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2453 |
/* fall through */ |
087bcd225 crypto: tcrypt - ... |
2454 |
case 422: |
8fcdc8685 crypto: tcrypt - ... |
2455 2456 |
test_mb_ahash_speed("sha1", sec, generic_hash_speed_template, num_mb); |
087bcd225 crypto: tcrypt - ... |
2457 |
if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2458 |
/* fall through */ |
087bcd225 crypto: tcrypt - ... |
2459 |
case 423: |
8fcdc8685 crypto: tcrypt - ... |
2460 2461 |
test_mb_ahash_speed("sha256", sec, generic_hash_speed_template, num_mb); |
087bcd225 crypto: tcrypt - ... |
2462 |
if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2463 |
/* fall through */ |
14009c4bd crypto: tcrypt - ... |
2464 |
case 424: |
8fcdc8685 crypto: tcrypt - ... |
2465 2466 |
test_mb_ahash_speed("sha512", sec, generic_hash_speed_template, num_mb); |
14009c4bd crypto: tcrypt - ... |
2467 |
if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2468 |
/* fall through */ |
b7e275304 crypto: sm3 - add... |
2469 |
case 425: |
8fcdc8685 crypto: tcrypt - ... |
2470 2471 |
test_mb_ahash_speed("sm3", sec, generic_hash_speed_template, num_mb); |
b7e275304 crypto: sm3 - add... |
2472 |
if (mode > 400 && mode < 500) break; |
59517226a crypto: tcrypt - ... |
2473 |
/* fall through */ |
beb63da73 crypto: tcrypt - ... |
2474 2475 |
case 499: break; |
3f3baf359 crypto: tcrypt - ... |
2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 |
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, |
b66ad0b7a crypto: tcrypt - ... |
2490 |
speed_template_32_64); |
3f3baf359 crypto: tcrypt - ... |
2491 |
test_acipher_speed("xts(aes)", DECRYPT, sec, NULL, 0, |
b66ad0b7a crypto: tcrypt - ... |
2492 |
speed_template_32_64); |
1503a24f5 crypto: tcrypt - ... |
2493 2494 2495 2496 |
test_acipher_speed("cts(cbc(aes))", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("cts(cbc(aes))", DECRYPT, sec, NULL, 0, speed_template_16_24_32); |
3f3baf359 crypto: tcrypt - ... |
2497 2498 2499 2500 |
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... |
2501 2502 2503 2504 2505 2506 2507 2508 |
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... |
2509 2510 2511 2512 |
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 - ... |
2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 |
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... |
2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 |
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 - ... |
2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 |
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... |
2551 2552 2553 2554 2555 2556 2557 2558 |
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 - ... |
2559 |
break; |
7fb7fe446 crypto: tcrypt - ... |
2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 |
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 - ... |
2573 2574 2575 2576 |
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 - ... |
2577 2578 2579 2580 |
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 - ... |
2581 |
break; |
107778b59 crypto: twofish -... |
2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 |
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 -... |
2604 2605 2606 2607 |
case 505: test_acipher_speed("ecb(arc4)", ENCRYPT, sec, NULL, 0, speed_template_8); break; |
a2c582609 crypto: testmgr -... |
2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 |
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 -... |
2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 |
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 - ... |
2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 |
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 - ... |
2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 |
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; |
e161c5930 crypto: tcrypt - ... |
2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 |
case 600: test_mb_skcipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("ecb(aes)", DECRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("cbc(aes)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("cbc(aes)", DECRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("lrw(aes)", ENCRYPT, sec, NULL, 0, speed_template_32_40_48, num_mb); test_mb_skcipher_speed("lrw(aes)", DECRYPT, sec, NULL, 0, speed_template_32_40_48, num_mb); test_mb_skcipher_speed("xts(aes)", ENCRYPT, sec, NULL, 0, speed_template_32_64, num_mb); test_mb_skcipher_speed("xts(aes)", DECRYPT, sec, NULL, 0, speed_template_32_64, num_mb); test_mb_skcipher_speed("cts(cbc(aes))", ENCRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("cts(cbc(aes))", DECRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("ctr(aes)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("ctr(aes)", DECRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("cfb(aes)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("cfb(aes)", DECRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("ofb(aes)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("ofb(aes)", DECRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("rfc3686(ctr(aes))", ENCRYPT, sec, NULL, 0, speed_template_20_28_36, num_mb); test_mb_skcipher_speed("rfc3686(ctr(aes))", DECRYPT, sec, NULL, 0, speed_template_20_28_36, num_mb); break; case 601: test_mb_skcipher_speed("ecb(des3_ede)", ENCRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24, num_mb); test_mb_skcipher_speed("ecb(des3_ede)", DECRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24, num_mb); test_mb_skcipher_speed("cbc(des3_ede)", ENCRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24, num_mb); test_mb_skcipher_speed("cbc(des3_ede)", DECRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24, num_mb); test_mb_skcipher_speed("cfb(des3_ede)", ENCRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24, num_mb); test_mb_skcipher_speed("cfb(des3_ede)", DECRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24, num_mb); test_mb_skcipher_speed("ofb(des3_ede)", ENCRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24, num_mb); test_mb_skcipher_speed("ofb(des3_ede)", DECRYPT, sec, des3_speed_template, DES3_SPEED_VECTORS, speed_template_24, num_mb); break; case 602: test_mb_skcipher_speed("ecb(des)", ENCRYPT, sec, NULL, 0, speed_template_8, num_mb); test_mb_skcipher_speed("ecb(des)", DECRYPT, sec, NULL, 0, speed_template_8, num_mb); test_mb_skcipher_speed("cbc(des)", ENCRYPT, sec, NULL, 0, speed_template_8, num_mb); test_mb_skcipher_speed("cbc(des)", DECRYPT, sec, NULL, 0, speed_template_8, num_mb); test_mb_skcipher_speed("cfb(des)", ENCRYPT, sec, NULL, 0, speed_template_8, num_mb); test_mb_skcipher_speed("cfb(des)", DECRYPT, sec, NULL, 0, speed_template_8, num_mb); test_mb_skcipher_speed("ofb(des)", ENCRYPT, sec, NULL, 0, speed_template_8, num_mb); test_mb_skcipher_speed("ofb(des)", DECRYPT, sec, NULL, 0, speed_template_8, num_mb); break; case 603: test_mb_skcipher_speed("ecb(serpent)", ENCRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("ecb(serpent)", DECRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("cbc(serpent)", ENCRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("cbc(serpent)", DECRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("ctr(serpent)", ENCRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("ctr(serpent)", DECRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("lrw(serpent)", ENCRYPT, sec, NULL, 0, speed_template_32_48, num_mb); test_mb_skcipher_speed("lrw(serpent)", DECRYPT, sec, NULL, 0, speed_template_32_48, num_mb); test_mb_skcipher_speed("xts(serpent)", ENCRYPT, sec, NULL, 0, speed_template_32_64, num_mb); test_mb_skcipher_speed("xts(serpent)", DECRYPT, sec, NULL, 0, speed_template_32_64, num_mb); break; case 604: test_mb_skcipher_speed("ecb(twofish)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("ecb(twofish)", DECRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("cbc(twofish)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("cbc(twofish)", DECRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("ctr(twofish)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("ctr(twofish)", DECRYPT, sec, NULL, 0, speed_template_16_24_32, num_mb); test_mb_skcipher_speed("lrw(twofish)", ENCRYPT, sec, NULL, 0, speed_template_32_40_48, num_mb); test_mb_skcipher_speed("lrw(twofish)", DECRYPT, sec, NULL, 0, speed_template_32_40_48, num_mb); test_mb_skcipher_speed("xts(twofish)", ENCRYPT, sec, NULL, 0, speed_template_32_48_64, num_mb); test_mb_skcipher_speed("xts(twofish)", DECRYPT, sec, NULL, 0, speed_template_32_48_64, num_mb); break; case 605: test_mb_skcipher_speed("ecb(arc4)", ENCRYPT, sec, NULL, 0, speed_template_8, num_mb); break; case 606: test_mb_skcipher_speed("ecb(cast5)", ENCRYPT, sec, NULL, 0, speed_template_8_16, num_mb); test_mb_skcipher_speed("ecb(cast5)", DECRYPT, sec, NULL, 0, speed_template_8_16, num_mb); test_mb_skcipher_speed("cbc(cast5)", ENCRYPT, sec, NULL, 0, speed_template_8_16, num_mb); test_mb_skcipher_speed("cbc(cast5)", DECRYPT, sec, NULL, 0, speed_template_8_16, num_mb); test_mb_skcipher_speed("ctr(cast5)", ENCRYPT, sec, NULL, 0, speed_template_8_16, num_mb); test_mb_skcipher_speed("ctr(cast5)", DECRYPT, sec, NULL, 0, speed_template_8_16, num_mb); break; case 607: test_mb_skcipher_speed("ecb(cast6)", ENCRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("ecb(cast6)", DECRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("cbc(cast6)", ENCRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("cbc(cast6)", DECRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("ctr(cast6)", ENCRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("ctr(cast6)", DECRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("lrw(cast6)", ENCRYPT, sec, NULL, 0, speed_template_32_48, num_mb); test_mb_skcipher_speed("lrw(cast6)", DECRYPT, sec, NULL, 0, speed_template_32_48, num_mb); test_mb_skcipher_speed("xts(cast6)", ENCRYPT, sec, NULL, 0, speed_template_32_64, num_mb); test_mb_skcipher_speed("xts(cast6)", DECRYPT, sec, NULL, 0, speed_template_32_64, num_mb); break; case 608: test_mb_skcipher_speed("ecb(camellia)", ENCRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("ecb(camellia)", DECRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("cbc(camellia)", ENCRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("cbc(camellia)", DECRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("ctr(camellia)", ENCRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("ctr(camellia)", DECRYPT, sec, NULL, 0, speed_template_16_32, num_mb); test_mb_skcipher_speed("lrw(camellia)", ENCRYPT, sec, NULL, 0, speed_template_32_48, num_mb); test_mb_skcipher_speed("lrw(camellia)", DECRYPT, sec, NULL, 0, speed_template_32_48, num_mb); test_mb_skcipher_speed("xts(camellia)", ENCRYPT, sec, NULL, 0, speed_template_32_64, num_mb); test_mb_skcipher_speed("xts(camellia)", DECRYPT, sec, NULL, 0, speed_template_32_64, num_mb); break; case 609: test_mb_skcipher_speed("ecb(blowfish)", ENCRYPT, sec, NULL, 0, speed_template_8_32, num_mb); test_mb_skcipher_speed("ecb(blowfish)", DECRYPT, sec, NULL, 0, speed_template_8_32, num_mb); test_mb_skcipher_speed("cbc(blowfish)", ENCRYPT, sec, NULL, 0, speed_template_8_32, num_mb); test_mb_skcipher_speed("cbc(blowfish)", DECRYPT, sec, NULL, 0, speed_template_8_32, num_mb); test_mb_skcipher_speed("ctr(blowfish)", ENCRYPT, sec, NULL, 0, speed_template_8_32, num_mb); test_mb_skcipher_speed("ctr(blowfish)", DECRYPT, sec, NULL, 0, speed_template_8_32, num_mb); break; |
1da177e4c Linux-2.6.12-rc2 |
2891 2892 2893 |
case 1000: test_available(); break; |
1da177e4c Linux-2.6.12-rc2 |
2894 |
} |
4e033a6bc crypto: tcrypt - ... |
2895 2896 |
return ret; |
1da177e4c Linux-2.6.12-rc2 |
2897 |
} |
3af5b90bd [CRYPTO] all: Cle... |
2898 |
static int __init tcrypt_mod_init(void) |
1da177e4c Linux-2.6.12-rc2 |
2899 |
{ |
e3a4ea4fd [CRYPTO] tcrypt: ... |
2900 |
int err = -ENOMEM; |
f139cfa7c crypto: tcrypt - ... |
2901 |
int i; |
e3a4ea4fd [CRYPTO] tcrypt: ... |
2902 |
|
f139cfa7c crypto: tcrypt - ... |
2903 2904 2905 2906 2907 |
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 |
2908 |
|
4e234eed5 crypto: tcrypt - ... |
2909 |
err = do_test(alg, type, mask, mode, num_mb); |
a873a5f1c crypto: tcrypt - ... |
2910 |
|
4e033a6bc crypto: tcrypt - ... |
2911 2912 2913 2914 |
if (err) { printk(KERN_ERR "tcrypt: one or more tests failed! "); goto err_free_tv; |
76512f2d8 crypto: tcrypt - ... |
2915 2916 2917 |
} else { pr_debug("all tests passed "); |
4e033a6bc crypto: tcrypt - ... |
2918 |
} |
14fdf477a [CRYPTO] tcrypt: ... |
2919 |
|
4e033a6bc crypto: tcrypt - ... |
2920 2921 2922 2923 |
/* 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: ... |
2924 2925 2926 |
* => we don't need it in the memory, do we? * -- mludvig */ |
4e033a6bc crypto: tcrypt - ... |
2927 2928 |
if (!fips_enabled) err = -EAGAIN; |
e3a4ea4fd [CRYPTO] tcrypt: ... |
2929 |
|
f139cfa7c crypto: tcrypt - ... |
2930 2931 2932 |
err_free_tv: for (i = 0; i < TVMEMSIZE && tvmem[i]; i++) free_page((unsigned long)tvmem[i]); |
e3a4ea4fd [CRYPTO] tcrypt: ... |
2933 2934 |
return err; |
1da177e4c Linux-2.6.12-rc2 |
2935 2936 2937 2938 2939 2940 |
} /* * If an init function is provided, an exit function must also be provided * to allow module unload. */ |
3af5b90bd [CRYPTO] all: Cle... |
2941 |
static void __exit tcrypt_mod_fini(void) { } |
1da177e4c Linux-2.6.12-rc2 |
2942 |
|
3af5b90bd [CRYPTO] all: Cle... |
2943 2944 |
module_init(tcrypt_mod_init); module_exit(tcrypt_mod_fini); |
1da177e4c Linux-2.6.12-rc2 |
2945 |
|
a873a5f1c crypto: tcrypt - ... |
2946 2947 |
module_param(alg, charp, 0); module_param(type, uint, 0); |
7be380f72 crypto: tcrypt - ... |
2948 |
module_param(mask, uint, 0); |
1da177e4c Linux-2.6.12-rc2 |
2949 |
module_param(mode, int, 0); |
ebfd9bcf1 [CRYPTO]: Add cip... |
2950 |
module_param(sec, uint, 0); |
6a17944ca [CRYPTO]: Use CPU... |
2951 2952 |
MODULE_PARM_DESC(sec, "Length in seconds of speed tests " "(defaults to zero which uses CPU cycles instead)"); |
8fcdc8685 crypto: tcrypt - ... |
2953 2954 |
module_param(num_mb, uint, 0000); MODULE_PARM_DESC(num_mb, "Number of concurrent requests to be used in mb speed tests (defaults to 8)"); |
1da177e4c Linux-2.6.12-rc2 |
2955 2956 2957 2958 |
MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Quick & dirty crypto testing module"); MODULE_AUTHOR("James Morris <jmorris@intercode.com.au>"); |