Commit 61c38e3a authored by Eric Biggers's avatar Eric Biggers Committed by Herbert Xu

crypto: hisilicon/sec2 - use crypto_shash_tfm_digest()

Instead of manually allocating a 'struct shash_desc' on the stack and
calling crypto_shash_digest(), switch to using the new helper function
crypto_shash_tfm_digest() which does this for us.

Cc: Zaibo Xu <xuzaibo@huawei.com>
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 8cbb8097
...@@ -832,7 +832,6 @@ static int sec_aead_auth_set_key(struct sec_auth_ctx *ctx, ...@@ -832,7 +832,6 @@ static int sec_aead_auth_set_key(struct sec_auth_ctx *ctx,
struct crypto_authenc_keys *keys) struct crypto_authenc_keys *keys)
{ {
struct crypto_shash *hash_tfm = ctx->hash_tfm; struct crypto_shash *hash_tfm = ctx->hash_tfm;
SHASH_DESC_ON_STACK(shash, hash_tfm);
int blocksize, ret; int blocksize, ret;
if (!keys->authkeylen) { if (!keys->authkeylen) {
...@@ -842,8 +841,8 @@ static int sec_aead_auth_set_key(struct sec_auth_ctx *ctx, ...@@ -842,8 +841,8 @@ static int sec_aead_auth_set_key(struct sec_auth_ctx *ctx,
blocksize = crypto_shash_blocksize(hash_tfm); blocksize = crypto_shash_blocksize(hash_tfm);
if (keys->authkeylen > blocksize) { if (keys->authkeylen > blocksize) {
ret = crypto_shash_digest(shash, keys->authkey, ret = crypto_shash_tfm_digest(hash_tfm, keys->authkey,
keys->authkeylen, ctx->a_key); keys->authkeylen, ctx->a_key);
if (ret) { if (ret) {
pr_err("hisi_sec2: aead auth digest error!\n"); pr_err("hisi_sec2: aead auth digest error!\n");
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment