diff options
Diffstat (limited to 'crypto/ec/ecp_nistp521.c')
-rw-r--r-- | crypto/ec/ecp_nistp521.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/crypto/ec/ecp_nistp521.c b/crypto/ec/ecp_nistp521.c index 613c5abc38..eec9f4220b 100644 --- a/crypto/ec/ecp_nistp521.c +++ b/crypto/ec/ecp_nistp521.c @@ -624,8 +624,10 @@ static void felem_reduce(felem out, const largefelem in) out[1] += ((limb) in[0]) >> 58; out[1] += (((limb) (in[0] >> 64)) & bottom52bits) << 6; - /* out[1] < 2^58 + 2^6 + 2^58 - * = 2^59 + 2^6 */ + /*- + * out[1] < 2^58 + 2^6 + 2^58 + * = 2^59 + 2^6 + */ out[2] += ((limb) (in[0] >> 64)) >> 52; out[2] += ((limb) in[1]) >> 58; @@ -654,8 +656,10 @@ static void felem_reduce(felem out, const largefelem in) out[8] += ((limb) in[7]) >> 58; out[8] += (((limb) (in[7] >> 64)) & bottom52bits) << 6; - /* out[x > 1] < 2^58 + 2^6 + 2^58 + 2^12 - * < 2^59 + 2^13 */ + /*- + * out[x > 1] < 2^58 + 2^6 + 2^58 + 2^12 + * < 2^59 + 2^13 + */ overflow1 = ((limb) (in[7] >> 64)) >> 52; overflow1 += ((limb) in[8]) >> 58; @@ -669,9 +673,11 @@ static void felem_reduce(felem out, const largefelem in) out[1] += overflow2; /* out[1] < 2^59 + 2^6 + 2^13 */ out[1] += out[0] >> 58; out[0] &= bottom58bits; - /* out[0] < 2^58 + /*- + * out[0] < 2^58 * out[1] < 2^59 + 2^6 + 2^13 + 2^2 - * < 2^59 + 2^14 */ + * < 2^59 + 2^14 + */ } static void felem_square_reduce(felem out, const felem in) @@ -1216,9 +1222,11 @@ static void point_add(felem x3, felem y3, felem z3, felem_scalar128(tmp2, 2); /* tmp2[i] < 17*2^121 */ felem_diff128(tmp, tmp2); - /* tmp[i] < 2^127 - 2^69 + 17*2^122 + /*- + * tmp[i] < 2^127 - 2^69 + 17*2^122 * = 2^126 - 2^122 - 2^6 - 2^2 - 1 - * < 2^127 */ + * < 2^127 + */ felem_reduce(y_out, tmp); copy_conditional(x_out, x2, z1_is_zero); |