[pycrypto] FW: python crypto with python 3.0 or 3.1

Grail Dane grail69 at hotmail.com
Sun Feb 28 17:58:44 CST 2010


Hello Christoph
I have made more head way since that one (and made a lot more changes).I found that the module creation required a few more steps and I have come up with two solutions (in attached patches):
1. First patch follows most of the online info I could find related to PyModuleDef and the related PyTypeObject.   This required that all tp_getattr functions be removed and set to 0 (zero) in the PyTypeObject definition.
2. The second patch retained the already created tp_getattr functions.
With either applied I am able to compile but when running a test program with the following lines only:
#!/usr/bin/env python
from Crypto.Cipher import AESimport base64import os

When run I receive the following error:
Traceback (most recent call last):  File "./cypher.py", line 3, in <module>    from Crypto.Cipher import AESSystemError: NULL result without error in PyObject_Call
So apply patches (and make necessary changes for Windows) and we will see if I can help further :)
Cheers Grail

> Date: Sun, 28 Feb 2010 22:04:12 +0100
> From: christoph.tapler at gmx.net
> To: pycrypto at lists.dlitz.net
> Subject: Re: [pycrypto] FW: python crypto with python 3.0 or 3.1
> 
> Hi Grail,
> 
> Thanks for your patch! I assume you generated the patch based on a Unix
> environment. Tried to compile pycrypto together with your patch on my
> Windows machine. However, it did not work out.
> After fixing two straightforward errors in setup.py (relevant to Windows 
> only,
> see [1], [2]), I got stuck when linking the module MD4 and other hashing 
> methods
> (MD2, etc).
> 
> Now, when I compare the build process against Python 2, I see the following
> difference:
> 
> ###############################################################################
> [Python 2:]
> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL 
> /nologo /INCRE
> MENTAL:NO "/LIBPATH:C:\Program Files\Python26\libs" "/LIBPATH:C:\Program 
> Files\P
> ython26\PCbuild" /EXPORT:initMD4 
> build\temp.win32-2.6\Release\src/MD4.obj /OUT:b
> uild\lib.win32-2.6\Crypto\Hash\MD4.pyd 
> /IMPLIB:build\temp.win32-2.6\Release\src\
> MD4.lib /MANIFESTFILE:build\temp.win32-2.6\Release\src\MD4.pyd.manifest
>     Creating library build\temp.win32-2.6\Release\src\MD4.lib and object 
> build\te
> mp.win32-2.6\Release\src\MD4.exp
> C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\mt.exe -nologo 
> -manifest build
> \temp.win32-2.6\Release\src\MD4.pyd.manifest 
> -outputresource:build\lib.win32-2.6
> \Crypto\Hash\MD4.pyd;2
> 
> [Python 3:]
> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL 
> /nologo /INCRE
> MENTAL:NO "/LIBPATH:C:\Program Files\Python31\libs" "/LIBPATH:C:\Program 
> Files\P
> ython31\PCbuild" /EXPORT:PyInit_MD4 
> build\temp.win32-3.1\Release\src/MD4.obj /OU
> T:build\lib.win32-3.1\Crypto\Hash\MD4.pyd 
> /IMPLIB:build\temp.win32-3.1\Release\s
> rc\MD4.lib /MANIFESTFILE:build\temp.win32-3.1\Release\src\MD4.pyd.manifest
> LINK : error LNK2001: unresolved external symbol PyInit_MD4
> build\temp.win32-3.1\Release\src\MD4.lib : fatal error LNK1120: 1 
> unresolved ext
> ernals
> error: command '"C:\Program Files\Microsoft Visual Studio 
> 9.0\VC\BIN\link.exe"'
> failed with exit status 1120
> ###############################################################################
> 
> It seems that the /EXPORT argument for the Windows Linker is assembled in a
> different way. This leads to an export name, which does not exist as 
> function.
> Hence the linker terminates with an error.
> 
> Any idea what I need to change to get the /EXPORT name fixed? Is this 
> problem
> located in pycrypto or in the Python distutils?
> 
> 
> ##### Regarding the changes in setup.py:
> [1] Changed the following stmt:
> From
> print << sys.stderr "warning: GMP library not found; Not building 
> Crypto.PublicKey._fastmath."
> to
> print("warning: GMP library not found; Not building 
> Crypto.PublicKey._fastmath.", sys.stderr)
> 
> [2] (Temporarily) disabled winrand.c which is included when using the 
> Windows platform.
> 
> Cheers, Christoph
> 
> _______________________________________________
> pycrypto mailing list
> pycrypto at lists.dlitz.net
> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
 		 	   		  
_________________________________________________________________
Find a great deal on your next car. Get straight to the Point.
http://clk.atdmt.com/NMN/go/157637060/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.dlitz.net/pipermail/pycrypto/attachments/20100228/349e8dc6/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pycrypto-patches.zip
Type: application/octet-stream
Size: 27460 bytes
Desc: not available
Url : http://lists.dlitz.net/pipermail/pycrypto/attachments/20100228/349e8dc6/attachment-0001.obj 


More information about the pycrypto mailing list