modes/modes_lcl.h: make it indent-friendly.
[oweals/openssl.git] / engines / ccgost / gost2001.c
index e0d685f7546a52b282515db7b0b57cfa0f1ca7dc..e8bbfdfc061ce734bed038823a3576c956a6279b 100644 (file)
@@ -106,7 +106,7 @@ DSA_SIG *gost2001_do_sign(const unsigned char *dgst,int dlen, EC_KEY *eckey)
        newsig=DSA_SIG_new();
        if (!newsig) 
                {
-               GOSTerr(GOST_F_GOST2001_DO_SIGN,GOST_R_NO_MEMORY);
+               GOSTerr(GOST_F_GOST2001_DO_SIGN,ERR_R_MALLOC_FAILURE);
                goto err;
                }       
        group = EC_KEY_get0_group(eckey);
@@ -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);
@@ -205,7 +208,7 @@ int gost2001_do_verify(const unsigned char *dgst,int dgst_len,
        if (BN_is_zero(sig->s) || BN_is_zero(sig->r) ||
                (BN_cmp(sig->s,order)>=1) || (BN_cmp(sig->r,order)>=1)) 
                {
-               GOSTerr(GOST_F_GOST_DO_VERIFY,GOST_R_SIGNATURE_PARTS_GREATER_THAN_Q);
+               GOSTerr(GOST_F_GOST2001_DO_VERIFY,GOST_R_SIGNATURE_PARTS_GREATER_THAN_Q);
                goto err;
 
                }
@@ -325,7 +328,7 @@ int gost2001_keygen(EC_KEY *ec)
                {
                if (!BN_rand_range(d,order)) 
                        {
-                       GOSTerr(GOST_F_GOST2001_DO_SIGN,GOST_R_RANDOM_NUMBER_GENERATOR_FAILED);
+                       GOSTerr(GOST_F_GOST2001_KEYGEN,GOST_R_RANDOM_NUMBER_GENERATOR_FAILED);
                        BN_free(d);
                        BN_free(order);
                        return 0;