Merge bitcoin-core/secp256k1#1438: correct assertion for secp256k1_fe_mul_inner
dcdda31f2cda13839a4285d8601118c041b18c13 Tighten secp256k1_fe_mul_inner's VERIFY_BITS checks (Russell O'Connor)
8e2a5fe908faa2ad0b847b3e5c42662614c8fa88 correct assertion for secp256k1_fe_mul_inner (roconnor-blockstream)
Pull request description:
  Based on the surrounding asserts, 112 bits before this line, and 61 bits after this line, this assertion should be 113 bits.  Notably the commensurate line in secp256k1_fe_sqr_inner is correctly assert to be 113 bits.
ACKs for top commit:
  real-or-random:
    ACK dcdda31f2cda13839a4285d8601118c041b18c13 tested with asm disabled
Tree-SHA512: c35170e37d9a6d1413dd625032028129ab2eccee7da86697ab9641b68ad78efd7251953d51e7acaefd14888d3fd61877f9f05349c44f6fc0133ce9b3921b0e1a
			
			
This commit is contained in:
		
						commit
						5814d8485c
					
				| @ -89,18 +89,18 @@ SECP256K1_INLINE static void secp256k1_fe_mul_inner(uint64_t *r, const uint64_t | |||||||
|     secp256k1_u128_accum_mul(&d, a2, b[3]); |     secp256k1_u128_accum_mul(&d, a2, b[3]); | ||||||
|     secp256k1_u128_accum_mul(&d, a3, b[2]); |     secp256k1_u128_accum_mul(&d, a3, b[2]); | ||||||
|     secp256k1_u128_accum_mul(&d, a4, b[1]); |     secp256k1_u128_accum_mul(&d, a4, b[1]); | ||||||
|     VERIFY_BITS_128(&d, 115); |     VERIFY_BITS_128(&d, 114); | ||||||
|     /* [d t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ |     /* [d t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ | ||||||
|     u0 = secp256k1_u128_to_u64(&d) & M; secp256k1_u128_rshift(&d, 52); |     u0 = secp256k1_u128_to_u64(&d) & M; secp256k1_u128_rshift(&d, 52); | ||||||
|     VERIFY_BITS(u0, 52); |     VERIFY_BITS(u0, 52); | ||||||
|     VERIFY_BITS_128(&d, 63); |     VERIFY_BITS_128(&d, 62); | ||||||
|     /* [d u0 t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ |     /* [d u0 t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ | ||||||
|     /* [d 0 t4+(tx<<48)+(u0<<52) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ |     /* [d 0 t4+(tx<<48)+(u0<<52) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ | ||||||
|     u0 = (u0 << 4) | tx; |     u0 = (u0 << 4) | tx; | ||||||
|     VERIFY_BITS(u0, 56); |     VERIFY_BITS(u0, 56); | ||||||
|     /* [d 0 t4+(u0<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ |     /* [d 0 t4+(u0<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ | ||||||
|     secp256k1_u128_accum_mul(&c, u0, R >> 4); |     secp256k1_u128_accum_mul(&c, u0, R >> 4); | ||||||
|     VERIFY_BITS_128(&c, 115); |     VERIFY_BITS_128(&c, 113); | ||||||
|     /* [d 0 t4 t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ |     /* [d 0 t4 t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ | ||||||
|     r[0] = secp256k1_u128_to_u64(&c) & M; secp256k1_u128_rshift(&c, 52); |     r[0] = secp256k1_u128_to_u64(&c) & M; secp256k1_u128_rshift(&c, 52); | ||||||
|     VERIFY_BITS(r[0], 52); |     VERIFY_BITS(r[0], 52); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user