Submitted by: Dmitry Ivanov <vonami@gmail.com>
authorDr. Stephen Henson <steve@openssl.org>
Tue, 16 Feb 2010 14:30:29 +0000 (14:30 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Tue, 16 Feb 2010 14:30:29 +0000 (14:30 +0000)
Don't leave dangling pointers in GOST engine if calls fail.

engines/ccgost/gost2001.c

index e3354549e1b5a61a7b706db1f5ee1464b20a8f13..dacd82d2b92aad29a3088e354b32fe5c3627ad6d 100644 (file)
@@ -136,12 +136,14 @@ DSA_SIG *gost2001_do_sign(const unsigned char *dgst,int dlen, EC_KEY *eckey)
                                {
                                GOSTerr(GOST_F_GOST2001_DO_SIGN,GOST_R_RANDOM_NUMBER_GENERATOR_FAILED);
                                DSA_SIG_free(newsig);
+                               newsig = NULL;
                                goto err;
                                }       
                        if (!EC_POINT_mul(group,C,k,NULL,NULL,ctx))
                                {
                                GOSTerr(GOST_F_GOST2001_DO_SIGN,ERR_R_EC_LIB);
                                DSA_SIG_free(newsig);
+                               newsig = NULL;
                                goto err;
                                }       
                        if (!X) X=BN_CTX_get(ctx);
@@ -149,6 +151,7 @@ DSA_SIG *gost2001_do_sign(const unsigned char *dgst,int dlen, EC_KEY *eckey)
                                {
                                GOSTerr(GOST_F_GOST2001_DO_SIGN,ERR_R_EC_LIB);
                                DSA_SIG_free(newsig);
+                               newsig = NULL;
                                goto err;
                                }       
                        if (!r) r=BN_CTX_get(ctx);