]> granicus.if.org Git - openssl/commitdiff
Move BN_CTX_start() call so the error case can always call BN_CTX_end().
authorPascal Cuoq <cuoq@trust-in-soft.com>
Tue, 5 May 2015 09:20:39 +0000 (11:20 +0200)
committerKurt Roeckx <kurt@roeckx.be>
Wed, 7 Oct 2015 16:54:13 +0000 (18:54 +0200)
Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
MR #1231

crypto/rsa/rsa_eay.c

index 511ecb8c977a38ea077f42ebb35cc03c99eed454..837e9159d2e6e5a48884144d2367e1f86f093aac 100644 (file)
@@ -717,6 +717,8 @@ static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
     BIGNUM *dmp1, *dmq1, *c, *pr1;
     int ret = 0;
 
+    BN_CTX_start(ctx);
+
     local_dmp1 = BN_new();
     local_dmq1 = BN_new();
     local_c = BN_new();
@@ -724,7 +726,6 @@ static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
     if (!local_dmp1 || !local_dmq1 || !local_c || !local_r1)
         goto err;
 
-    BN_CTX_start(ctx);
     r1 = BN_CTX_get(ctx);
     m1 = BN_CTX_get(ctx);
     vrfy = BN_CTX_get(ctx);