top = BN_ucmp(field, a);
if (top == 0)
- return BN_zero(r);
+ {
+ BN_zero(r);
+ return 1;
+ }
else if (top > 0)
return (r == a)? 1 : (BN_copy(r ,a) != NULL);
--carry;
}
r->top = BN_NIST_192_TOP;
-
-#if 1
- bn_clear_top2max(r);
-#endif
bn_correct_top(r);
-
if (BN_ucmp(r, field) >= 0)
{
bn_sub_words(r_d, r_d, _nist_p_192, BN_NIST_192_TOP);
tmp_int = BN_ucmp(field, a);
if (tmp_int == 0)
- return BN_zero(r);
+ {
+ BN_zero(r);
+ return 1;
+ }
else if (tmp_int > 0)
return (r == a)? 1 : (BN_copy(r ,a) != NULL);
}
r->top = BN_NIST_224_TOP;
-#if 1
- bn_clear_top2max(r);
-#endif
bn_correct_top(r);
-
if (BN_ucmp(r, field) >= 0)
{
bn_sub_words(r_d, r_d, _nist_p_224, BN_NIST_224_TOP);
tmp_int = BN_ucmp(field, a);
if (tmp_int == 0)
- return BN_zero(r);
+ {
+ BN_zero(r);
+ return 1;
+ }
else if (tmp_int > 0)
return (r == a)? 1 : (BN_copy(r ,a) != NULL);
}
r->top = BN_NIST_256_TOP;
-#if 1
- bn_clear_top2max(r);
-#endif
bn_correct_top(r);
-
if (BN_ucmp(r, field) >= 0)
{
bn_sub_words(r_d, r_d, _nist_p_256, BN_NIST_256_TOP);
tmp_int = BN_ucmp(field, a);
if (tmp_int == 0)
- return BN_zero(r);
+ {
+ BN_zero(r);
+ return 1;
+ }
else if (tmp_int > 0)
return (r == a)? 1 : (BN_copy(r ,a) != NULL);
}
r->top = BN_NIST_384_TOP;
-#if 1
- bn_clear_top2max(r);
-#endif
bn_correct_top(r);
-
if (BN_ucmp(r, field) >= 0)
{
bn_sub_words(r_d, r_d, _nist_p_384, BN_NIST_384_TOP);