[PYTHON-CRYPTO] win32 no OPENSSL_Applink fatal error - a trial

Larry Bugbee bugbee at MAC.COM
Fri Jun 30 10:47:45 CEST 2006


>> From my knothole, asking users to recompile Python just so they can
>> use OpenSSL/M2Crypto is not right.

I really want to see OpenSSL/M2Crypto work on Windows without having  
to ask arguably the least capable to compile their Python from  
scratch.  I've played with _m2crypto.i and __init__.py and me with no  
success.  ...but that may because I was going at it wrong.  Please  
check my work and I'll try any reasonable suggestion.

Here is my diff file.  Suggestions are needed.  Clues anybody?

Larry



Index: M2Crypto/__init__.py
===================================================================
--- M2Crypto/__init__.py	(revision 454)
+++ M2Crypto/__init__.py	(working copy)
@@ -43,3 +43,4 @@
decrypt=0
__m2crypto.lib_init()
+__m2crypto.openssl_applink()

Index: setup.py
===================================================================
--- setup.py	(revision 454)
+++ setup.py	(working copy)
@@ -22,14 +22,15 @@
              break
if os.name == 'nt':
-    libraries = ['ssleay32', 'libeay32']
+#    libraries = ['ssleay32', 'libeay32']
+    libraries = ['ssl32', 'eay32']                  # for MinGW
      option_dict = {'openssl_prefix': 'c:\\pkg'}
else:
      libraries = ['ssl', 'crypto']
      option_dict = {'openssl_prefix': '/usr'}

parse_args(option_dict)
-	
+
include_dir = os.path.join(option_dict['openssl_prefix'], 'include')
include_dirs = [os.path.join(os.getcwd(), 'SWIG'), include_dir]
swig_opts_str = ''.join(('-I', include_dir))
@@ -100,7 +101,10 @@
m2crypto = Extension(name = '__m2crypto',
-                     sources = ['SWIG/_m2crypto.i'],
+#                     sources = ['SWIG/_m2crypto.i'],
+                     sources = ['SWIG/_m2crypto.i',  # for MinGW
+#                                'C:\work\openssl-0.9.8b/ms/applink.c',
+                                'applink.c'],
                       include_dirs = include_dirs,
                       library_dirs = library_dirs,
                       libraries = libraries,

Index: SWIG/_m2crypto.i
===================================================================
--- SWIG/_m2crypto.i	(revision 454)
+++ SWIG/_m2crypto.i	(working copy)
@@ -57,3 +57,5 @@
%constant int decrypt = 0;
#endif

+%rename(openssl_applink) OPENSSL_Applink;
+extern void ** OPENSSL_Applink(void);



More information about the python-crypto mailing list