summaryrefslogtreecommitdiffstats
path: root/crypto/openssl/engines/ccgost/gost2001.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssl/engines/ccgost/gost2001.c')
-rw-r--r--crypto/openssl/engines/ccgost/gost2001.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/crypto/openssl/engines/ccgost/gost2001.c b/crypto/openssl/engines/ccgost/gost2001.c
index 9536295..881d0d3 100644
--- a/crypto/openssl/engines/ccgost/gost2001.c
+++ b/crypto/openssl/engines/ccgost/gost2001.c
@@ -434,8 +434,16 @@ int gost2001_compute_public(EC_KEY *ec)
int gost2001_keygen(EC_KEY *ec)
{
BIGNUM *order = BN_new(), *d = BN_new();
- const EC_GROUP *group = EC_KEY_get0_group(ec);
+ const EC_GROUP *group = NULL;
+
+ if (order == NULL || d == NULL) {
+ GOSTerr(GOST_F_GOST2001_KEYGEN, ERR_R_MALLOC_FAILURE);
+ BN_free(d);
+ BN_free(order);
+ return 0;
+ }
+ group = EC_KEY_get0_group(ec);
if(!group || !EC_GROUP_get_order(group, order, NULL)) {
GOSTerr(GOST_F_GOST2001_KEYGEN, ERR_R_INTERNAL_ERROR);
BN_free(d);
OpenPOWER on IntegriCloud