39 lines
1.2 KiB
Diff
39 lines
1.2 KiB
Diff
Fix compatibility with M2Crypto>=0.26.0
|
|
|
|
--- a/browserid/crypto/_m2_monkeypatch.py 2014-12-12 06:15:36.000000000 +0100
|
|
+++ b/browserid/crypto/_m2_monkeypatch.py 2018-10-12 18:29:19.859395622 +0200
|
|
@@ -8,9 +8,9 @@
|
|
# We use ctypes to avoid recompiling the M2Crypto binaries.
|
|
|
|
import ctypes
|
|
-from M2Crypto import RSA, DSA, m2, __m2crypto
|
|
+from M2Crypto import RSA, DSA, m2, _m2crypto
|
|
|
|
-_m2lib = ctypes.CDLL(__m2crypto.__file__)
|
|
+_m2lib = ctypes.CDLL(_m2crypto.__file__)
|
|
|
|
|
|
_m2lib.BN_free.argtypes = (ctypes.c_void_p,)
|
|
@@ -109,9 +109,7 @@
|
|
def load_pub_key_params(p, q, g, pub):
|
|
"""Create a DSA_pub object from parameters and key."""
|
|
dsa = m2.dsa_new()
|
|
- m2.dsa_set_p(dsa, p)
|
|
- m2.dsa_set_q(dsa, q)
|
|
- m2.dsa_set_g(dsa, g)
|
|
+ m2.dsa_set_pqg(dsa, p, q, g)
|
|
m2.dsa_set_pub(dsa, pub)
|
|
return DSA.DSA_pub(dsa, 1)
|
|
|
|
@@ -120,9 +118,7 @@
|
|
def load_key_params(p, q, g, pub, priv):
|
|
"""Create a DSA object from parameters and key."""
|
|
dsa = m2.dsa_new()
|
|
- m2.dsa_set_p(dsa, p)
|
|
- m2.dsa_set_q(dsa, q)
|
|
- m2.dsa_set_g(dsa, g)
|
|
+ m2.dsa_set_pqg(dsa, p, q, g)
|
|
m2.dsa_set_pub(dsa, pub)
|
|
m2.dsa_set_priv(dsa, priv)
|
|
return DSA.DSA(dsa, 1)
|