From 9fde5fb95ca373f19bcbfa9991e7cc156cc8c3cc Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Thu, 30 Nov 2023 22:18:41 +0100 Subject: [PATCH] cleanup --- src/algorithms/rsa.rs | 4 ---- src/key.rs | 7 +------ 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/algorithms/rsa.rs b/src/algorithms/rsa.rs index 4965e1be..b52754b6 100644 --- a/src/algorithms/rsa.rs +++ b/src/algorithms/rsa.rs @@ -43,8 +43,6 @@ pub fn rsa_decrypt( 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); } @@ -133,8 +131,6 @@ pub fn rsa_decrypt_and_check( c: &BigUint, ) -> Result { let m = rsa_decrypt(rng, priv_key, c)?; - let m2 = rsa_decrypt::(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. diff --git a/src/key.rs b/src/key.rs index 4c354dda..502fb30b 100644 --- a/src/key.rs +++ b/src/key.rs @@ -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() @@ -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); } @@ -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(