summaryrefslogtreecommitdiffstats
path: root/crypto/ec
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-01-22 13:59:54 +0100
committerTomas Mraz <tomas@openssl.org>2021-01-26 15:26:49 +0100
commit82a46200911f2bb1af00b6921c0db9738825aa76 (patch)
tree7f649219bfd9d88248bcb035b25024c2ab524da6 /crypto/ec
parentf468e2f95160defb7ab7461f8217697add762b90 (diff)
Add checks for NULL return from EC_KEY_get0_group()
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13139)
Diffstat (limited to 'crypto/ec')
-rw-r--r--crypto/ec/ec_pmeth.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/ec/ec_pmeth.c b/crypto/ec/ec_pmeth.c
index cd1632dc9a..084633dcdc 100644
--- a/crypto/ec/ec_pmeth.c
+++ b/crypto/ec/ec_pmeth.c
@@ -172,6 +172,9 @@ static int pkey_ec_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)
if (!key) {
const EC_GROUP *group;
group = EC_KEY_get0_group(eckey);
+
+ if (group == NULL)
+ return 0;
*keylen = (EC_GROUP_get_degree(group) + 7) / 8;
return 1;
}