summaryrefslogtreecommitdiff
path: root/lib/Crypto/PublicKey
diff options
context:
space:
mode:
authorDwayne C. Litzenberger <dlitz@dlitz.net>2010-08-26 23:43:01 -0400
committerDwayne C. Litzenberger <dlitz@dlitz.net>2010-08-26 23:48:25 -0400
commit1d68d2b9fdf6edc4cc672fa8f2605e6d7e4f517e (patch)
treefcb59305e28f510a9173c4144537d439490ba694 /lib/Crypto/PublicKey
parent901254f9741f879372ca0105e09b1985c8dd1ef0 (diff)
downloadpycrypto-1d68d2b9fdf6edc4cc672fa8f2605e6d7e4f517e.tar.gz
_slowmath: Compute RSA u parameter when it's not given to RSA.construct
This makes _slowmath behave the same as _fastmath in this regard.
Diffstat (limited to 'lib/Crypto/PublicKey')
-rw-r--r--lib/Crypto/PublicKey/_slowmath.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Crypto/PublicKey/_slowmath.py b/lib/Crypto/PublicKey/_slowmath.py
index 05f1e18..5761a83 100644
--- a/lib/Crypto/PublicKey/_slowmath.py
+++ b/lib/Crypto/PublicKey/_slowmath.py
@@ -83,7 +83,10 @@ def rsa_construct(n, e, d=None, p=None, q=None, u=None):
if d is not None: obj.d = d
if p is not None: obj.p = p
if q is not None: obj.q = q
- if u is not None: obj.u = u
+ if u is not None:
+ obj.u = u
+ elif p is not None and q is not None:
+ obj.u = inverse(p, q)
return obj
class _DSAKey(object):