Skip to content

Commit 045b854

Browse files
committed
Remove redundant resizing in reduce_vartime()
1 parent f3008a9 commit 045b854

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

src/algorithms/rsa.rs

-8
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,7 @@ fn pow_mod_params(base: &BoxedUint, exp: &BoxedUint, n_params: &BoxedMontyParams
258258
}
259259

260260
fn reduce_vartime(n: &BoxedUint, p: &BoxedMontyParams) -> BoxedMontyForm {
261-
let bits_precision = p.modulus().bits_precision();
262261
let modulus = p.modulus().as_nz_ref().clone();
263-
264-
let n = match n.bits_precision().cmp(&bits_precision) {
265-
Ordering::Less => n.widen(bits_precision),
266-
Ordering::Equal => n.clone(),
267-
Ordering::Greater => n.shorten(bits_precision),
268-
};
269-
270262
let n_reduced = n.rem_vartime(&modulus).widen(p.bits_precision());
271263
BoxedMontyForm::new(n_reduced, p.clone())
272264
}

0 commit comments

Comments
 (0)