summaryrefslogtreecommitdiffstats
path: root/crypto/ec/ecdh_ossl.c
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2017-06-13 18:08:40 +0200
committerRich Salz <rsalz@openssl.org>2017-06-14 09:51:32 -0400
commit4b797282c23450406c2dc73aea051b4b85589b8d (patch)
tree5cf6823fcff1d7d15e8335379a8bb470515f01f9 /crypto/ec/ecdh_ossl.c
parent388105fff3a3290806f411f0ea1d384adecb7ffa (diff)
Fix crash in ecdh_simple_compute_key.
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3671) (cherry picked from commit abea494cf75061650deecf584adc2cd293ce322d)
Diffstat (limited to 'crypto/ec/ecdh_ossl.c')
-rw-r--r--crypto/ec/ecdh_ossl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/ec/ecdh_ossl.c b/crypto/ec/ecdh_ossl.c
index caf65de8c4..a865145974 100644
--- a/crypto/ec/ecdh_ossl.c
+++ b/crypto/ec/ecdh_ossl.c
@@ -66,6 +66,10 @@ int ecdh_simple_compute_key(unsigned char **pout, size_t *poutlen,
BN_CTX_start(ctx);
x = BN_CTX_get(ctx);
y = BN_CTX_get(ctx);
+ if (y == NULL) {
+ ECerr(EC_F_ECDH_SIMPLE_COMPUTE_KEY, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
priv_key = EC_KEY_get0_private_key(ecdh);
if (priv_key == NULL) {