diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-01 22:59:41 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-01 22:59:41 +0000 |
commit | 4224465e820a1a7232255d980e692720169776af (patch) | |
tree | c67e489c7b1ceb61d95035802730e564dff18a56 /tools | |
parent | f9448bf33f7fa75806a8739743c0c5b803f0d10f (diff) | |
parent | 1f1ed24cc5252c0d33d775bb00052462b462f77c (diff) | |
download | src-4224465e820a1a7232255d980e692720169776af.tar.gz src-4224465e820a1a7232255d980e692720169776af.zip |
Merge ^/head r319251 through r319479.
Notes
Notes:
svn path=/projects/clang500-import/; revision=319480
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/crypto/cryptotest.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/tools/tools/crypto/cryptotest.c b/tools/tools/crypto/cryptotest.c index bf0f8eef3e46..2b5aa0af5085 100644 --- a/tools/tools/crypto/cryptotest.c +++ b/tools/tools/crypto/cryptotest.c @@ -216,7 +216,7 @@ crlookup(const char *devname) const char * crfind(int crid) { - struct crypt_find_op find; + static struct crypt_find_op find; bzero(&find, sizeof(find)); find.crid = crid; @@ -252,7 +252,7 @@ runtest(struct alg *alg, int count, int size, u_long cmd, struct timeval *tv) { int i, fd = crget(); struct timeval start, stop, dt; - char *cleartext, *ciphertext, *originaltext; + char *cleartext, *ciphertext, *originaltext, *key; struct session2_op sop; struct crypt_op cop; char iv[EALG_MAX_BLOCK_LEN]; @@ -260,19 +260,21 @@ runtest(struct alg *alg, int count, int size, u_long cmd, struct timeval *tv) bzero(&sop, sizeof(sop)); if (!alg->ishash) { sop.keylen = (alg->minkeylen + alg->maxkeylen)/2; - sop.key = (char *) malloc(sop.keylen); - if (sop.key == NULL) + key = (char *) malloc(sop.keylen); + if (key == NULL) err(1, "malloc (key)"); for (i = 0; i < sop.keylen; i++) - sop.key[i] = rdigit(); + key[i] = rdigit(); + sop.key = key; sop.cipher = alg->code; } else { sop.mackeylen = (alg->minkeylen + alg->maxkeylen)/2; - sop.mackey = (char *) malloc(sop.mackeylen); - if (sop.mackey == NULL) + key = (char *) malloc(sop.mackeylen); + if (key == NULL) err(1, "malloc (mac)"); for (i = 0; i < sop.mackeylen; i++) - sop.mackey[i] = rdigit(); + key[i] = rdigit(); + sop.mackey = key; sop.mac = alg->code; } sop.crid = crid; |