projects
/
cascardo
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge tag 'hsi-for-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi
[cascardo/linux.git]
/
crypto
/
tcrypt.c
diff --git
a/crypto/tcrypt.c
b/crypto/tcrypt.c
index
1a28001
..
9f6f10b
100644
(file)
--- a/
crypto/tcrypt.c
+++ b/
crypto/tcrypt.c
@@
-22,8
+22,10
@@
*
*/
*
*/
+#include <crypto/aead.h>
#include <crypto/hash.h>
#include <linux/err.h>
#include <crypto/hash.h>
#include <linux/err.h>
+#include <linux/fips.h>
#include <linux/init.h>
#include <linux/gfp.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/gfp.h>
#include <linux/module.h>
@@
-34,7
+36,6
@@
#include <linux/timex.h>
#include <linux/interrupt.h>
#include "tcrypt.h"
#include <linux/timex.h>
#include <linux/interrupt.h>
#include "tcrypt.h"
-#include "internal.h"
/*
* Need slab memory for testing (size in number of pages).
/*
* Need slab memory for testing (size in number of pages).
@@
-257,12
+258,12
@@
static void sg_init_aead(struct scatterlist *sg, char *xbuf[XBUFSIZE],
rem = buflen % PAGE_SIZE;
}
rem = buflen % PAGE_SIZE;
}
- sg_init_table(sg, np);
+ sg_init_table(sg, np
+ 1
);
np--;
for (k = 0; k < np; k++)
np--;
for (k = 0; k < np; k++)
- sg_set_buf(&sg[k], xbuf[k], PAGE_SIZE);
+ sg_set_buf(&sg[k
+ 1
], xbuf[k], PAGE_SIZE);
- sg_set_buf(&sg[k], xbuf[k], rem);
+ sg_set_buf(&sg[k
+ 1
], xbuf[k], rem);
}
static void test_aead_speed(const char *algo, int enc, unsigned int secs,
}
static void test_aead_speed(const char *algo, int enc, unsigned int secs,
@@
-276,7
+277,6
@@
static void test_aead_speed(const char *algo, int enc, unsigned int secs,
const char *key;
struct aead_request *req;
struct scatterlist *sg;
const char *key;
struct aead_request *req;
struct scatterlist *sg;
- struct scatterlist *asg;
struct scatterlist *sgout;
const char *e;
void *assoc;
struct scatterlist *sgout;
const char *e;
void *assoc;
@@
-308,11
+308,10
@@
static void test_aead_speed(const char *algo, int enc, unsigned int secs,
if (testmgr_alloc_buf(xoutbuf))
goto out_nooutbuf;
if (testmgr_alloc_buf(xoutbuf))
goto out_nooutbuf;
- sg = kmalloc(sizeof(*sg) *
8 * 3
, GFP_KERNEL);
+ sg = kmalloc(sizeof(*sg) *
9 * 2
, GFP_KERNEL);
if (!sg)
goto out_nosg;
if (!sg)
goto out_nosg;
- asg = &sg[8];
- sgout = &asg[8];
+ sgout = &sg[9];
tfm = crypto_alloc_aead(algo, 0, 0);
tfm = crypto_alloc_aead(algo, 0, 0);
@@
-338,7
+337,6
@@
static void test_aead_speed(const char *algo, int enc, unsigned int secs,
do {
assoc = axbuf[0];
memset(assoc, 0xff, aad_size);
do {
assoc = axbuf[0];
memset(assoc, 0xff, aad_size);
- sg_init_one(&asg[0], assoc, aad_size);
if ((*keysize + *b_size) > TVMEMSIZE * PAGE_SIZE) {
pr_err("template (%u) too big for tvmem (%lu)\n",
if ((*keysize + *b_size) > TVMEMSIZE * PAGE_SIZE) {
pr_err("template (%u) too big for tvmem (%lu)\n",
@@
-374,14
+372,17
@@
static void test_aead_speed(const char *algo, int enc, unsigned int secs,
goto out;
}
goto out;
}
- sg_init_aead(
&sg[0]
, xbuf,
+ sg_init_aead(
sg
, xbuf,
*b_size + (enc ? authsize : 0));
*b_size + (enc ? authsize : 0));
- sg_init_aead(
&sgout[0]
, xoutbuf,
+ sg_init_aead(
sgout
, xoutbuf,
*b_size + (enc ? authsize : 0));
*b_size + (enc ? authsize : 0));
+ sg_set_buf(&sg[0], assoc, aad_size);
+ sg_set_buf(&sgout[0], assoc, aad_size);
+
aead_request_set_crypt(req, sg, sgout, *b_size, iv);
aead_request_set_crypt(req, sg, sgout, *b_size, iv);
- aead_request_set_a
ssoc(req, asg
, aad_size);
+ aead_request_set_a
d(req
, aad_size);
if (secs)
ret = test_aead_jiffies(req, enc, *b_size,
if (secs)
ret = test_aead_jiffies(req, enc, *b_size,
@@
-808,7
+809,7
@@
static int test_ahash_jiffies(struct ahash_request *req, int blen,
for (start = jiffies, end = start + secs * HZ, bcount = 0;
time_before(jiffies, end); bcount++) {
for (start = jiffies, end = start + secs * HZ, bcount = 0;
time_before(jiffies, end); bcount++) {
- ret =
crypto_ahash_init(req
);
+ ret =
do_one_ahash_op(req, crypto_ahash_init(req)
);
if (ret)
return ret;
for (pcount = 0; pcount < blen; pcount += plen) {
if (ret)
return ret;
for (pcount = 0; pcount < blen; pcount += plen) {
@@
-877,7
+878,7
@@
static int test_ahash_cycles(struct ahash_request *req, int blen,
/* Warm-up run. */
for (i = 0; i < 4; i++) {
/* Warm-up run. */
for (i = 0; i < 4; i++) {
- ret =
crypto_ahash_init(req
);
+ ret =
do_one_ahash_op(req, crypto_ahash_init(req)
);
if (ret)
goto out;
for (pcount = 0; pcount < blen; pcount += plen) {
if (ret)
goto out;
for (pcount = 0; pcount < blen; pcount += plen) {
@@
-896,7
+897,7
@@
static int test_ahash_cycles(struct ahash_request *req, int blen,
start = get_cycles();
start = get_cycles();
- ret =
crypto_ahash_init(req
);
+ ret =
do_one_ahash_op(req, crypto_ahash_init(req)
);
if (ret)
goto out;
for (pcount = 0; pcount < blen; pcount += plen) {
if (ret)
goto out;
for (pcount = 0; pcount < blen; pcount += plen) {
@@
-1761,6
+1762,11
@@
static int do_test(const char *alg, u32 type, u32 mask, int m)
NULL, 0, 16, 8, aead_speed_template_20);
break;
NULL, 0, 16, 8, aead_speed_template_20);
break;
+ case 212:
+ test_aead_speed("rfc4309(ccm(aes))", ENCRYPT, sec,
+ NULL, 0, 16, 8, aead_speed_template_19);
+ break;
+
case 300:
if (alg) {
test_hash_speed(alg, sec, generic_hash_speed_template);
case 300:
if (alg) {
test_hash_speed(alg, sec, generic_hash_speed_template);