Check for NULL before use (Coverity ID 203).

This commit is contained in:
Ben Laurie 2008-12-13 17:28:25 +00:00
parent 1f6e9bce21
commit 071920d9f6

View File

@ -421,14 +421,15 @@ static int print_gost_01(BIO *out, const EVP_PKEY *pkey, int indent,
BIGNUM *X,*Y; BIGNUM *X,*Y;
const EC_POINT *pubkey; const EC_POINT *pubkey;
const EC_GROUP *group; const EC_GROUP *group;
BN_CTX_start(ctx);
X= BN_CTX_get(ctx);
Y=BN_CTX_get(ctx);
if (!ctx) if (!ctx)
{ {
GOSTerr(GOST_F_PRINT_GOST_01,ERR_R_MALLOC_FAILURE); GOSTerr(GOST_F_PRINT_GOST_01,ERR_R_MALLOC_FAILURE);
return 0; 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)); 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)); 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)) if (!EC_POINT_get_affine_coordinates_GFp(group,pubkey,X,Y,ctx))