crypto: artpec6 - 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: Jesper Nilsson <jesper.nilsson@axis.com> Cc: Lars Persson <lars.persson@axis.com> Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Родитель
1306664fde
Коммит
7e3e48d86b
|
@ -2239,16 +2239,12 @@ artpec6_crypto_hash_set_key(struct crypto_ahash *tfm,
|
||||||
blocksize = crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
|
blocksize = crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
|
||||||
|
|
||||||
if (keylen > blocksize) {
|
if (keylen > blocksize) {
|
||||||
SHASH_DESC_ON_STACK(hdesc, tfm_ctx->child_hash);
|
|
||||||
|
|
||||||
hdesc->tfm = tfm_ctx->child_hash;
|
|
||||||
|
|
||||||
tfm_ctx->hmac_key_length = blocksize;
|
tfm_ctx->hmac_key_length = blocksize;
|
||||||
ret = crypto_shash_digest(hdesc, key, keylen,
|
|
||||||
|
ret = crypto_shash_tfm_digest(tfm_ctx->child_hash, key, keylen,
|
||||||
tfm_ctx->hmac_key);
|
tfm_ctx->hmac_key);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
memcpy(tfm_ctx->hmac_key, key, keylen);
|
memcpy(tfm_ctx->hmac_key, key, keylen);
|
||||||
tfm_ctx->hmac_key_length = keylen;
|
tfm_ctx->hmac_key_length = keylen;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче