aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-02-13 20:44:22 -0500
committerJack Lloyd <[email protected]>2018-02-13 20:44:22 -0500
commit03cdf8c82d0e792c34c5087c8b3ecc0a23213423 (patch)
tree27a4e561bb486bc2bc5160ccb48ab200ad4e1e72
parent989ca96ca489a6367b659305d4932575800916f5 (diff)
Remove handling of even e in RSA keygen
This is a holdover from Rabin-Williams support and just confusing in RSA-specific code.
-rw-r--r--src/lib/pubkey/rsa/rsa.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/lib/pubkey/rsa/rsa.cpp b/src/lib/pubkey/rsa/rsa.cpp
index bd02d1f19..a3b40df02 100644
--- a/src/lib/pubkey/rsa/rsa.cpp
+++ b/src/lib/pubkey/rsa/rsa.cpp
@@ -117,11 +117,8 @@ RSA_PrivateKey::RSA_PrivateKey(const BigInt& prime1,
if(m_d == 0)
{
- BigInt inv_for_d = lcm(m_p - 1, m_q - 1);
- if(m_e.is_even())
- inv_for_d >>= 1;
-
- m_d = inverse_mod(m_e, inv_for_d);
+ const BigInt phi_n = lcm(m_p - 1, m_q - 1);
+ m_d = inverse_mod(m_e, phi_n);
}
m_d1 = m_d % (m_p - 1);