lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170112160959.GA19732@gondor.apana.org.au>
Date:   Fri, 13 Jan 2017 00:09:59 +0800
From:   Herbert Xu <herbert@...dor.apana.org.au>
To:     Harsh Jain <harsh@...lsio.com>
Cc:     hariprasad@...lsio.com, netdev@...r.kernel.org,
        linux-crypto@...r.kernel.org
Subject: Re: [PATCH v1 3/8] crypto:chcr- Fix key length for RFC4106

On Fri, Jan 06, 2017 at 02:01:34PM +0530, Harsh Jain wrote:
> Check keylen before copying salt to avoid wrap around of Integer.
> 
> Signed-off-by: Harsh Jain <harsh@...lsio.com>
> ---
>  drivers/crypto/chelsio/chcr_algo.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
> index deec7c0..6c2dea3 100644
> --- a/drivers/crypto/chelsio/chcr_algo.c
> +++ b/drivers/crypto/chelsio/chcr_algo.c
> @@ -2194,8 +2194,8 @@ static int chcr_gcm_setkey(struct crypto_aead *aead, const u8 *key,
>  	unsigned int ck_size;
>  	int ret = 0, key_ctx_size = 0;
>  
> -	if (get_aead_subtype(aead) ==
> -	    CRYPTO_ALG_SUB_TYPE_AEAD_RFC4106) {
> +	if (get_aead_subtype(aead) == CRYPTO_ALG_SUB_TYPE_AEAD_RFC4106 &&
> +	    keylen > 3) {
>  		keylen -= 4;  /* nonce/salt is present in the last 4 bytes */
>  		memcpy(aeadctx->salt, key + keylen, 4);
>  	}

We should return an error in this case.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ