aboutsummaryrefslogtreecommitdiffstats
path: root/engines/ccgost/gost2001.c
diff options
context:
space:
mode:
Diffstat (limited to 'engines/ccgost/gost2001.c')
-rw-r--r--engines/ccgost/gost2001.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/engines/ccgost/gost2001.c b/engines/ccgost/gost2001.c
index 9536295430d0..881d0d3c9097 100644
--- a/engines/ccgost/gost2001.c
+++ b/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);