Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: artpec6 - use memcpy_and_pad to simplify prepare_hash

Use memcpy_and_pad() instead of memcpy() followed by memset() to
simplify artpec6_crypto_prepare_hash().

Also fix a duplicate word in a comment and remove a now-redundant one.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Thorsten Blum and committed by
Herbert Xu
32611844 2ef3bac1

+3 -6
+3 -6
drivers/crypto/axis/artpec6_crypto.c
··· 1323 1323 1324 1324 artpec6_crypto_init_dma_operation(common); 1325 1325 1326 - /* Upload HMAC key, must be first the first packet */ 1326 + /* Upload HMAC key, it must be the first packet */ 1327 1327 if (req_ctx->hash_flags & HASH_FLAG_HMAC) { 1328 1328 if (variant == ARTPEC6_CRYPTO) { 1329 1329 req_ctx->key_md = FIELD_PREP(A6_CRY_MD_OPER, ··· 1333 1333 a7_regk_crypto_dlkey); 1334 1334 } 1335 1335 1336 - /* Copy and pad up the key */ 1337 - memcpy(req_ctx->key_buffer, ctx->hmac_key, 1338 - ctx->hmac_key_length); 1339 - memset(req_ctx->key_buffer + ctx->hmac_key_length, 0, 1340 - blocksize - ctx->hmac_key_length); 1336 + memcpy_and_pad(req_ctx->key_buffer, blocksize, ctx->hmac_key, 1337 + ctx->hmac_key_length, 0); 1341 1338 1342 1339 error = artpec6_crypto_setup_out_descr(common, 1343 1340 (void *)&req_ctx->key_md,