bn_check_top(a);
if (!p[0])
+ {
/* reduction mod 1 => return 0 */
- return BN_zero(r);
+ BN_zero(r);
+ return 1;
+ }
/* Since the algorithm does reduction in the r value, if a != r, copy
* the contents of a into r so we can do reduction in r.
if (v == NULL) goto err;
if (!BN_one(b)) goto err;
- if (!BN_zero(c)) goto err;
if (!BN_GF2m_mod(u, a, p)) goto err;
if (!BN_copy(v, p)) goto err;
if (!BN_GF2m_mod(u, y, p)) goto err;
if (!BN_GF2m_mod(a, x, p)) goto err;
if (!BN_copy(b, p)) goto err;
- if (!BN_zero(v)) goto err;
while (!BN_is_odd(a))
{
bn_check_top(a);
if (!p[0])
+ {
/* reduction mod 1 => return 0 */
- return BN_zero(r);
+ BN_zero(r);
+ return 1;
+ }
BN_CTX_start(ctx);
if ((u = BN_CTX_get(ctx)) == NULL) goto err;
- if (!BN_zero(u)) goto err;
if (!BN_set_bit(u, p[0] - 1)) goto err;
ret = BN_GF2m_mod_exp_arr(r, a, u, p, ctx);
bn_check_top(r);
bn_check_top(a_);
if (!p[0])
+ {
/* reduction mod 1 => return 0 */
- return BN_zero(r);
+ BN_zero(r);
+ return 1;
+ }
BN_CTX_start(ctx);
a = BN_CTX_get(ctx);
if (BN_is_zero(a))
{
- ret = BN_zero(r);
+ BN_zero(r);
+ ret = 1;
goto err;
}
{
if (!BN_rand(rho, p[0], 0, 0)) goto err;
if (!BN_GF2m_mod_arr(rho, rho, p)) goto err;
- if (!BN_zero(z)) goto err;
+ BN_zero(z);
if (!BN_copy(w, rho)) goto err;
for (j = 1; j <= p[0] - 1; j++)
{