summaryrefslogtreecommitdiffstats
path: root/engines/ccgost
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>2008-12-13 17:28:25 +0000
committerBen Laurie <ben@openssl.org>2008-12-13 17:28:25 +0000
commit071920d9f640ff1383016e95a19be76a4f80c798 (patch)
treeb3ab4a0b405a87e7500317888c64b30c4143bea1 /engines/ccgost
parent1f6e9bce21c4459cca7e23a4ceab8169f1092b25 (diff)
Check for NULL before use (Coverity ID 203).
Diffstat (limited to 'engines/ccgost')
-rw-r--r--engines/ccgost/gost_ameth.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/engines/ccgost/gost_ameth.c b/engines/ccgost/gost_ameth.c
index 0a896039df..b9d9ba734b 100644
--- a/engines/ccgost/gost_ameth.c
+++ b/engines/ccgost/gost_ameth.c
@@ -415,20 +415,21 @@ static int print_gost_01(BIO *out, const EVP_PKEY *pkey, int indent,
BN_print(out,key);
BIO_printf(out,"\n");
}
- if (type >=1)
+ if (type >= 1)
{
BN_CTX *ctx = BN_CTX_new();
BIGNUM *X,*Y;
const EC_POINT *pubkey;
const EC_GROUP *group;
- BN_CTX_start(ctx);
- X= BN_CTX_get(ctx);
- Y=BN_CTX_get(ctx);
+
if (!ctx)
{
GOSTerr(GOST_F_PRINT_GOST_01,ERR_R_MALLOC_FAILURE);
return 0;
}
+ BN_CTX_start(ctx);
+ X = BN_CTX_get(ctx);
+ Y = BN_CTX_get(ctx);
pubkey = EC_KEY_get0_public_key((EC_KEY *)EVP_PKEY_get0((EVP_PKEY *)pkey));
group = EC_KEY_get0_group((EC_KEY *)EVP_PKEY_get0((EVP_PKEY *)pkey));
if (!EC_POINT_get_affine_coordinates_GFp(group,pubkey,X,Y,ctx))