* [PATCH] crypto: sa2ul - Add check for crypto_aead_setkey
@ 2023-11-07 6:31 Chen Ni
2023-11-17 10:29 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Chen Ni @ 2023-11-07 6:31 UTC (permalink / raw)
To: herbert, davem, t-kristo, j-keerthy; +Cc: linux-crypto, linux-kernel, Chen Ni
Add check for crypto_aead_setkey() and return the error if it fails
in order to transfer the error.
Fixes: d2c8ac187fc9 ("crypto: sa2ul - Add AEAD algorithm support")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
drivers/crypto/sa2ul.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/sa2ul.c b/drivers/crypto/sa2ul.c
index 6846a8429574..6bac2382e261 100644
--- a/drivers/crypto/sa2ul.c
+++ b/drivers/crypto/sa2ul.c
@@ -1806,6 +1806,7 @@ static int sa_aead_setkey(struct crypto_aead *authenc,
int cmdl_len;
struct sa_cmdl_cfg cfg;
int key_idx;
+ int error;
if (crypto_authenc_extractkeys(&keys, key, keylen) != 0)
return -EINVAL;
@@ -1869,7 +1870,9 @@ static int sa_aead_setkey(struct crypto_aead *authenc,
crypto_aead_set_flags(ctx->fallback.aead,
crypto_aead_get_flags(authenc) &
CRYPTO_TFM_REQ_MASK);
- crypto_aead_setkey(ctx->fallback.aead, key, keylen);
+ error = crypto_aead_setkey(ctx->fallback.aead, key, keylen);
+ if (error)
+ return error;
return 0;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: sa2ul - Add check for crypto_aead_setkey
2023-11-07 6:31 [PATCH] crypto: sa2ul - Add check for crypto_aead_setkey Chen Ni
@ 2023-11-17 10:29 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2023-11-17 10:29 UTC (permalink / raw)
To: Chen Ni; +Cc: davem, t-kristo, j-keerthy, linux-crypto, linux-kernel, nichen
Chen Ni <nichen@iscas.ac.cn> wrote:
> Add check for crypto_aead_setkey() and return the error if it fails
> in order to transfer the error.
>
> Fixes: d2c8ac187fc9 ("crypto: sa2ul - Add AEAD algorithm support")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
> drivers/crypto/sa2ul.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/sa2ul.c b/drivers/crypto/sa2ul.c
> index 6846a8429574..6bac2382e261 100644
> --- a/drivers/crypto/sa2ul.c
> +++ b/drivers/crypto/sa2ul.c
> @@ -1806,6 +1806,7 @@ static int sa_aead_setkey(struct crypto_aead *authenc,
> int cmdl_len;
> struct sa_cmdl_cfg cfg;
> int key_idx;
> + int error;
>
> if (crypto_authenc_extractkeys(&keys, key, keylen) != 0)
> return -EINVAL;
> @@ -1869,7 +1870,9 @@ static int sa_aead_setkey(struct crypto_aead *authenc,
> crypto_aead_set_flags(ctx->fallback.aead,
> crypto_aead_get_flags(authenc) &
> CRYPTO_TFM_REQ_MASK);
> - crypto_aead_setkey(ctx->fallback.aead, key, keylen);
> + error = crypto_aead_setkey(ctx->fallback.aead, key, keylen);
> + if (error)
> + return error;
This should be
return crypto_aead_setkey(ctx->fallback.aead, key, keylen);
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-17 10:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-07 6:31 [PATCH] crypto: sa2ul - Add check for crypto_aead_setkey Chen Ni
2023-11-17 10:29 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).