Re: [PATCH v2 1/9] crypto: authenc - don't leak pointers to authenc keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 23, 2018 at 12:42:16PM +0200, Tudor Ambarus wrote:
> In crypto_authenc_setkey we save pointers to the authenc keys in
> a local variable of type struct crypto_authenc_keys and we don't
> zeroize it after use. Fix this and don't leak pointers to the
> authenc keys.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@xxxxxxxxxxxxx>
> ---
>  crypto/authenc.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/crypto/authenc.c b/crypto/authenc.c
> index d3d6d72..480a08b 100644
> --- a/crypto/authenc.c
> +++ b/crypto/authenc.c
> @@ -87,8 +87,10 @@ static int crypto_authenc_setkey(struct crypto_aead *authenc, const u8 *key,
>  	struct crypto_authenc_keys keys;
>  	int err = -EINVAL;
>  
> -	if (crypto_authenc_extractkeys(&keys, key, keylen) != 0)
> -		goto badkey;
> +	if (crypto_authenc_extractkeys(&keys, key, keylen) != 0) {
> +		crypto_aead_set_flags(authenc, CRYPTO_TFM_RES_BAD_KEY_LEN);
> +		goto out;
> +	}

Why did you change this? The existing goto arrangement should work
fine even with your addition.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux