diff options
-rw-r--r-- | networking/tls_sp_c32.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/networking/tls_sp_c32.c b/networking/tls_sp_c32.c index baed62f41..b3f7888f5 100644 --- a/networking/tls_sp_c32.c +++ b/networking/tls_sp_c32.c | |||
@@ -636,12 +636,14 @@ static void sp_256_rshift1_8(sp_digit* r, sp_digit carry) | |||
636 | } | 636 | } |
637 | #endif | 637 | #endif |
638 | 638 | ||
639 | /* Divide the number by 2 mod the modulus (prime). (r = a / 2 % m) */ | 639 | /* Divide the number by 2 mod the modulus (prime). (r = (r / 2) % m) */ |
640 | static void sp_256_div2_8(sp_digit* r, const sp_digit* a, const sp_digit* m) | 640 | static void sp_256_div2_8(sp_digit* r /*, const sp_digit* m*/) |
641 | { | 641 | { |
642 | const sp_digit* m = p256_mod; | ||
643 | |||
642 | int carry = 0; | 644 | int carry = 0; |
643 | if (a[0] & 1) | 645 | if (r[0] & 1) |
644 | carry = sp_256_add_8(r, a, m); | 646 | carry = sp_256_add_8(r, r, m); |
645 | sp_256_norm_8(r); | 647 | sp_256_norm_8(r); |
646 | sp_256_rshift1_8(r, carry); | 648 | sp_256_rshift1_8(r, carry); |
647 | } | 649 | } |
@@ -1125,7 +1127,7 @@ static void sp_256_proj_point_dbl_8(sp_point* r, sp_point* p) | |||
1125 | /* T2 = Y * Y */ | 1127 | /* T2 = Y * Y */ |
1126 | sp_256to512z_mont_sqr_8(t2, r->y /*, p256_mod, p256_mp_mod*/); | 1128 | sp_256to512z_mont_sqr_8(t2, r->y /*, p256_mod, p256_mp_mod*/); |
1127 | /* T2 = T2/2 */ | 1129 | /* T2 = T2/2 */ |
1128 | sp_256_div2_8(t2, t2, p256_mod); | 1130 | sp_256_div2_8(t2 /*, p256_mod*/); |
1129 | /* Y = Y * X */ | 1131 | /* Y = Y * X */ |
1130 | sp_256to512z_mont_mul_8(r->y, r->y, r->x /*, p256_mod, p256_mp_mod*/); | 1132 | sp_256to512z_mont_mul_8(r->y, r->y, r->x /*, p256_mod, p256_mp_mod*/); |
1131 | /* X = T1 * T1 */ | 1133 | /* X = T1 * T1 */ |