Skip to content

Commit 6048e6c

Browse files
Merge #1222: Remove redundant checks.
5d8f53e Remove redudent checks. (Russell O'Connor) Pull request description: These abs checks are implied by the subsequent line, and with the subsequent line written as it is, no underflow is possible with signed integers. Follows up on #1218. ACKs for top commit: sipa: utACK 5d8f53e real-or-random: ACK 5d8f53e Tree-SHA512: ddd6758638fe634866fdaf900224372e2e51cb81ef4d024f169fbc39fff38ef1b29e90e0732877e8910158b82bc428ee9c3a4031882c2850b22ad87cc63ee305
2 parents eb8749f + 5d8f53e commit 6048e6c

File tree

2 files changed

+0
-4
lines changed

2 files changed

+0
-4
lines changed

src/modinv32_impl.h

-2
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,7 @@ static void secp256k1_modinv32_update_de_30(secp256k1_modinv32_signed30 *d, secp
415415
VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(d, 9, &modinfo->modulus, 1) < 0); /* d < modulus */
416416
VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(e, 9, &modinfo->modulus, -2) > 0); /* e > -2*modulus */
417417
VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(e, 9, &modinfo->modulus, 1) < 0); /* e < modulus */
418-
VERIFY_CHECK(labs(v) <= M30 + 1); /* |v| <= 2^30 */
419418
VERIFY_CHECK(labs(u) <= (M30 + 1 - labs(v))); /* |u|+|v| <= 2^30 */
420-
VERIFY_CHECK(labs(r) <= M30 + 1); /* |r| <= 2^30 */
421419
VERIFY_CHECK(labs(q) <= (M30 + 1 - labs(r))); /* |q|+|r| <= 2^30 */
422420
#endif
423421
/* [md,me] start as zero; plus [u,q] if d is negative; plus [v,r] if e is negative. */

src/modinv64_impl.h

-2
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,7 @@ static void secp256k1_modinv64_update_de_62(secp256k1_modinv64_signed62 *d, secp
419419
VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(d, 5, &modinfo->modulus, 1) < 0); /* d < modulus */
420420
VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(e, 5, &modinfo->modulus, -2) > 0); /* e > -2*modulus */
421421
VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(e, 5, &modinfo->modulus, 1) < 0); /* e < modulus */
422-
VERIFY_CHECK(secp256k1_modinv64_abs(v) <= (int64_t)1 << 62); /* |v| <= 2^62 */
423422
VERIFY_CHECK(secp256k1_modinv64_abs(u) <= (((int64_t)1 << 62) - secp256k1_modinv64_abs(v))); /* |u|+|v| <= 2^62 */
424-
VERIFY_CHECK(secp256k1_modinv64_abs(r) <= (int64_t)1 << 62); /* |r| <= 2^62 */
425423
VERIFY_CHECK(secp256k1_modinv64_abs(q) <= (((int64_t)1 << 62) - secp256k1_modinv64_abs(r))); /* |q|+|r| <= 2^62 */
426424
#endif
427425
/* [md,me] start as zero; plus [u,q] if d is negative; plus [v,r] if e is negative. */

0 commit comments

Comments
 (0)