Skip to content

Commit 6df1997

Browse files
authored
Fix blinding factor generation loop (#653)
Closes #652
1 parent ae65734 commit 6df1997

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

src/algorithms/rsa.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,10 @@ fn blind<R: TryCryptoRng + ?Sized, K: PublicKeyParts>(
182182
debug_assert_eq!(&key.n().clone().get(), n_params.modulus());
183183
let bits = key.n_bits_precision();
184184

185-
let mut r: BoxedUint = BoxedUint::one_with_precision(bits);
185+
let mut r: BoxedUint = BoxedUint::zero_with_precision(bits);
186186
let mut ir: Option<BoxedUint> = None;
187187
while ir.is_none() {
188188
r = BoxedUint::try_random_mod_vartime(rng, key.n()).map_err(|_| Error::Rng)?;
189-
if r.is_zero().into() {
190-
r = BoxedUint::one_with_precision(bits);
191-
}
192189

193190
// r^-1 (mod n)
194191
ir = r.invert_mod(key.n()).into();

0 commit comments

Comments
 (0)