crypto: qce - use memcpy_and_pad in qce_aead_setkey
Subsystems (3)
PATCH 1/1 crypto: qce - use memcpy_and_pad in qce_aead_setkey
Replace memset() followed by memcpy() with memcpy_and_pad() to simplify the code and to write to ->auth_key only once.
Signed-off-by Thorsten Blum <[email protected]>
--- drivers/crypto/qce/aead.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/qce/aead.c +2 -2
@@ -642,8 +642,8 @@ static int qce_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned intmemcpy (ctx->enc_key, authenc_keys.enckey, authenc_keys.enckeylen); -memset (ctx->auth_key,0 ,sizeof (ctx->auth_key)); -memcpy (ctx->auth_key, authenc_keys.authkey, authenc_keys.authkeylen); +memcpy_and_pad (ctx->auth_key,sizeof (ctx->auth_key), + authenc_keys.authkey, authenc_keys.authkeylen,0 );return crypto_aead_setkey (ctx->fallback, key, keylen); }
Quoted 5 lines · Thorsten Blum
Replace
memset()followed bymemcpy()withmemcpy_and_pad()to simplify the code and to write to ->auth_key only once.Signed-off-by Thorsten Blum <[email protected]>---
Reviewed-by Konrad Dybcio <[email protected]>
Konrad
Herbert Xu
maintainerQuoted 7 lines · Thorsten Blum
Replace
memset()followed bymemcpy()withmemcpy_and_pad()to simplify the code and to write to ->auth_key only once.Signed-off-by Thorsten Blum <[email protected]>--- drivers/crypto/qce/aead.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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