int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx)
{
- int i, j, bits, ret = 0, wstart, wend, window, wvalue;
+ int i, j, bits, ret = 0, wstart, wend, window;
int start = 1;
BIGNUM *aa;
/* Table of variables obtained from 'ctx' */
start = 1; /* This is used to avoid multiplication etc
* when there is only the value '1' in the
* buffer. */
- wvalue = 0; /* The 'value' of the window */
wstart = bits - 1; /* The top bit of the window */
wend = 0; /* The bottom bit of the window */
goto err;
for (;;) {
+ int wvalue; /* The 'value' of the window */
+
if (BN_is_bit_set(p, wstart) == 0) {
if (!start)
if (!BN_mod_mul_reciprocal(r, r, r, &recp, ctx))
/* move the 'window' down further */
wstart -= wend + 1;
- wvalue = 0;
start = 0;
if (wstart < 0)
break;
int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx)
{
- int i, j, bits, ret = 0, wstart, wend, window, wvalue;
+ int i, j, bits, ret = 0, wstart, wend, window;
int start = 1;
BIGNUM *d;
/* Table of variables obtained from 'ctx' */
start = 1; /* This is used to avoid multiplication etc
* when there is only the value '1' in the
* buffer. */
- wvalue = 0; /* The 'value' of the window */
wstart = bits - 1; /* The top bit of the window */
wend = 0; /* The bottom bit of the window */
goto err;
for (;;) {
+ int wvalue; /* The 'value' of the window */
+
if (BN_is_bit_set(p, wstart) == 0) {
if (!start)
if (!BN_mod_mul(r, r, r, m, ctx))
/* move the 'window' down further */
wstart -= wend + 1;
- wvalue = 0;
start = 0;
if (wstart < 0)
break;