From: Tudor Ambarus <tudor.ambarus@microchip.com> To: <herbert@gondor.apana.org.au>, <davem@davemloft.net>, <dhowells@redhat.com> Cc: <linux-crypto@vger.kernel.org>, <keyrings@vger.kernel.org>, <Nicolas.Ferre@microchip.com>, Tudor Ambarus <tudor.ambarus@microchip.com> Subject: [PATCH v2 09/11] crypto: testmgr - check err on kpp maxsize Date: Wed, 17 May 2017 18:00:36 +0300 [thread overview] Message-ID: <1495033238-26016-10-git-send-email-tudor.ambarus@microchip.com> (raw) In-Reply-To: <1495033238-26016-1-git-send-email-tudor.ambarus@microchip.com> crypto_kpp_maxsize() returns minimum length for output buffer or error code if key hasn't been set. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> --- crypto/testmgr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 87a4abd..0bf9a00 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -2013,6 +2013,11 @@ static int do_test_kpp(struct crypto_kpp *tfm, const struct kpp_testvec *vec, goto free_req; out_len_max = crypto_kpp_maxsize(tfm); + if (out_len_max < 0) { + err = out_len_max; + goto free_req; + } + output_buf = kzalloc(out_len_max, GFP_KERNEL); if (!output_buf) { err = -ENOMEM; -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: Tudor Ambarus <tudor.ambarus@microchip.com> To: herbert@gondor.apana.org.au, davem@davemloft.net, dhowells@redhat.com Cc: linux-crypto@vger.kernel.org, keyrings@vger.kernel.org, Nicolas.Ferre@microchip.com, Tudor Ambarus <tudor.ambarus@microchip.com> Subject: [PATCH v2 09/11] crypto: testmgr - check err on kpp maxsize Date: Wed, 17 May 2017 15:00:36 +0000 [thread overview] Message-ID: <1495033238-26016-10-git-send-email-tudor.ambarus@microchip.com> (raw) In-Reply-To: <1495033238-26016-1-git-send-email-tudor.ambarus@microchip.com> crypto_kpp_maxsize() returns minimum length for output buffer or error code if key hasn't been set. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> --- crypto/testmgr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 87a4abd..0bf9a00 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -2013,6 +2013,11 @@ static int do_test_kpp(struct crypto_kpp *tfm, const struct kpp_testvec *vec, goto free_req; out_len_max = crypto_kpp_maxsize(tfm); + if (out_len_max < 0) { + err = out_len_max; + goto free_req; + } + output_buf = kzalloc(out_len_max, GFP_KERNEL); if (!output_buf) { err = -ENOMEM; -- 2.7.4
next prev parent reply other threads:[~2017-05-17 15:01 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-05-17 15:00 [PATCH v2 00/11] fixes for ecc, ec(dh), rsa & testmgr Tudor Ambarus 2017-05-17 15:00 ` Tudor Ambarus 2017-05-17 15:00 ` [PATCH v2 01/11] crypto: kpp, (ec)dh - fix typos Tudor Ambarus 2017-05-17 15:00 ` Tudor Ambarus 2017-05-17 15:00 ` [PATCH v2 02/11] crypto: ecc - remove unused function arguments Tudor Ambarus 2017-05-17 15:00 ` Tudor Ambarus 2017-05-17 15:00 ` [PATCH v2 03/11] crypto: ecc - remove unnecessary casts Tudor Ambarus 2017-05-17 15:00 ` Tudor Ambarus 2017-05-17 15:00 ` [PATCH v2 04/11] crypto: dh - fix dh_max_size Tudor Ambarus 2017-05-17 15:00 ` Tudor Ambarus 2017-05-23 4:07 ` Herbert Xu 2017-05-23 4:07 ` Herbert Xu 2017-05-17 15:00 ` [PATCH v2 05/11] crypto: ecdh - fix ecdh_max_size Tudor Ambarus 2017-05-17 15:00 ` Tudor Ambarus 2017-05-17 15:00 ` [PATCH v2 06/11] crypto: ecc - don't be selfish on pubkeys Tudor Ambarus 2017-05-17 15:00 ` Tudor Ambarus 2017-05-17 15:00 ` [PATCH v2 07/11] crypto: dh - fix memleak in setkey Tudor Ambarus 2017-05-17 15:00 ` Tudor Ambarus 2017-05-17 15:00 ` [PATCH v2 08/11] crypto: testmgr - check err on akcipher maxsize Tudor Ambarus 2017-05-17 15:00 ` Tudor Ambarus 2017-05-23 4:08 ` Herbert Xu 2017-05-23 4:08 ` Herbert Xu 2017-05-23 9:18 ` Tudor Ambarus 2017-05-23 9:18 ` Tudor Ambarus 2017-05-24 3:51 ` Herbert Xu 2017-05-24 3:51 ` Herbert Xu 2017-05-17 15:00 ` Tudor Ambarus [this message] 2017-05-17 15:00 ` [PATCH v2 09/11] crypto: testmgr - check err on kpp maxsize Tudor Ambarus 2017-05-17 15:00 ` [PATCH v2 10/11] crypto: KEYS: check err on akcipher maxsize Tudor Ambarus 2017-05-17 15:00 ` Tudor Ambarus 2017-05-17 15:00 ` [PATCH v2 11/11] crypto: rsa - do checks before allocating data Tudor Ambarus 2017-05-17 15:00 ` Tudor Ambarus 2017-05-24 12:49 ` [PATCH v2 10/11] crypto: KEYS: check err on akcipher maxsize David Howells 2017-05-24 12:49 ` David Howells
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=1495033238-26016-10-git-send-email-tudor.ambarus@microchip.com \ --to=tudor.ambarus@microchip.com \ --cc=Nicolas.Ferre@microchip.com \ --cc=davem@davemloft.net \ --cc=dhowells@redhat.com \ --cc=herbert@gondor.apana.org.au \ --cc=keyrings@vger.kernel.org \ --cc=linux-crypto@vger.kernel.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.