Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Nov 30, 2023
1 parent efc4460 commit 9fde5fb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
4 changes: 0 additions & 4 deletions src/algorithms/rsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ pub fn rsa_decrypt<R: CryptoRngCore + ?Sized>(
let c = to_uint_exact(c_orig.clone(), nbits);
let d = priv_key.d();

std::dbg!(nbits, d.bits_precision(), c.bits_precision());

if c >= **n {
return Err(Error::Decryption);
}
Expand Down Expand Up @@ -133,8 +131,6 @@ pub fn rsa_decrypt_and_check<R: CryptoRngCore + ?Sized>(
c: &BigUint,
) -> Result<BigUint> {
let m = rsa_decrypt(rng, priv_key, c)?;
let m2 = rsa_decrypt::<R>(None, priv_key, c)?;
assert_eq!(m, m2);

// In order to defend against errors in the CRT computation, m^e is
// calculated, which should match the original ciphertext.
Expand Down
7 changes: 1 addition & 6 deletions src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,6 @@ impl RsaPrivateKey {
let n_c = NonZero::new(to_uint(n.clone())).unwrap();
let nbits = n_c.bits_precision();

std::dbg!(nbits);

let mut should_validate = false;
let mut primes: Vec<_> = primes
.into_iter()
Expand Down Expand Up @@ -636,9 +634,7 @@ fn inner_to_uint(big_uint: BigUint) -> BoxedUint {

pub(crate) fn to_uint(big_uint: BigUint) -> BoxedUint {
let nbits = needed_bits(&big_uint);

let res = inner_to_uint(big_uint);
std::dbg!(res.bits_precision(), nbits);
if res.bits_precision() < nbits {
return res.widen(nbits);
}
Expand Down Expand Up @@ -714,8 +710,7 @@ mod tests {
let mut rng = ChaCha8Rng::from_seed([42; 32]);
let exp = BigUint::from_u64(RsaPrivateKey::EXP).expect("invalid static exponent");

for i in 0..10 {
std::dbg!(i, $size);
for _ in 0..10 {
let components =
generate_multi_prime_key_with_exp(&mut rng, $multi, $size, &exp).unwrap();
let private_key = RsaPrivateKey::from_components(
Expand Down

0 comments on commit 9fde5fb

Please sign in to comment.