[pycrypto] _fastmath None !!
Lorenz Quack
don at amberfisharts.com
Tue May 18 04:20:32 CST 2010
Hi
On 05/18/2010 08:19 AM, jd wrote:
>
> Hi Lorenz,
> Thanks for quick response.
>
> It is happening on someone else's machine, I have requested them to check and send me details.
>
> In the mean time I looked that the code.
> In RSA.py
>
> try:
> from Crypto.PublicKey import _fastmath
> except ImportError:
> _fastmath = None
>
>
> Could this be problem ?
I don't think so. That should happen when PyCrypto was compiled without gmp support.
According to my analysis the relevant parts are the __setstate__ method in the class _RSAobj
and the __init__ in the class RSAImplementation.
In the __init__ the attribute _math is set which is later being accessed by both the construct
method and in the _RSAobj.__setstate__ method.
The way the _math attribute is set seems pretty safe to me so I believe things must be going
astray somewhere else. But it's hard to tell without any code.
cheers
//Lorenz
> Thanks
> /Jd
>
>
> --- On Mon, 5/17/10, Lorenz Quack<don at amberfisharts.com> wrote:
>
>> From: Lorenz Quack<don at amberfisharts.com>
>> Subject: Re: [pycrypto] _fastmath None !!
>> To: "PyCrypto discussion list"<pycrypto at lists.dlitz.net>
>> Date: Monday, May 17, 2010, 8:40 AM
>> Hi again,
>>
>> no idea what's going wrong. normally pycrypto should fall
>> back to _slowmath (a pure python implementation) when gmp is
>>
>> not installed meaning _fastmath is not available (_fastmath
>> is a C implementation using gmp).
>>
>> Maybe you could prvide some more information, like python
>> version, pycrypto version, is gmp installed?
>> Also it would be a good idea to provide a
>> small/minimalistic example demonstrating the problem.
>> That way it is easyier to figure out if it's a bug in
>> pycrypto or in your code.
>>
>> cheers,
>> //Lorenz
>>
>>
>>
>> On 05/17/2010 04:48 PM, jd wrote:
>>> Hi Guys
>>> I am serializing the pycrypto keys
>> using pickle.. as suggested in one of recent posts. It is
>> working fine, but giving following problem on cenos 5.1.
>> (stack at the bottom of email)
>>>
>>> 'NoneType' object has no attribute 'rsa_construct'
>>>
>>>
>>> I looked at the code.. it seems
>> while constructing _fastmath is used. Any workarounds /
>> fixes ? I do not think changing to saving tuple would help
>> as it would also need to use __setstate__..
>>>
>>> Help is greatly appreciated.
>>> Thanks
>>> /Jd
>>>
>>> File "/tg2env/bin/paster", line 7, in ?
>>> sys.exit(
>>> File
>> "/tg2env/lib/python2.4/site-packages/PasteScript-1.7.3-py2.4.egg/paste/script/command.py",
>> line 84, in run
>>> invoke(command, command_name,
>> options, args[1:])
>>> File
>> "/tg2env/lib/python2.4/site-packages/PasteScript-1.7.3-py2.4.egg/paste/script/command.py",
>> line 123, in invoke
>>> exit_code = runner.run(args)
>>> File
>> "/tg2env/lib/python2.4/site-packages/PasteScript-1.7.3-py2.4.egg/paste/script/command.py",
>> line 218, in run
>>> result = self.command()
>>> File
>> "/tg2env/lib/python2.4/site-packages/PasteScript-1.7.3-py2.4.egg/paste/script/serve.py",
>> line 276, in command
>>> relative_to=base,
>> global_conf=vars)
>>> File
>> "/tg2env/lib/python2.4/site-packages/PasteScript-1.7.3-py2.4.egg/paste/script/serve.py",
>> line 311, in loadapp
>>> return loadapp(
>>> File
>> "/tg2env/lib/python2.4/site-packages/PasteDeploy-1.3.3-py2.4.egg/paste/deploy/loadwsgi.py",
>> line 204, in loadapp
>>> return loadobj(APP, uri,
>> name=name, **kw)
>>> File
>> "/tg2env/lib/python2.4/site-packages/PasteDeploy-1.3.3-py2.4.egg/paste/deploy/loadwsgi.py",
>> line 225, in loadobj
>>> return context.create()
>>> File
>> "/tg2env/lib/python2.4/site-packages/PasteDeploy-1.3.3-py2.4.egg/paste/deploy/loadwsgi.py",
>> line 625, in create
>>> return
>> self.object_type.invoke(self)
>>> File
>> "/tg2env/lib/python2.4/site-packages/PasteDeploy-1.3.3-py2.4.egg/paste/deploy/loadwsgi.py",
>> line 110, in invoke
>>> return fix_call(context.object,
>> context.global_conf, **context.local_conf)
>>> File
>> "/tg2env/lib/python2.4/site-packages/PasteDeploy-1.3.3-py2.4.egg/paste/deploy/util/fixtypeerror.py",
>> line 57, in fix_call
>>> val = callable(*args, **kw)
>>> File
>> "/m2svn/trunk/src/app/web/app/app/config/middleware.py",
>> line 46, in make_app
>>> if verify_license():
>>> File
>> "/m2svn/trunk/src/app/web/app/app/core/utils/utils.py", line
>> 2221, in verify_license
>>> l_info =
>> read_license_using_embeded(license_file)
>>> File
>> "/m2svn/trunk/src/app/web/app/app/core/utils/utils.py", line
>> 2202, in read_license_using_embeded
>>> pub_key =get_embeded_key()
>>> File
>> "/m2svn/trunk/src/app/web/app/app/core/utils/utils.py", line
>> 2197, in get_embeded_key
>>> key = pickle.loads(str)
>>> File "/usr/lib64/python2.4/pickle.py",
>> line 1394, in loads
>>> return Unpickler(file).load()
>>> File "/usr/lib64/python2.4/pickle.py",
>> line 872, in load
>>> dispatch[key](self)
>>> File "/usr/lib64/python2.4/pickle.py",
>> line 1237, in load_build
>>> setstate(state)
>>> File
>> "build/bdist.linux-x86_64/egg/Crypto/PublicKey/RSA.py", line
>> 171, in __setstate__
>>> AttributeError: 'NoneType' object has no attribute
>> 'rsa_construct'
>>>
More information about the pycrypto
mailing list