crypto: artpec6 - use memcpy_and_pad to simplify prepare_hash
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- drivers/crypto/axis/artpec6_crypto.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/crypto/axis/artpec6_crypto.c +3 -6
@@ -1323,7 +1323,7 @@ static int artpec6_crypto_prepare_hash(struct ahash_request *areq)artpec6_crypto_init_dma_operation (common); -/* Upload HMAC key, must be first the first packet */ +/* Upload HMAC key, it must be the first packet */ if (req_ctx->hash_flags &HASH_FLAG_HMAC ) {if (variant ==ARTPEC6_CRYPTO ) { req_ctx->key_md = FIELD_PREP(A6_CRY_MD_OPER,
@@ -1333,11 +1333,8 @@ static int artpec6_crypto_prepare_hash(struct ahash_request *areq) a7_regk_crypto_dlkey); } -/* Copy and pad up the key */ -memcpy (req_ctx->key_buffer, ctx->hmac_key, - ctx->hmac_key_length); -memset (req_ctx->key_buffer + ctx->hmac_key_length,0 , - blocksize - ctx->hmac_key_length); +memcpy_and_pad (req_ctx->key_buffer, blocksize, ctx->hmac_key, + ctx->hmac_key_length,0 ); error = artpec6_crypto_setup_out_descr(common, (void *)&req_ctx->key_md,
Herbert Xu
maintainerQuoted 9 lines · Thorsten Blum
Use
memcpy_and_pad()instead ofmemcpy()followed bymemset()to simplifyartpec6_crypto_prepare_hash().Also fix a duplicate word in a comment and remove a now-redundant one.
Signed-off-by Thorsten Blum <[email protected]>--- drivers/crypto/axis/artpec6_crypto.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt