2019-05-27 14:55:01 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2005-06-23 04:26:03 +08:00
|
|
|
/*
|
2005-04-17 06:20:36 +08: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 22:12:07 +08:00
|
|
|
* Copyright (c) 2007 Nokia Siemens Networks
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2010-11-05 03:02:04 +08: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 06:20:36 +08:00
|
|
|
*/
|
|
|
|
|
2017-01-18 21:54:05 +08:00
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
|
|
|
2015-04-22 15:06:30 +08:00
|
|
|
#include <crypto/aead.h>
|
2008-07-10 16:01:22 +08:00
|
|
|
#include <crypto/hash.h>
|
2016-06-29 18:03:50 +08:00
|
|
|
#include <crypto/skcipher.h>
|
2006-08-13 06:26:09 +08:00
|
|
|
#include <linux/err.h>
|
2015-04-22 13:25:57 +08:00
|
|
|
#include <linux/fips.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/init.h>
|
2023-04-03 12:48:42 +08:00
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/jiffies.h>
|
|
|
|
#include <linux/kernel.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/module.h>
|
2023-04-03 12:48:42 +08:00
|
|
|
#include <linux/moduleparam.h>
|
2005-09-17 15:55:31 +08:00
|
|
|
#include <linux/scatterlist.h>
|
2023-04-03 12:48:42 +08:00
|
|
|
#include <linux/slab.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/string.h>
|
2005-06-23 04:29:03 +08:00
|
|
|
#include <linux/timex.h>
|
2023-04-03 12:48:42 +08:00
|
|
|
|
|
|
|
#include "internal.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
#include "tcrypt.h"
|
|
|
|
|
|
|
|
/*
|
2008-07-31 12:23:53 +08:00
|
|
|
* Need slab memory for testing (size in number of pages).
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2008-07-31 12:23:53 +08:00
|
|
|
#define TVMEMSIZE 4
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
2008-07-31 17:08:25 +08:00
|
|
|
* Used by test_cipher_speed()
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
#define ENCRYPT 1
|
|
|
|
#define DECRYPT 0
|
|
|
|
|
2015-08-27 23:38:36 +08:00
|
|
|
#define MAX_DIGEST_SIZE 64
|
|
|
|
|
2014-06-26 13:57:42 +08: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 04:27:23 +08:00
|
|
|
/*
|
|
|
|
* Used by test_cipher_speed()
|
|
|
|
*/
|
2005-06-23 04:29:03 +08:00
|
|
|
static unsigned int sec;
|
2005-06-23 04:27:23 +08:00
|
|
|
|
2022-07-23 17:26:40 +08:00
|
|
|
static char *alg;
|
2009-06-19 19:46:53 +08:00
|
|
|
static u32 type;
|
2009-07-14 16:06:54 +08:00
|
|
|
static u32 mask;
|
2005-04-17 06:20:36 +08:00
|
|
|
static int mode;
|
2017-12-17 16:29:02 +08:00
|
|
|
static u32 num_mb = 8;
|
2020-08-05 13:57:08 +08:00
|
|
|
static unsigned int klen;
|
2008-07-31 12:23:53 +08:00
|
|
|
static char *tvmem[TVMEMSIZE];
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2021-07-20 11:46:42 +08:00
|
|
|
static const int block_sizes[] = { 16, 64, 128, 256, 1024, 1420, 4096, 0 };
|
2020-11-20 19:04:33 +08:00
|
|
|
static const int aead_sizes[] = { 16, 64, 256, 512, 1024, 1420, 4096, 8192, 0 };
|
2017-12-17 16:29:05 +08: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 23:31:49 +08:00
|
|
|
static inline int do_one_aead_op(struct aead_request *req, int ret)
|
|
|
|
{
|
2017-10-18 15:00:48 +08:00
|
|
|
struct crypto_wait *wait = req->base.data;
|
2015-07-07 23:31:49 +08:00
|
|
|
|
2017-10-18 15:00:48 +08:00
|
|
|
return crypto_wait_req(ret, wait);
|
2015-07-07 23:31:49 +08:00
|
|
|
}
|
|
|
|
|
2017-12-17 16:29:05 +08: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 10:57:28 +08:00
|
|
|
u32 num_mb, int *rc)
|
2017-12-17 16:29:05 +08:00
|
|
|
{
|
2018-04-27 10:57:28 +08:00
|
|
|
int i, err = 0;
|
2017-12-17 16:29:05 +08: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 06:28:47 +08:00
|
|
|
{
|
|
|
|
unsigned long start, end;
|
|
|
|
int bcount;
|
2018-04-27 10:57:28 +08:00
|
|
|
int ret = 0;
|
|
|
|
int *rc;
|
|
|
|
|
|
|
|
rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL);
|
|
|
|
if (!rc)
|
|
|
|
return -ENOMEM;
|
2013-12-12 06:28:47 +08:00
|
|
|
|
2014-07-25 17:53:38 +08:00
|
|
|
for (start = jiffies, end = start + secs * HZ, bcount = 0;
|
2013-12-12 06:28:47 +08:00
|
|
|
time_before(jiffies, end); bcount++) {
|
2018-04-27 10:57:28 +08:00
|
|
|
ret = do_mult_aead_op(data, enc, num_mb, rc);
|
2013-12-12 06:28:47 +08:00
|
|
|
if (ret)
|
2018-04-27 10:57:28 +08:00
|
|
|
goto out;
|
2013-12-12 06:28:47 +08:00
|
|
|
}
|
|
|
|
|
2020-12-08 22:34:41 +08:00
|
|
|
pr_cont("%d operations in %d seconds (%llu bytes)\n",
|
|
|
|
bcount * num_mb, secs, (u64)bcount * blen * num_mb);
|
2018-04-27 10:57:28 +08:00
|
|
|
|
|
|
|
out:
|
|
|
|
kfree(rc);
|
|
|
|
return ret;
|
2013-12-12 06:28:47 +08:00
|
|
|
}
|
|
|
|
|
2017-12-17 16:29:05 +08:00
|
|
|
static int test_mb_aead_cycles(struct test_mb_aead_data *data, int enc,
|
|
|
|
int blen, u32 num_mb)
|
2013-12-12 06:28:47 +08:00
|
|
|
{
|
|
|
|
unsigned long cycles = 0;
|
|
|
|
int ret = 0;
|
|
|
|
int i;
|
2018-04-27 10:57:28 +08:00
|
|
|
int *rc;
|
|
|
|
|
|
|
|
rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL);
|
|
|
|
if (!rc)
|
|
|
|
return -ENOMEM;
|
2013-12-12 06:28:47 +08:00
|
|
|
|
|
|
|
/* Warm-up run. */
|
|
|
|
for (i = 0; i < 4; i++) {
|
2018-04-27 10:57:28 +08:00
|
|
|
ret = do_mult_aead_op(data, enc, num_mb, rc);
|
2013-12-12 06:28:47 +08:00
|
|
|
if (ret)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The real thing. */
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
cycles_t start, end;
|
|
|
|
|
|
|
|
start = get_cycles();
|
2018-04-27 10:57:28 +08:00
|
|
|
ret = do_mult_aead_op(data, enc, num_mb, rc);
|
2013-12-12 06:28:47 +08:00
|
|
|
end = get_cycles();
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
cycles += end - start;
|
|
|
|
}
|
|
|
|
|
2018-04-27 10:57:28 +08:00
|
|
|
pr_cont("1 operation in %lu cycles (%d bytes)\n",
|
|
|
|
(cycles + 4) / (8 * num_mb), blen);
|
2013-12-12 06:28:47 +08:00
|
|
|
|
2018-04-27 10:57:28 +08:00
|
|
|
out:
|
|
|
|
kfree(rc);
|
2013-12-12 06:28:47 +08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2017-12-17 16:29:05 +08: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 19:04:33 +08:00
|
|
|
const int *b_size;
|
2017-12-17 16:29:05 +08:00
|
|
|
const char *key;
|
|
|
|
const char *e;
|
|
|
|
void *assoc;
|
|
|
|
char *iv;
|
|
|
|
int ret;
|
2013-12-12 06:28:47 +08:00
|
|
|
|
|
|
|
|
2017-12-17 16:29:05 +08:00
|
|
|
if (aad_size >= PAGE_SIZE) {
|
|
|
|
pr_err("associate data length (%u) too big\n", aad_size);
|
|
|
|
return;
|
|
|
|
}
|
2013-12-12 06:28:47 +08:00
|
|
|
|
2017-12-17 16:29:05 +08: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 06:28:47 +08:00
|
|
|
}
|
|
|
|
|
2017-12-17 16:29:05 +08:00
|
|
|
ret = crypto_aead_setauthsize(tfm, authsize);
|
2021-08-13 15:55:06 +08:00
|
|
|
if (ret) {
|
|
|
|
pr_err("alg: aead: Failed to setauthsize for %s: %d\n", algo,
|
|
|
|
ret);
|
|
|
|
goto out_free_tfm;
|
|
|
|
}
|
2013-12-12 06:28:47 +08:00
|
|
|
|
2017-12-17 16:29:05 +08: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 06:28:47 +08:00
|
|
|
|
2017-12-17 16:29:05 +08: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 23:43:04 +08:00
|
|
|
testmgr_free_buf(data[i].xoutbuf);
|
2017-12-17 16:29:05 +08: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 15:55:06 +08:00
|
|
|
pr_err("alg: aead: Failed to allocate request for %s\n",
|
2017-12-17 16:29:05 +08: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);
|
|
|
|
}
|
|
|
|
|
2022-10-27 03:16:16 +08:00
|
|
|
pr_info("testing speed of multibuffer %s (%s) %s\n", algo,
|
2017-12-17 16:29:05 +08:00
|
|
|
get_driver_name(crypto_aead, tfm), e);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
do {
|
|
|
|
b_size = aead_sizes;
|
|
|
|
do {
|
2020-11-20 19:04:33 +08:00
|
|
|
int bs = round_up(*b_size, crypto_aead_blocksize(tfm));
|
|
|
|
|
|
|
|
if (bs + authsize > XBUFSIZE * PAGE_SIZE) {
|
2018-01-02 17:21:06 +08:00
|
|
|
pr_err("template (%u) too big for buffer (%lu)\n",
|
2020-11-20 19:04:33 +08:00
|
|
|
authsize + bs,
|
2017-12-17 16:29:05 +08:00
|
|
|
XBUFSIZE * PAGE_SIZE);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
pr_info("test %u (%d bit key, %d byte blocks): ", i,
|
2020-11-20 19:04:33 +08:00
|
|
|
*keysize * 8, bs);
|
2017-12-17 16:29:05 +08: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 19:04:33 +08:00
|
|
|
bs + (enc ? 0 : authsize),
|
2017-12-17 16:29:05 +08:00
|
|
|
assoc, aad_size);
|
|
|
|
|
|
|
|
sg_init_aead(cur->sgout, cur->xoutbuf,
|
2020-11-20 19:04:33 +08:00
|
|
|
bs + (enc ? authsize : 0),
|
2017-12-17 16:29:05 +08: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 19:04:33 +08:00
|
|
|
bs, iv);
|
2017-12-17 16:29:05 +08:00
|
|
|
ret = crypto_aead_encrypt(cur->req);
|
|
|
|
ret = do_one_aead_op(cur->req, ret);
|
|
|
|
|
|
|
|
if (ret) {
|
2020-07-31 10:39:24 +08:00
|
|
|
pr_err("calculating auth failed (%d)\n",
|
2017-12-17 16:29:05 +08:00
|
|
|
ret);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aead_request_set_crypt(cur->req, cur->sg,
|
2020-11-20 19:04:33 +08:00
|
|
|
cur->sgout, bs +
|
2017-12-17 16:29:05 +08:00
|
|
|
(enc ? 0 : authsize),
|
|
|
|
iv);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-07-23 22:18:48 +08:00
|
|
|
if (secs) {
|
2020-11-20 19:04:33 +08:00
|
|
|
ret = test_mb_aead_jiffies(data, enc, bs,
|
2017-12-17 16:29:05 +08:00
|
|
|
secs, num_mb);
|
2018-07-23 22:18:48 +08:00
|
|
|
cond_resched();
|
|
|
|
} else {
|
2020-11-20 19:04:33 +08:00
|
|
|
ret = test_mb_aead_cycles(data, enc, bs,
|
2017-12-17 16:29:05 +08:00
|
|
|
num_mb);
|
2018-07-23 22:18:48 +08:00
|
|
|
}
|
2017-12-17 16:29:05 +08: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 06:28:47 +08:00
|
|
|
}
|
|
|
|
|
2017-12-17 16:29:05 +08:00
|
|
|
static int test_aead_jiffies(struct aead_request *req, int enc,
|
|
|
|
int blen, int secs)
|
2013-12-12 06:28:47 +08:00
|
|
|
{
|
2017-12-17 16:29:05 +08:00
|
|
|
unsigned long start, end;
|
|
|
|
int bcount;
|
|
|
|
int ret;
|
2013-12-12 06:28:47 +08:00
|
|
|
|
2017-12-17 16:29:05 +08: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 22:34:41 +08:00
|
|
|
pr_cont("%d operations in %d seconds (%llu bytes)\n",
|
|
|
|
bcount, secs, (u64)bcount * blen);
|
2017-12-17 16:29:05 +08:00
|
|
|
return 0;
|
2013-12-12 06:28:47 +08:00
|
|
|
}
|
|
|
|
|
2017-12-17 16:29:05 +08:00
|
|
|
static int test_aead_cycles(struct aead_request *req, int enc, int blen)
|
2013-12-12 06:28:47 +08:00
|
|
|
{
|
2017-12-17 16:29:05 +08:00
|
|
|
unsigned long cycles = 0;
|
|
|
|
int ret = 0;
|
|
|
|
int i;
|
2013-12-12 06:28:47 +08:00
|
|
|
|
2017-12-17 16:29:05 +08: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 06:28:47 +08:00
|
|
|
}
|
2015-01-27 17:54:27 +08:00
|
|
|
|
2017-12-17 16:29:05 +08:00
|
|
|
/* The real thing. */
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
cycles_t start, end;
|
2017-11-14 22:59:15 +08:00
|
|
|
|
2017-12-17 16:29:05 +08: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 22:59:15 +08:00
|
|
|
|
2017-12-17 16:29:05 +08:00
|
|
|
if (ret)
|
|
|
|
goto out;
|
2015-01-27 17:54:27 +08:00
|
|
|
|
2017-12-17 16:29:05 +08:00
|
|
|
cycles += end - start;
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
if (ret == 0)
|
2022-10-27 03:16:13 +08:00
|
|
|
pr_cont("1 operation in %lu cycles (%d bytes)\n",
|
|
|
|
(cycles + 4) / 8, blen);
|
2017-12-17 16:29:05 +08:00
|
|
|
|
|
|
|
return ret;
|
2013-12-12 06:28:47 +08:00
|
|
|
}
|
|
|
|
|
2014-07-25 17:53:38 +08:00
|
|
|
static void test_aead_speed(const char *algo, int enc, unsigned int secs,
|
2013-12-12 06:28:47 +08: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 19:07:32 +08:00
|
|
|
char *iv;
|
2013-12-12 06:28:47 +08:00
|
|
|
char *xbuf[XBUFSIZE];
|
|
|
|
char *xoutbuf[XBUFSIZE];
|
|
|
|
char *axbuf[XBUFSIZE];
|
2020-11-20 19:04:33 +08:00
|
|
|
const int *b_size;
|
2013-12-12 06:28:47 +08:00
|
|
|
unsigned int iv_len;
|
2017-10-18 15:00:48 +08:00
|
|
|
struct crypto_wait wait;
|
2013-12-12 06:28:47 +08:00
|
|
|
|
2015-01-28 19:07:32 +08:00
|
|
|
iv = kzalloc(MAX_IVLEN, GFP_KERNEL);
|
|
|
|
if (!iv)
|
|
|
|
return;
|
|
|
|
|
2014-04-22 02:45:59 +08:00
|
|
|
if (aad_size >= PAGE_SIZE) {
|
|
|
|
pr_err("associate data length (%u) too big\n", aad_size);
|
2015-01-28 19:07:32 +08:00
|
|
|
goto out_noxbuf;
|
2014-04-22 02:45:59 +08:00
|
|
|
}
|
|
|
|
|
2013-12-12 06:28:47 +08: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 16:03:51 +08:00
|
|
|
sg = kmalloc(sizeof(*sg) * 9 * 2, GFP_KERNEL);
|
2013-12-12 06:28:47 +08:00
|
|
|
if (!sg)
|
|
|
|
goto out_nosg;
|
2015-05-27 16:03:51 +08:00
|
|
|
sgout = &sg[9];
|
2013-12-12 06:28:47 +08:00
|
|
|
|
2015-08-13 17:29:06 +08:00
|
|
|
tfm = crypto_alloc_aead(algo, 0, 0);
|
2013-12-12 06:28:47 +08:00
|
|
|
if (IS_ERR(tfm)) {
|
|
|
|
pr_err("alg: aead: Failed to load transform for %s: %ld\n", algo,
|
|
|
|
PTR_ERR(tfm));
|
2014-04-22 02:46:40 +08:00
|
|
|
goto out_notfm;
|
2013-12-12 06:28:47 +08:00
|
|
|
}
|
|
|
|
|
2021-08-13 15:55:06 +08: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 15:00:48 +08:00
|
|
|
crypto_init_wait(&wait);
|
2022-10-27 03:16:16 +08:00
|
|
|
pr_info("testing speed of %s (%s) %s\n", algo,
|
2022-10-27 03:16:14 +08:00
|
|
|
get_driver_name(crypto_aead, tfm), e);
|
2014-06-26 13:57:42 +08:00
|
|
|
|
2013-12-12 06:28:47 +08:00
|
|
|
req = aead_request_alloc(tfm, GFP_KERNEL);
|
|
|
|
if (!req) {
|
|
|
|
pr_err("alg: aead: Failed to allocate request for %s\n",
|
|
|
|
algo);
|
2014-04-22 02:47:05 +08:00
|
|
|
goto out_noreq;
|
2013-12-12 06:28:47 +08:00
|
|
|
}
|
|
|
|
|
2015-07-07 23:31:49 +08:00
|
|
|
aead_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
|
2017-10-18 15:00:48 +08:00
|
|
|
crypto_req_done, &wait);
|
2015-07-07 23:31:49 +08:00
|
|
|
|
2013-12-12 06:28:47 +08:00
|
|
|
i = 0;
|
|
|
|
do {
|
|
|
|
b_size = aead_sizes;
|
|
|
|
do {
|
2020-11-20 19:04:33 +08:00
|
|
|
u32 bs = round_up(*b_size, crypto_aead_blocksize(tfm));
|
|
|
|
|
2013-12-12 06:28:47 +08:00
|
|
|
assoc = axbuf[0];
|
2014-04-22 02:45:59 +08:00
|
|
|
memset(assoc, 0xff, aad_size);
|
2013-12-12 06:28:47 +08:00
|
|
|
|
2020-11-20 19:04:33 +08:00
|
|
|
if ((*keysize + bs) > TVMEMSIZE * PAGE_SIZE) {
|
2013-12-12 06:28:47 +08:00
|
|
|
pr_err("template (%u) too big for tvmem (%lu)\n",
|
2020-11-20 19:04:33 +08:00
|
|
|
*keysize + bs,
|
2013-12-12 06:28:47 +08: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 15:55:06 +08:00
|
|
|
|
2013-12-12 06:28:47 +08:00
|
|
|
ret = crypto_aead_setkey(tfm, key, *keysize);
|
2021-08-13 15:55:06 +08:00
|
|
|
if (ret) {
|
|
|
|
pr_err("setkey() failed flags=%x: %d\n",
|
|
|
|
crypto_aead_get_flags(tfm), ret);
|
|
|
|
goto out;
|
|
|
|
}
|
2013-12-12 06:28:47 +08:00
|
|
|
|
|
|
|
iv_len = crypto_aead_ivsize(tfm);
|
|
|
|
if (iv_len)
|
2015-01-28 19:07:32 +08:00
|
|
|
memset(iv, 0xff, iv_len);
|
2013-12-12 06:28:47 +08:00
|
|
|
|
|
|
|
crypto_aead_clear_flags(tfm, ~0);
|
2022-10-27 03:16:14 +08:00
|
|
|
pr_info("test %u (%d bit key, %d byte blocks): ",
|
|
|
|
i, *keysize * 8, bs);
|
2013-12-12 06:28:47 +08:00
|
|
|
|
|
|
|
memset(tvmem[0], 0xff, PAGE_SIZE);
|
|
|
|
|
2020-11-20 19:04:33 +08:00
|
|
|
sg_init_aead(sg, xbuf, bs + (enc ? 0 : authsize),
|
2017-11-14 22:59:15 +08:00
|
|
|
assoc, aad_size);
|
2013-12-12 06:28:47 +08:00
|
|
|
|
2015-06-17 14:05:26 +08:00
|
|
|
sg_init_aead(sgout, xoutbuf,
|
2020-11-20 19:04:33 +08:00
|
|
|
bs + (enc ? authsize : 0), assoc,
|
2017-11-14 22:59:15 +08:00
|
|
|
aad_size);
|
2015-06-17 14:05:26 +08:00
|
|
|
|
2017-12-17 16:29:01 +08: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 19:04:33 +08:00
|
|
|
bs, iv);
|
2017-12-17 16:29:01 +08:00
|
|
|
ret = do_one_aead_op(req,
|
|
|
|
crypto_aead_encrypt(req));
|
|
|
|
|
|
|
|
if (ret) {
|
2020-07-31 10:39:24 +08:00
|
|
|
pr_err("calculating auth failed (%d)\n",
|
2017-12-17 16:29:01 +08:00
|
|
|
ret);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-10 18:22:00 +08:00
|
|
|
aead_request_set_crypt(req, sg, sgout,
|
2020-11-20 19:04:33 +08:00
|
|
|
bs + (enc ? 0 : authsize),
|
2017-10-10 18:22:00 +08:00
|
|
|
iv);
|
2013-12-12 06:28:47 +08:00
|
|
|
|
2018-07-23 22:18:48 +08:00
|
|
|
if (secs) {
|
2020-11-20 19:04:33 +08:00
|
|
|
ret = test_aead_jiffies(req, enc, bs,
|
2014-07-25 17:53:38 +08:00
|
|
|
secs);
|
2018-07-23 22:18:48 +08:00
|
|
|
cond_resched();
|
|
|
|
} else {
|
2020-11-20 19:04:33 +08:00
|
|
|
ret = test_aead_cycles(req, enc, bs);
|
2018-07-23 22:18:48 +08:00
|
|
|
}
|
2013-12-12 06:28:47 +08: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-22 02:47:05 +08:00
|
|
|
aead_request_free(req);
|
|
|
|
out_noreq:
|
2013-12-12 06:28:47 +08:00
|
|
|
crypto_free_aead(tfm);
|
2014-04-22 02:46:40 +08:00
|
|
|
out_notfm:
|
2013-12-12 06:28:47 +08: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 19:07:32 +08:00
|
|
|
kfree(iv);
|
2013-12-12 06:28:47 +08:00
|
|
|
}
|
2008-03-11 21:27:11 +08: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 12:11:21 +08: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 15:00:48 +08: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 12:11:21 +08:00
|
|
|
|
2017-10-18 15:00:48 +08: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 12:11:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int test_ahash_jiffies_digest(struct ahash_request *req, int blen,
|
2014-07-25 17:53:38 +08: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 12:11:21 +08:00
|
|
|
{
|
|
|
|
unsigned long start, end;
|
|
|
|
int bcount;
|
|
|
|
int ret;
|
|
|
|
|
2014-07-25 17:53:38 +08: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 12:11:21 +08:00
|
|
|
time_before(jiffies, end); bcount++) {
|
|
|
|
ret = do_one_ahash_op(req, crypto_ahash_digest(req));
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2022-10-27 03:16:13 +08:00
|
|
|
pr_cont("%6u opers/sec, %9lu bytes/sec\n",
|
|
|
|
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 12:11:21 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int test_ahash_jiffies(struct ahash_request *req, int blen,
|
2014-07-25 17:53:38 +08: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 12:11:21 +08:00
|
|
|
{
|
|
|
|
unsigned long start, end;
|
|
|
|
int bcount, pcount;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (plen == blen)
|
2014-07-25 17:53:38 +08: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 12:11:21 +08:00
|
|
|
|
2014-07-25 17:53:38 +08: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 12:11:21 +08:00
|
|
|
time_before(jiffies, end); bcount++) {
|
2015-04-22 11:02:27 +08: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 12:11:21 +08: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 17:53:38 +08: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 12:11:21 +08: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 11:02:27 +08: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 12:11:21 +08: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 11:02:27 +08: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 12:11:21 +08: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 21:36:49 +08: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 12:11:21 +08:00
|
|
|
{
|
|
|
|
struct scatterlist sg[TVMEMSIZE];
|
2017-10-18 15:00:48 +08: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 12:11:21 +08:00
|
|
|
struct ahash_request *req;
|
|
|
|
struct crypto_ahash *tfm;
|
2015-08-27 23:38:36 +08: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 12:11:21 +08:00
|
|
|
int i, ret;
|
|
|
|
|
2016-02-01 21:36:49 +08: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 12:11:21 +08:00
|
|
|
if (IS_ERR(tfm)) {
|
|
|
|
pr_err("failed to load transform for %s: %ld\n",
|
|
|
|
algo, PTR_ERR(tfm));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-10-27 03:16:16 +08:00
|
|
|
pr_info("testing speed of async %s (%s)\n", algo,
|
2022-10-27 03:16:14 +08:00
|
|
|
get_driver_name(crypto_ahash, tfm));
|
2014-06-26 13:57:42 +08:00
|
|
|
|
2015-08-27 23:38:36 +08: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 12:11:21 +08: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 15:00:48 +08: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 12:11:21 +08:00
|
|
|
ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
|
2017-10-18 15:00:48 +08: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 12:11:21 +08:00
|
|
|
|
2015-08-27 23:38:36 +08: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 12:11:21 +08: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 13:57:08 +08:00
|
|
|
if (klen)
|
|
|
|
crypto_ahash_setkey(tfm, tvmem[0], klen);
|
2018-09-12 21:20:48 +08: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 12:11:21 +08: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 22:18:48 +08: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 12:11:21 +08:00
|
|
|
ret = test_ahash_jiffies(req, speed[i].blen,
|
2014-07-25 17:53:38 +08:00
|
|
|
speed[i].plen, output, secs);
|
2018-07-23 22:18:48 +08: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 12:11:21 +08:00
|
|
|
ret = test_ahash_cycles(req, speed[i].blen,
|
|
|
|
speed[i].plen, output);
|
2018-07-23 22:18:48 +08: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 12:11:21 +08:00
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
pr_err("hashing failed ret=%d\n", ret);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-27 23:38:36 +08: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 12:11:21 +08:00
|
|
|
ahash_request_free(req);
|
|
|
|
|
|
|
|
out:
|
|
|
|
crypto_free_ahash(tfm);
|
|
|
|
}
|
|
|
|
|
2016-02-01 21:36:49 +08: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 16:29:04 +08: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 10:57:28 +08:00
|
|
|
u32 num_mb, int *rc)
|
2017-12-17 16:29:04 +08:00
|
|
|
{
|
2018-04-27 10:57:28 +08:00
|
|
|
int i, err = 0;
|
2017-12-17 16:29:04 +08: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 10:57:28 +08:00
|
|
|
int ret = 0;
|
|
|
|
int *rc;
|
|
|
|
|
|
|
|
rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL);
|
|
|
|
if (!rc)
|
|
|
|
return -ENOMEM;
|
2017-12-17 16:29:04 +08:00
|
|
|
|
|
|
|
for (start = jiffies, end = start + secs * HZ, bcount = 0;
|
|
|
|
time_before(jiffies, end); bcount++) {
|
2018-04-27 10:57:28 +08:00
|
|
|
ret = do_mult_acipher_op(data, enc, num_mb, rc);
|
2017-12-17 16:29:04 +08:00
|
|
|
if (ret)
|
2018-04-27 10:57:28 +08:00
|
|
|
goto out;
|
2017-12-17 16:29:04 +08:00
|
|
|
}
|
|
|
|
|
2020-12-08 22:34:41 +08:00
|
|
|
pr_cont("%d operations in %d seconds (%llu bytes)\n",
|
|
|
|
bcount * num_mb, secs, (u64)bcount * blen * num_mb);
|
2018-04-27 10:57:28 +08:00
|
|
|
|
|
|
|
out:
|
|
|
|
kfree(rc);
|
|
|
|
return ret;
|
2017-12-17 16:29:04 +08: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 10:57:28 +08:00
|
|
|
int *rc;
|
|
|
|
|
|
|
|
rc = kcalloc(num_mb, sizeof(*rc), GFP_KERNEL);
|
|
|
|
if (!rc)
|
|
|
|
return -ENOMEM;
|
2017-12-17 16:29:04 +08:00
|
|
|
|
|
|
|
/* Warm-up run. */
|
|
|
|
for (i = 0; i < 4; i++) {
|
2018-04-27 10:57:28 +08:00
|
|
|
ret = do_mult_acipher_op(data, enc, num_mb, rc);
|
2017-12-17 16:29:04 +08:00
|
|
|
if (ret)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The real thing. */
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
cycles_t start, end;
|
|
|
|
|
|
|
|
start = get_cycles();
|
2018-04-27 10:57:28 +08:00
|
|
|
ret = do_mult_acipher_op(data, enc, num_mb, rc);
|
2017-12-17 16:29:04 +08:00
|
|
|
end = get_cycles();
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
cycles += end - start;
|
|
|
|
}
|
|
|
|
|
2018-04-27 10:57:28 +08:00
|
|
|
pr_cont("1 operation in %lu cycles (%d bytes)\n",
|
|
|
|
(cycles + 4) / (8 * num_mb), blen);
|
2017-12-17 16:29:04 +08:00
|
|
|
|
2018-04-27 10:57:28 +08:00
|
|
|
out:
|
|
|
|
kfree(rc);
|
2017-12-17 16:29:04 +08: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 19:04:33 +08:00
|
|
|
const int *b_size;
|
2017-12-17 16:29:04 +08: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) {
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2022-10-27 03:16:16 +08:00
|
|
|
pr_info("testing speed of multibuffer %s (%s) %s\n", algo,
|
2017-12-17 16:29:04 +08:00
|
|
|
get_driver_name(crypto_skcipher, tfm), e);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
do {
|
|
|
|
b_size = block_sizes;
|
|
|
|
do {
|
2020-11-20 19:04:33 +08:00
|
|
|
u32 bs = round_up(*b_size, crypto_skcipher_blocksize(tfm));
|
|
|
|
|
|
|
|
if (bs > XBUFSIZE * PAGE_SIZE) {
|
2018-01-02 17:21:06 +08:00
|
|
|
pr_err("template (%u) too big for buffer (%lu)\n",
|
2021-10-15 15:39:18 +08:00
|
|
|
bs, XBUFSIZE * PAGE_SIZE);
|
2017-12-17 16:29:04 +08:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
pr_info("test %u (%d bit key, %d byte blocks): ", i,
|
2020-11-20 19:04:33 +08:00
|
|
|
*keysize * 8, bs);
|
2017-12-17 16:29:04 +08: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 19:04:33 +08:00
|
|
|
unsigned int k = bs;
|
2017-12-17 16:29:04 +08: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,
|
2021-10-15 15:39:18 +08:00
|
|
|
cur->sg, bs, iv);
|
2017-12-17 16:29:04 +08:00
|
|
|
}
|
|
|
|
|
2018-07-23 22:18:48 +08:00
|
|
|
if (secs) {
|
2017-12-17 16:29:04 +08:00
|
|
|
ret = test_mb_acipher_jiffies(data, enc,
|
2020-11-20 19:04:33 +08:00
|
|
|
bs, secs,
|
2017-12-17 16:29:04 +08:00
|
|
|
num_mb);
|
2018-07-23 22:18:48 +08:00
|
|
|
cond_resched();
|
|
|
|
} else {
|
2017-12-17 16:29:04 +08:00
|
|
|
ret = test_mb_acipher_cycles(data, enc,
|
2020-11-20 19:04:33 +08:00
|
|
|
bs, num_mb);
|
2018-07-23 22:18:48 +08:00
|
|
|
}
|
2017-12-17 16:29:04 +08: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 18:03:50 +08:00
|
|
|
static inline int do_one_acipher_op(struct skcipher_request *req, int ret)
|
2011-10-18 05:02:58 +08:00
|
|
|
{
|
2017-10-18 15:00:48 +08:00
|
|
|
struct crypto_wait *wait = req->base.data;
|
2011-10-18 05:02:58 +08:00
|
|
|
|
2017-10-18 15:00:48 +08:00
|
|
|
return crypto_wait_req(ret, wait);
|
2011-10-18 05:02:58 +08:00
|
|
|
}
|
|
|
|
|
2016-06-29 18:03:50 +08:00
|
|
|
static int test_acipher_jiffies(struct skcipher_request *req, int enc,
|
2014-07-25 17:53:38 +08:00
|
|
|
int blen, int secs)
|
2011-10-18 05:02:58 +08:00
|
|
|
{
|
|
|
|
unsigned long start, end;
|
|
|
|
int bcount;
|
|
|
|
int ret;
|
|
|
|
|
2014-07-25 17:53:38 +08:00
|
|
|
for (start = jiffies, end = start + secs * HZ, bcount = 0;
|
2011-10-18 05:02:58 +08:00
|
|
|
time_before(jiffies, end); bcount++) {
|
|
|
|
if (enc)
|
|
|
|
ret = do_one_acipher_op(req,
|
2016-06-29 18:03:50 +08:00
|
|
|
crypto_skcipher_encrypt(req));
|
2011-10-18 05:02:58 +08:00
|
|
|
else
|
|
|
|
ret = do_one_acipher_op(req,
|
2016-06-29 18:03:50 +08:00
|
|
|
crypto_skcipher_decrypt(req));
|
2011-10-18 05:02:58 +08:00
|
|
|
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2020-12-08 22:34:41 +08:00
|
|
|
pr_cont("%d operations in %d seconds (%llu bytes)\n",
|
|
|
|
bcount, secs, (u64)bcount * blen);
|
2011-10-18 05:02:58 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-06-29 18:03:50 +08:00
|
|
|
static int test_acipher_cycles(struct skcipher_request *req, int enc,
|
2011-10-18 05:02:58 +08: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 18:03:50 +08:00
|
|
|
crypto_skcipher_encrypt(req));
|
2011-10-18 05:02:58 +08:00
|
|
|
else
|
|
|
|
ret = do_one_acipher_op(req,
|
2016-06-29 18:03:50 +08:00
|
|
|
crypto_skcipher_decrypt(req));
|
2011-10-18 05:02:58 +08: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 18:03:50 +08:00
|
|
|
crypto_skcipher_encrypt(req));
|
2011-10-18 05:02:58 +08:00
|
|
|
else
|
|
|
|
ret = do_one_acipher_op(req,
|
2016-06-29 18:03:50 +08:00
|
|
|
crypto_skcipher_decrypt(req));
|
2011-10-18 05:02:58 +08: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 18:03:50 +08: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 05:02:58 +08:00
|
|
|
{
|
2012-07-02 01:19:47 +08:00
|
|
|
unsigned int ret, i, j, k, iv_len;
|
2017-10-18 15:00:48 +08:00
|
|
|
struct crypto_wait wait;
|
2011-10-18 05:02:58 +08:00
|
|
|
const char *key;
|
|
|
|
char iv[128];
|
2016-06-29 18:03:50 +08:00
|
|
|
struct skcipher_request *req;
|
|
|
|
struct crypto_skcipher *tfm;
|
2020-11-20 19:04:33 +08:00
|
|
|
const int *b_size;
|
2011-10-18 05:02:58 +08:00
|
|
|
const char *e;
|
|
|
|
|
|
|
|
if (enc == ENCRYPT)
|
|
|
|
e = "encryption";
|
|
|
|
else
|
|
|
|
e = "decryption";
|
|
|
|
|
2017-10-18 15:00:48 +08:00
|
|
|
crypto_init_wait(&wait);
|
2011-10-18 05:02:58 +08:00
|
|
|
|
2016-06-29 18:03:50 +08:00
|
|
|
tfm = crypto_alloc_skcipher(algo, 0, async ? 0 : CRYPTO_ALG_ASYNC);
|
2011-10-18 05:02:58 +08:00
|
|
|
|
|
|
|
if (IS_ERR(tfm)) {
|
|
|
|
pr_err("failed to load transform for %s: %ld\n", algo,
|
|
|
|
PTR_ERR(tfm));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-10-27 03:16:16 +08:00
|
|
|
pr_info("testing speed of %s %s (%s) %s\n", async ? "async" : "sync",
|
2020-02-05 18:19:58 +08:00
|
|
|
algo, get_driver_name(crypto_skcipher, tfm), e);
|
2014-06-26 13:57:42 +08:00
|
|
|
|
2016-06-29 18:03:50 +08:00
|
|
|
req = skcipher_request_alloc(tfm, GFP_KERNEL);
|
2011-10-18 05:02:58 +08:00
|
|
|
if (!req) {
|
2022-10-27 03:16:15 +08:00
|
|
|
pr_err("skcipher: Failed to allocate request for %s\n", algo);
|
2011-10-18 05:02:58 +08:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2016-06-29 18:03:50 +08:00
|
|
|
skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
|
2017-10-18 15:00:48 +08:00
|
|
|
crypto_req_done, &wait);
|
2011-10-18 05:02:58 +08:00
|
|
|
|
|
|
|
i = 0;
|
|
|
|
do {
|
|
|
|
b_size = block_sizes;
|
|
|
|
|
|
|
|
do {
|
2020-11-20 19:04:33 +08:00
|
|
|
u32 bs = round_up(*b_size, crypto_skcipher_blocksize(tfm));
|
2011-10-18 05:02:58 +08:00
|
|
|
struct scatterlist sg[TVMEMSIZE];
|
|
|
|
|
2020-11-20 19:04:33 +08:00
|
|
|
if ((*keysize + bs) > TVMEMSIZE * PAGE_SIZE) {
|
2011-10-18 05:02:58 +08:00
|
|
|
pr_err("template (%u) too big for "
|
2020-11-20 19:04:33 +08:00
|
|
|
"tvmem (%lu)\n", *keysize + bs,
|
2011-10-18 05:02:58 +08:00
|
|
|
TVMEMSIZE * PAGE_SIZE);
|
|
|
|
goto out_free_req;
|
|
|
|
}
|
|
|
|
|
|
|
|
pr_info("test %u (%d bit key, %d byte blocks): ", i,
|
2020-11-20 19:04:33 +08:00
|
|
|
*keysize * 8, bs);
|
2011-10-18 05:02:58 +08: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 18:03:50 +08:00
|
|
|
crypto_skcipher_clear_flags(tfm, ~0);
|
2011-10-18 05:02:58 +08:00
|
|
|
|
2016-06-29 18:03:50 +08:00
|
|
|
ret = crypto_skcipher_setkey(tfm, key, *keysize);
|
2011-10-18 05:02:58 +08:00
|
|
|
if (ret) {
|
|
|
|
pr_err("setkey() failed flags=%x\n",
|
2016-06-29 18:03:50 +08:00
|
|
|
crypto_skcipher_get_flags(tfm));
|
2011-10-18 05:02:58 +08:00
|
|
|
goto out_free_req;
|
|
|
|
}
|
|
|
|
|
2020-11-20 19:04:33 +08:00
|
|
|
k = *keysize + bs;
|
2015-03-09 22:14:58 +08:00
|
|
|
sg_init_table(sg, DIV_ROUND_UP(k, PAGE_SIZE));
|
|
|
|
|
2012-07-02 01:19:47 +08:00
|
|
|
if (k > PAGE_SIZE) {
|
|
|
|
sg_set_buf(sg, tvmem[0] + *keysize,
|
2011-10-18 05:02:58 +08:00
|
|
|
PAGE_SIZE - *keysize);
|
2012-07-02 01:19:47 +08: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 19:04:33 +08:00
|
|
|
sg_set_buf(sg, tvmem[0] + *keysize, bs);
|
2011-10-18 05:02:58 +08:00
|
|
|
}
|
|
|
|
|
2016-06-29 18:03:50 +08:00
|
|
|
iv_len = crypto_skcipher_ivsize(tfm);
|
2011-10-18 05:02:58 +08:00
|
|
|
if (iv_len)
|
|
|
|
memset(&iv, 0xff, iv_len);
|
|
|
|
|
2020-11-20 19:04:33 +08:00
|
|
|
skcipher_request_set_crypt(req, sg, sg, bs, iv);
|
2011-10-18 05:02:58 +08:00
|
|
|
|
2018-07-23 22:18:48 +08:00
|
|
|
if (secs) {
|
2011-10-18 05:02:58 +08:00
|
|
|
ret = test_acipher_jiffies(req, enc,
|
2020-11-20 19:04:33 +08:00
|
|
|
bs, secs);
|
2018-07-23 22:18:48 +08:00
|
|
|
cond_resched();
|
|
|
|
} else {
|
2011-10-18 05:02:58 +08:00
|
|
|
ret = test_acipher_cycles(req, enc,
|
2020-11-20 19:04:33 +08:00
|
|
|
bs);
|
2018-07-23 22:18:48 +08:00
|
|
|
}
|
2011-10-18 05:02:58 +08:00
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
pr_err("%s() failed flags=%x\n", e,
|
2016-06-29 18:03:50 +08:00
|
|
|
crypto_skcipher_get_flags(tfm));
|
2011-10-18 05:02:58 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
b_size++;
|
|
|
|
i++;
|
|
|
|
} while (*b_size);
|
|
|
|
keysize++;
|
|
|
|
} while (*keysize);
|
|
|
|
|
|
|
|
out_free_req:
|
2016-06-29 18:03:50 +08:00
|
|
|
skcipher_request_free(req);
|
2011-10-18 05:02:58 +08:00
|
|
|
out:
|
2016-06-29 18:03:50 +08: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 05:02:58 +08:00
|
|
|
}
|
|
|
|
|
2008-07-31 15:41:55 +08: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 13:10:21 +08:00
|
|
|
int ret;
|
|
|
|
|
2017-01-18 21:54:05 +08: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 13:10:21 +08:00
|
|
|
ret = alg_test(alg, alg, 0, 0);
|
crypto: api - allow algs only in specific constructions in FIPS mode
Currently we do not distinguish between algorithms that fail on
the self-test vs. those which are disabled in FIPS mode (not allowed).
Both are marked as having failed the self-test.
Recently the need arose to allow the usage of certain algorithms only
as arguments to specific template instantiations in FIPS mode. For
example, standalone "dh" must be blocked, but e.g. "ffdhe2048(dh)" is
allowed. Other potential use cases include "cbcmac(aes)", which must
only be used with ccm(), or "ghash", which must be used only for
gcm().
This patch allows this scenario by adding a new flag FIPS_INTERNAL to
indicate those algorithms that are not FIPS-allowed. They can then be
used as template arguments only, i.e. when looked up via
crypto_grab_spawn() to be more specific. The FIPS_INTERNAL bit gets
propagated upwards recursively into the surrounding template
instances, until the construction eventually matches an explicit
testmgr entry with ->fips_allowed being set, if any.
The behaviour to skip !->fips_allowed self-test executions in FIPS
mode will be retained. Note that this effectively means that
FIPS_INTERNAL algorithms are handled very similarly to the INTERNAL
ones in this regard. It is expected that the FIPS_INTERNAL algorithms
will receive sufficient testing when the larger constructions they're
a part of, if any, get exercised by testmgr.
Note that as a side-effect of this patch algorithms which are not
FIPS-allowed will now return ENOENT instead of ELIBBAD. Hopefully
this is not an issue as some people were relying on this already.
Link: https://lore.kernel.org/r/YeEVSaMEVJb3cQkq@gondor.apana.org.au
Originally-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Nicolai Stange <nstange@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2022-02-21 20:10:58 +08:00
|
|
|
/* non-fips algs return -EINVAL or -ECANCELED in fips mode */
|
|
|
|
if (fips_enabled && (ret == -EINVAL || ret == -ECANCELED))
|
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 13:10:21 +08:00
|
|
|
ret = 0;
|
|
|
|
return ret;
|
2008-07-31 15:41:55 +08:00
|
|
|
}
|
|
|
|
|
2018-04-27 10:57:28 +08:00
|
|
|
static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb)
|
2008-07-31 15:41:55 +08: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 13:10:21 +08:00
|
|
|
int ret = 0;
|
2008-07-31 15:41:55 +08:00
|
|
|
|
|
|
|
switch (m) {
|
2005-04-17 06:20:36 +08:00
|
|
|
case 0:
|
2014-12-04 16:43:29 +08:00
|
|
|
if (alg) {
|
|
|
|
if (!crypto_has_alg(alg, type,
|
|
|
|
mask ?: CRYPTO_ALG_TYPE_MASK))
|
|
|
|
ret = -ENOENT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-07-31 15:41:55 +08:00
|
|
|
for (i = 1; i < 200; i++)
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, do_test(NULL, 0, 0, i, num_mb));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("md5"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("sha1"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(des)"));
|
|
|
|
ret = min(ret, tcrypt_test("cbc(des)"));
|
|
|
|
ret = min(ret, tcrypt_test("ctr(des)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(des3_ede)"));
|
|
|
|
ret = min(ret, tcrypt_test("cbc(des3_ede)"));
|
|
|
|
ret = min(ret, tcrypt_test("ctr(des3_ede)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("md4"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
2005-06-23 04:26:03 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
case 6:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("sha256"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
2005-06-23 04:26:03 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
case 7:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(blowfish)"));
|
|
|
|
ret = min(ret, tcrypt_test("cbc(blowfish)"));
|
|
|
|
ret = min(ret, tcrypt_test("ctr(blowfish)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(twofish)"));
|
|
|
|
ret = min(ret, tcrypt_test("cbc(twofish)"));
|
|
|
|
ret = min(ret, tcrypt_test("ctr(twofish)"));
|
|
|
|
ret = min(ret, tcrypt_test("lrw(twofish)"));
|
|
|
|
ret = min(ret, tcrypt_test("xts(twofish)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
2005-06-23 04:26:03 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
case 9:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(serpent)"));
|
|
|
|
ret = min(ret, tcrypt_test("cbc(serpent)"));
|
|
|
|
ret = min(ret, tcrypt_test("ctr(serpent)"));
|
|
|
|
ret = min(ret, tcrypt_test("lrw(serpent)"));
|
|
|
|
ret = min(ret, tcrypt_test("xts(serpent)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 10:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(aes)"));
|
|
|
|
ret = min(ret, tcrypt_test("cbc(aes)"));
|
|
|
|
ret = min(ret, tcrypt_test("lrw(aes)"));
|
|
|
|
ret = min(ret, tcrypt_test("xts(aes)"));
|
|
|
|
ret = min(ret, tcrypt_test("ctr(aes)"));
|
|
|
|
ret = min(ret, tcrypt_test("rfc3686(ctr(aes))"));
|
|
|
|
ret = min(ret, tcrypt_test("ofb(aes)"));
|
|
|
|
ret = min(ret, tcrypt_test("cfb(aes)"));
|
|
|
|
ret = min(ret, tcrypt_test("xctr(aes)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 11:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("sha384"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
2005-06-23 04:26:03 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
case 12:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("sha512"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 13:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("deflate"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 14:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(cast5)"));
|
|
|
|
ret = min(ret, tcrypt_test("cbc(cast5)"));
|
|
|
|
ret = min(ret, tcrypt_test("ctr(cast5)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 15:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(cast6)"));
|
|
|
|
ret = min(ret, tcrypt_test("cbc(cast6)"));
|
|
|
|
ret = min(ret, tcrypt_test("ctr(cast6)"));
|
|
|
|
ret = min(ret, tcrypt_test("lrw(cast6)"));
|
|
|
|
ret = min(ret, tcrypt_test("xts(cast6)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(arc4)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 17:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("michael_mic"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 18:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("crc32c"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 19:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(tea)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 20:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(xtea)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 21:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(khazad)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 22:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("wp512"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 23:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("wp384"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 24:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("wp256"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 26:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(anubis)"));
|
|
|
|
ret = min(ret, tcrypt_test("cbc(anubis)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
2005-09-02 08:42:46 +08:00
|
|
|
case 30:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(xeta)"));
|
2005-09-02 08:42:46 +08:00
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-12-16 09:13:14 +08:00
|
|
|
case 31:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("pcbc(fcrypt)"));
|
2006-12-16 09:13:14 +08:00
|
|
|
break;
|
|
|
|
|
2007-01-24 18:48:19 +08:00
|
|
|
case 32:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(camellia)"));
|
|
|
|
ret = min(ret, tcrypt_test("cbc(camellia)"));
|
|
|
|
ret = min(ret, tcrypt_test("ctr(camellia)"));
|
|
|
|
ret = min(ret, tcrypt_test("lrw(camellia)"));
|
|
|
|
ret = min(ret, tcrypt_test("xts(camellia)"));
|
2007-01-24 18:48:19 +08:00
|
|
|
break;
|
2013-04-08 15:48:44 +08:00
|
|
|
|
2007-11-10 20:08:25 +08:00
|
|
|
case 33:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("sha224"));
|
2007-11-10 20:08:25 +08:00
|
|
|
break;
|
2007-01-24 18:48:19 +08:00
|
|
|
|
2007-12-02 11:55:47 +08:00
|
|
|
case 35:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("gcm(aes)"));
|
2007-12-02 11:55:47 +08:00
|
|
|
break;
|
|
|
|
|
2007-12-07 16:53:23 +08:00
|
|
|
case 36:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("lzo"));
|
2007-12-07 16:53:23 +08:00
|
|
|
break;
|
|
|
|
|
2007-12-12 20:24:22 +08:00
|
|
|
case 37:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ccm(aes)"));
|
2007-12-12 20:24:22 +08:00
|
|
|
break;
|
|
|
|
|
2008-03-24 21:26:16 +08:00
|
|
|
case 38:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("cts(cbc(aes))"));
|
2008-03-24 21:26:16 +08:00
|
|
|
break;
|
|
|
|
|
2021-05-20 18:40:00 +08:00
|
|
|
case 39:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("xxhash64"));
|
2021-05-20 18:40:00 +08:00
|
|
|
break;
|
|
|
|
|
2008-05-07 22:16:36 +08:00
|
|
|
case 40:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("rmd160"));
|
2008-05-07 22:16:36 +08:00
|
|
|
break;
|
|
|
|
|
2021-05-20 18:40:00 +08:00
|
|
|
case 42:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("blake2b-512"));
|
2021-05-20 18:40:00 +08:00
|
|
|
break;
|
|
|
|
|
2008-07-31 15:41:55 +08:00
|
|
|
case 43:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(seed)"));
|
2008-05-09 21:29:35 +08:00
|
|
|
break;
|
|
|
|
|
2009-05-04 19:23:40 +08:00
|
|
|
case 45:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("rfc4309(ccm(aes))"));
|
2009-05-04 19:23:40 +08:00
|
|
|
break;
|
|
|
|
|
2012-09-21 15:27:10 +08:00
|
|
|
case 46:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ghash"));
|
2012-09-21 15:27:10 +08:00
|
|
|
break;
|
|
|
|
|
2013-09-07 10:56:26 +08:00
|
|
|
case 47:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("crct10dif"));
|
2013-09-07 10:56:26 +08:00
|
|
|
break;
|
|
|
|
|
2016-06-17 13:00:36 +08:00
|
|
|
case 48:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("sha3-224"));
|
2016-06-17 13:00:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 49:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("sha3-256"));
|
2016-06-17 13:00:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 50:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("sha3-384"));
|
2016-06-17 13:00:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 51:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("sha3-512"));
|
2016-06-17 13:00:36 +08:00
|
|
|
break;
|
|
|
|
|
2017-08-21 18:51:29 +08:00
|
|
|
case 52:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("sm3"));
|
2017-08-21 18:51:29 +08:00
|
|
|
break;
|
|
|
|
|
2018-11-07 05:00:03 +08:00
|
|
|
case 53:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("streebog256"));
|
2018-11-07 05:00:03 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 54:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("streebog512"));
|
2018-11-07 05:00:03 +08:00
|
|
|
break;
|
|
|
|
|
2021-08-13 15:55:08 +08:00
|
|
|
case 55:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("gcm(sm4)"));
|
2021-08-13 15:55:08 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 56:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ccm(sm4)"));
|
2021-08-13 15:55:08 +08:00
|
|
|
break;
|
|
|
|
|
2022-05-21 02:14:54 +08:00
|
|
|
case 57:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("polyval"));
|
2022-05-21 02:14:54 +08:00
|
|
|
break;
|
|
|
|
|
2022-07-04 17:42:49 +08:00
|
|
|
case 58:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("gcm(aria)"));
|
2022-07-04 17:42:49 +08:00
|
|
|
break;
|
|
|
|
|
2022-10-27 14:54:57 +08:00
|
|
|
case 59:
|
|
|
|
ret = min(ret, tcrypt_test("cts(cbc(sm4))"));
|
|
|
|
break;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
case 100:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("hmac(md5)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
2005-06-23 04:26:03 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
case 101:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("hmac(sha1)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
2005-06-23 04:26:03 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
case 102:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("hmac(sha256)"));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
2006-12-10 09:10:20 +08:00
|
|
|
case 103:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("hmac(sha384)"));
|
2006-12-10 09:10:20 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 104:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("hmac(sha512)"));
|
2006-12-10 09:10:20 +08:00
|
|
|
break;
|
2008-01-01 12:59:28 +08:00
|
|
|
|
2007-11-10 20:08:25 +08:00
|
|
|
case 105:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("hmac(sha224)"));
|
2007-11-10 20:08:25 +08:00
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-01-01 12:59:28 +08:00
|
|
|
case 106:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("xcbc(aes)"));
|
2008-01-01 12:59:28 +08:00
|
|
|
break;
|
|
|
|
|
2008-05-07 22:16:36 +08:00
|
|
|
case 108:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("hmac(rmd160)"));
|
2008-05-07 22:16:36 +08:00
|
|
|
break;
|
|
|
|
|
2009-09-02 18:05:22 +08:00
|
|
|
case 109:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("vmac64(aes)"));
|
2009-09-02 18:05:22 +08:00
|
|
|
break;
|
2013-04-08 15:48:44 +08:00
|
|
|
|
2016-07-01 13:46:54 +08:00
|
|
|
case 111:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("hmac(sha3-224)"));
|
2016-07-01 13:46:54 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 112:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("hmac(sha3-256)"));
|
2016-07-01 13:46:54 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 113:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("hmac(sha3-384)"));
|
2016-07-01 13:46:54 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 114:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("hmac(sha3-512)"));
|
2016-07-01 13:46:54 +08:00
|
|
|
break;
|
|
|
|
|
2018-11-07 05:00:03 +08:00
|
|
|
case 115:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("hmac(streebog256)"));
|
2018-11-07 05:00:03 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 116:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("hmac(streebog512)"));
|
2018-11-07 05:00:03 +08:00
|
|
|
break;
|
|
|
|
|
2009-05-04 19:46:29 +08:00
|
|
|
case 150:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ansi_cprng"));
|
2009-05-04 19:46:29 +08:00
|
|
|
break;
|
|
|
|
|
2010-11-05 03:02:04 +08:00
|
|
|
case 151:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("rfc4106(gcm(aes))"));
|
2010-11-05 03:02:04 +08:00
|
|
|
break;
|
|
|
|
|
2013-04-07 21:43:51 +08:00
|
|
|
case 152:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("rfc4543(gcm(aes))"));
|
2013-04-07 21:43:51 +08:00
|
|
|
break;
|
|
|
|
|
2013-04-08 15:48:44 +08:00
|
|
|
case 153:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("cmac(aes)"));
|
2013-04-08 15:48:44 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 154:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("cmac(des3_ede)"));
|
2013-04-08 15:48:44 +08:00
|
|
|
break;
|
|
|
|
|
2013-11-28 21:11:16 +08:00
|
|
|
case 155:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("authenc(hmac(sha1),cbc(aes))"));
|
2013-11-28 21:11:16 +08:00
|
|
|
break;
|
|
|
|
|
2014-03-14 23:46:51 +08:00
|
|
|
case 156:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("authenc(hmac(md5),ecb(cipher_null))"));
|
2014-03-14 23:46:51 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 157:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("authenc(hmac(sha1),ecb(cipher_null))"));
|
2014-03-14 23:46:51 +08:00
|
|
|
break;
|
2021-08-13 15:55:08 +08:00
|
|
|
|
|
|
|
case 158:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("cbcmac(sm4)"));
|
2021-08-13 15:55:08 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 159:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("cmac(sm4)"));
|
2021-08-13 15:55:08 +08:00
|
|
|
break;
|
|
|
|
|
2022-10-27 14:54:57 +08:00
|
|
|
case 160:
|
|
|
|
ret = min(ret, tcrypt_test("xcbc(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 19:39:08 +08:00
|
|
|
case 181:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("authenc(hmac(sha1),cbc(des))"));
|
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 19:39:08 +08:00
|
|
|
break;
|
|
|
|
case 182:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("authenc(hmac(sha1),cbc(des3_ede))"));
|
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 19:39:08 +08:00
|
|
|
break;
|
|
|
|
case 183:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("authenc(hmac(sha224),cbc(des))"));
|
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 19:39:08 +08:00
|
|
|
break;
|
|
|
|
case 184:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("authenc(hmac(sha224),cbc(des3_ede))"));
|
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 19:39:08 +08:00
|
|
|
break;
|
|
|
|
case 185:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("authenc(hmac(sha256),cbc(des))"));
|
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 19:39:08 +08:00
|
|
|
break;
|
|
|
|
case 186:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("authenc(hmac(sha256),cbc(des3_ede))"));
|
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 19:39:08 +08:00
|
|
|
break;
|
|
|
|
case 187:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("authenc(hmac(sha384),cbc(des))"));
|
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 19:39:08 +08:00
|
|
|
break;
|
|
|
|
case 188:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("authenc(hmac(sha384),cbc(des3_ede))"));
|
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 19:39:08 +08:00
|
|
|
break;
|
|
|
|
case 189:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("authenc(hmac(sha512),cbc(des))"));
|
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 19:39:08 +08:00
|
|
|
break;
|
|
|
|
case 190:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("authenc(hmac(sha512),cbc(des3_ede))"));
|
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 19:39:08 +08:00
|
|
|
break;
|
2018-03-06 17:44:43 +08:00
|
|
|
case 191:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(sm4)"));
|
|
|
|
ret = min(ret, tcrypt_test("cbc(sm4)"));
|
|
|
|
ret = min(ret, tcrypt_test("cfb(sm4)"));
|
|
|
|
ret = min(ret, tcrypt_test("ctr(sm4)"));
|
2022-10-27 14:54:57 +08:00
|
|
|
ret = min(ret, tcrypt_test("xts(sm4)"));
|
2018-03-06 17:44:43 +08:00
|
|
|
break;
|
2022-07-04 17:42:49 +08:00
|
|
|
case 192:
|
2022-10-01 05:40:14 +08:00
|
|
|
ret = min(ret, tcrypt_test("ecb(aria)"));
|
|
|
|
ret = min(ret, tcrypt_test("cbc(aria)"));
|
|
|
|
ret = min(ret, tcrypt_test("cfb(aria)"));
|
|
|
|
ret = min(ret, tcrypt_test("ctr(aria)"));
|
2022-07-04 17:42:49 +08:00
|
|
|
break;
|
2005-06-23 04:27:23 +08:00
|
|
|
case 200:
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_16_24_32);
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("ecb(aes)", DECRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_16_24_32);
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("cbc(aes)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_16_24_32);
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("cbc(aes)", DECRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_16_24_32);
|
2006-11-29 16:01:41 +08:00
|
|
|
test_cipher_speed("lrw(aes)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_32_40_48);
|
2006-11-29 16:01:41 +08:00
|
|
|
test_cipher_speed("lrw(aes)", DECRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_32_40_48);
|
2007-09-19 20:23:13 +08:00
|
|
|
test_cipher_speed("xts(aes)", ENCRYPT, sec, NULL, 0,
|
2017-07-20 00:40:32 +08:00
|
|
|
speed_template_32_64);
|
2007-09-19 20:23:13 +08:00
|
|
|
test_cipher_speed("xts(aes)", DECRYPT, sec, NULL, 0,
|
2017-07-20 00:40:32 +08:00
|
|
|
speed_template_32_64);
|
2016-06-29 18:04:14 +08: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 14:34:01 +08: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 07:01:53 +08: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 04:27:23 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 201:
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("ecb(des3_ede)", ENCRYPT, sec,
|
2008-07-31 17:08:25 +08:00
|
|
|
des3_speed_template, DES3_SPEED_VECTORS,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_24);
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("ecb(des3_ede)", DECRYPT, sec,
|
2008-07-31 17:08:25 +08:00
|
|
|
des3_speed_template, DES3_SPEED_VECTORS,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_24);
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("cbc(des3_ede)", ENCRYPT, sec,
|
2008-07-31 17:08:25 +08:00
|
|
|
des3_speed_template, DES3_SPEED_VECTORS,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_24);
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("cbc(des3_ede)", DECRYPT, sec,
|
2008-07-31 17:08:25 +08:00
|
|
|
des3_speed_template, DES3_SPEED_VECTORS,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_24);
|
2014-06-10 01:59:49 +08: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 04:27:23 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 202:
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("ecb(twofish)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_16_24_32);
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("ecb(twofish)", DECRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_16_24_32);
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("cbc(twofish)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_16_24_32);
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("cbc(twofish)", DECRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_16_24_32);
|
2011-09-26 21:47:15 +08: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 18:32:56 +08: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 18:33:38 +08: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 04:27:23 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 203:
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("ecb(blowfish)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_8_32);
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("ecb(blowfish)", DECRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_8_32);
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("cbc(blowfish)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_8_32);
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("cbc(blowfish)", DECRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_8_32);
|
2011-09-02 06:45:17 +08: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 04:27:23 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 204:
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("ecb(des)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_8);
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("ecb(des)", DECRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_8);
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("cbc(des)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_8);
|
2006-08-13 06:26:09 +08:00
|
|
|
test_cipher_speed("cbc(des)", DECRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_8);
|
2005-06-23 04:27:23 +08:00
|
|
|
break;
|
|
|
|
|
2007-01-24 18:48:19 +08:00
|
|
|
case 205:
|
|
|
|
test_cipher_speed("ecb(camellia)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_16_24_32);
|
2007-01-24 18:48:19 +08:00
|
|
|
test_cipher_speed("ecb(camellia)", DECRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_16_24_32);
|
2007-01-24 18:48:19 +08:00
|
|
|
test_cipher_speed("cbc(camellia)", ENCRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_16_24_32);
|
2007-01-24 18:48:19 +08:00
|
|
|
test_cipher_speed("cbc(camellia)", DECRYPT, sec, NULL, 0,
|
2008-03-11 21:24:26 +08:00
|
|
|
speed_template_16_24_32);
|
2012-03-06 02:26:26 +08: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 18:48:19 +08:00
|
|
|
break;
|
|
|
|
|
2011-10-18 05:03:03 +08: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 18:32:39 +08: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 18:33:22 +08: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 05:03:03 +08:00
|
|
|
break;
|
|
|
|
|
2012-06-12 16:52:04 +08:00
|
|
|
case 208:
|
|
|
|
test_cipher_speed("ecb(arc4)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_8);
|
|
|
|
break;
|
|
|
|
|
2012-07-12 01:37:21 +08: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-12 01:38:29 +08: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 06:28:47 +08:00
|
|
|
case 211:
|
|
|
|
test_aead_speed("rfc4106(gcm(aes))", ENCRYPT, sec,
|
2022-12-15 01:19:56 +08:00
|
|
|
NULL, 0, 16, 16, aead_speed_template_20_28_36);
|
2015-07-07 23:31:49 +08:00
|
|
|
test_aead_speed("gcm(aes)", ENCRYPT, sec,
|
2015-11-17 20:37:10 +08:00
|
|
|
NULL, 0, 16, 8, speed_template_16_24_32);
|
2017-12-17 16:29:01 +08:00
|
|
|
test_aead_speed("rfc4106(gcm(aes))", DECRYPT, sec,
|
2022-12-15 01:19:56 +08:00
|
|
|
NULL, 0, 16, 16, aead_speed_template_20_28_36);
|
2017-12-17 16:29:01 +08:00
|
|
|
test_aead_speed("gcm(aes)", DECRYPT, sec,
|
|
|
|
NULL, 0, 16, 8, speed_template_16_24_32);
|
2013-12-12 06:28:47 +08:00
|
|
|
break;
|
|
|
|
|
2015-06-17 14:04:21 +08:00
|
|
|
case 212:
|
|
|
|
test_aead_speed("rfc4309(ccm(aes))", ENCRYPT, sec,
|
2015-07-09 07:17:26 +08:00
|
|
|
NULL, 0, 16, 16, aead_speed_template_19);
|
2017-12-17 16:29:01 +08:00
|
|
|
test_aead_speed("rfc4309(ccm(aes))", DECRYPT, sec,
|
|
|
|
NULL, 0, 16, 16, aead_speed_template_19);
|
2015-06-17 14:04:21 +08:00
|
|
|
break;
|
|
|
|
|
2015-07-17 01:13:59 +08:00
|
|
|
case 213:
|
|
|
|
test_aead_speed("rfc7539esp(chacha20,poly1305)", ENCRYPT, sec,
|
|
|
|
NULL, 0, 16, 8, aead_speed_template_36);
|
2017-12-17 16:29:01 +08:00
|
|
|
test_aead_speed("rfc7539esp(chacha20,poly1305)", DECRYPT, sec,
|
|
|
|
NULL, 0, 16, 8, aead_speed_template_36);
|
2015-07-17 01:13:59 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 214:
|
|
|
|
test_cipher_speed("chacha20", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_32);
|
|
|
|
break;
|
|
|
|
|
2017-12-17 16:29:05 +08:00
|
|
|
case 215:
|
|
|
|
test_mb_aead_speed("rfc4106(gcm(aes))", ENCRYPT, sec, NULL,
|
2022-12-15 01:19:56 +08:00
|
|
|
0, 16, 16, aead_speed_template_20_28_36, num_mb);
|
2017-12-17 16:29:05 +08:00
|
|
|
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,
|
2022-12-15 01:19:56 +08:00
|
|
|
0, 16, 16, aead_speed_template_20_28_36, num_mb);
|
2017-12-17 16:29:05 +08:00
|
|
|
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 21:18:38 +08: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);
|
2022-10-27 14:54:57 +08:00
|
|
|
test_cipher_speed("cts(cbc(sm4))", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
|
|
|
test_cipher_speed("cts(cbc(sm4))", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16);
|
2021-07-20 11:46:42 +08: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 21:18:38 +08: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);
|
2022-10-27 14:54:57 +08:00
|
|
|
test_cipher_speed("xts(sm4)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_32);
|
|
|
|
test_cipher_speed("xts(sm4)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_32);
|
2018-09-20 21:18:38 +08:00
|
|
|
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 09:26:31 +08: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 22:17:34 +08: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 16:55:12 +08: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 15:55:08 +08: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;
|
|
|
|
|
crypto: hctr2 - Add HCTR2 support
Add support for HCTR2 as a template. HCTR2 is a length-preserving
encryption mode that is efficient on processors with instructions to
accelerate AES and carryless multiplication, e.g. x86 processors with
AES-NI and CLMUL, and ARM processors with the ARMv8 Crypto Extensions.
As a length-preserving encryption mode, HCTR2 is suitable for
applications such as storage encryption where ciphertext expansion is
not possible, and thus authenticated encryption cannot be used.
Currently, such applications usually use XTS, or in some cases Adiantum.
XTS has the disadvantage that it is a narrow-block mode: a bitflip will
only change 16 bytes in the resulting ciphertext or plaintext. This
reveals more information to an attacker than necessary.
HCTR2 is a wide-block mode, so it provides a stronger security property:
a bitflip will change the entire message. HCTR2 is somewhat similar to
Adiantum, which is also a wide-block mode. However, HCTR2 is designed
to take advantage of existing crypto instructions, while Adiantum
targets devices without such hardware support. Adiantum is also
designed with longer messages in mind, while HCTR2 is designed to be
efficient even on short messages.
HCTR2 requires POLYVAL and XCTR as components. More information on
HCTR2 can be found here: "Length-preserving encryption with HCTR2":
https://eprint.iacr.org/2021/1441.pdf
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2022-05-21 02:14:55 +08:00
|
|
|
case 226:
|
|
|
|
test_cipher_speed("hctr2(aes)", ENCRYPT, sec, NULL,
|
|
|
|
0, speed_template_32);
|
|
|
|
break;
|
|
|
|
|
2022-07-04 17:42:49 +08:00
|
|
|
case 227:
|
|
|
|
test_cipher_speed("ecb(aria)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_24_32);
|
|
|
|
test_cipher_speed("ecb(aria)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_24_32);
|
|
|
|
test_cipher_speed("cbc(aria)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_24_32);
|
|
|
|
test_cipher_speed("cbc(aria)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_24_32);
|
|
|
|
test_cipher_speed("cfb(aria)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_24_32);
|
|
|
|
test_cipher_speed("cfb(aria)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_24_32);
|
|
|
|
test_cipher_speed("ctr(aria)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_24_32);
|
|
|
|
test_cipher_speed("ctr(aria)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_24_32);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 228:
|
|
|
|
test_aead_speed("gcm(aria)", ENCRYPT, sec,
|
|
|
|
NULL, 0, 16, 8, speed_template_16_24_32);
|
|
|
|
test_aead_speed("gcm(aria)", DECRYPT, sec,
|
|
|
|
NULL, 0, 16, 8, speed_template_16_24_32);
|
|
|
|
break;
|
|
|
|
|
2022-09-16 20:57:36 +08:00
|
|
|
case 229:
|
|
|
|
test_mb_aead_speed("gcm(aria)", ENCRYPT, sec, NULL, 0, 16, 8,
|
|
|
|
speed_template_16, num_mb);
|
|
|
|
test_mb_aead_speed("gcm(aria)", DECRYPT, sec, NULL, 0, 16, 8,
|
|
|
|
speed_template_16, num_mb);
|
|
|
|
break;
|
|
|
|
|
2006-05-30 20:04:19 +08:00
|
|
|
case 300:
|
2014-12-04 16:43:29 +08:00
|
|
|
if (alg) {
|
|
|
|
test_hash_speed(alg, sec, generic_hash_speed_template);
|
|
|
|
break;
|
|
|
|
}
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2006-05-30 20:04:19 +08:00
|
|
|
case 301:
|
2006-08-19 19:38:49 +08:00
|
|
|
test_hash_speed("md4", sec, generic_hash_speed_template);
|
2006-05-30 20:04:19 +08:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2006-05-30 20:04:19 +08:00
|
|
|
case 302:
|
2006-08-19 19:38:49 +08:00
|
|
|
test_hash_speed("md5", sec, generic_hash_speed_template);
|
2006-05-30 20:04:19 +08:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2006-05-30 20:04:19 +08:00
|
|
|
case 303:
|
2006-08-19 19:38:49 +08:00
|
|
|
test_hash_speed("sha1", sec, generic_hash_speed_template);
|
2006-05-30 20:04:19 +08:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2006-05-30 20:04:19 +08:00
|
|
|
case 304:
|
2006-08-19 19:38:49 +08:00
|
|
|
test_hash_speed("sha256", sec, generic_hash_speed_template);
|
2006-05-30 20:04:19 +08:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2006-05-30 20:04:19 +08:00
|
|
|
case 305:
|
2006-08-19 19:38:49 +08:00
|
|
|
test_hash_speed("sha384", sec, generic_hash_speed_template);
|
2006-05-30 20:04:19 +08:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2006-05-30 20:04:19 +08:00
|
|
|
case 306:
|
2006-08-19 19:38:49 +08:00
|
|
|
test_hash_speed("sha512", sec, generic_hash_speed_template);
|
2006-05-30 20:04:19 +08:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2006-05-30 20:04:19 +08:00
|
|
|
case 307:
|
2006-08-19 19:38:49 +08:00
|
|
|
test_hash_speed("wp256", sec, generic_hash_speed_template);
|
2006-05-30 20:04:19 +08:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2006-05-30 20:04:19 +08:00
|
|
|
case 308:
|
2006-08-19 19:38:49 +08:00
|
|
|
test_hash_speed("wp384", sec, generic_hash_speed_template);
|
2006-05-30 20:04:19 +08:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2006-05-30 20:04:19 +08:00
|
|
|
case 309:
|
2006-08-19 19:38:49 +08:00
|
|
|
test_hash_speed("wp512", sec, generic_hash_speed_template);
|
2006-05-30 20:04:19 +08:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2007-11-10 20:08:25 +08:00
|
|
|
case 313:
|
|
|
|
test_hash_speed("sha224", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2021-05-20 18:40:00 +08:00
|
|
|
case 314:
|
|
|
|
test_hash_speed("xxhash64", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
|
|
|
fallthrough;
|
2008-05-07 22:16:36 +08:00
|
|
|
case 315:
|
|
|
|
test_hash_speed("rmd160", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2021-05-20 18:40:00 +08:00
|
|
|
case 317:
|
|
|
|
test_hash_speed("blake2b-512", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
|
|
|
fallthrough;
|
2010-03-10 18:30:32 +08:00
|
|
|
case 318:
|
2020-08-05 13:57:08 +08:00
|
|
|
klen = 16;
|
|
|
|
test_hash_speed("ghash", sec, generic_hash_speed_template);
|
2010-03-10 18:30:32 +08:00
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2012-09-28 06:44:24 +08:00
|
|
|
case 319:
|
|
|
|
test_hash_speed("crc32c", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2013-09-07 10:56:26 +08:00
|
|
|
case 320:
|
|
|
|
test_hash_speed("crct10dif", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2015-07-17 01:13:59 +08:00
|
|
|
case 321:
|
|
|
|
test_hash_speed("poly1305", sec, poly1305_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-06-17 13:00:36 +08:00
|
|
|
case 322:
|
|
|
|
test_hash_speed("sha3-224", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-06-17 13:00:36 +08:00
|
|
|
case 323:
|
|
|
|
test_hash_speed("sha3-256", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-06-17 13:00:36 +08:00
|
|
|
case 324:
|
|
|
|
test_hash_speed("sha3-384", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-06-17 13:00:36 +08:00
|
|
|
case 325:
|
|
|
|
test_hash_speed("sha3-512", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2017-08-21 18:51:29 +08:00
|
|
|
case 326:
|
|
|
|
test_hash_speed("sm3", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2018-11-07 05:00:03 +08:00
|
|
|
case 327:
|
|
|
|
test_hash_speed("streebog256", sec,
|
|
|
|
generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2018-11-07 05:00:03 +08:00
|
|
|
case 328:
|
|
|
|
test_hash_speed("streebog512", sec,
|
|
|
|
generic_hash_speed_template);
|
|
|
|
if (mode > 300 && mode < 400) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2006-05-30 20:04:19 +08: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 12:11:21 +08:00
|
|
|
case 400:
|
2014-12-04 16:43:29 +08:00
|
|
|
if (alg) {
|
|
|
|
test_ahash_speed(alg, sec, generic_hash_speed_template);
|
|
|
|
break;
|
|
|
|
}
|
2020-08-24 06:36:59 +08: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 12:11:21 +08:00
|
|
|
case 401:
|
|
|
|
test_ahash_speed("md4", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08: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 12:11:21 +08:00
|
|
|
case 402:
|
|
|
|
test_ahash_speed("md5", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08: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 12:11:21 +08:00
|
|
|
case 403:
|
|
|
|
test_ahash_speed("sha1", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08: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 12:11:21 +08:00
|
|
|
case 404:
|
|
|
|
test_ahash_speed("sha256", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08: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 12:11:21 +08:00
|
|
|
case 405:
|
|
|
|
test_ahash_speed("sha384", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08: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 12:11:21 +08:00
|
|
|
case 406:
|
|
|
|
test_ahash_speed("sha512", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08: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 12:11:21 +08:00
|
|
|
case 407:
|
|
|
|
test_ahash_speed("wp256", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08: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 12:11:21 +08:00
|
|
|
case 408:
|
|
|
|
test_ahash_speed("wp384", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08: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 12:11:21 +08:00
|
|
|
case 409:
|
|
|
|
test_ahash_speed("wp512", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08: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 12:11:21 +08:00
|
|
|
case 413:
|
|
|
|
test_ahash_speed("sha224", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2021-05-20 18:40:00 +08: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 12:11:21 +08:00
|
|
|
case 415:
|
|
|
|
test_ahash_speed("rmd160", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2021-05-20 18:40:00 +08:00
|
|
|
case 417:
|
|
|
|
test_ahash_speed("blake2b-512", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
|
|
|
fallthrough;
|
2016-06-17 13:00:36 +08:00
|
|
|
case 418:
|
|
|
|
test_ahash_speed("sha3-224", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-06-17 13:00:36 +08:00
|
|
|
case 419:
|
|
|
|
test_ahash_speed("sha3-256", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-06-17 13:00:36 +08:00
|
|
|
case 420:
|
|
|
|
test_ahash_speed("sha3-384", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-06-17 13:00:36 +08:00
|
|
|
case 421:
|
|
|
|
test_ahash_speed("sha3-512", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08:00
|
|
|
fallthrough;
|
2016-06-24 09:40:47 +08:00
|
|
|
case 422:
|
2022-01-07 20:07:00 +08:00
|
|
|
test_ahash_speed("sm3", sec, generic_hash_speed_template);
|
|
|
|
if (mode > 400 && mode < 500) break;
|
2020-08-24 06:36:59 +08: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 12:11:21 +08:00
|
|
|
case 499:
|
|
|
|
break;
|
|
|
|
|
2011-10-18 05:02:58 +08: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-20 00:40:32 +08:00
|
|
|
speed_template_32_64);
|
2011-10-18 05:02:58 +08:00
|
|
|
test_acipher_speed("xts(aes)", DECRYPT, sec, NULL, 0,
|
2017-07-20 00:40:32 +08:00
|
|
|
speed_template_32_64);
|
2016-06-29 18:04:14 +08: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 05:02:58 +08: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-02 01:19:47 +08: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 18:04:58 +08: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 05:02:58 +08: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-02 01:19:47 +08: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 05:02:58 +08: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-02 01:19:47 +08: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 05:02:58 +08:00
|
|
|
break;
|
|
|
|
|
2011-10-18 05:03:03 +08: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 18:32:39 +08: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 18:33:22 +08: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 05:03:03 +08:00
|
|
|
break;
|
|
|
|
|
2012-05-28 21:54:24 +08: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 16:52:04 +08:00
|
|
|
case 505:
|
|
|
|
test_acipher_speed("ecb(arc4)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_8);
|
|
|
|
break;
|
|
|
|
|
2012-07-12 01:37:21 +08: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-12 01:38:29 +08: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 19:48:51 +08: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 18:46:40 +08: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 11:46:42 +08: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);
|
2022-10-27 14:54:57 +08:00
|
|
|
test_acipher_speed("xts(sm4)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_32);
|
|
|
|
test_acipher_speed("xts(sm4)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_32);
|
2021-07-20 11:46:42 +08:00
|
|
|
break;
|
|
|
|
|
2022-09-16 20:57:36 +08:00
|
|
|
case 519:
|
|
|
|
test_acipher_speed("ecb(aria)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_24_32);
|
|
|
|
test_acipher_speed("ecb(aria)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_24_32);
|
|
|
|
test_acipher_speed("ctr(aria)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_24_32);
|
|
|
|
test_acipher_speed("ctr(aria)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_24_32);
|
|
|
|
break;
|
|
|
|
|
2017-12-17 16:29:04 +08: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;
|
2022-09-16 20:57:36 +08:00
|
|
|
|
|
|
|
case 610:
|
|
|
|
test_mb_skcipher_speed("ecb(aria)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_32, num_mb);
|
|
|
|
test_mb_skcipher_speed("ecb(aria)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_32, num_mb);
|
|
|
|
test_mb_skcipher_speed("ctr(aria)", ENCRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_32, num_mb);
|
|
|
|
test_mb_skcipher_speed("ctr(aria)", DECRYPT, sec, NULL, 0,
|
|
|
|
speed_template_16_32, num_mb);
|
|
|
|
break;
|
|
|
|
|
2005-04-17 06:20:36 +08: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 13:10:21 +08:00
|
|
|
|
|
|
|
return ret;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2008-04-05 21:00:57 +08:00
|
|
|
static int __init tcrypt_mod_init(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2007-11-26 22:12:07 +08:00
|
|
|
int err = -ENOMEM;
|
2008-07-31 12:23:53 +08:00
|
|
|
int i;
|
2007-11-26 22:12:07 +08:00
|
|
|
|
2008-07-31 12:23:53 +08: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 06:20:36 +08:00
|
|
|
|
2018-04-27 10:57:28 +08:00
|
|
|
err = do_test(alg, type, mask, mode, num_mb);
|
2009-06-19 19:46:53 +08: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 13:10:21 +08:00
|
|
|
if (err) {
|
2022-10-27 03:16:14 +08:00
|
|
|
pr_err("one or more tests failed!\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 13:10:21 +08:00
|
|
|
goto err_free_tv;
|
2017-01-18 21:54:05 +08: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 13:10:21 +08:00
|
|
|
}
|
2006-05-30 12:49:38 +08: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 13:10:21 +08: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 12:49:38 +08: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 13:10:21 +08:00
|
|
|
if (!fips_enabled)
|
|
|
|
err = -EAGAIN;
|
2007-11-26 22:12:07 +08:00
|
|
|
|
2008-07-31 12:23:53 +08:00
|
|
|
err_free_tv:
|
|
|
|
for (i = 0; i < TVMEMSIZE && tvmem[i]; i++)
|
|
|
|
free_page((unsigned long)tvmem[i]);
|
2007-11-26 22:12:07 +08:00
|
|
|
|
|
|
|
return err;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If an init function is provided, an exit function must also be provided
|
|
|
|
* to allow module unload.
|
|
|
|
*/
|
2008-04-05 21:00:57 +08:00
|
|
|
static void __exit tcrypt_mod_fini(void) { }
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2020-11-20 19:04:31 +08:00
|
|
|
late_initcall(tcrypt_mod_init);
|
2008-04-05 21:00:57 +08:00
|
|
|
module_exit(tcrypt_mod_fini);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-06-19 19:46:53 +08:00
|
|
|
module_param(alg, charp, 0);
|
|
|
|
module_param(type, uint, 0);
|
2009-07-14 16:06:54 +08:00
|
|
|
module_param(mask, uint, 0);
|
2005-04-17 06:20:36 +08:00
|
|
|
module_param(mode, int, 0);
|
2005-06-23 04:27:23 +08:00
|
|
|
module_param(sec, uint, 0);
|
2005-06-23 04:29:03 +08:00
|
|
|
MODULE_PARM_DESC(sec, "Length in seconds of speed tests "
|
|
|
|
"(defaults to zero which uses CPU cycles instead)");
|
2017-12-17 16:29:02 +08: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 13:57:08 +08:00
|
|
|
module_param(klen, uint, 0);
|
|
|
|
MODULE_PARM_DESC(klen, "Key length (defaults to 0)");
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_DESCRIPTION("Quick & dirty crypto testing module");
|
|
|
|
MODULE_AUTHOR("James Morris <jmorris@intercode.com.au>");
|