@@ -87,7 +87,6 @@ static void secp256k1_ecmult_gen_blind(secp256k1_ecmult_gen_context *ctx, const
8787 secp256k1_fe s ;
8888 unsigned char nonce32 [32 ];
8989 secp256k1_rfc6979_hmac_sha256 rng ;
90- int overflow ;
9190 unsigned char keydata [64 ];
9291 if (seed32 == NULL ) {
9392 /* When seed is NULL, reset the initial point and blinding value. */
@@ -106,11 +105,9 @@ static void secp256k1_ecmult_gen_blind(secp256k1_ecmult_gen_context *ctx, const
106105 memcpy (keydata + 32 , seed32 , 32 );
107106 secp256k1_rfc6979_hmac_sha256_initialize (& rng , keydata , 64 );
108107 memset (keydata , 0 , sizeof (keydata ));
109- /* Accept unobservably small non-uniformity. */
110108 secp256k1_rfc6979_hmac_sha256_generate (& rng , nonce32 , 32 );
111- overflow = !secp256k1_fe_set_b32_limit (& s , nonce32 );
112- overflow |= secp256k1_fe_is_zero (& s );
113- secp256k1_fe_cmov (& s , & secp256k1_fe_one , overflow );
109+ secp256k1_fe_set_b32_mod (& s , nonce32 );
110+ secp256k1_fe_cmov (& s , & secp256k1_fe_one , secp256k1_fe_normalizes_to_zero (& s );
114111 /* Randomize the projection to defend against multiplier sidechannels.
115112 Do this before our own call to secp256k1_ecmult_gen below. */
116113 secp256k1_gej_rescale (& ctx -> initial , & s );
0 commit comments