2019-05-27 09:55:01 +03:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2005-06-23 00:26:03 +04:00
|
|
|
/*
|
2005-04-17 02:20:36 +04:00
|
|
|
* 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>
|
2007-11-26 17:12:07 +03:00
|
|
|
* Copyright (c) 2007 Nokia Siemens Networks
|
2005-04-17 02:20:36 +04:00
|
|
|
*
|
2010-11-04 22:02:04 +03:00
|
|
|
* 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.
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
|
|
|
|
2017-01-18 16:54:05 +03:00
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
|
|
|
2015-04-22 10:06:30 +03:00
|
|
|
#include <crypto/aead.h>
|
2008-07-10 12:01:22 +04:00
|
|
|
#include <crypto/hash.h>
|
2016-06-29 13:03:50 +03:00
|
|
|
#include <crypto/skcipher.h>
|
2006-08-13 02:26:09 +04:00
|
|
|
#include <linux/err.h>
|
2015-04-22 08:25:57 +03:00
|
|
|
#include <linux/fips.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <linux/init.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 11:04:11 +03:00
|
|
|
#include <linux/gfp.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <linux/module.h>
|
2005-09-17 11:55:31 +04:00
|
|
|
#include <linux/scatterlist.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/moduleparam.h>
|
2005-06-23 00:27:23 +04:00
|
|
|
#include <linux/jiffies.h>
|
2005-06-23 00:29:03 +04:00
|
|
|
#include <linux/timex.h>
|
|
|
|
#include <linux/interrupt.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include "tcrypt.h"
|
|
|
|
|
|
|
|
/*
|
2008-07-31 08:23:53 +04:00
|
|
|
* Need slab memory for testing (size in number of pages).
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
2008-07-31 08:23:53 +04:00
|
|
|
#define TVMEMSIZE 4
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/*
|
2008-07-31 13:08:25 +04:00
|
|
|
* Used by test_cipher_speed()
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
|
|
|
#define ENCRYPT 1
|
|
|
|
#define DECRYPT 0
|
|
|
|
|
2015-08-27 18:38:36 +03:00
|
|
|
#define MAX_DIGEST_SIZE 64
|
|
|
|
|
2014-06-26 09:57:42 +04:00
|
|
|
/*
|
|
|
|
* return a string with the driver name
|
|
|
|
*/
|
|
|
|
#define get_driver_name(tfm_type, tfm) crypto_tfm_alg_driver_name(tfm_type ## _tfm(tfm))
|
|
|
|
|
2005-06-23 00:27:23 +04:00
|
|
|
/*
|
|
|
|
* Used by test_cipher_speed()
|
|
|
|
*/
|
2005-06-23 00:29:03 +04:00
|
|
|
static unsigned int sec;
|
2005-06-23 00:27:23 +04:00
|
|
|
|
2009-06-19 15:46:53 +04:00
|
|
|
static char *alg = NULL;
|
|
|
|
static u32 type;
|
2009-07-14 12:06:54 +04:00
|
|
|
static u32 mask;
|
2005-04-17 02:20:36 +04:00
|
|
|
static int mode;
|
2017-12-17 11:29:02 +03:00
|
|
|
static u32 num_mb = 8;
|
2020-08-05 08:57:08 +03:00
|
|
|
static unsigned int klen;
|
2008-07-31 08:23:53 +04:00
|
|
|
static char *tvmem[TVMEMSIZE];
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2019-11-08 18:42:13 +03:00
|
|
|
static const char *check[] = {
|
2017-08-21 13:51:29 +03:00
|
|
|
"des", "md5", "des3_ede", "rot13", "sha1", "sha224", "sha256", "sm3",
|
2007-11-10 15:08:25 +03:00
|
|
|
"blowfish", "twofish", "serpent", "sha384", "sha512", "md4", "aes",
|
|
|
|
"cast6", "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea",
|
2021-02-01 21:02:30 +03:00
|
|
|
"khazad", "wp512", "wp384", "wp256", "xeta", "fcrypt",
|
2021-01-21 16:07:33 +03:00
|
|
|
"camellia", "seed", "rmd160",
|
2019-03-08 03:30:44 +03:00
|
|
|
"lzo", "lzo-rle", "cts", "sha3-224", "sha3-256", "sha3-384",
|
|
|
|
"sha3-512", "streebog256", "streebog512",
|
2018-11-07 00:00:03 +03:00
|
|
|
NULL
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
2021-07-20 06:46:42 +03:00
|
|
|
static const int block_sizes[] = { 16, 64, 128, 256, 1024, 1420, 4096, 0 };
|
2020-11-20 14:04:33 +03:00
|
|
|
static const int aead_sizes[] = { 16, 64, 256, 512, 1024, 1420, 4096, 8192, 0 };
|
2017-12-17 11:29:05 +03:00
|
|
|
|
|
|
|
#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);
|
|
|
|
}
|
|
|
|
|
2015-07-07 18:31:49 +03:00
|
|
|
static inline int do_one_aead_op(struct aead_request *req, int ret)
|
|
|
|
{
|
2017-10-18 10:00:48 +03:00
|
|
|
struct crypto_wait *wait = req->base.data;
|
2015-07-07 18:31:49 +03:00
|
|
|
|
2017-10-18 10:00:48 +03:00
|
|
|
return crypto_wait_req(ret, wait);
|
2015-07-07 18:31:49 +03:00
|
|
|
}
|
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
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,
|
2018-04-27 05:57:28 +03:00
|
|
|
u32 num_mb, int *rc)
|
2017-12-17 11:29:05 +03:00
|
|
|
{
|
2018-04-27 05:57:28 +03:00
|
|
|
int i, err = 0;
|
2017-12-17 11:29:05 +03:00
|
|
|
|
|
|
|
/* 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\n", 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)
|
2013-12-12 02:28:47 +04:00
|
|
|
{
|
|
|
|
unsigned long start, end;
|
|
|
|
int bcount;
|
2018-04-27 05:57:28 +03:00
|
|
|
int ret = 0;
|
|
|
|
int *rc;
|
|
|
|
|
|
|
|
rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL);
|
|
|
|
if (!rc)
|
|
|
|
return -ENOMEM;
|
2013-12-12 02:28:47 +04:00
|
|
|
|
2014-07-25 13:53:38 +04:00
|
|
|
for (start = jiffies, end = start + secs * HZ, bcount = 0;
|
2013-12-12 02:28:47 +04:00
|
|
|
time_before(jiffies, end); bcount++) {
|
2018-04-27 05:57:28 +03:00
|
|
|
ret = do_mult_aead_op(data, enc, num_mb, rc);
|
2013-12-12 02:28:47 +04:00
|
|
|
if (ret)
|
2018-04-27 05:57:28 +03:00
|
|
|
goto out;
|
2013-12-12 02:28:47 +04:00
|
|
|
}
|
|
|
|
|
2020-12-08 17:34:41 +03:00
|
|
|
pr_cont("%d operations in %d seconds (%llu bytes)\n",
|
|
|
|
bcount * num_mb, secs, (u64)bcount * blen * num_mb);
|
2018-04-27 05:57:28 +03:00
|
|
|
|
|
|
|
out:
|
|
|
|
kfree(rc);
|
|
|
|
return ret;
|
2013-12-12 02:28:47 +04:00
|
|
|
}
|
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
static int test_mb_aead_cycles(struct test_mb_aead_data *data, int enc,
|
|
|
|
int blen, u32 num_mb)
|
2013-12-12 02:28:47 +04:00
|
|
|
{
|
|
|
|
unsigned long cycles = 0;
|
|
|
|
int ret = 0;
|
|
|
|
int i;
|
2018-04-27 05:57:28 +03:00
|
|
|
int *rc;
|
|
|
|
|
|
|
|
rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL);
|
|
|
|
if (!rc)
|
|
|
|
return -ENOMEM;
|
2013-12-12 02:28:47 +04:00
|
|
|
|
|
|
|
/* Warm-up run. */
|
|
|
|
for (i = 0; i < 4; i++) {
|
2018-04-27 05:57:28 +03:00
|
|
|
ret = do_mult_aead_op(data, enc, num_mb, rc);
|
2013-12-12 02:28:47 +04:00
|
|
|
if (ret)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The real thing. */
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
cycles_t start, end;
|
|
|
|
|
|
|
|
start = get_cycles();
|
2018-04-27 05:57:28 +03:00
|
|
|
ret = do_mult_aead_op(data, enc, num_mb, rc);
|
2013-12-12 02:28:47 +04:00
|
|
|
end = get_cycles();
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
cycles += end - start;
|
|
|
|
}
|
|
|
|
|
2018-04-27 05:57:28 +03:00
|
|
|
pr_cont("1 operation in %lu cycles (%d bytes)\n",
|
|
|
|
(cycles + 4) / (8 * num_mb), blen);
|
2013-12-12 02:28:47 +04:00
|
|
|
|
2018-04-27 05:57:28 +03:00
|
|
|
out:
|
|
|
|
kfree(rc);
|
2013-12-12 02:28:47 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
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;
|
2020-11-20 14:04:33 +03:00
|
|
|
const int *b_size;
|
2017-12-17 11:29:05 +03:00
|
|
|
const char *key;
|
|
|
|
const char *e;
|
|
|
|
void *assoc;
|
|
|
|
char *iv;
|
|
|
|
int ret;
|
2013-12-12 02:28:47 +04:00
|
|
|
|
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
if (aad_size >= PAGE_SIZE) {
|
|
|
|
pr_err("associate data length (%u) too big\n", aad_size);
|
|
|
|
return;
|
|
|
|
}
|
2013-12-12 02:28:47 +04:00
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
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\n",
|
|
|
|
algo, PTR_ERR(tfm));
|
|
|
|
goto out_free_data;
|
2013-12-12 02:28:47 +04:00
|
|
|
}
|
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
ret = crypto_aead_setauthsize(tfm, authsize);
|
2021-08-13 10:55:06 +03:00
|
|
|
if (ret) {
|
|
|
|
pr_err("alg: aead: Failed to setauthsize for %s: %d\n", algo,
|
|
|
|
ret);
|
|
|
|
goto out_free_tfm;
|
|
|
|
}
|
2013-12-12 02:28:47 +04:00
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
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;
|
|
|
|
}
|
2013-12-12 02:28:47 +04:00
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
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--)
|
2018-01-02 18:43:04 +03:00
|
|
|
testmgr_free_buf(data[i].xoutbuf);
|
2017-12-17 11:29:05 +03:00
|
|
|
goto out_free_axbuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < num_mb; ++i) {
|
|
|
|
data[i].req = aead_request_alloc(tfm, GFP_KERNEL);
|
|
|
|
if (!data[i].req) {
|
2021-08-13 10:55:06 +03:00
|
|
|
pr_err("alg: aead: Failed to allocate request for %s\n",
|
2017-12-17 11:29:05 +03:00
|
|
|
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("\ntesting speed of multibuffer %s (%s) %s\n", algo,
|
|
|
|
get_driver_name(crypto_aead, tfm), e);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
do {
|
|
|
|
b_size = aead_sizes;
|
|
|
|
do {
|
2020-11-20 14:04:33 +03:00
|
|
|
int bs = round_up(*b_size, crypto_aead_blocksize(tfm));
|
|
|
|
|
|
|
|
if (bs + authsize > XBUFSIZE * PAGE_SIZE) {
|
2018-01-02 12:21:06 +03:00
|
|
|
pr_err("template (%u) too big for buffer (%lu)\n",
|
2020-11-20 14:04:33 +03:00
|
|
|
authsize + bs,
|
2017-12-17 11:29:05 +03:00
|
|
|
XBUFSIZE * PAGE_SIZE);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
pr_info("test %u (%d bit key, %d byte blocks): ", i,
|
2020-11-20 14:04:33 +03:00
|
|
|
*keysize * 8, bs);
|
2017-12-17 11:29:05 +03:00
|
|
|
|
|
|
|
/* 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\n",
|
|
|
|
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,
|
2020-11-20 14:04:33 +03:00
|
|
|
bs + (enc ? 0 : authsize),
|
2017-12-17 11:29:05 +03:00
|
|
|
assoc, aad_size);
|
|
|
|
|
|
|
|
sg_init_aead(cur->sgout, cur->xoutbuf,
|
2020-11-20 14:04:33 +03:00
|
|
|
bs + (enc ? authsize : 0),
|
2017-12-17 11:29:05 +03:00
|
|
|
assoc, aad_size);
|
|
|
|
|
|
|
|
aead_request_set_ad(cur->req, aad_size);
|
|
|
|
|
|
|
|
if (!enc) {
|
|
|
|
|
|
|
|
aead_request_set_crypt(cur->req,
|
|
|
|
cur->sgout,
|
|
|
|
cur->sg,
|
2020-11-20 14:04:33 +03:00
|
|
|
bs, iv);
|
2017-12-17 11:29:05 +03:00
|
|
|
ret = crypto_aead_encrypt(cur->req);
|
|
|
|
ret = do_one_aead_op(cur->req, ret);
|
|
|
|
|
|
|
|
if (ret) {
|
2020-07-31 05:39:24 +03:00
|
|
|
pr_err("calculating auth failed (%d)\n",
|
2017-12-17 11:29:05 +03:00
|
|
|
ret);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aead_request_set_crypt(cur->req, cur->sg,
|
2020-11-20 14:04:33 +03:00
|
|
|
cur->sgout, bs +
|
2017-12-17 11:29:05 +03:00
|
|
|
(enc ? 0 : authsize),
|
|
|
|
iv);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-07-23 17:18:48 +03:00
|
|
|
if (secs) {
|
2020-11-20 14:04:33 +03:00
|
|
|
ret = test_mb_aead_jiffies(data, enc, bs,
|
2017-12-17 11:29:05 +03:00
|
|
|
secs, num_mb);
|
2018-07-23 17:18:48 +03:00
|
|
|
cond_resched();
|
|
|
|
} else {
|
2020-11-20 14:04:33 +03:00
|
|
|
ret = test_mb_aead_cycles(data, enc, bs,
|
2017-12-17 11:29:05 +03:00
|
|
|
num_mb);
|
2018-07-23 17:18:48 +03:00
|
|
|
}
|
2017-12-17 11:29:05 +03:00
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
pr_err("%s() failed return code=%d\n", 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);
|
2013-12-12 02:28:47 +04:00
|
|
|
}
|
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
static int test_aead_jiffies(struct aead_request *req, int enc,
|
|
|
|
int blen, int secs)
|
2013-12-12 02:28:47 +04:00
|
|
|
{
|
2017-12-17 11:29:05 +03:00
|
|
|
unsigned long start, end;
|
|
|
|
int bcount;
|
|
|
|
int ret;
|
2013-12-12 02:28:47 +04:00
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2020-12-08 17:34:41 +03:00
|
|
|
pr_cont("%d operations in %d seconds (%llu bytes)\n",
|
|
|
|
bcount, secs, (u64)bcount * blen);
|
2017-12-17 11:29:05 +03:00
|
|
|
return 0;
|
2013-12-12 02:28:47 +04:00
|
|
|
}
|
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
static int test_aead_cycles(struct aead_request *req, int enc, int blen)
|
2013-12-12 02:28:47 +04:00
|
|
|
{
|
2017-12-17 11:29:05 +03:00
|
|
|
unsigned long cycles = 0;
|
|
|
|
int ret = 0;
|
|
|
|
int i;
|
2013-12-12 02:28:47 +04:00
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
/* 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;
|
2013-12-12 02:28:47 +04:00
|
|
|
}
|
2015-01-27 12:54:27 +03:00
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
/* The real thing. */
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
cycles_t start, end;
|
2017-11-14 17:59:15 +03:00
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
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();
|
2017-11-14 17:59:15 +03:00
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
if (ret)
|
|
|
|
goto out;
|
2015-01-27 12:54:27 +03:00
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
cycles += end - start;
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
if (ret == 0)
|
|
|
|
printk("1 operation in %lu cycles (%d bytes)\n",
|
|
|
|
(cycles + 4) / 8, blen);
|
|
|
|
|
|
|
|
return ret;
|
2013-12-12 02:28:47 +04:00
|
|
|
}
|
|
|
|
|
2014-07-25 13:53:38 +04:00
|
|
|
static void test_aead_speed(const char *algo, int enc, unsigned int secs,
|
2013-12-12 02:28:47 +04:00
|
|
|
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;
|
|
|
|
struct scatterlist *sgout;
|
|
|
|
const char *e;
|
|
|
|
void *assoc;
|
2015-01-28 14:07:32 +03:00
|
|
|
char *iv;
|
2013-12-12 02:28:47 +04:00
|
|
|
char *xbuf[XBUFSIZE];
|
|
|
|
char *xoutbuf[XBUFSIZE];
|
|
|
|
char *axbuf[XBUFSIZE];
|
2020-11-20 14:04:33 +03:00
|
|
|
const int *b_size;
|
2013-12-12 02:28:47 +04:00
|
|
|
unsigned int iv_len;
|
2017-10-18 10:00:48 +03:00
|
|
|
struct crypto_wait wait;
|
2013-12-12 02:28:47 +04:00
|
|
|
|
2015-01-28 14:07:32 +03:00
|
|
|
iv = kzalloc(MAX_IVLEN, GFP_KERNEL);
|
|
|
|
if (!iv)
|
|
|
|
return;
|
|
|
|
|
2014-04-21 22:45:59 +04:00
|
|
|
if (aad_size >= PAGE_SIZE) {
|
|
|
|
pr_err("associate data length (%u) too big\n", aad_size);
|
2015-01-28 14:07:32 +03:00
|
|
|
goto out_noxbuf;
|
2014-04-21 22:45:59 +04:00
|
|
|
}
|
|
|
|
|
2013-12-12 02:28:47 +04:00
|
|
|
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;
|
|
|
|
|
2015-05-27 11:03:51 +03:00
|
|
|
sg = kmalloc(sizeof(*sg) * 9 * 2, GFP_KERNEL);
|
2013-12-12 02:28:47 +04:00
|
|
|
if (!sg)
|
|
|
|
goto out_nosg;
|
2015-05-27 11:03:51 +03:00
|
|
|
sgout = &sg[9];
|
2013-12-12 02:28:47 +04:00
|
|
|
|
2015-08-13 12:29:06 +03:00
|
|
|
tfm = crypto_alloc_aead(algo, 0, 0);
|
2013-12-12 02:28:47 +04:00
|
|
|
if (IS_ERR(tfm)) {
|
|
|
|
pr_err("alg: aead: Failed to load transform for %s: %ld\n", algo,
|
|
|
|
PTR_ERR(tfm));
|
2014-04-21 22:46:40 +04:00
|
|
|
goto out_notfm;
|
2013-12-12 02:28:47 +04:00
|
|
|
}
|
|
|
|
|
2021-08-13 10:55:06 +03:00
|
|
|
ret = crypto_aead_setauthsize(tfm, authsize);
|
|
|
|
if (ret) {
|
|
|
|
pr_err("alg: aead: Failed to setauthsize for %s: %d\n", algo,
|
|
|
|
ret);
|
|
|
|
goto out_noreq;
|
|
|
|
}
|
|
|
|
|
2017-10-18 10:00:48 +03:00
|
|
|
crypto_init_wait(&wait);
|
2014-06-26 09:57:42 +04:00
|
|
|
printk(KERN_INFO "\ntesting speed of %s (%s) %s\n", algo,
|
|
|
|
get_driver_name(crypto_aead, tfm), e);
|
|
|
|
|
2013-12-12 02:28:47 +04:00
|
|
|
req = aead_request_alloc(tfm, GFP_KERNEL);
|
|
|
|
if (!req) {
|
|
|
|
pr_err("alg: aead: Failed to allocate request for %s\n",
|
|
|
|
algo);
|
2014-04-21 22:47:05 +04:00
|
|
|
goto out_noreq;
|
2013-12-12 02:28:47 +04:00
|
|
|
}
|
|
|
|
|
2015-07-07 18:31:49 +03:00
|
|
|
aead_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
|
2017-10-18 10:00:48 +03:00
|
|
|
crypto_req_done, &wait);
|
2015-07-07 18:31:49 +03:00
|
|
|
|
2013-12-12 02:28:47 +04:00
|
|
|
i = 0;
|
|
|
|
do {
|
|
|
|
b_size = aead_sizes;
|
|
|
|
do {
|
2020-11-20 14:04:33 +03:00
|
|
|
u32 bs = round_up(*b_size, crypto_aead_blocksize(tfm));
|
|
|
|
|
2013-12-12 02:28:47 +04:00
|
|
|
assoc = axbuf[0];
|
2014-04-21 22:45:59 +04:00
|
|
|
memset(assoc, 0xff, aad_size);
|
2013-12-12 02:28:47 +04:00
|
|
|
|
2020-11-20 14:04:33 +03:00
|
|
|
if ((*keysize + bs) > TVMEMSIZE * PAGE_SIZE) {
|
2013-12-12 02:28:47 +04:00
|
|
|
pr_err("template (%u) too big for tvmem (%lu)\n",
|
2020-11-20 14:04:33 +03:00
|
|
|
*keysize + bs,
|
2013-12-12 02:28:47 +04:00
|
|
|
TVMEMSIZE * PAGE_SIZE);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
key = tvmem[0];
|
|
|
|
for (j = 0; j < tcount; j++) {
|
|
|
|
if (template[j].klen == *keysize) {
|
|
|
|
key = template[j].key;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2021-08-13 10:55:06 +03:00
|
|
|
|
2013-12-12 02:28:47 +04:00
|
|
|
ret = crypto_aead_setkey(tfm, key, *keysize);
|
2021-08-13 10:55:06 +03:00
|
|
|
if (ret) {
|
|
|
|
pr_err("setkey() failed flags=%x: %d\n",
|
|
|
|
crypto_aead_get_flags(tfm), ret);
|
|
|
|
goto out;
|
|
|
|
}
|
2013-12-12 02:28:47 +04:00
|
|
|
|
|
|
|
iv_len = crypto_aead_ivsize(tfm);
|
|
|
|
if (iv_len)
|
2015-01-28 14:07:32 +03:00
|
|
|
memset(iv, 0xff, iv_len);
|
2013-12-12 02:28:47 +04:00
|
|
|
|
|
|
|
crypto_aead_clear_flags(tfm, ~0);
|
|
|
|
printk(KERN_INFO "test %u (%d bit key, %d byte blocks): ",
|
2020-11-20 14:04:33 +03:00
|
|
|
i, *keysize * 8, bs);
|
2013-12-12 02:28:47 +04:00
|
|
|
|
|
|
|
memset(tvmem[0], 0xff, PAGE_SIZE);
|
|
|
|
|
2020-11-20 14:04:33 +03:00
|
|
|
sg_init_aead(sg, xbuf, bs + (enc ? 0 : authsize),
|
2017-11-14 17:59:15 +03:00
|
|
|
assoc, aad_size);
|
2013-12-12 02:28:47 +04:00
|
|
|
|
2015-06-17 09:05:26 +03:00
|
|
|
sg_init_aead(sgout, xoutbuf,
|
2020-11-20 14:04:33 +03:00
|
|
|
bs + (enc ? authsize : 0), assoc,
|
2017-11-14 17:59:15 +03:00
|
|
|
aad_size);
|
2015-06-17 09:05:26 +03:00
|
|
|
|
2017-12-17 11:29:01 +03:00
|
|
|
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,
|
2020-11-20 14:04:33 +03:00
|
|
|
bs, iv);
|
2017-12-17 11:29:01 +03:00
|
|
|
ret = do_one_aead_op(req,
|
|
|
|
crypto_aead_encrypt(req));
|
|
|
|
|
|
|
|
if (ret) {
|
2020-07-31 05:39:24 +03:00
|
|
|
pr_err("calculating auth failed (%d)\n",
|
2017-12-17 11:29:01 +03:00
|
|
|
ret);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-10 13:22:00 +03:00
|
|
|
aead_request_set_crypt(req, sg, sgout,
|
2020-11-20 14:04:33 +03:00
|
|
|
bs + (enc ? 0 : authsize),
|
2017-10-10 13:22:00 +03:00
|
|
|
iv);
|
2013-12-12 02:28:47 +04:00
|
|
|
|
2018-07-23 17:18:48 +03:00
|
|
|
if (secs) {
|
2020-11-20 14:04:33 +03:00
|
|
|
ret = test_aead_jiffies(req, enc, bs,
|
2014-07-25 13:53:38 +04:00
|
|
|
secs);
|
2018-07-23 17:18:48 +03:00
|
|
|
cond_resched();
|
|
|
|
} else {
|
2020-11-20 14:04:33 +03:00
|
|
|
ret = test_aead_cycles(req, enc, bs);
|
2018-07-23 17:18:48 +03:00
|
|
|
}
|
2013-12-12 02:28:47 +04:00
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
pr_err("%s() failed return code=%d\n", e, ret);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
b_size++;
|
|
|
|
i++;
|
|
|
|
} while (*b_size);
|
|
|
|
keysize++;
|
|
|
|
} while (*keysize);
|
|
|
|
|
|
|
|
out:
|
2014-04-21 22:47:05 +04:00
|
|
|
aead_request_free(req);
|
|
|
|
out_noreq:
|
2013-12-12 02:28:47 +04:00
|
|
|
crypto_free_aead(tfm);
|
2014-04-21 22:46:40 +04:00
|
|
|
out_notfm:
|
2013-12-12 02:28:47 +04:00
|
|
|
kfree(sg);
|
|
|
|
out_nosg:
|
|
|
|
testmgr_free_buf(xoutbuf);
|
|
|
|
out_nooutbuf:
|
|
|
|
testmgr_free_buf(axbuf);
|
|
|
|
out_noaxbuf:
|
|
|
|
testmgr_free_buf(xbuf);
|
|
|
|
out_noxbuf:
|
2015-01-28 14:07:32 +03:00
|
|
|
kfree(iv);
|
2013-12-12 02:28:47 +04:00
|
|
|
}
|
2008-03-11 16:27:11 +03:00
|
|
|
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int do_one_ahash_op(struct ahash_request *req, int ret)
|
|
|
|
{
|
2017-10-18 10:00:48 +03:00
|
|
|
struct crypto_wait *wait = req->base.data;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
|
2017-10-18 10:00:48 +03:00
|
|
|
return crypto_wait_req(ret, wait);
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
}
|
|
|
|
|
2016-06-28 15:33:52 +03:00
|
|
|
struct test_mb_ahash_data {
|
2017-12-17 11:29:00 +03:00
|
|
|
struct scatterlist sg[XBUFSIZE];
|
2016-06-28 15:33:52 +03:00
|
|
|
char result[64];
|
|
|
|
struct ahash_request *req;
|
2017-10-18 10:00:48 +03:00
|
|
|
struct crypto_wait wait;
|
2016-06-28 15:33:52 +03:00
|
|
|
char *xbuf[XBUFSIZE];
|
|
|
|
};
|
2016-06-24 04:40:47 +03:00
|
|
|
|
2018-04-27 05:57:28 +03:00
|
|
|
static inline int do_mult_ahash_op(struct test_mb_ahash_data *data, u32 num_mb,
|
|
|
|
int *rc)
|
2017-12-17 11:29:03 +03:00
|
|
|
{
|
2018-04-27 05:57:28 +03:00
|
|
|
int i, err = 0;
|
2017-12-17 11:29:03 +03:00
|
|
|
|
|
|
|
/* 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\n", 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;
|
2018-04-27 05:57:28 +03:00
|
|
|
int ret = 0;
|
|
|
|
int *rc;
|
|
|
|
|
|
|
|
rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL);
|
|
|
|
if (!rc)
|
|
|
|
return -ENOMEM;
|
2017-12-17 11:29:03 +03:00
|
|
|
|
|
|
|
for (start = jiffies, end = start + secs * HZ, bcount = 0;
|
|
|
|
time_before(jiffies, end); bcount++) {
|
2018-04-27 05:57:28 +03:00
|
|
|
ret = do_mult_ahash_op(data, num_mb, rc);
|
2017-12-17 11:29:03 +03:00
|
|
|
if (ret)
|
2018-04-27 05:57:28 +03:00
|
|
|
goto out;
|
2017-12-17 11:29:03 +03:00
|
|
|
}
|
|
|
|
|
2020-12-08 17:34:41 +03:00
|
|
|
pr_cont("%d operations in %d seconds (%llu bytes)\n",
|
|
|
|
bcount * num_mb, secs, (u64)bcount * blen * num_mb);
|
2018-04-27 05:57:28 +03:00
|
|
|
|
|
|
|
out:
|
|
|
|
kfree(rc);
|
|
|
|
return ret;
|
2017-12-17 11:29:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2018-04-27 05:57:28 +03:00
|
|
|
int *rc;
|
|
|
|
|
|
|
|
rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL);
|
|
|
|
if (!rc)
|
|
|
|
return -ENOMEM;
|
2017-12-17 11:29:03 +03:00
|
|
|
|
|
|
|
/* Warm-up run. */
|
|
|
|
for (i = 0; i < 4; i++) {
|
2018-04-27 05:57:28 +03:00
|
|
|
ret = do_mult_ahash_op(data, num_mb, rc);
|
2017-12-17 11:29:03 +03:00
|
|
|
if (ret)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The real thing. */
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
cycles_t start, end;
|
|
|
|
|
|
|
|
start = get_cycles();
|
2018-04-27 05:57:28 +03:00
|
|
|
ret = do_mult_ahash_op(data, num_mb, rc);
|
2017-12-17 11:29:03 +03:00
|
|
|
end = get_cycles();
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
cycles += end - start;
|
|
|
|
}
|
|
|
|
|
2018-04-27 05:57:28 +03:00
|
|
|
pr_cont("1 operation in %lu cycles (%d bytes)\n",
|
|
|
|
(cycles + 4) / (8 * num_mb), blen);
|
2017-12-17 11:29:03 +03:00
|
|
|
|
2018-04-27 05:57:28 +03:00
|
|
|
out:
|
|
|
|
kfree(rc);
|
2017-12-17 11:29:03 +03:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_mb_ahash_speed(const char *algo, unsigned int secs,
|
2017-12-17 11:29:02 +03:00
|
|
|
struct hash_speed *speed, u32 num_mb)
|
2016-06-24 04:40:47 +03:00
|
|
|
{
|
2016-06-28 15:33:52 +03:00
|
|
|
struct test_mb_ahash_data *data;
|
2016-06-24 04:40:47 +03:00
|
|
|
struct crypto_ahash *tfm;
|
2016-06-28 15:33:52 +03:00
|
|
|
unsigned int i, j, k;
|
|
|
|
int ret;
|
|
|
|
|
2017-12-17 11:29:02 +03:00
|
|
|
data = kcalloc(num_mb, sizeof(*data), GFP_KERNEL);
|
2016-06-28 15:33:52 +03:00
|
|
|
if (!data)
|
|
|
|
return;
|
2016-06-24 04:40:47 +03:00
|
|
|
|
|
|
|
tfm = crypto_alloc_ahash(algo, 0, 0);
|
|
|
|
if (IS_ERR(tfm)) {
|
|
|
|
pr_err("failed to load transform for %s: %ld\n",
|
|
|
|
algo, PTR_ERR(tfm));
|
2016-06-28 15:33:52 +03:00
|
|
|
goto free_data;
|
2016-06-24 04:40:47 +03:00
|
|
|
}
|
2016-06-28 15:33:52 +03:00
|
|
|
|
2017-12-17 11:29:02 +03:00
|
|
|
for (i = 0; i < num_mb; ++i) {
|
2016-06-28 15:33:52 +03:00
|
|
|
if (testmgr_alloc_buf(data[i].xbuf))
|
|
|
|
goto out;
|
2016-06-24 04:40:47 +03:00
|
|
|
|
2017-10-18 10:00:48 +03:00
|
|
|
crypto_init_wait(&data[i].wait);
|
2016-06-24 04:40:47 +03:00
|
|
|
|
2016-06-28 15:33:52 +03:00
|
|
|
data[i].req = ahash_request_alloc(tfm, GFP_KERNEL);
|
|
|
|
if (!data[i].req) {
|
2016-06-28 10:23:06 +03:00
|
|
|
pr_err("alg: hash: Failed to allocate request for %s\n",
|
|
|
|
algo);
|
2016-06-28 15:33:52 +03:00
|
|
|
goto out;
|
2016-06-24 04:40:47 +03:00
|
|
|
}
|
|
|
|
|
2017-10-18 10:00:48 +03:00
|
|
|
ahash_request_set_callback(data[i].req, 0, crypto_req_done,
|
|
|
|
&data[i].wait);
|
2017-12-17 11:29:00 +03:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2016-06-24 04:40:47 +03:00
|
|
|
}
|
|
|
|
|
2016-06-28 15:33:52 +03:00
|
|
|
pr_info("\ntesting speed of multibuffer %s (%s)\n", algo,
|
|
|
|
get_driver_name(crypto_ahash, tfm));
|
2016-06-24 04:40:47 +03:00
|
|
|
|
|
|
|
for (i = 0; speed[i].blen != 0; i++) {
|
2016-06-28 15:33:52 +03:00
|
|
|
/* For some reason this only tests digests. */
|
|
|
|
if (speed[i].blen != speed[i].plen)
|
|
|
|
continue;
|
|
|
|
|
2017-12-17 11:29:00 +03:00
|
|
|
if (speed[i].blen > XBUFSIZE * PAGE_SIZE) {
|
2016-06-28 10:23:06 +03:00
|
|
|
pr_err("template (%u) too big for tvmem (%lu)\n",
|
2017-12-17 11:29:00 +03:00
|
|
|
speed[i].blen, XBUFSIZE * PAGE_SIZE);
|
2016-06-28 10:23:06 +03:00
|
|
|
goto out;
|
2016-06-24 04:40:47 +03:00
|
|
|
}
|
|
|
|
|
2020-08-05 08:57:08 +03:00
|
|
|
if (klen)
|
|
|
|
crypto_ahash_setkey(tfm, tvmem[0], klen);
|
2016-06-24 04:40:47 +03:00
|
|
|
|
2017-12-17 11:29:02 +03:00
|
|
|
for (k = 0; k < num_mb; k++)
|
2016-06-28 15:33:52 +03:00
|
|
|
ahash_request_set_crypt(data[k].req, data[k].sg,
|
|
|
|
data[k].result, speed[i].blen);
|
2016-06-24 04:40:47 +03:00
|
|
|
|
2016-06-28 15:33:52 +03:00
|
|
|
pr_info("test%3u "
|
|
|
|
"(%5u byte blocks,%5u bytes per update,%4u updates): ",
|
2016-06-24 04:40:47 +03:00
|
|
|
i, speed[i].blen, speed[i].plen,
|
|
|
|
speed[i].blen / speed[i].plen);
|
|
|
|
|
2018-07-23 17:18:48 +03:00
|
|
|
if (secs) {
|
2017-12-17 11:29:03 +03:00
|
|
|
ret = test_mb_ahash_jiffies(data, speed[i].blen, secs,
|
|
|
|
num_mb);
|
2018-07-23 17:18:48 +03:00
|
|
|
cond_resched();
|
|
|
|
} else {
|
2017-12-17 11:29:03 +03:00
|
|
|
ret = test_mb_ahash_cycles(data, speed[i].blen, num_mb);
|
2018-07-23 17:18:48 +03:00
|
|
|
}
|
2016-06-24 04:40:47 +03:00
|
|
|
|
2016-06-28 15:33:52 +03:00
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
pr_err("At least one hashing failed ret=%d\n", ret);
|
|
|
|
break;
|
|
|
|
}
|
2016-06-24 04:40:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
2017-12-17 11:29:02 +03:00
|
|
|
for (k = 0; k < num_mb; ++k)
|
2016-06-28 15:33:52 +03:00
|
|
|
ahash_request_free(data[k].req);
|
|
|
|
|
2017-12-17 11:29:02 +03:00
|
|
|
for (k = 0; k < num_mb; ++k)
|
2016-06-28 15:33:52 +03:00
|
|
|
testmgr_free_buf(data[k].xbuf);
|
|
|
|
|
|
|
|
crypto_free_ahash(tfm);
|
|
|
|
|
|
|
|
free_data:
|
|
|
|
kfree(data);
|
2016-06-24 04:40:47 +03:00
|
|
|
}
|
|
|
|
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
static int test_ahash_jiffies_digest(struct ahash_request *req, int blen,
|
2014-07-25 13:53:38 +04:00
|
|
|
char *out, int secs)
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
{
|
|
|
|
unsigned long start, end;
|
|
|
|
int bcount;
|
|
|
|
int ret;
|
|
|
|
|
2014-07-25 13:53:38 +04:00
|
|
|
for (start = jiffies, end = start + secs * HZ, bcount = 0;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
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\n",
|
2014-07-25 13:53:38 +04:00
|
|
|
bcount / secs, ((long)bcount * blen) / secs);
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int test_ahash_jiffies(struct ahash_request *req, int blen,
|
2014-07-25 13:53:38 +04:00
|
|
|
int plen, char *out, int secs)
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
{
|
|
|
|
unsigned long start, end;
|
|
|
|
int bcount, pcount;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (plen == blen)
|
2014-07-25 13:53:38 +04:00
|
|
|
return test_ahash_jiffies_digest(req, blen, out, secs);
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
|
2014-07-25 13:53:38 +04:00
|
|
|
for (start = jiffies, end = start + secs * HZ, bcount = 0;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
time_before(jiffies, end); bcount++) {
|
2015-04-22 06:02:27 +03:00
|
|
|
ret = do_one_ahash_op(req, crypto_ahash_init(req));
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
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\n",
|
2014-07-25 13:53:38 +04:00
|
|
|
bcount / secs, ((long)bcount * blen) / secs);
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
|
|
|
|
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\n",
|
|
|
|
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++) {
|
2015-04-22 06:02:27 +03:00
|
|
|
ret = do_one_ahash_op(req, crypto_ahash_init(req));
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
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();
|
|
|
|
|
2015-04-22 06:02:27 +03:00
|
|
|
ret = do_one_ahash_op(req, crypto_ahash_init(req));
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
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\n",
|
|
|
|
cycles / 8, cycles / (8 * blen));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-02-01 16:36:49 +03:00
|
|
|
static void test_ahash_speed_common(const char *algo, unsigned int secs,
|
|
|
|
struct hash_speed *speed, unsigned mask)
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
{
|
|
|
|
struct scatterlist sg[TVMEMSIZE];
|
2017-10-18 10:00:48 +03:00
|
|
|
struct crypto_wait wait;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
struct ahash_request *req;
|
|
|
|
struct crypto_ahash *tfm;
|
2015-08-27 18:38:36 +03:00
|
|
|
char *output;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
int i, ret;
|
|
|
|
|
2016-02-01 16:36:49 +03:00
|
|
|
tfm = crypto_alloc_ahash(algo, 0, mask);
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
if (IS_ERR(tfm)) {
|
|
|
|
pr_err("failed to load transform for %s: %ld\n",
|
|
|
|
algo, PTR_ERR(tfm));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-06-26 09:57:42 +04:00
|
|
|
printk(KERN_INFO "\ntesting speed of async %s (%s)\n", algo,
|
|
|
|
get_driver_name(crypto_ahash, tfm));
|
|
|
|
|
2015-08-27 18:38:36 +03:00
|
|
|
if (crypto_ahash_digestsize(tfm) > MAX_DIGEST_SIZE) {
|
|
|
|
pr_err("digestsize(%u) > %d\n", crypto_ahash_digestsize(tfm),
|
|
|
|
MAX_DIGEST_SIZE);
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
test_hash_sg_init(sg);
|
|
|
|
req = ahash_request_alloc(tfm, GFP_KERNEL);
|
|
|
|
if (!req) {
|
|
|
|
pr_err("ahash request allocation failure\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2017-10-18 10:00:48 +03:00
|
|
|
crypto_init_wait(&wait);
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
|
2017-10-18 10:00:48 +03:00
|
|
|
crypto_req_done, &wait);
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
|
2015-08-27 18:38:36 +03:00
|
|
|
output = kmalloc(MAX_DIGEST_SIZE, GFP_KERNEL);
|
|
|
|
if (!output)
|
|
|
|
goto out_nomem;
|
|
|
|
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
for (i = 0; speed[i].blen != 0; i++) {
|
|
|
|
if (speed[i].blen > TVMEMSIZE * PAGE_SIZE) {
|
|
|
|
pr_err("template (%u) too big for tvmem (%lu)\n",
|
|
|
|
speed[i].blen, TVMEMSIZE * PAGE_SIZE);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-08-05 08:57:08 +03:00
|
|
|
if (klen)
|
|
|
|
crypto_ahash_setkey(tfm, tvmem[0], klen);
|
2018-09-12 16:20:48 +03:00
|
|
|
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
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);
|
|
|
|
|
2018-07-23 17:18:48 +03:00
|
|
|
if (secs) {
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
ret = test_ahash_jiffies(req, speed[i].blen,
|
2014-07-25 13:53:38 +04:00
|
|
|
speed[i].plen, output, secs);
|
2018-07-23 17:18:48 +03:00
|
|
|
cond_resched();
|
|
|
|
} else {
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
ret = test_ahash_cycles(req, speed[i].blen,
|
|
|
|
speed[i].plen, output);
|
2018-07-23 17:18:48 +03:00
|
|
|
}
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
pr_err("hashing failed ret=%d\n", ret);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-27 18:38:36 +03:00
|
|
|
kfree(output);
|
|
|
|
|
|
|
|
out_nomem:
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
ahash_request_free(req);
|
|
|
|
|
|
|
|
out:
|
|
|
|
crypto_free_ahash(tfm);
|
|
|
|
}
|
|
|
|
|
2016-02-01 16:36:49 +03:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2017-12-17 11:29:04 +03:00
|
|
|
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,
|
2018-04-27 05:57:28 +03:00
|
|
|
u32 num_mb, int *rc)
|
2017-12-17 11:29:04 +03:00
|
|
|
{
|
2018-04-27 05:57:28 +03:00
|
|
|
int i, err = 0;
|
2017-12-17 11:29:04 +03:00
|
|
|
|
|
|
|
/* 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\n", 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;
|
2018-04-27 05:57:28 +03:00
|
|
|
int ret = 0;
|
|
|
|
int *rc;
|
|
|
|
|
|
|
|
rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL);
|
|
|
|
if (!rc)
|
|
|
|
return -ENOMEM;
|
2017-12-17 11:29:04 +03:00
|
|
|
|
|
|
|
for (start = jiffies, end = start + secs * HZ, bcount = 0;
|
|
|
|
time_before(jiffies, end); bcount++) {
|
2018-04-27 05:57:28 +03:00
|
|
|
ret = do_mult_acipher_op(data, enc, num_mb, rc);
|
2017-12-17 11:29:04 +03:00
|
|
|
if (ret)
|
2018-04-27 05:57:28 +03:00
|
|
|
goto out;
|
2017-12-17 11:29:04 +03:00
|
|
|
}
|
|
|
|
|
2020-12-08 17:34:41 +03:00
|
|
|
pr_cont("%d operations in %d seconds (%llu bytes)\n",
|
|
|
|
bcount * num_mb, secs, (u64)bcount * blen * num_mb);
|
2018-04-27 05:57:28 +03:00
|
|
|
|
|
|
|
out:
|
|
|
|
kfree(rc);
|
|
|
|
return ret;
|
2017-12-17 11:29:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2018-04-27 05:57:28 +03:00
|
|
|
int *rc;
|
|
|
|
|
|
|
|
rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL);
|
|
|
|
if (!rc)
|
|
|
|
return -ENOMEM;
|
2017-12-17 11:29:04 +03:00
|
|
|
|
|
|
|
/* Warm-up run. */
|
|
|
|
for (i = 0; i < 4; i++) {
|
2018-04-27 05:57:28 +03:00
|
|
|
ret = do_mult_acipher_op(data, enc, num_mb, rc);
|
2017-12-17 11:29:04 +03:00
|
|
|
if (ret)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The real thing. */
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
cycles_t start, end;
|
|
|
|
|
|
|
|
start = get_cycles();
|
2018-04-27 05:57:28 +03:00
|
|
|
ret = do_mult_acipher_op(data, enc, num_mb, rc);
|
2017-12-17 11:29:04 +03:00
|
|
|
end = get_cycles();
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
cycles += end - start;
|
|
|
|
}
|
|
|
|
|
2018-04-27 05:57:28 +03:00
|
|
|
pr_cont("1 operation in %lu cycles (%d bytes)\n",
|
|
|
|
(cycles + 4) / (8 * num_mb), blen);
|
2017-12-17 11:29:04 +03:00
|
|
|
|
2018-04-27 05:57:28 +03:00
|
|
|
out:
|
|
|
|
kfree(rc);
|
2017-12-17 11:29:04 +03:00
|
|
|
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;
|
2020-11-20 14:04:33 +03:00
|
|
|
const int *b_size;
|
2017-12-17 11:29:04 +03:00
|
|
|
const char *key;
|
|
|
|
const char *e;
|
|
|
|
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\n",
|
|
|
|
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\n",
|
|
|
|
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("\ntesting speed of multibuffer %s (%s) %s\n", algo,
|
|
|
|
get_driver_name(crypto_skcipher, tfm), e);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
do {
|
|
|
|
b_size = block_sizes;
|
|
|
|
do {
|
2020-11-20 14:04:33 +03:00
|
|
|
u32 bs = round_up(*b_size, crypto_skcipher_blocksize(tfm));
|
|
|
|
|
|
|
|
if (bs > XBUFSIZE * PAGE_SIZE) {
|
2018-01-02 12:21:06 +03:00
|
|
|
pr_err("template (%u) too big for buffer (%lu)\n",
|
2017-12-17 11:29:04 +03:00
|
|
|
*b_size, XBUFSIZE * PAGE_SIZE);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
pr_info("test %u (%d bit key, %d byte blocks): ", i,
|
2020-11-20 14:04:33 +03:00
|
|
|
*keysize * 8, bs);
|
2017-12-17 11:29:04 +03:00
|
|
|
|
|
|
|
/* 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\n",
|
|
|
|
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];
|
2020-11-20 14:04:33 +03:00
|
|
|
unsigned int k = bs;
|
2017-12-17 11:29:04 +03:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2018-07-23 17:18:48 +03:00
|
|
|
if (secs) {
|
2017-12-17 11:29:04 +03:00
|
|
|
ret = test_mb_acipher_jiffies(data, enc,
|
2020-11-20 14:04:33 +03:00
|
|
|
bs, secs,
|
2017-12-17 11:29:04 +03:00
|
|
|
num_mb);
|
2018-07-23 17:18:48 +03:00
|
|
|
cond_resched();
|
|
|
|
} else {
|
2017-12-17 11:29:04 +03:00
|
|
|
ret = test_mb_acipher_cycles(data, enc,
|
2020-11-20 14:04:33 +03:00
|
|
|
bs, num_mb);
|
2018-07-23 17:18:48 +03:00
|
|
|
}
|
2017-12-17 11:29:04 +03:00
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
pr_err("%s() failed flags=%x\n", 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);
|
|
|
|
}
|
|
|
|
|
2016-06-29 13:03:50 +03:00
|
|
|
static inline int do_one_acipher_op(struct skcipher_request *req, int ret)
|
2011-10-18 01:02:58 +04:00
|
|
|
{
|
2017-10-18 10:00:48 +03:00
|
|
|
struct crypto_wait *wait = req->base.data;
|
2011-10-18 01:02:58 +04:00
|
|
|
|
2017-10-18 10:00:48 +03:00
|
|
|
return crypto_wait_req(ret, wait);
|
2011-10-18 01:02:58 +04:00
|
|
|
}
|
|
|
|
|
2016-06-29 13:03:50 +03:00
|
|
|
static int test_acipher_jiffies(struct skcipher_request *req, int enc,
|
2014-07-25 13:53:38 +04:00
|
|
|
int blen, int secs)
|
2011-10-18 01:02:58 +04:00
|
|
|
{
|
|
|
|
unsigned long start, end;
|
|
|
|
int bcount;
|
|
|
|
int ret;
|
|
|
|
|
2014-07-25 13:53:38 +04:00
|
|
|
for (start = jiffies, end = start + secs * HZ, bcount = 0;
|
2011-10-18 01:02:58 +04:00
|
|
|
time_before(jiffies, end); bcount++) {
|
|
|
|
if (enc)
|
|
|
|
ret = do_one_acipher_op(req,
|
2016-06-29 13:03:50 +03:00
|
|
|
crypto_skcipher_encrypt(req));
|
2011-10-18 01:02:58 +04:00
|
|
|
else
|
|
|
|
ret = do_one_acipher_op(req,
|
2016-06-29 13:03:50 +03:00
|
|
|
crypto_skcipher_decrypt(req));
|
2011-10-18 01:02:58 +04:00
|
|
|
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2020-12-08 17:34:41 +03:00
|
|
|
pr_cont("%d operations in %d seconds (%llu bytes)\n",
|
|
|
|
bcount, secs, (u64)bcount * blen);
|
2011-10-18 01:02:58 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-06-29 13:03:50 +03:00
|
|
|
static int test_acipher_cycles(struct skcipher_request *req, int enc,
|
2011-10-18 01:02:58 +04:00
|
|
|
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,
|
2016-06-29 13:03:50 +03:00
|
|
|
crypto_skcipher_encrypt(req));
|
2011-10-18 01:02:58 +04:00
|
|
|
else
|
|
|
|
ret = do_one_acipher_op(req,
|
2016-06-29 13:03:50 +03:00
|
|
|
crypto_skcipher_decrypt(req));
|
2011-10-18 01:02:58 +04:00
|
|
|
|
|
|
|
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,
|
2016-06-29 13:03:50 +03:00
|
|
|
crypto_skcipher_encrypt(req));
|
2011-10-18 01:02:58 +04:00
|
|
|
else
|
|
|
|
ret = do_one_acipher_op(req,
|
2016-06-29 13:03:50 +03:00
|
|
|
crypto_skcipher_decrypt(req));
|
2011-10-18 01:02:58 +04:00
|
|
|
end = get_cycles();
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
cycles += end - start;
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
if (ret == 0)
|
|
|
|
pr_cont("1 operation in %lu cycles (%d bytes)\n",
|
|
|
|
(cycles + 4) / 8, blen);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-06-29 13:03:50 +03:00
|
|
|
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)
|
2011-10-18 01:02:58 +04:00
|
|
|
{
|
2012-07-01 21:19:47 +04:00
|
|
|
unsigned int ret, i, j, k, iv_len;
|
2017-10-18 10:00:48 +03:00
|
|
|
struct crypto_wait wait;
|
2011-10-18 01:02:58 +04:00
|
|
|
const char *key;
|
|
|
|
char iv[128];
|
2016-06-29 13:03:50 +03:00
|
|
|
struct skcipher_request *req;
|
|
|
|
struct crypto_skcipher *tfm;
|
2020-11-20 14:04:33 +03:00
|
|
|
const int *b_size;
|
2011-10-18 01:02:58 +04:00
|
|
|
const char *e;
|
|
|
|
|
|
|
|
if (enc == ENCRYPT)
|
|
|
|
e = "encryption";
|
|
|
|
else
|
|
|
|
e = "decryption";
|
|
|
|
|
2017-10-18 10:00:48 +03:00
|
|
|
crypto_init_wait(&wait);
|
2011-10-18 01:02:58 +04:00
|
|
|
|
2016-06-29 13:03:50 +03:00
|
|
|
tfm = crypto_alloc_skcipher(algo, 0, async ? 0 : CRYPTO_ALG_ASYNC);
|
2011-10-18 01:02:58 +04:00
|
|
|
|
|
|
|
if (IS_ERR(tfm)) {
|
|
|
|
pr_err("failed to load transform for %s: %ld\n", algo,
|
|
|
|
PTR_ERR(tfm));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-02-05 13:19:58 +03:00
|
|
|
pr_info("\ntesting speed of %s %s (%s) %s\n", async ? "async" : "sync",
|
|
|
|
algo, get_driver_name(crypto_skcipher, tfm), e);
|
2014-06-26 09:57:42 +04:00
|
|
|
|
2016-06-29 13:03:50 +03:00
|
|
|
req = skcipher_request_alloc(tfm, GFP_KERNEL);
|
2011-10-18 01:02:58 +04:00
|
|
|
if (!req) {
|
|
|
|
pr_err("tcrypt: skcipher: Failed to allocate request for %s\n",
|
|
|
|
algo);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2016-06-29 13:03:50 +03:00
|
|
|
skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
|
2017-10-18 10:00:48 +03:00
|
|
|
crypto_req_done, &wait);
|
2011-10-18 01:02:58 +04:00
|
|
|
|
|
|
|
i = 0;
|
|
|
|
do {
|
|
|
|
b_size = block_sizes;
|
|
|
|
|
|
|
|
do {
|
2020-11-20 14:04:33 +03:00
|
|
|
u32 bs = round_up(*b_size, crypto_skcipher_blocksize(tfm));
|
2011-10-18 01:02:58 +04:00
|
|
|
struct scatterlist sg[TVMEMSIZE];
|
|
|
|
|
2020-11-20 14:04:33 +03:00
|
|
|
if ((*keysize + bs) > TVMEMSIZE * PAGE_SIZE) {
|
2011-10-18 01:02:58 +04:00
|
|
|
pr_err("template (%u) too big for "
|
2020-11-20 14:04:33 +03:00
|
|
|
"tvmem (%lu)\n", *keysize + bs,
|
2011-10-18 01:02:58 +04:00
|
|
|
TVMEMSIZE * PAGE_SIZE);
|
|
|
|
goto out_free_req;
|
|
|
|
}
|
|
|
|
|
|
|
|
pr_info("test %u (%d bit key, %d byte blocks): ", i,
|
2020-11-20 14:04:33 +03:00
|
|
|
*keysize * 8, bs);
|
2011-10-18 01:02:58 +04:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-29 13:03:50 +03:00
|
|
|
crypto_skcipher_clear_flags(tfm, ~0);
|
2011-10-18 01:02:58 +04:00
|
|
|
|
2016-06-29 13:03:50 +03:00
|
|
|
ret = crypto_skcipher_setkey(tfm, key, *keysize);
|
2011-10-18 01:02:58 +04:00
|
|
|
if (ret) {
|
|
|
|
pr_err("setkey() failed flags=%x\n",
|
2016-06-29 13:03:50 +03:00
|
|
|
crypto_skcipher_get_flags(tfm));
|
2011-10-18 01:02:58 +04:00
|
|
|
goto out_free_req;
|
|
|
|
}
|
|
|
|
|
2020-11-20 14:04:33 +03:00
|
|
|
k = *keysize + bs;
|
2015-03-09 17:14:58 +03:00
|
|
|
sg_init_table(sg, DIV_ROUND_UP(k, PAGE_SIZE));
|
|
|
|
|
2012-07-01 21:19:47 +04:00
|
|
|
if (k > PAGE_SIZE) {
|
|
|
|
sg_set_buf(sg, tvmem[0] + *keysize,
|
2011-10-18 01:02:58 +04:00
|
|
|
PAGE_SIZE - *keysize);
|
2012-07-01 21:19:47 +04:00
|
|
|
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 {
|
2020-11-20 14:04:33 +03:00
|
|
|
sg_set_buf(sg, tvmem[0] + *keysize, bs);
|
2011-10-18 01:02:58 +04:00
|
|
|
}
|
|
|
|
|
2016-06-29 13:03:50 +03:00
|
|
|
iv_len = crypto_skcipher_ivsize(tfm);
|
2011-10-18 01:02:58 +04:00
|
|
|
if (iv_len)
|
|
|
|
memset(&iv, 0xff, iv_len);
|
|
|
|
|
2020-11-20 14:04:33 +03:00
|
|
|
skcipher_request_set_crypt(req, sg, sg, bs, iv);
|
2011-10-18 01:02:58 +04:00
|
|
|
|
2018-07-23 17:18:48 +03:00
|
|
|
if (secs) {
|
2011-10-18 01:02:58 +04:00
|
|
|
ret = test_acipher_jiffies(req, enc,
|
2020-11-20 14:04:33 +03:00
|
|
|
bs, secs);
|
2018-07-23 17:18:48 +03:00
|
|
|
cond_resched();
|
|
|
|
} else {
|
2011-10-18 01:02:58 +04:00
|
|
|
ret = test_acipher_cycles(req, enc,
|
2020-11-20 14:04:33 +03:00
|
|
|
bs);
|
2018-07-23 17:18:48 +03:00
|
|
|
}
|
2011-10-18 01:02:58 +04:00
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
pr_err("%s() failed flags=%x\n", e,
|
2016-06-29 13:03:50 +03:00
|
|
|
crypto_skcipher_get_flags(tfm));
|
2011-10-18 01:02:58 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
b_size++;
|
|
|
|
i++;
|
|
|
|
} while (*b_size);
|
|
|
|
keysize++;
|
|
|
|
} while (*keysize);
|
|
|
|
|
|
|
|
out_free_req:
|
2016-06-29 13:03:50 +03:00
|
|
|
skcipher_request_free(req);
|
2011-10-18 01:02:58 +04:00
|
|
|
out:
|
2016-06-29 13:03:50 +03:00
|
|
|
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);
|
2011-10-18 01:02:58 +04:00
|
|
|
}
|
|
|
|
|
2005-06-23 00:26:03 +04:00
|
|
|
static void test_available(void)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2019-11-08 18:42:13 +03:00
|
|
|
const char **name = check;
|
2005-06-23 00:26:03 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
while (*name) {
|
|
|
|
printk("alg %s ", *name);
|
2007-04-04 11:41:07 +04:00
|
|
|
printk(crypto_has_alg(*name, 0, 0) ?
|
2006-08-26 12:12:40 +04:00
|
|
|
"found\n" : "not found\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
name++;
|
2005-06-23 00:26:03 +04:00
|
|
|
}
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2008-07-31 11:41:55 +04:00
|
|
|
static inline int tcrypt_test(const char *alg)
|
|
|
|
{
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
int ret;
|
|
|
|
|
2017-01-18 16:54:05 +03:00
|
|
|
pr_debug("testing %s\n", alg);
|
|
|
|
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret = alg_test(alg, alg, 0, 0);
|
|
|
|
/* non-fips algs return -EINVAL in fips mode */
|
|
|
|
if (fips_enabled && ret == -EINVAL)
|
|
|
|
ret = 0;
|
|
|
|
return ret;
|
2008-07-31 11:41:55 +04:00
|
|
|
}
|
|
|
|
|
2018-04-27 05:57:28 +03:00
|
|
|
static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb)
|
2008-07-31 11:41:55 +04:00
|
|
|
{
|
|
|
|
int i;
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
int ret = 0;
|
2008-07-31 11:41:55 +04:00
|
|
|
|
|
|
|
switch (m) {
|
2005-04-17 02:20:36 +04:00
|
|
|
case 0:
|
2014-12-04 11:43:29 +03:00
|
|
|
if (alg) {
|
|
|
|
if (!crypto_has_alg(alg, type,
|
|
|
|
mask ?: CRYPTO_ALG_TYPE_MASK))
|
|
|
|
ret = -ENOENT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-07-31 11:41:55 +04:00
|
|
|
for (i = 1; i < 200; i++)
|
2018-04-27 05:57:28 +03:00
|
|
|
ret += do_test(NULL, 0, 0, i, num_mb);
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("md5");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("sha1");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ecb(des)");
|
|
|
|
ret += tcrypt_test("cbc(des)");
|
2012-10-20 15:53:07 +04:00
|
|
|
ret += tcrypt_test("ctr(des)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ecb(des3_ede)");
|
|
|
|
ret += tcrypt_test("cbc(des3_ede)");
|
2012-10-20 15:53:12 +04:00
|
|
|
ret += tcrypt_test("ctr(des3_ede)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("md4");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
2005-06-23 00:26:03 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
case 6:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("sha256");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
2005-06-23 00:26:03 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
case 7:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ecb(blowfish)");
|
|
|
|
ret += tcrypt_test("cbc(blowfish)");
|
2011-10-11 00:03:03 +04:00
|
|
|
ret += tcrypt_test("ctr(blowfish)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ecb(twofish)");
|
|
|
|
ret += tcrypt_test("cbc(twofish)");
|
2011-10-11 00:03:12 +04:00
|
|
|
ret += tcrypt_test("ctr(twofish)");
|
2011-10-18 14:32:56 +04:00
|
|
|
ret += tcrypt_test("lrw(twofish)");
|
2011-10-18 14:33:38 +04:00
|
|
|
ret += tcrypt_test("xts(twofish)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
2005-06-23 00:26:03 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
case 9:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ecb(serpent)");
|
2011-10-18 01:02:53 +04:00
|
|
|
ret += tcrypt_test("cbc(serpent)");
|
|
|
|
ret += tcrypt_test("ctr(serpent)");
|
2011-10-18 14:32:39 +04:00
|
|
|
ret += tcrypt_test("lrw(serpent)");
|
2011-10-18 14:33:22 +04:00
|
|
|
ret += tcrypt_test("xts(serpent)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 10:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
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))");
|
2018-09-20 16:18:40 +03:00
|
|
|
ret += tcrypt_test("ofb(aes)");
|
2018-10-20 02:01:53 +03:00
|
|
|
ret += tcrypt_test("cfb(aes)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 11:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("sha384");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
2005-06-23 00:26:03 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
case 12:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("sha512");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 13:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("deflate");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 14:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ecb(cast5)");
|
2012-07-11 21:37:21 +04:00
|
|
|
ret += tcrypt_test("cbc(cast5)");
|
|
|
|
ret += tcrypt_test("ctr(cast5)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 15:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ecb(cast6)");
|
2012-07-11 21:38:29 +04:00
|
|
|
ret += tcrypt_test("cbc(cast6)");
|
|
|
|
ret += tcrypt_test("ctr(cast6)");
|
|
|
|
ret += tcrypt_test("lrw(cast6)");
|
|
|
|
ret += tcrypt_test("xts(cast6)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ecb(arc4)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 17:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("michael_mic");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 18:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("crc32c");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 19:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ecb(tea)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 20:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ecb(xtea)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 21:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ecb(khazad)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 22:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("wp512");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 23:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("wp384");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 24:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("wp256");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 26:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ecb(anubis)");
|
|
|
|
ret += tcrypt_test("cbc(anubis)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
2005-09-02 04:42:46 +04:00
|
|
|
case 30:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ecb(xeta)");
|
2005-09-02 04:42:46 +04:00
|
|
|
break;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2006-12-16 04:13:14 +03:00
|
|
|
case 31:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("pcbc(fcrypt)");
|
2006-12-16 04:13:14 +03:00
|
|
|
break;
|
|
|
|
|
2007-01-24 13:48:19 +03:00
|
|
|
case 32:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ecb(camellia)");
|
|
|
|
ret += tcrypt_test("cbc(camellia)");
|
2012-09-21 11:27:10 +04:00
|
|
|
ret += tcrypt_test("ctr(camellia)");
|
|
|
|
ret += tcrypt_test("lrw(camellia)");
|
|
|
|
ret += tcrypt_test("xts(camellia)");
|
2007-01-24 13:48:19 +03:00
|
|
|
break;
|
2013-04-08 11:48:44 +04:00
|
|
|
|
2007-11-10 15:08:25 +03:00
|
|
|
case 33:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("sha224");
|
2007-11-10 15:08:25 +03:00
|
|
|
break;
|
2007-01-24 13:48:19 +03:00
|
|
|
|
2007-12-02 06:55:47 +03:00
|
|
|
case 35:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("gcm(aes)");
|
2007-12-02 06:55:47 +03:00
|
|
|
break;
|
|
|
|
|
2007-12-07 11:53:23 +03:00
|
|
|
case 36:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("lzo");
|
2007-12-07 11:53:23 +03:00
|
|
|
break;
|
|
|
|
|
2007-12-12 15:24:22 +03:00
|
|
|
case 37:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ccm(aes)");
|
2007-12-12 15:24:22 +03:00
|
|
|
break;
|
|
|
|
|
2008-03-24 16:26:16 +03:00
|
|
|
case 38:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("cts(cbc(aes))");
|
2008-03-24 16:26:16 +03:00
|
|
|
break;
|
|
|
|
|
2021-05-20 13:40:00 +03:00
|
|
|
case 39:
|
|
|
|
ret += tcrypt_test("xxhash64");
|
|
|
|
break;
|
|
|
|
|
2008-05-07 18:16:36 +04:00
|
|
|
case 40:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("rmd160");
|
2008-05-07 18:16:36 +04:00
|
|
|
break;
|
|
|
|
|
2021-05-20 13:40:00 +03:00
|
|
|
case 41:
|
|
|
|
ret += tcrypt_test("blake2s-256");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 42:
|
|
|
|
ret += tcrypt_test("blake2b-512");
|
|
|
|
break;
|
|
|
|
|
2008-07-31 11:41:55 +04:00
|
|
|
case 43:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ecb(seed)");
|
2008-05-09 17:29:35 +04:00
|
|
|
break;
|
|
|
|
|
2009-05-04 15:23:40 +04:00
|
|
|
case 45:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("rfc4309(ccm(aes))");
|
2009-05-04 15:23:40 +04:00
|
|
|
break;
|
|
|
|
|
2012-09-21 11:27:10 +04:00
|
|
|
case 46:
|
|
|
|
ret += tcrypt_test("ghash");
|
|
|
|
break;
|
|
|
|
|
2013-09-07 06:56:26 +04:00
|
|
|
case 47:
|
|
|
|
ret += tcrypt_test("crct10dif");
|
|
|
|
break;
|
|
|
|
|
2016-06-17 08:00:36 +03:00
|
|
|
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;
|
|
|
|
|
2017-08-21 13:51:29 +03:00
|
|
|
case 52:
|
|
|
|
ret += tcrypt_test("sm3");
|
|
|
|
break;
|
|
|
|
|
2018-11-07 00:00:03 +03:00
|
|
|
case 53:
|
|
|
|
ret += tcrypt_test("streebog256");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 54:
|
|
|
|
ret += tcrypt_test("streebog512");
|
|
|
|
break;
|
|
|
|
|
2021-08-13 10:55:08 +03:00
|
|
|
case 55:
|
|
|
|
ret += tcrypt_test("gcm(sm4)");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 56:
|
|
|
|
ret += tcrypt_test("ccm(sm4)");
|
|
|
|
break;
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
case 100:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("hmac(md5)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
2005-06-23 00:26:03 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
case 101:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("hmac(sha1)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
2005-06-23 00:26:03 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
case 102:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("hmac(sha256)");
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
|
|
|
|
2006-12-10 04:10:20 +03:00
|
|
|
case 103:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("hmac(sha384)");
|
2006-12-10 04:10:20 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 104:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("hmac(sha512)");
|
2006-12-10 04:10:20 +03:00
|
|
|
break;
|
2008-01-01 07:59:28 +03:00
|
|
|
|
2007-11-10 15:08:25 +03:00
|
|
|
case 105:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("hmac(sha224)");
|
2007-11-10 15:08:25 +03:00
|
|
|
break;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2008-01-01 07:59:28 +03:00
|
|
|
case 106:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("xcbc(aes)");
|
2008-01-01 07:59:28 +03:00
|
|
|
break;
|
|
|
|
|
2008-05-07 18:16:36 +04:00
|
|
|
case 108:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("hmac(rmd160)");
|
2008-05-07 18:16:36 +04:00
|
|
|
break;
|
|
|
|
|
2009-09-02 14:05:22 +04:00
|
|
|
case 109:
|
2018-06-18 20:22:40 +03:00
|
|
|
ret += tcrypt_test("vmac64(aes)");
|
2009-09-02 14:05:22 +04:00
|
|
|
break;
|
2013-04-08 11:48:44 +04:00
|
|
|
|
2016-07-01 08:46:54 +03:00
|
|
|
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;
|
|
|
|
|
2018-11-07 00:00:03 +03:00
|
|
|
case 115:
|
|
|
|
ret += tcrypt_test("hmac(streebog256)");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 116:
|
|
|
|
ret += tcrypt_test("hmac(streebog512)");
|
|
|
|
break;
|
|
|
|
|
2009-05-04 15:46:29 +04:00
|
|
|
case 150:
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
ret += tcrypt_test("ansi_cprng");
|
2009-05-04 15:46:29 +04:00
|
|
|
break;
|
|
|
|
|
2010-11-04 22:02:04 +03:00
|
|
|
case 151:
|
|
|
|
ret += tcrypt_test("rfc4106(gcm(aes))");
|
|
|
|
break;
|
|
|
|
|
2013-04-07 17:43:51 +04:00
|
|
|
case 152:
|
|
|
|
ret += tcrypt_test("rfc4543(gcm(aes))");
|
|
|
|
break;
|
|
|
|
|
2013-04-08 11:48:44 +04:00
|
|
|
case 153:
|
|
|
|
ret += tcrypt_test("cmac(aes)");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 154:
|
|
|
|
ret += tcrypt_test("cmac(des3_ede)");
|
|
|
|
break;
|
|
|
|
|
2013-11-28 17:11:16 +04:00
|
|
|
case 155:
|
|
|
|
ret += tcrypt_test("authenc(hmac(sha1),cbc(aes))");
|
|
|
|
break;
|
|
|
|
|
2014-03-14 19:46:51 +04:00
|
|
|
case 156:
|
|
|
|
ret += tcrypt_test("authenc(hmac(md5),ecb(cipher_null))");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 157:
|
|
|
|
ret += tcrypt_test("authenc(hmac(sha1),ecb(cipher_null))");
|
|
|
|
break;
|
2021-08-13 10:55:08 +03:00
|
|
|
|
|
|
|
case 158:
|
|
|
|
ret += tcrypt_test("cbcmac(sm4)");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 159:
|
|
|
|
ret += tcrypt_test("cmac(sm4)");
|
|
|
|
break;
|
|
|
|
|
crypto: testmgr - add aead cbc des, des3_ede tests
Test vectors were taken from existing test for
CBC(DES3_EDE). Associated data has been added to test vectors.
HMAC computed with Crypto++ has been used. Following algos have
been covered.
(a) "authenc(hmac(sha1),cbc(des))"
(b) "authenc(hmac(sha1),cbc(des3_ede))"
(c) "authenc(hmac(sha224),cbc(des))"
(d) "authenc(hmac(sha224),cbc(des3_ede))"
(e) "authenc(hmac(sha256),cbc(des))"
(f) "authenc(hmac(sha256),cbc(des3_ede))"
(g) "authenc(hmac(sha384),cbc(des))"
(h) "authenc(hmac(sha384),cbc(des3_ede))"
(i) "authenc(hmac(sha512),cbc(des))"
(j) "authenc(hmac(sha512),cbc(des3_ede))"
Signed-off-by: Vakul Garg <vakul@freescale.com>
[NiteshNarayanLal@freescale.com: added hooks for the missing algorithms test and tested the patch]
Signed-off-by: Nitesh Lal <NiteshNarayanLal@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2014-05-21 15:39:08 +04:00
|
|
|
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;
|
2018-03-06 12:44:43 +03:00
|
|
|
case 191:
|
|
|
|
ret += tcrypt_test("ecb(sm4)");
|
2018-09-20 16:18:38 +03:00
|
|
|
ret += tcrypt_test("cbc(sm4)");
|
2021-07-20 06:46:42 +03:00
|
|
|
ret += tcrypt_test("cfb(sm4)");
|
2018-09-20 16:18:38 +03:00
|
|
|
ret += tcrypt_test("ctr(sm4)");
|
2018-03-06 12:44:43 +03:00
|
|
|
break;
|
2005-06-23 00:27:23 +04:00
|
|
|
case 200:
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_16_24_32);
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("ecb(aes)", DECRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_16_24_32);
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("cbc(aes)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_16_24_32);
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("cbc(aes)", DECRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_16_24_32);
|
2006-11-29 11:01:41 +03:00
|
|
|
test_cipher_speed("lrw(aes)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_32_40_48);
|
2006-11-29 11:01:41 +03:00
|
|
|
test_cipher_speed("lrw(aes)", DECRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_32_40_48);
|
2007-09-19 16:23:13 +04:00
|
|
|
test_cipher_speed("xts(aes)", ENCRYPT, sec, NULL, 0,
|
2017-07-19 19:40:32 +03:00
|
|
|
speed_template_32_64);
|
2007-09-19 16:23:13 +04:00
|
|
|
test_cipher_speed("xts(aes)", DECRYPT, sec, NULL, 0,
|
2017-07-19 19:40:32 +03:00
|
|
|
speed_template_32_64);
|
2016-06-29 13:04:14 +03:00
|
|
|
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);
|
2011-04-26 10:34:01 +04:00
|
|
|
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);
|
2018-10-20 02:01:53 +03:00
|
|
|
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);
|
2005-06-23 00:27:23 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 201:
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("ecb(des3_ede)", ENCRYPT, sec,
|
2008-07-31 13:08:25 +04:00
|
|
|
des3_speed_template, DES3_SPEED_VECTORS,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_24);
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("ecb(des3_ede)", DECRYPT, sec,
|
2008-07-31 13:08:25 +04:00
|
|
|
des3_speed_template, DES3_SPEED_VECTORS,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_24);
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("cbc(des3_ede)", ENCRYPT, sec,
|
2008-07-31 13:08:25 +04:00
|
|
|
des3_speed_template, DES3_SPEED_VECTORS,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_24);
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("cbc(des3_ede)", DECRYPT, sec,
|
2008-07-31 13:08:25 +04:00
|
|
|
des3_speed_template, DES3_SPEED_VECTORS,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_24);
|
2014-06-09 21:59:49 +04:00
|
|
|
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);
|
2005-06-23 00:27:23 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 202:
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("ecb(twofish)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_16_24_32);
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("ecb(twofish)", DECRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_16_24_32);
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("cbc(twofish)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_16_24_32);
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("cbc(twofish)", DECRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_16_24_32);
|
2011-09-26 17:47:15 +04:00
|
|
|
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);
|
2011-10-18 14:32:56 +04:00
|
|
|
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);
|
2011-10-18 14:33:38 +04:00
|
|
|
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);
|
2005-06-23 00:27:23 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 203:
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("ecb(blowfish)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_8_32);
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("ecb(blowfish)", DECRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_8_32);
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("cbc(blowfish)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_8_32);
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("cbc(blowfish)", DECRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_8_32);
|
2011-09-02 02:45:17 +04:00
|
|
|
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);
|
2005-06-23 00:27:23 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 204:
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("ecb(des)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_8);
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("ecb(des)", DECRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_8);
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("cbc(des)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_8);
|
2006-08-13 02:26:09 +04:00
|
|
|
test_cipher_speed("cbc(des)", DECRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_8);
|
2005-06-23 00:27:23 +04:00
|
|
|
break;
|
|
|
|
|
2007-01-24 13:48:19 +03:00
|
|
|
case 205:
|
|
|
|
test_cipher_speed("ecb(camellia)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_16_24_32);
|
2007-01-24 13:48:19 +03:00
|
|
|
test_cipher_speed("ecb(camellia)", DECRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_16_24_32);
|
2007-01-24 13:48:19 +03:00
|
|
|
test_cipher_speed("cbc(camellia)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_16_24_32);
|
2007-01-24 13:48:19 +03:00
|
|
|
test_cipher_speed("cbc(camellia)", DECRYPT, sec, NULL, 0,
|
2008-03-11 16:24:26 +03:00
|
|
|
speed_template_16_24_32);
|
2012-03-05 22:26:26 +04:00
|
|
|
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);
|
2007-01-24 13:48:19 +03:00
|
|
|
break;
|
|
|
|
|
2011-10-18 01:03:03 +04:00
|
|
|
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);
|
2011-10-18 14:32:39 +04:00
|
|
|
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);
|
2011-10-18 14:33:22 +04:00
|
|
|
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);
|
2011-10-18 01:03:03 +04:00
|
|
|
break;
|
|
|
|
|
2012-06-12 12:52:04 +04:00
|
|
|
case 208:
|
|
|
|
test_cipher_speed("ecb(arc4)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_8);
|
|
|
|
break;
|
|
|
|
|
2012-07-11 21:37:21 +04:00
|
|
|
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;
|
|
|
|
|
2012-07-11 21:38:29 +04:00
|
|
|
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;
|
|
|
|
|
2013-12-12 02:28:47 +04:00
|
|
|
case 211:
|
|
|
|
test_aead_speed("rfc4106(gcm(aes))", ENCRYPT, sec,
|
2015-07-09 02:17:26 +03:00
|
|
|
NULL, 0, 16, 16, aead_speed_template_20);
|
2015-07-07 18:31:49 +03:00
|
|
|
test_aead_speed("gcm(aes)", ENCRYPT, sec,
|
2015-11-17 15:37:10 +03:00
|
|
|
NULL, 0, 16, 8, speed_template_16_24_32);
|
2017-12-17 11:29:01 +03:00
|
|
|
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);
|
2013-12-12 02:28:47 +04:00
|
|
|
break;
|
|
|
|
|
2015-06-17 09:04:21 +03:00
|
|
|
case 212:
|
|
|
|
test_aead_speed("rfc4309(ccm(aes))", ENCRYPT, sec,
|
2015-07-09 02:17:26 +03:00
|
|
|
NULL, 0, 16, 16, aead_speed_template_19);
|
2017-12-17 11:29:01 +03:00
|
|
|
test_aead_speed("rfc4309(ccm(aes))", DECRYPT, sec,
|
|
|
|
NULL, 0, 16, 16, aead_speed_template_19);
|
2015-06-17 09:04:21 +03:00
|
|
|
break;
|
|
|
|
|
2015-07-16 20:13:59 +03:00
|
|
|
case 213:
|
|
|
|
test_aead_speed("rfc7539esp(chacha20,poly1305)", ENCRYPT, sec,
|
|
|
|
NULL, 0, 16, 8, aead_speed_template_36);
|
2017-12-17 11:29:01 +03:00
|
|
|
test_aead_speed("rfc7539esp(chacha20,poly1305)", DECRYPT, sec,
|
|
|
|
NULL, 0, 16, 8, aead_speed_template_36);
|
2015-07-16 20:13:59 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 214:
|
|
|
|
test_cipher_speed("chacha20", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_32);
|
|
|
|
break;
|
|
|
|
|
2017-12-17 11:29:05 +03:00
|
|
|
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;
|
|
|
|
|
2018-09-20 16:18:38 +03:00
|
|
|
case 218:
|
|
|
|
test_cipher_speed("ecb(sm4)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
|
|
|
test_cipher_speed("ecb(sm4)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
|
|
|
test_cipher_speed("cbc(sm4)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
|
|
|
test_cipher_speed("cbc(sm4)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
2021-07-20 06:46:42 +03:00
|
|
|
test_cipher_speed("cfb(sm4)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
|
|
|
test_cipher_speed("cfb(sm4)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
2018-09-20 16:18:38 +03:00
|
|
|
test_cipher_speed("ctr(sm4)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
|
|
|
test_cipher_speed("ctr(sm4)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
|
|
|
break;
|
crypto: adiantum - add Adiantum support
Add support for the Adiantum encryption mode. Adiantum was designed by
Paul Crowley and is specified by our paper:
Adiantum: length-preserving encryption for entry-level processors
(https://eprint.iacr.org/2018/720.pdf)
See our paper for full details; this patch only provides an overview.
Adiantum is a tweakable, length-preserving encryption mode designed for
fast and secure disk encryption, especially on CPUs without dedicated
crypto instructions. Adiantum encrypts each sector using the XChaCha12
stream cipher, two passes of an ε-almost-∆-universal (εA∆U) hash
function, and an invocation of the AES-256 block cipher on a single
16-byte block. On CPUs without AES instructions, Adiantum is much
faster than AES-XTS; for example, on ARM Cortex-A7, on 4096-byte sectors
Adiantum encryption is about 4 times faster than AES-256-XTS encryption,
and decryption about 5 times faster.
Adiantum is a specialization of the more general HBSH construction. Our
earlier proposal, HPolyC, was also a HBSH specialization, but it used a
different εA∆U hash function, one based on Poly1305 only. Adiantum's
εA∆U hash function, which is based primarily on the "NH" hash function
like that used in UMAC (RFC4418), is about twice as fast as HPolyC's;
consequently, Adiantum is about 20% faster than HPolyC.
This speed comes with no loss of security: Adiantum is provably just as
secure as HPolyC, in fact slightly *more* secure. Like HPolyC,
Adiantum's security is reducible to that of XChaCha12 and AES-256,
subject to a security bound. XChaCha12 itself has a security reduction
to ChaCha12. Therefore, one need not "trust" Adiantum; one need only
trust ChaCha12 and AES-256. Note that the εA∆U hash function is only
used for its proven combinatorical properties so cannot be "broken".
Adiantum is also a true wide-block encryption mode, so flipping any
plaintext bit in the sector scrambles the entire ciphertext, and vice
versa. No other such mode is available in the kernel currently; doing
the same with XTS scrambles only 16 bytes. Adiantum also supports
arbitrary-length tweaks and naturally supports any length input >= 16
bytes without needing "ciphertext stealing".
For the stream cipher, Adiantum uses XChaCha12 rather than XChaCha20 in
order to make encryption feasible on the widest range of devices.
Although the 20-round variant is quite popular, the best known attacks
on ChaCha are on only 7 rounds, so ChaCha12 still has a substantial
security margin; in fact, larger than AES-256's. 12-round Salsa20 is
also the eSTREAM recommendation. For the block cipher, Adiantum uses
AES-256, despite it having a lower security margin than XChaCha12 and
needing table lookups, due to AES's extensive adoption and analysis
making it the obvious first choice. Nevertheless, for flexibility this
patch also permits the "adiantum" template to be instantiated with
XChaCha20 and/or with an alternate block cipher.
We need Adiantum support in the kernel for use in dm-crypt and fscrypt,
where currently the only other suitable options are block cipher modes
such as AES-XTS. A big problem with this is that many low-end mobile
devices (e.g. Android Go phones sold primarily in developing countries,
as well as some smartwatches) still have CPUs that lack AES
instructions, e.g. ARM Cortex-A7. Sadly, AES-XTS encryption is much too
slow to be viable on these devices. We did find that some "lightweight"
block ciphers are fast enough, but these suffer from problems such as
not having much cryptanalysis or being too controversial.
The ChaCha stream cipher has excellent performance but is insecure to
use directly for disk encryption, since each sector's IV is reused each
time it is overwritten. Even restricting the threat model to offline
attacks only isn't enough, since modern flash storage devices don't
guarantee that "overwrites" are really overwrites, due to wear-leveling.
Adiantum avoids this problem by constructing a
"tweakable super-pseudorandom permutation"; this is the strongest
possible security model for length-preserving encryption.
Of course, storing random nonces along with the ciphertext would be the
ideal solution. But doing that with existing hardware and filesystems
runs into major practical problems; in most cases it would require data
journaling (like dm-integrity) which severely degrades performance.
Thus, for now length-preserving encryption is still needed.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2018-11-17 04:26:31 +03:00
|
|
|
|
|
|
|
case 219:
|
|
|
|
test_cipher_speed("adiantum(xchacha12,aes)", ENCRYPT, sec, NULL,
|
|
|
|
0, speed_template_32);
|
|
|
|
test_cipher_speed("adiantum(xchacha12,aes)", DECRYPT, sec, NULL,
|
|
|
|
0, speed_template_32);
|
|
|
|
test_cipher_speed("adiantum(xchacha20,aes)", ENCRYPT, sec, NULL,
|
|
|
|
0, speed_template_32);
|
|
|
|
test_cipher_speed("adiantum(xchacha20,aes)", DECRYPT, sec, NULL,
|
|
|
|
0, speed_template_32);
|
|
|
|
break;
|
|
|
|
|
2019-08-19 17:17:34 +03:00
|
|
|
case 220:
|
|
|
|
test_acipher_speed("essiv(cbc(aes),sha256)",
|
|
|
|
ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_24_32);
|
|
|
|
test_acipher_speed("essiv(cbc(aes),sha256)",
|
|
|
|
DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_24_32);
|
|
|
|
break;
|
|
|
|
|
2019-07-03 11:55:12 +03:00
|
|
|
case 221:
|
|
|
|
test_aead_speed("aegis128", ENCRYPT, sec,
|
|
|
|
NULL, 0, 16, 8, speed_template_16);
|
|
|
|
test_aead_speed("aegis128", DECRYPT, sec,
|
|
|
|
NULL, 0, 16, 8, speed_template_16);
|
|
|
|
break;
|
|
|
|
|
2021-08-13 10:55:08 +03:00
|
|
|
case 222:
|
|
|
|
test_aead_speed("gcm(sm4)", ENCRYPT, sec,
|
|
|
|
NULL, 0, 16, 8, speed_template_16);
|
|
|
|
test_aead_speed("gcm(sm4)", DECRYPT, sec,
|
|
|
|
NULL, 0, 16, 8, speed_template_16);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 223:
|
|
|
|
test_aead_speed("rfc4309(ccm(sm4))", ENCRYPT, sec,
|
|
|
|
NULL, 0, 16, 16, aead_speed_template_19);
|
|
|
|
test_aead_speed("rfc4309(ccm(sm4))", DECRYPT, sec,
|
|
|
|
NULL, 0, 16, 16, aead_speed_template_19);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 224:
|
|
|
|
test_mb_aead_speed("gcm(sm4)", ENCRYPT, sec, NULL, 0, 16, 8,
|
|
|
|
speed_template_16, num_mb);
|
|
|
|
test_mb_aead_speed("gcm(sm4)", DECRYPT, sec, NULL, 0, 16, 8,
|
|
|
|
speed_template_16, num_mb);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 225:
|
|
|
|
test_mb_aead_speed("rfc4309(ccm(sm4))", ENCRYPT, sec, NULL, 0,
|
|
|
|
16, 16, aead_speed_template_19, num_mb);
|
|
|
|
test_mb_aead_speed("rfc4309(ccm(sm4))", DECRYPT, sec, NULL, 0,
|
|
|
|
16, 16, aead_speed_template_19, num_mb);
|
|
|
|
break;
|
|
|
|
|
2006-05-30 16:04:19 +04:00
|
|
|
case 300:
|
2014-12-04 11:43:29 +03:00
|
|
|
if (alg) {
|
|
|
|
test_hash_speed(alg, sec, generic_hash_speed_template);
|
|
|
|
break;
|
|
|
|
}
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2006-05-30 16:04:19 +04:00
|
|
|
case 301:
|
2006-08-19 15:38:49 +04:00
|
|
|
test_hash_speed("md4", sec, generic_hash_speed_template);
|
2006-05-30 16:04:19 +04:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2006-05-30 16:04:19 +04:00
|
|
|
case 302:
|
2006-08-19 15:38:49 +04:00
|
|
|
test_hash_speed("md5", sec, generic_hash_speed_template);
|
2006-05-30 16:04:19 +04:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2006-05-30 16:04:19 +04:00
|
|
|
case 303:
|
2006-08-19 15:38:49 +04:00
|
|
|
test_hash_speed("sha1", sec, generic_hash_speed_template);
|
2006-05-30 16:04:19 +04:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2006-05-30 16:04:19 +04:00
|
|
|
case 304:
|
2006-08-19 15:38:49 +04:00
|
|
|
test_hash_speed("sha256", sec, generic_hash_speed_template);
|
2006-05-30 16:04:19 +04:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2006-05-30 16:04:19 +04:00
|
|
|
case 305:
|
2006-08-19 15:38:49 +04:00
|
|
|
test_hash_speed("sha384", sec, generic_hash_speed_template);
|
2006-05-30 16:04:19 +04:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2006-05-30 16:04:19 +04:00
|
|
|
case 306:
|
2006-08-19 15:38:49 +04:00
|
|
|
test_hash_speed("sha512", sec, generic_hash_speed_template);
|
2006-05-30 16:04:19 +04:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2006-05-30 16:04:19 +04:00
|
|
|
case 307:
|
2006-08-19 15:38:49 +04:00
|
|
|
test_hash_speed("wp256", sec, generic_hash_speed_template);
|
2006-05-30 16:04:19 +04:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2006-05-30 16:04:19 +04:00
|
|
|
case 308:
|
2006-08-19 15:38:49 +04:00
|
|
|
test_hash_speed("wp384", sec, generic_hash_speed_template);
|
2006-05-30 16:04:19 +04:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2006-05-30 16:04:19 +04:00
|
|
|
case 309:
|
2006-08-19 15:38:49 +04:00
|
|
|
test_hash_speed("wp512", sec, generic_hash_speed_template);
|
2006-05-30 16:04:19 +04:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2007-11-10 15:08:25 +03:00
|
|
|
case 313:
|
|
|
|
test_hash_speed("sha224", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2021-05-20 13:40:00 +03:00
|
|
|
case 314:
|
|
|
|
test_hash_speed("xxhash64", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
|
|
|
fallthrough;
|
2008-05-07 18:16:36 +04:00
|
|
|
case 315:
|
|
|
|
test_hash_speed("rmd160", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2021-05-20 13:40:00 +03:00
|
|
|
case 316:
|
|
|
|
test_hash_speed("blake2s-256", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
|
|
|
fallthrough;
|
|
|
|
case 317:
|
|
|
|
test_hash_speed("blake2b-512", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
|
|
|
fallthrough;
|
2010-03-10 13:30:32 +03:00
|
|
|
case 318:
|
2020-08-05 08:57:08 +03:00
|
|
|
klen = 16;
|
|
|
|
test_hash_speed("ghash", sec, generic_hash_speed_template);
|
2010-03-10 13:30:32 +03:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2012-09-28 02:44:24 +04:00
|
|
|
case 319:
|
|
|
|
test_hash_speed("crc32c", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2013-09-07 06:56:26 +04:00
|
|
|
case 320:
|
|
|
|
test_hash_speed("crct10dif", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2015-07-16 20:13:59 +03:00
|
|
|
case 321:
|
|
|
|
test_hash_speed("poly1305", sec, poly1305_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2016-06-17 08:00:36 +03:00
|
|
|
case 322:
|
|
|
|
test_hash_speed("sha3-224", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2016-06-17 08:00:36 +03:00
|
|
|
case 323:
|
|
|
|
test_hash_speed("sha3-256", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2016-06-17 08:00:36 +03:00
|
|
|
case 324:
|
|
|
|
test_hash_speed("sha3-384", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2016-06-17 08:00:36 +03:00
|
|
|
case 325:
|
|
|
|
test_hash_speed("sha3-512", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2017-08-21 13:51:29 +03:00
|
|
|
case 326:
|
|
|
|
test_hash_speed("sm3", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2018-11-07 00:00:03 +03:00
|
|
|
case 327:
|
|
|
|
test_hash_speed("streebog256", sec,
|
|
|
|
generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2018-11-07 00:00:03 +03:00
|
|
|
case 328:
|
|
|
|
test_hash_speed("streebog512", sec,
|
|
|
|
generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2006-05-30 16:04:19 +04:00
|
|
|
case 399:
|
|
|
|
break;
|
|
|
|
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
case 400:
|
2014-12-04 11:43:29 +03:00
|
|
|
if (alg) {
|
|
|
|
test_ahash_speed(alg, sec, generic_hash_speed_template);
|
|
|
|
break;
|
|
|
|
}
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
case 401:
|
|
|
|
test_ahash_speed("md4", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
case 402:
|
|
|
|
test_ahash_speed("md5", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
case 403:
|
|
|
|
test_ahash_speed("sha1", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
case 404:
|
|
|
|
test_ahash_speed("sha256", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
case 405:
|
|
|
|
test_ahash_speed("sha384", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
case 406:
|
|
|
|
test_ahash_speed("sha512", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
case 407:
|
|
|
|
test_ahash_speed("wp256", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
case 408:
|
|
|
|
test_ahash_speed("wp384", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
case 409:
|
|
|
|
test_ahash_speed("wp512", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
case 413:
|
|
|
|
test_ahash_speed("sha224", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2021-05-20 13:40:00 +03:00
|
|
|
case 414:
|
|
|
|
test_ahash_speed("xxhash64", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
|
|
|
fallthrough;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
case 415:
|
|
|
|
test_ahash_speed("rmd160", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2021-05-20 13:40:00 +03:00
|
|
|
case 416:
|
|
|
|
test_ahash_speed("blake2s-256", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
|
|
|
fallthrough;
|
|
|
|
case 417:
|
|
|
|
test_ahash_speed("blake2b-512", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
|
|
|
fallthrough;
|
2016-06-17 08:00:36 +03:00
|
|
|
case 418:
|
|
|
|
test_ahash_speed("sha3-224", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2016-06-17 08:00:36 +03:00
|
|
|
case 419:
|
|
|
|
test_ahash_speed("sha3-256", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2016-06-17 08:00:36 +03:00
|
|
|
case 420:
|
|
|
|
test_ahash_speed("sha3-384", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2016-06-17 08:00:36 +03:00
|
|
|
case 421:
|
|
|
|
test_ahash_speed("sha3-512", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2016-06-24 04:40:47 +03:00
|
|
|
case 422:
|
2017-12-17 11:29:02 +03:00
|
|
|
test_mb_ahash_speed("sha1", sec, generic_hash_speed_template,
|
|
|
|
num_mb);
|
2016-06-24 04:40:47 +03:00
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2016-06-24 04:40:47 +03:00
|
|
|
case 423:
|
2017-12-17 11:29:02 +03:00
|
|
|
test_mb_ahash_speed("sha256", sec, generic_hash_speed_template,
|
|
|
|
num_mb);
|
2016-06-24 04:40:47 +03:00
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2016-06-27 20:20:09 +03:00
|
|
|
case 424:
|
2017-12-17 11:29:02 +03:00
|
|
|
test_mb_ahash_speed("sha512", sec, generic_hash_speed_template,
|
|
|
|
num_mb);
|
2016-06-27 20:20:09 +03:00
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2017-08-21 13:51:29 +03:00
|
|
|
case 425:
|
2017-12-17 11:29:02 +03:00
|
|
|
test_mb_ahash_speed("sm3", sec, generic_hash_speed_template,
|
|
|
|
num_mb);
|
2017-08-21 13:51:29 +03:00
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2018-11-07 00:00:03 +03:00
|
|
|
case 426:
|
|
|
|
test_mb_ahash_speed("streebog256", sec,
|
|
|
|
generic_hash_speed_template, num_mb);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
2018-11-07 00:00:03 +03:00
|
|
|
case 427:
|
|
|
|
test_mb_ahash_speed("streebog512", sec,
|
|
|
|
generic_hash_speed_template, num_mb);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 01:36:59 +03:00
|
|
|
fallthrough;
|
crypto: tcrypt - Add speed tests for async hashing
These are invoked in the 'mode' range of 400 to 499.
The cost of async vs. sync for the software algorithm implementations
varies. It can be as low as 16 cycles but as much as a couple hundred.
Here two runs of md5 testing, async then sync:
testing speed of async md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2448 cycles/operation, 153 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 4992 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3808 cycles/operation, 59 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14000 cycles/operation, 54 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8480 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7280 cycles/operation, 28 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50016 cycles/operation, 48 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22496 cycles/operation, 21 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 21232 cycles/operation, 20 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 117184 cycles/operation, 57 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43008 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40176 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39888 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 194176 cycles/operation, 47 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 84096 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 78336 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 77120 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 403056 cycles/operation, 49 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 166112 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 154768 cycles/operation, 18 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 151904 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 155456 cycles/operation, 18 cycles/byte
testing speed of md5
test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2208 cycles/operation, 138 cycles/byte
test 1 ( 64 byte blocks, 16 bytes per update, 4 updates): 5008 cycles/operation, 78 cycles/byte
test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 3600 cycles/operation, 56 cycles/byte
test 3 ( 256 byte blocks, 16 bytes per update, 16 updates): 14080 cycles/operation, 55 cycles/byte
test 4 ( 256 byte blocks, 64 bytes per update, 4 updates): 8560 cycles/operation, 33 cycles/byte
test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 7040 cycles/operation, 27 cycles/byte
test 6 ( 1024 byte blocks, 16 bytes per update, 64 updates): 50592 cycles/operation, 49 cycles/byte
test 7 ( 1024 byte blocks, 256 bytes per update, 4 updates): 22736 cycles/operation, 22 cycles/byte
test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 24960 cycles/operation, 24 cycles/byte
test 9 ( 2048 byte blocks, 16 bytes per update, 128 updates): 99312 cycles/operation, 48 cycles/byte
test 10 ( 2048 byte blocks, 256 bytes per update, 8 updates): 43520 cycles/operation, 21 cycles/byte
test 11 ( 2048 byte blocks, 1024 bytes per update, 2 updates): 40704 cycles/operation, 19 cycles/byte
test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 39552 cycles/operation, 19 cycles/byte
test 13 ( 4096 byte blocks, 16 bytes per update, 256 updates): 196720 cycles/operation, 48 cycles/byte
test 14 ( 4096 byte blocks, 256 bytes per update, 16 updates): 85152 cycles/operation, 20 cycles/byte
test 15 ( 4096 byte blocks, 1024 bytes per update, 4 updates): 79408 cycles/operation, 19 cycles/byte
test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 76816 cycles/operation, 18 cycles/byte
test 17 ( 8192 byte blocks, 16 bytes per update, 512 updates): 391520 cycles/operation, 47 cycles/byte
test 18 ( 8192 byte blocks, 256 bytes per update, 32 updates): 168464 cycles/operation, 20 cycles/byte
test 19 ( 8192 byte blocks, 1024 bytes per update, 8 updates): 156912 cycles/operation, 19 cycles/byte
test 20 ( 8192 byte blocks, 4096 bytes per update, 2 updates): 154016 cycles/operation, 18 cycles/byte
test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 153856 cycles/operation, 18 cycles/byte
We can ditch the sync hash code at some point if we feel that makes
sense. For now I've left it there.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2010-05-19 08:11:21 +04:00
|
|
|
case 499:
|
|
|
|
break;
|
|
|
|
|
2011-10-18 01:02:58 +04:00
|
|
|
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,
|
2017-07-19 19:40:32 +03:00
|
|
|
speed_template_32_64);
|
2011-10-18 01:02:58 +04:00
|
|
|
test_acipher_speed("xts(aes)", DECRYPT, sec, NULL, 0,
|
2017-07-19 19:40:32 +03:00
|
|
|
speed_template_32_64);
|
2016-06-29 13:04:14 +03:00
|
|
|
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);
|
2011-10-18 01:02:58 +04:00
|
|
|
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);
|
2012-07-01 21:19:47 +04:00
|
|
|
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);
|
2012-12-28 14:04:58 +04:00
|
|
|
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);
|
2011-10-18 01:02:58 +04:00
|
|
|
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);
|
2012-07-01 21:19:47 +04:00
|
|
|
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);
|
2011-10-18 01:02:58 +04:00
|
|
|
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);
|
2012-07-01 21:19:47 +04:00
|
|
|
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);
|
2011-10-18 01:02:58 +04:00
|
|
|
break;
|
|
|
|
|
2011-10-18 01:03:03 +04:00
|
|
|
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);
|
2011-10-18 14:32:39 +04:00
|
|
|
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);
|
2011-10-18 14:33:22 +04:00
|
|
|
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);
|
2011-10-18 01:03:03 +04:00
|
|
|
break;
|
|
|
|
|
2012-05-28 17:54:24 +04:00
|
|
|
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;
|
|
|
|
|
2012-06-12 12:52:04 +04:00
|
|
|
case 505:
|
|
|
|
test_acipher_speed("ecb(arc4)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_8);
|
|
|
|
break;
|
|
|
|
|
2012-07-11 21:37:21 +04:00
|
|
|
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;
|
|
|
|
|
2012-07-11 21:38:29 +04:00
|
|
|
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;
|
|
|
|
|
2012-10-26 15:48:51 +04:00
|
|
|
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;
|
|
|
|
|
2013-04-13 14:46:40 +04:00
|
|
|
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;
|
|
|
|
|
2021-07-20 06:46:42 +03:00
|
|
|
case 518:
|
|
|
|
test_acipher_speed("ecb(sm4)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
|
|
|
test_acipher_speed("ecb(sm4)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
|
|
|
test_acipher_speed("cbc(sm4)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
|
|
|
test_acipher_speed("cbc(sm4)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
|
|
|
test_acipher_speed("cfb(sm4)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
|
|
|
test_acipher_speed("cfb(sm4)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
|
|
|
test_acipher_speed("ctr(sm4)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
|
|
|
test_acipher_speed("ctr(sm4)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
|
|
|
break;
|
|
|
|
|
2017-12-17 11:29:04 +03:00
|
|
|
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;
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
case 1000:
|
|
|
|
test_available();
|
|
|
|
break;
|
|
|
|
}
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
|
|
|
|
return ret;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2008-04-05 17:00:57 +04:00
|
|
|
static int __init tcrypt_mod_init(void)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2007-11-26 17:12:07 +03:00
|
|
|
int err = -ENOMEM;
|
2008-07-31 08:23:53 +04:00
|
|
|
int i;
|
2007-11-26 17:12:07 +03:00
|
|
|
|
2008-07-31 08:23:53 +04:00
|
|
|
for (i = 0; i < TVMEMSIZE; i++) {
|
|
|
|
tvmem[i] = (void *)__get_free_page(GFP_KERNEL);
|
|
|
|
if (!tvmem[i])
|
|
|
|
goto err_free_tv;
|
|
|
|
}
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2018-04-27 05:57:28 +03:00
|
|
|
err = do_test(alg, type, mask, mode, num_mb);
|
2009-06-19 15:46:53 +04:00
|
|
|
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
if (err) {
|
|
|
|
printk(KERN_ERR "tcrypt: one or more tests failed!\n");
|
|
|
|
goto err_free_tv;
|
2017-01-18 16:54:05 +03:00
|
|
|
} else {
|
|
|
|
pr_debug("all tests passed\n");
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
}
|
2006-05-30 08:49:38 +04:00
|
|
|
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
/* 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.
|
2006-05-30 08:49:38 +04:00
|
|
|
* => we don't need it in the memory, do we?
|
|
|
|
* -- mludvig
|
|
|
|
*/
|
crypto: tcrypt - Do not exit on success in fips mode
At present, the tcrypt module always exits with an -EAGAIN upon
successfully completing all the tests its been asked to run. In fips
mode, integrity checking is done by running all self-tests from the
initrd, and its much simpler to check the ret from modprobe for
success than to scrape dmesg and/or /proc/crypto. Simply stay
loaded, giving modprobe a retval of 0, if self-tests all pass and
we're in fips mode.
A side-effect of tracking success/failure for fips mode is that in
non-fips mode, self-test failures will return the actual failure
return codes, rather than always returning -EAGAIN, which seems more
correct anyway.
The tcrypt_test() portion of the patch is dependent on my earlier
pair of patches that skip non-fips algs in fips mode, at least to
achieve the fully intended behavior.
Nb: testing this patch against the cryptodev tree revealed a test
failure for sha384, which I have yet to look into...
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2009-05-27 09:10:21 +04:00
|
|
|
if (!fips_enabled)
|
|
|
|
err = -EAGAIN;
|
2007-11-26 17:12:07 +03:00
|
|
|
|
2008-07-31 08:23:53 +04:00
|
|
|
err_free_tv:
|
|
|
|
for (i = 0; i < TVMEMSIZE && tvmem[i]; i++)
|
|
|
|
free_page((unsigned long)tvmem[i]);
|
2007-11-26 17:12:07 +03:00
|
|
|
|
|
|
|
return err;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If an init function is provided, an exit function must also be provided
|
|
|
|
* to allow module unload.
|
|
|
|
*/
|
2008-04-05 17:00:57 +04:00
|
|
|
static void __exit tcrypt_mod_fini(void) { }
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2020-11-20 14:04:31 +03:00
|
|
|
late_initcall(tcrypt_mod_init);
|
2008-04-05 17:00:57 +04:00
|
|
|
module_exit(tcrypt_mod_fini);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2009-06-19 15:46:53 +04:00
|
|
|
module_param(alg, charp, 0);
|
|
|
|
module_param(type, uint, 0);
|
2009-07-14 12:06:54 +04:00
|
|
|
module_param(mask, uint, 0);
|
2005-04-17 02:20:36 +04:00
|
|
|
module_param(mode, int, 0);
|
2005-06-23 00:27:23 +04:00
|
|
|
module_param(sec, uint, 0);
|
2005-06-23 00:29:03 +04:00
|
|
|
MODULE_PARM_DESC(sec, "Length in seconds of speed tests "
|
|
|
|
"(defaults to zero which uses CPU cycles instead)");
|
2017-12-17 11:29:02 +03:00
|
|
|
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)");
|
2020-08-05 08:57:08 +03:00
|
|
|
module_param(klen, uint, 0);
|
|
|
|
MODULE_PARM_DESC(klen, "Key length (defaults to 0)");
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_DESCRIPTION("Quick & dirty crypto testing module");
|
|
|
|
MODULE_AUTHOR("James Morris <jmorris@intercode.com.au>");
|