crypto: arm64/aes-glue - 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. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
@ -158,7 +158,6 @@ static int __maybe_unused essiv_cbc_set_key(struct crypto_skcipher *tfm,
|
|||||||
unsigned int key_len)
|
unsigned int key_len)
|
||||||
{
|
{
|
||||||
struct crypto_aes_essiv_cbc_ctx *ctx = crypto_skcipher_ctx(tfm);
|
struct crypto_aes_essiv_cbc_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||||
SHASH_DESC_ON_STACK(desc, ctx->hash);
|
|
||||||
u8 digest[SHA256_DIGEST_SIZE];
|
u8 digest[SHA256_DIGEST_SIZE];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -166,8 +165,7 @@ static int __maybe_unused essiv_cbc_set_key(struct crypto_skcipher *tfm,
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
desc->tfm = ctx->hash;
|
crypto_shash_tfm_digest(ctx->hash, in_key, key_len, digest);
|
||||||
crypto_shash_digest(desc, in_key, key_len, digest);
|
|
||||||
|
|
||||||
return aes_expandkey(&ctx->key2, digest, sizeof(digest));
|
return aes_expandkey(&ctx->key2, digest, sizeof(digest));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user