[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190201062655.hmxeqo5hprhcgtfx@gondor.apana.org.au>
Date: Fri, 1 Feb 2019 14:26:55 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Vitaly Chikunov <vt@...linux.org>
Cc: "David S. Miller" <davem@...emloft.net>,
David Howells <dhowells@...hat.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...com>,
Horia Geantă <horia.geanta@....com>,
Aymen Sghaier <aymen.sghaier@....com>,
Tom Lendacky <thomas.lendacky@....com>,
Gary Hook <gary.hook@....com>,
Giovanni Cabiddu <giovanni.cabiddu@...el.com>,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
keyrings@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, qat-linux@...el.com
Subject: Re: [RFC PATCH v4] akcipher: new verify API for public key algorithms
On Fri, Jan 25, 2019 at 09:01:16PM +0300, Vitaly Chikunov wrote:
>
> @@ -781,36 +780,17 @@ static int tpm_key_verify_signature(const struct key *key,
> if (!req)
> goto error_free_tfm;
>
> - ret = -ENOMEM;
> - outlen = crypto_akcipher_maxsize(tfm);
> - output = kmalloc(outlen, GFP_KERNEL);
> - if (!output)
> - goto error_free_req;
> -
> - sg_init_one(&sig_sg, sig->s, sig->s_size);
> - sg_init_one(&digest_sg, output, outlen);
> - akcipher_request_set_crypt(req, &sig_sg, &digest_sg, sig->s_size,
> - outlen);
> + sg_init_table(&src_sg, 2);
> + sg_set_buf(&src_sg[0], sig->s, sig->s_size);
> + sg_set_buf(&src_sg[1], sig->digest, sig->digest_size);
> + akcipher_request_set_crypt(req, &src_sg, NULL, sig->s_size,
> + sig->digest_size);
It's not clear that sig->digest is guaranteed to be kmalloc memory.
In any case, it's best not to mix unrelated changes in a single
patch. So please keep the kmalloc on output and then copy
sig->digest into it and put output into the SG list.
Thanks,
--
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