From: Harsh Jain <Harsh@chelsio.com> To: Herbert Xu <herbert@gondor.apana.org.au> Cc: hariprasad@chelsio.com, netdev@vger.kernel.org, linux-crypto@vger.kernel.org Subject: Re: [PATCH v1 3/8] crypto:chcr- Fix key length for RFC4106 Date: Thu, 12 Jan 2017 22:08:46 +0530 [thread overview] Message-ID: <648404c5-4234-7895-d478-858433b0d093@chelsio.com> (raw) In-Reply-To: <20170112160959.GA19732@gondor.apana.org.au> On 12-01-2017 21:39, Herbert Xu wrote: > 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@chelsio.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. That case is already handled in next if condition.It will error out with -EINVAL in next condition. if (keylen == AES_KEYSIZE_128) { > > Cheers,
next prev parent reply other threads:[~2017-01-12 16:38 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-01-06 8:31 [PATCH v1 0/8] crypto:chcr- Bug fixes Harsh Jain 2017-01-06 8:31 ` [PATCH v1 1/8] crypto:chcr-Change flow IDs Harsh Jain 2017-01-06 8:31 ` [PATCH v1 2/8] crypto:chcr- Fix panic on dma_unmap_sg Harsh Jain 2017-01-06 8:31 ` [PATCH v1 3/8] crypto:chcr- Fix key length for RFC4106 Harsh Jain 2017-01-12 16:09 ` Herbert Xu 2017-01-12 16:38 ` Harsh Jain [this message] 2017-01-12 16:42 ` Herbert Xu 2017-01-06 8:31 ` [PATCH v1 4/8] crypto:chcr- Use cipher instead of Block Cipher in gcm setkey Harsh Jain 2017-01-06 8:31 ` [PATCH v1 5/8] crypto:chcr: Change cra_flags for cipher algos Harsh Jain 2017-01-06 8:31 ` [PATCH v1 6/8] crypto:chcr- Change algo priority Harsh Jain 2017-01-06 8:31 ` [PATCH v1 7/8] crypto:chcr- Check device is allocated before use Harsh Jain 2017-01-06 8:31 ` [PATCH v1 8/8] crypto:chcr- Fix wrong typecasting Harsh Jain 2017-01-12 16:14 ` [PATCH v1 0/8] crypto:chcr- Bug fixes Herbert Xu
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=648404c5-4234-7895-d478-858433b0d093@chelsio.com \ --to=harsh@chelsio.com \ --cc=hariprasad@chelsio.com \ --cc=herbert@gondor.apana.org.au \ --cc=linux-crypto@vger.kernel.org \ --cc=netdev@vger.kernel.org \ --subject='Re: [PATCH v1 3/8] crypto:chcr- Fix key length for RFC4106' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
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).