Python Cryptography Toolkit

cannot build PyCrypto in windows (64-bit)

Reported by Kim Jonguk on 2009-11-03
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Python-Crypto
Undecided
Unassigned

Bug Description

I tried to build PyCrypto in my PC, but it failed.
I use Python 2.6 in Windows Server 2008 R2 (64-bit).

the following messages are the whole error:

running build
running build_py
running build_ext
warning: GMP library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Cipher.AES' extension
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Isrc/ -Isrc
/inc-msvc/ -IC:\Python26\include -IC:\Python26\PC /Tcsrc/AES.c /Fobuild\temp.win-amd64-2.6\Release\src/AES.obj
AES.c
c:\users\administrator\pycrypto-2.x\src\block_template.c(435) : error C2275: 'PyObject' : illegal use of this type as an
 expression
        c:\python26\include\object.h(108) : see declaration of 'PyObject'
c:\users\administrator\pycrypto-2.x\src\block_template.c(435) : error C2065: 'ctr' : undeclared identifier
c:\users\administrator\pycrypto-2.x\src\block_template.c(436) : error C2065: 'ctr' : undeclared identifier
c:\users\administrator\pycrypto-2.x\src\block_template.c(436) : warning C4047: '==' : 'int' differs in levels of indirec
tion from 'void *'
c:\users\administrator\pycrypto-2.x\src\block_template.c(440) : error C2065: 'ctr' : undeclared identifier
c:\users\administrator\pycrypto-2.x\src\block_template.c(444) : error C2065: 'ctr' : undeclared identifier
c:\users\administrator\pycrypto-2.x\src\block_template.c(444) : error C2065: 'ctr' : undeclared identifier
c:\users\administrator\pycrypto-2.x\src\block_template.c(444) : error C2065: 'ctr' : undeclared identifier
c:\users\administrator\pycrypto-2.x\src\block_template.c(448) : error C2065: 'ctr' : undeclared identifier
c:\users\administrator\pycrypto-2.x\src\block_template.c(448) : warning C4047: 'function' : 'PyObject *' differs in leve
ls of indirection from 'int'
c:\users\administrator\pycrypto-2.x\src\block_template.c(448) : warning C4024: 'PyString_Size' : different types for for
mal and actual parameter 1
c:\users\administrator\pycrypto-2.x\src\block_template.c(453) : error C2065: 'ctr' : undeclared identifier
c:\users\administrator\pycrypto-2.x\src\block_template.c(453) : error C2065: 'ctr' : undeclared identifier
c:\users\administrator\pycrypto-2.x\src\block_template.c(453) : error C2065: 'ctr' : undeclared identifier
c:\users\administrator\pycrypto-2.x\src\block_template.c(458) : error C2065: 'ctr' : undeclared identifier
c:\users\administrator\pycrypto-2.x\src\block_template.c(458) : warning C4047: 'function' : 'PyObject *' differs in leve
ls of indirection from 'int'
c:\users\administrator\pycrypto-2.x\src\block_template.c(458) : warning C4024: 'PyString_AsString' : different types for
 formal and actual parameter 1
c:\users\administrator\pycrypto-2.x\src\block_template.c(461) : error C2065: 'ctr' : undeclared identifier
c:\users\administrator\pycrypto-2.x\src\block_template.c(461) : error C2065: 'ctr' : undeclared identifier
c:\users\administrator\pycrypto-2.x\src\block_template.c(461) : error C2065: 'ctr' : undeclared identifier
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe"' failed with exit status 2
PS C:\Users\Administrator\pycrypto-2.x>
PS C:\Users\Administrator\pycrypto-2.x>
PS C:\Users\Administrator\pycrypto-2.x>
PS C:\Users\Administrator\pycrypto-2.x> python setup.py build > error
warning: GMP library not found; Not building Crypto.PublicKey._fastmath.
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe"' failed with exit status 2

Nevins (nevins-bartolomeo) wrote :

The fix for this is to modify line 435 of block_template.c change it from:

Py_BLOCK_THREADS;
PyObject *ctr = PyObject_CallObject(self->counter, NULL);
if (ctr == NULL) {
 free(buffer);
 return NULL;
}

to

PyObject *ctr;
Py_BLOCK_THREADS;
ctr = PyObject_CallObject(self->counter, NULL);
if (ctr == NULL) {
 free(buffer);
 return NULL;
}

Build and install, then run a test. Everything should work.

Dwayne Litzenberger (dlitz) wrote :

We believe this bug has been fixed in PyCrypto v2.1.0, which can be obtained from http://www.pycrypto.org/

Changed in pycrypto:
status: Fix Committed → Fix Released
Changed in pycrypto:
milestone: none → 2.1.0
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers