@@ -87,7 +87,6 @@ static void secp256k1_ecmult_gen_blind(secp256k1_ecmult_gen_context *ctx, const
87
87
secp256k1_fe s ;
88
88
unsigned char nonce32 [32 ];
89
89
secp256k1_rfc6979_hmac_sha256 rng ;
90
- int overflow ;
91
90
unsigned char keydata [64 ];
92
91
if (seed32 == NULL ) {
93
92
/* 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
106
105
memcpy (keydata + 32 , seed32 , 32 );
107
106
secp256k1_rfc6979_hmac_sha256_initialize (& rng , keydata , 64 );
108
107
memset (keydata , 0 , sizeof (keydata ));
109
- /* Accept unobservably small non-uniformity. */
110
108
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 ));
114
111
/* Randomize the projection to defend against multiplier sidechannels.
115
112
Do this before our own call to secp256k1_ecmult_gen below. */
116
113
secp256k1_gej_rescale (& ctx -> initial , & s );
0 commit comments