Move the crypto extension module aside to make way for an incremental rewrite in Python
diff --git a/OpenSSL/crypto.py b/OpenSSL/crypto.py
new file mode 100644
index 0000000..24d4bdc
--- /dev/null
+++ b/OpenSSL/crypto.py
@@ -0,0 +1,2 @@
+from OpenSSL.xcrypto import *
+from OpenSSL.xcrypto import _exception_from_error_queue
diff --git a/OpenSSL/crypto/crypto.c b/OpenSSL/crypto/crypto.c
index ad35ce9..78f3ed7 100644
--- a/OpenSSL/crypto/crypto.c
+++ b/OpenSSL/crypto/crypto.c
@@ -816,7 +816,7 @@
#ifdef PY3
static struct PyModuleDef cryptomodule = {
PyModuleDef_HEAD_INIT,
- "crypto",
+ "xcrypto",
crypto_doc,
-1,
crypto_methods
@@ -829,7 +829,7 @@
* Arguments: None
* Returns: None
*/
-PyOpenSSL_MODINIT(crypto) {
+PyOpenSSL_MODINIT(xcrypto) {
#ifndef PY3
static void *crypto_API[crypto_API_pointers];
PyObject *c_api_object;
@@ -842,7 +842,7 @@
#ifdef PY3
module = PyModule_Create(&cryptomodule);
#else
- module = Py_InitModule3("crypto", crypto_methods, crypto_doc);
+ module = Py_InitModule3("xcrypto", crypto_methods, crypto_doc);
#endif
if (module == NULL) {
diff --git a/OpenSSL/crypto/crypto.h b/OpenSSL/crypto/crypto.h
index 4006e71..d0dba6b 100644
--- a/OpenSSL/crypto/crypto.h
+++ b/OpenSSL/crypto/crypto.h
@@ -118,7 +118,7 @@
#define import_crypto() \
{ \
- PyObject *crypto_module = PyImport_ImportModule("OpenSSL.crypto"); \
+ PyObject *crypto_module = PyImport_ImportModule("OpenSSL.xcrypto"); \
if (crypto_module != NULL) { \
PyObject *crypto_dict, *crypto_api_object; \
crypto_dict = PyModule_GetDict(crypto_module); \
diff --git a/setup.py b/setup.py
index 142d03c..6366b48 100755
--- a/setup.py
+++ b/setup.py
@@ -17,21 +17,20 @@
# XXX Deduplicate this
__version__ = '0.13'
-crypto_src = ['OpenSSL/crypto/crypto.c', 'OpenSSL/crypto/x509.c',
+xcrypto_src = ['OpenSSL/crypto/crypto.c', 'OpenSSL/crypto/x509.c',
'OpenSSL/crypto/x509name.c', 'OpenSSL/crypto/pkey.c',
'OpenSSL/crypto/x509store.c', 'OpenSSL/crypto/x509req.c',
'OpenSSL/crypto/x509ext.c', 'OpenSSL/crypto/pkcs7.c',
'OpenSSL/crypto/pkcs12.c', 'OpenSSL/crypto/netscape_spki.c',
'OpenSSL/crypto/revoked.c', 'OpenSSL/crypto/crl.c',
'OpenSSL/util.c']
-crypto_dep = ['OpenSSL/crypto/crypto.h', 'OpenSSL/crypto/x509.h',
+xcrypto_dep = ['OpenSSL/crypto/crypto.h', 'OpenSSL/crypto/x509.h',
'OpenSSL/crypto/x509name.h', 'OpenSSL/crypto/pkey.h',
'OpenSSL/crypto/x509store.h', 'OpenSSL/crypto/x509req.h',
'OpenSSL/crypto/x509ext.h', 'OpenSSL/crypto/pkcs7.h',
'OpenSSL/crypto/pkcs12.h', 'OpenSSL/crypto/netscape_spki.h',
'OpenSSL/crypto/revoked.h', 'OpenSSL/crypto/crl.h',
'OpenSSL/util.h']
-rand_dep = ['OpenSSL/util.h']
ssl_src = ['OpenSSL/ssl/connection.c', 'OpenSSL/ssl/context.c', 'OpenSSL/ssl/ssl.c',
'OpenSSL/ssl/session.c', 'OpenSSL/util.c']
ssl_dep = ['OpenSSL/ssl/connection.h', 'OpenSSL/ssl/context.h', 'OpenSSL/ssl/ssl.h',
@@ -194,7 +193,7 @@
setup(name='pyOpenSSL', version=__version__,
packages = ['OpenSSL'],
package_dir = {'OpenSSL': 'OpenSSL'},
- ext_modules = [mkExtension('crypto'), mkExtension('SSL')],
+ ext_modules = [mkExtension('xcrypto'), mkExtension('SSL')],
py_modules = ['OpenSSL.__init__', 'OpenSSL.tsafe',
'OpenSSL.rand',
'OpenSSL.version', 'OpenSSL.test.__init__',