aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/evp/pmeth_fn.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-12-20 12:56:14 +0100
committerRichard Levitte <levitte@openssl.org>2016-12-20 16:10:24 +0100
commitd7c8f142ea5953bf260b70a58739c1c9b0f038eb (patch)
tree21e2b3ed050147e8cbea3e234866c12ad10c1728 /crypto/evp/pmeth_fn.c
parent992155d0ea1d59d20f0c242ea400434cd8370fe1 (diff)
downloadopenssl-d7c8f142ea5953bf260b70a58739c1c9b0f038eb.tar.gz
M_check_autoarg: sanity check the key
For now, checking that the size is non-zero will suffice. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2120)
Diffstat (limited to 'crypto/evp/pmeth_fn.c')
-rw-r--r--crypto/evp/pmeth_fn.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/evp/pmeth_fn.c b/crypto/evp/pmeth_fn.c
index 8ff50da33a..e9b20a6088 100644
--- a/crypto/evp/pmeth_fn.c
+++ b/crypto/evp/pmeth_fn.c
@@ -18,7 +18,12 @@
if (ctx->pmeth->flags & EVP_PKEY_FLAG_AUTOARGLEN) \
{ \
size_t pksize = (size_t)EVP_PKEY_size(ctx->pkey); \
- if (!arg) \
+ if (pksize == 0) \
+ { \
+ EVPerr(err, EVP_R_INVALID_KEY); /*ckerr_ignore*/\
+ return 0; \
+ } \
+ else if (!arg) \
{ \
*arglen = pksize; \
return 1; \