Commit f92768e6 authored by Pascal Cuoq's avatar Pascal Cuoq Committed by Kurt Roeckx
Browse files

Set flags to 0 before calling BN_with_flags()



BN_with_flags() will read the dest->flags to keep the BN_FLG_MALLOCED but
overwrites everything else.

Signed-off-by: default avatarKurt Roeckx <kurt@roeckx.be>
Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
MR #1231
parent 68a16628
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -599,6 +599,7 @@ static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
         * BN_div_no_branch will be called eventually.
         */
        pB = &local_B;
        local_B.flags = 0;
        BN_with_flags(pB, B, BN_FLG_CONSTTIME);
        if (!BN_nnmod(B, pB, A, ctx))
            goto err;
@@ -626,6 +627,7 @@ static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
         * BN_div_no_branch will be called eventually.
         */
        pA = &local_A;
        local_A.flags = 0;
        BN_with_flags(pA, A, BN_FLG_CONSTTIME);

        /* (D, M) := (A/B, A%B) ... */