diff options
author | Richard Levitte <levitte@openssl.org> | 2016-12-20 12:56:14 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2016-12-20 16:10:24 +0100 |
commit | d7c8f142ea5953bf260b70a58739c1c9b0f038eb (patch) | |
tree | 21e2b3ed050147e8cbea3e234866c12ad10c1728 /crypto/evp/pmeth_fn.c | |
parent | 992155d0ea1d59d20f0c242ea400434cd8370fe1 (diff) | |
download | openssl-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.c | 7 |
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; \ |