|
@@ -3649,10 +3649,10 @@ int sp_mod_d(sp_int* a, const sp_int_digit d, sp_int_digit* r)
|
|
err = MP_VAL;
|
|
err = MP_VAL;
|
|
}
|
|
}
|
|
|
|
|
|
- if (0) {
|
|
|
|
|
|
+ #if 0
|
|
sp_print(a, "a");
|
|
sp_print(a, "a");
|
|
sp_print_digit(d, "m");
|
|
sp_print_digit(d, "m");
|
|
- }
|
|
|
|
|
|
+ #endif
|
|
|
|
|
|
if (err == MP_OKAY) {
|
|
if (err == MP_OKAY) {
|
|
/* Check whether d is a power of 2. */
|
|
/* Check whether d is a power of 2. */
|
|
@@ -3696,9 +3696,9 @@ int sp_mod_d(sp_int* a, const sp_int_digit d, sp_int_digit* r)
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
- if (0) {
|
|
|
|
|
|
+ #if 0
|
|
sp_print_digit(*r, "rmod");
|
|
sp_print_digit(*r, "rmod");
|
|
- }
|
|
|
|
|
|
+ #endif
|
|
|
|
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
@@ -3732,10 +3732,10 @@ int sp_div_2_mod_ct(sp_int* a, sp_int* m, sp_int* r)
|
|
sp_int_digit mask;
|
|
sp_int_digit mask;
|
|
int i;
|
|
int i;
|
|
|
|
|
|
- if (0) {
|
|
|
|
|
|
+ #if 0
|
|
sp_print(a, "a");
|
|
sp_print(a, "a");
|
|
sp_print(m, "m");
|
|
sp_print(m, "m");
|
|
- }
|
|
|
|
|
|
+ #endif
|
|
|
|
|
|
mask = 0 - (a->dp[0] & 1);
|
|
mask = 0 - (a->dp[0] & 1);
|
|
for (i = 0; i < m->used; i++) {
|
|
for (i = 0; i < m->used; i++) {
|
|
@@ -3754,9 +3754,9 @@ int sp_div_2_mod_ct(sp_int* a, sp_int* m, sp_int* r)
|
|
sp_clamp(r);
|
|
sp_clamp(r);
|
|
sp_div_2(r, r);
|
|
sp_div_2(r, r);
|
|
|
|
|
|
- if (0) {
|
|
|
|
|
|
+ #if 0
|
|
sp_print(r, "rd2");
|
|
sp_print(r, "rd2");
|
|
- }
|
|
|
|
|
|
+ #endif
|
|
}
|
|
}
|
|
|
|
|
|
return err;
|
|
return err;
|
|
@@ -3828,10 +3828,10 @@ static int _sp_add_off(sp_int* a, sp_int* b, sp_int* r, int o)
|
|
int j;
|
|
int j;
|
|
sp_int_word t = 0;
|
|
sp_int_word t = 0;
|
|
|
|
|
|
- if (0) {
|
|
|
|
|
|
+ #if 0
|
|
sp_print(a, "a");
|
|
sp_print(a, "a");
|
|
sp_print(b, "b");
|
|
sp_print(b, "b");
|
|
- }
|
|
|
|
|
|
+ #endif
|
|
|
|
|
|
#ifdef SP_MATH_NEED_ADD_OFF
|
|
#ifdef SP_MATH_NEED_ADD_OFF
|
|
for (i = 0; (i < o) && (i < a->used); i++) {
|
|
for (i = 0; (i < o) && (i < a->used); i++) {
|
|
@@ -3869,9 +3869,9 @@ static int _sp_add_off(sp_int* a, sp_int* b, sp_int* r, int o)
|
|
|
|
|
|
sp_clamp(r);
|
|
sp_clamp(r);
|
|
|
|
|
|
- if (0) {
|
|
|
|
|
|
+ #if 0
|
|
sp_print(r, "radd");
|
|
sp_print(r, "radd");
|
|
- }
|
|
|
|
|
|
+ #endif
|
|
|
|
|
|
return MP_OKAY;
|
|
return MP_OKAY;
|
|
}
|
|
}
|
|
@@ -4055,11 +4055,13 @@ int sp_addmod(sp_int* a, sp_int* b, sp_int* m, sp_int* r)
|
|
}
|
|
}
|
|
|
|
|
|
ALLOC_SP_INT_SIZE(t, used, err, NULL);
|
|
ALLOC_SP_INT_SIZE(t, used, err, NULL);
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
sp_print(a, "a");
|
|
sp_print(a, "a");
|
|
sp_print(b, "b");
|
|
sp_print(b, "b");
|
|
sp_print(m, "m");
|
|
sp_print(m, "m");
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
|
|
|
|
if (err == MP_OKAY) {
|
|
if (err == MP_OKAY) {
|
|
err = sp_add(a, b, t);
|
|
err = sp_add(a, b, t);
|
|
@@ -4068,9 +4070,11 @@ int sp_addmod(sp_int* a, sp_int* b, sp_int* m, sp_int* r)
|
|
err = sp_mod(t, m, r);
|
|
err = sp_mod(t, m, r);
|
|
}
|
|
}
|
|
|
|
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
sp_print(r, "rma");
|
|
sp_print(r, "rma");
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
|
|
|
|
FREE_SP_INT(t, NULL);
|
|
FREE_SP_INT(t, NULL);
|
|
return err;
|
|
return err;
|
|
@@ -4105,11 +4109,13 @@ int sp_submod(sp_int* a, sp_int* b, sp_int* m, sp_int* r)
|
|
err = MP_VAL;
|
|
err = MP_VAL;
|
|
}
|
|
}
|
|
|
|
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
sp_print(a, "a");
|
|
sp_print(a, "a");
|
|
sp_print(b, "b");
|
|
sp_print(b, "b");
|
|
sp_print(m, "m");
|
|
sp_print(m, "m");
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
|
|
|
|
ALLOC_SP_INT_ARRAY(t, used, 2, err, NULL);
|
|
ALLOC_SP_INT_ARRAY(t, used, 2, err, NULL);
|
|
if (err == MP_OKAY) {
|
|
if (err == MP_OKAY) {
|
|
@@ -4136,9 +4142,11 @@ int sp_submod(sp_int* a, sp_int* b, sp_int* m, sp_int* r)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
sp_print(r, "rms");
|
|
sp_print(r, "rms");
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
|
|
|
|
FREE_SP_INT_ARRAY(t, NULL);
|
|
FREE_SP_INT_ARRAY(t, NULL);
|
|
return err;
|
|
return err;
|
|
@@ -4154,11 +4162,13 @@ int sp_submod(sp_int* a, sp_int* b, sp_int* m, sp_int* r)
|
|
err = MP_VAL;
|
|
err = MP_VAL;
|
|
}
|
|
}
|
|
|
|
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
sp_print(a, "a");
|
|
sp_print(a, "a");
|
|
sp_print(b, "b");
|
|
sp_print(b, "b");
|
|
sp_print(m, "m");
|
|
sp_print(m, "m");
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
|
|
|
|
ALLOC_SP_INT_SIZE(t, used, err, NULL);
|
|
ALLOC_SP_INT_SIZE(t, used, err, NULL);
|
|
if (err == MP_OKAY) {
|
|
if (err == MP_OKAY) {
|
|
@@ -4168,9 +4178,11 @@ int sp_submod(sp_int* a, sp_int* b, sp_int* m, sp_int* r)
|
|
err = sp_mod(t, m, r);
|
|
err = sp_mod(t, m, r);
|
|
}
|
|
}
|
|
|
|
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
sp_print(r, "rms");
|
|
sp_print(r, "rms");
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
|
|
|
|
FREE_SP_INT(t, NULL);
|
|
FREE_SP_INT(t, NULL);
|
|
return err;
|
|
return err;
|
|
@@ -4551,10 +4563,12 @@ int sp_div(sp_int* a, sp_int* d, sp_int* r, sp_int* rem)
|
|
err = MP_VAL;
|
|
err = MP_VAL;
|
|
}
|
|
}
|
|
|
|
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
sp_print(a, "a");
|
|
sp_print(a, "a");
|
|
sp_print(d, "b");
|
|
sp_print(d, "b");
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
|
|
|
|
if (err == MP_OKAY) {
|
|
if (err == MP_OKAY) {
|
|
#ifdef WOLFSSL_SP_INT_NEGATIVE
|
|
#ifdef WOLFSSL_SP_INT_NEGATIVE
|
|
@@ -4756,7 +4770,8 @@ int sp_div(sp_int* a, sp_int* d, sp_int* r, sp_int* rem)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
if (rem != NULL) {
|
|
if (rem != NULL) {
|
|
sp_print(rem, "rdr");
|
|
sp_print(rem, "rdr");
|
|
}
|
|
}
|
|
@@ -4764,6 +4779,7 @@ int sp_div(sp_int* a, sp_int* d, sp_int* r, sp_int* rem)
|
|
sp_print(r, "rdw");
|
|
sp_print(r, "rdw");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
|
|
|
|
FREE_SP_INT_ARRAY(td, NULL);
|
|
FREE_SP_INT_ARRAY(td, NULL);
|
|
return err;
|
|
return err;
|
|
@@ -7679,10 +7695,12 @@ int sp_mul(sp_int* a, sp_int* b, sp_int* r)
|
|
err = MP_VAL;
|
|
err = MP_VAL;
|
|
}
|
|
}
|
|
|
|
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
sp_print(a, "a");
|
|
sp_print(a, "a");
|
|
sp_print(b, "b");
|
|
sp_print(b, "b");
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
|
|
|
|
if (err == MP_OKAY) {
|
|
if (err == MP_OKAY) {
|
|
#ifdef WOLFSSL_SP_INT_NEGATIVE
|
|
#ifdef WOLFSSL_SP_INT_NEGATIVE
|
|
@@ -7783,9 +7801,11 @@ int sp_mul(sp_int* a, sp_int* b, sp_int* r)
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
sp_print(r, "rmul");
|
|
sp_print(r, "rmul");
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
|
|
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
@@ -8665,11 +8685,13 @@ int sp_exptmod_ex(sp_int* b, sp_int* e, int digits, sp_int* m, sp_int* r)
|
|
err = MP_VAL;
|
|
err = MP_VAL;
|
|
}
|
|
}
|
|
|
|
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
sp_print(b, "a");
|
|
sp_print(b, "a");
|
|
sp_print(e, "b");
|
|
sp_print(e, "b");
|
|
sp_print(m, "m");
|
|
sp_print(m, "m");
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
|
|
|
|
if (err != MP_OKAY) {
|
|
if (err != MP_OKAY) {
|
|
}
|
|
}
|
|
@@ -8777,9 +8799,11 @@ int sp_exptmod_ex(sp_int* b, sp_int* e, int digits, sp_int* m, sp_int* r)
|
|
(void)eBits;
|
|
(void)eBits;
|
|
(void)digits;
|
|
(void)digits;
|
|
|
|
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
sp_print(r, "rme");
|
|
sp_print(r, "rme");
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
#endif /* WOLFSSL_SP_MATH_ALL || WOLFSSL_HAVE_SP_DH */
|
|
#endif /* WOLFSSL_SP_MATH_ALL || WOLFSSL_HAVE_SP_DH */
|
|
@@ -9172,11 +9196,13 @@ int sp_exptmod_nct(sp_int* b, sp_int* e, sp_int* m, sp_int* r)
|
|
err = MP_VAL;
|
|
err = MP_VAL;
|
|
}
|
|
}
|
|
|
|
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
sp_print(b, "a");
|
|
sp_print(b, "a");
|
|
sp_print(e, "b");
|
|
sp_print(e, "b");
|
|
sp_print(m, "m");
|
|
sp_print(m, "m");
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
|
|
|
|
if (err != MP_OKAY) {
|
|
if (err != MP_OKAY) {
|
|
}
|
|
}
|
|
@@ -9206,9 +9232,11 @@ int sp_exptmod_nct(sp_int* b, sp_int* e, sp_int* m, sp_int* r)
|
|
err = _sp_exptmod_nct(b, e, m, r);
|
|
err = _sp_exptmod_nct(b, e, m, r);
|
|
}
|
|
}
|
|
|
|
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
sp_print(r, "rme");
|
|
sp_print(r, "rme");
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
|
|
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
@@ -11655,9 +11683,11 @@ int sp_sqr(sp_int* a, sp_int* r)
|
|
err = MP_VAL;
|
|
err = MP_VAL;
|
|
}
|
|
}
|
|
|
|
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
sp_print(a, "a");
|
|
sp_print(a, "a");
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
|
|
|
|
if (err == MP_OKAY) {
|
|
if (err == MP_OKAY) {
|
|
if (a->used == 0) {
|
|
if (a->used == 0) {
|
|
@@ -11747,9 +11777,11 @@ int sp_sqr(sp_int* a, sp_int* r)
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- if (0 && (err == MP_OKAY)) {
|
|
|
|
|
|
+ #if 0
|
|
|
|
+ if (err == MP_OKAY) {
|
|
sp_print(r, "rsqr");
|
|
sp_print(r, "rsqr");
|
|
}
|
|
}
|
|
|
|
+ #endif
|
|
|
|
|
|
return err;
|
|
return err;
|
|
#endif /* WOLFSSL_SP_MATH && WOLFSSL_SP_SMALL */
|
|
#endif /* WOLFSSL_SP_MATH && WOLFSSL_SP_SMALL */
|