diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-12-02 09:33:25 -0800 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-12-02 09:33:25 -0800 |
commit | ef0902bd956672dc33d6f7dd7bcaff9f769ac5c3 (patch) | |
tree | 50a07d35f4a47620c4c611db434bf4fce05b9260 /crypto/tcrypt.c | |
parent | 82d748eb43a673a56b639efd4d698e1e95715d82 (diff) | |
parent | d3dd09594f91ee57e76cbc27023b214afa01a99a (diff) | |
download | linux-crypto-ef0902bd956672dc33d6f7dd7bcaff9f769ac5c3.tar.gz linux-crypto-ef0902bd956672dc33d6f7dd7bcaff9f769ac5c3.zip |
Merge tag 'v4.4-rc3' into next
Merge with Linux 4.4-rc3 to bring in helpers for multiu-driver modules.
Diffstat (limited to 'crypto/tcrypt.c')
-rw-r--r-- | crypto/tcrypt.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 2b00b617..46a4a757 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -48,6 +48,8 @@ #define ENCRYPT 1 #define DECRYPT 0 +#define MAX_DIGEST_SIZE 64 + /* * return a string with the driver name */ @@ -950,7 +952,7 @@ static void test_ahash_speed(const char *algo, unsigned int secs, struct tcrypt_result tresult; struct ahash_request *req; struct crypto_ahash *tfm; - static char output[1024]; + char *output; int i, ret; tfm = crypto_alloc_ahash(algo, 0, 0); @@ -963,9 +965,9 @@ static void test_ahash_speed(const char *algo, unsigned int secs, printk(KERN_INFO "\ntesting speed of async %s (%s)\n", algo, get_driver_name(crypto_ahash, tfm)); - if (crypto_ahash_digestsize(tfm) > sizeof(output)) { - pr_err("digestsize(%u) > outputbuffer(%zu)\n", - crypto_ahash_digestsize(tfm), sizeof(output)); + if (crypto_ahash_digestsize(tfm) > MAX_DIGEST_SIZE) { + pr_err("digestsize(%u) > %d\n", crypto_ahash_digestsize(tfm), + MAX_DIGEST_SIZE); goto out; } @@ -980,6 +982,10 @@ static void test_ahash_speed(const char *algo, unsigned int secs, ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, tcrypt_complete, &tresult); + output = kmalloc(MAX_DIGEST_SIZE, GFP_KERNEL); + if (!output) + goto out_nomem; + 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", @@ -1006,6 +1012,9 @@ static void test_ahash_speed(const char *algo, unsigned int secs, } } + kfree(output); + +out_nomem: ahash_request_free(req); out: |