From: SourceForge.net <no...@so...> - 2005-06-10 19:32:48
|
Bugs item #1118390, was opened at 2005-02-08 00:30 Message generated for change (Comment added) made by akuchling You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=120937&aid=1118390&group_id=20937 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Chris Ochs (snacktime) Assigned to: Nobody/Anonymous (nobody) Summary: RSA encrypt segfaults when used in threads Initial Comment: When running encrypt from the following class under threads it causes a segfault. I narrowed it down to the encrypt method as the culprit. I'm not sure if this is actually a pycrypto error or a python error as I'm not familiar enough with threading. You can see my post about this on the twisted-python list which has the rest of the information about the environment at: http://twistedmatrix.com/pipermail/twisted-python/2005- February/009474.html Chris ch...@pa... ---------------------------------------------------- import pickle import base64 from Crypto.Util.randpool import RandomPool from Crypto.PublicKey import RSA class OTCrypto: def __init__(self,req): self.req = req self.public_key = req.ot['publicKey'] self.private_key = req.ot['privateKey'] def genkey(self): random = RandomPool() random.stir() RSAkey = RSA.generate(2048, random.get_bytes) public = RSAkey.publickey() pickle.dump(public,open(self.public_key,'w')) pickle.dump(RSAkey,open(self.private_key,'w')) def encrypt(self,plaintext): public = pickle.load(open(self.public_key)) random = RandomPool() random.stir() bits = random.get_bytes(160) ciphertext = public.encrypt(plaintext,bits) ciphertext = base64.b64encode(ciphertext[0]) return ciphertext ---------------------------------------------------------------------- >Comment By: A.M. Kuchling (akuchling) Date: 2005-06-10 15:32 Message: Logged In: YES user_id=11375 Also reported as Python bug 1080660 (now closed). The only extension RSA might use is _fastmath, but _fastmath doesn't do anything for the sake of threads; it never releases the GIL. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=120937&aid=1118390&group_id=20937 |