Commit 9c39b3e 1 parent 2bfa3f1 commit 9c39b3e Copy full SHA for 9c39b3e
File tree 1 file changed +6
-15
lines changed
1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -128,19 +128,12 @@ impl<E: Curve> TrustedDealerBuilder<E> {
128
128
self ,
129
129
rng : & mut ( impl rand_core:: RngCore + rand_core:: CryptoRng ) ,
130
130
) -> Result < Vec < CoreKeyShare < E > > , TrustedDealerError > {
131
- let mut points = Vec :: with_capacity ( self . n . into ( ) ) ;
132
- ' each_point: for _ in 0 ..self . n {
133
- for _ in 0 ..u16:: MAX {
134
- let point = generic_ec:: NonZero :: < Scalar < E > > :: random ( rng) ;
135
- if !points. contains ( & point) {
136
- points. push ( point) ;
137
- continue ' each_point;
138
- }
139
- }
140
- // if we did not continue in inner loop, it means we couldn't
141
- // generate a distinct scalar
142
- return Err ( Reason :: BadRandom . into ( ) ) ;
143
- }
131
+ // The chance of scalars repeating is negligible for usual fields in EC.
132
+ // But in any case the dupliactes are checked during the validation of
133
+ // CoreKeyShare
134
+ let points = ( 0 ..self . n )
135
+ . map ( |_| generic_ec:: NonZero :: < Scalar < E > > :: random ( rng) )
136
+ . collect ( ) ;
144
137
self . generate_shares_at ( points, rng)
145
138
}
146
139
@@ -255,8 +248,6 @@ enum Reason {
255
248
ZeroShare ,
256
249
#[ displaydoc( "invalid share preimages given" ) ]
257
250
InvalidPreimages ,
258
- #[ displaydoc( "randomness source doesn't have enough entropy" ) ]
259
- BadRandom ,
260
251
}
261
252
262
253
impl From < Reason > for TrustedDealerError {
You can’t perform that action at this time.
0 commit comments