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 04/11] crypto: dh - fix dh_max_size Date: Wed, 17 May 2017 18:00:31 +0300 [thread overview] Message-ID: <1495033238-26016-5-git-send-email-tudor.ambarus@microchip.com> (raw) In-Reply-To: <1495033238-26016-1-git-send-email-tudor.ambarus@microchip.com> The function should return minimum size for output buffer or error code if key hasn't been set. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> --- crypto/dh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/dh.c b/crypto/dh.c index 7cec0498..325a5dd 100644 --- a/crypto/dh.c +++ b/crypto/dh.c @@ -148,7 +148,7 @@ static int dh_max_size(struct crypto_kpp *tfm) { struct dh_ctx *ctx = dh_get_ctx(tfm); - return mpi_get_size(ctx->p); + return ctx->p ? mpi_get_size(ctx->p) : -EINVAL; } static void dh_exit_tfm(struct crypto_kpp *tfm) -- 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 04/11] crypto: dh - fix dh_max_size Date: Wed, 17 May 2017 15:00:31 +0000 [thread overview] Message-ID: <1495033238-26016-5-git-send-email-tudor.ambarus@microchip.com> (raw) In-Reply-To: <1495033238-26016-1-git-send-email-tudor.ambarus@microchip.com> The function should return minimum size for output buffer or error code if key hasn't been set. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> --- crypto/dh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/dh.c b/crypto/dh.c index 7cec0498..325a5dd 100644 --- a/crypto/dh.c +++ b/crypto/dh.c @@ -148,7 +148,7 @@ static int dh_max_size(struct crypto_kpp *tfm) { struct dh_ctx *ctx = dh_get_ctx(tfm); - return mpi_get_size(ctx->p); + return ctx->p ? mpi_get_size(ctx->p) : -EINVAL; } static void dh_exit_tfm(struct crypto_kpp *tfm) -- 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 ` Tudor Ambarus [this message] 2017-05-17 15:00 ` [PATCH v2 04/11] crypto: dh - fix dh_max_size 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 ` [PATCH v2 09/11] crypto: testmgr - check err on kpp maxsize Tudor Ambarus 2017-05-17 15:00 ` 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-5-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.