aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorClayton Smith <argilo@gmail.com>2019-10-29 08:19:34 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2019-10-29 08:19:34 -0400
commitfdd594cd5d0024f67e51694687e290c3b6f58460 (patch)
tree3810308541807a3e0780939f02e20cfb5a29fce9 /src
parente400dc061ddbd505bbb4f3fe9797682e314717fb (diff)
downloadcryptography-fdd594cd5d0024f67e51694687e290c3b6f58460.tar.gz
cryptography-fdd594cd5d0024f67e51694687e290c3b6f58460.tar.bz2
cryptography-fdd594cd5d0024f67e51694687e290c3b6f58460.zip
Don't bother computing y coefficient in _modinv (#5037)
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/primitives/asymmetric/rsa.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cryptography/hazmat/primitives/asymmetric/rsa.py b/src/cryptography/hazmat/primitives/asymmetric/rsa.py
index 27db671a..f20cdf9c 100644
--- a/src/cryptography/hazmat/primitives/asymmetric/rsa.py
+++ b/src/cryptography/hazmat/primitives/asymmetric/rsa.py
@@ -184,12 +184,12 @@ def _modinv(e, m):
"""
Modular Multiplicative Inverse. Returns x such that: (x*e) mod m == 1
"""
- x1, y1, x2, y2 = 1, 0, 0, 1
+ x1, x2 = 1, 0
a, b = e, m
while b > 0:
q, r = divmod(a, b)
- xn, yn = x1 - q * x2, y1 - q * y2
- a, b, x1, y1, x2, y2 = b, r, x2, y2, xn, yn
+ xn = x1 - q * x2
+ a, b, x1, x2 = b, r, x2, xn
return x1 % m