Pycrypto

Latest version: v2.6.1

Safety actively analyzes 681775 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 4

2.7a1

=====
* Experimental release. This introduces a new API for AEAD modes, and
makes a few other minor API changes. These APIs should be considered
experimental, and may be changed before the final release.
* New API for authenticated encryption with associated data (AEAD):
- New block cipher modes:
- MODE_CCM
- MODE_EAX
- MODE_GCM
- MODE_SIV
- New methods:
- .encrypt_and_digest()
- .decrypt_and_verify()
- .digest()
- .verify()
- New MAC algorithm:
- Crypto.Cipher.CMAC
- New .verify() and .hexverify() methods also added to Hash and
HMAC/CMAC objects, providing constant-time hash comparison.
(Thanks: Legrandin, Lucas Garron)
* LP1132550: Fix MODE_OPENPGP not accepting uppercase 'IV' kwarg.
* LP1119552: Fix PKCS1v1.5 not accepting signatures without the
optional NULL parameter
* Add support for import/export of DSA keys. (Thanks: Legrandin)
* Add support for PKCS8-encrypted private keys. (Thanks: Legrandin)
* LP996193: Fix MODE_OFB requiring padding (it now behaves as a stream
cipher)
* Improve C extension autodocs
* Remove pointless 'error' attribute from stream ciphers.
* Deprecate the disable_shortcut option to Crypto.Util.Counter;
Remove __PCT_CTR_SHORTCUT__ entirely.
* Fix small MODE_CTR memory leak under Python 3.
* Fix error importing winrandom on Python 3. (Thanks: Jason R. Coombs)
* FortunaAccumulator: Use time.monotonic for rate-limiting if available
(i.e. Python 3.3 and later)
* AES-NI support (Thanks: Sebastian Ramacher)
* setup.py: Fix compilation on HP-UX 11.31. (Thanks: Adam Woodbeck)
* ElGamal: Add blinding to ElGamal decryption. (Thanks: Legrandin)
* Hash: Remove pure-Python wrappers (speeds up hash init 4x-7x)
* Hash: Add generic Crypto.Hash.new(algo, [data]) function
(like hashlib.new)
* Hash: Remove 'oid' attributes; Add 'name' attributes for compatibility
with hashlib.
* Hash: Rename SHA -> SHA1 and RIPEMD -> RIPEMD160, since the original
names are frequently used as the names of other algorithms.
* setup.py: Use autoconf to generate compiler options;
Fix OpenBSD build issues.
* Fix RSA object serialization (i.e. pickle)
* LP1061217: random.shuffle takes O(n^2) time.
(Thanks: Sujay Jayakar, Andrew Cooke)
* _fastmath: Fix leaks when errors occur.
(Thanks: Sebastian Ramacher, Andreas Stührk)
* SHA256/224/384/512: Don't export symbol 'add_length'
* setup.py: Use os.chmod instead of os.system("chmod ...").
(Thanks: Sebastian Ramacher)
* setup.py: The 'test' command now runs the 'build' command first.
(Thanks: Sebastian Ramacher)
* New tools/create-pythons.sh and tools/test-all.sh scripts for testing
against multiple versions of Python.
* getStrongProne: Fix error handling (Thanks: Sebastian Ramacher)
* ARC4: Add ARC4-drop[n] cipher support. (Thanks: Legrandin)
* RSA.importKey: Properly catch IndexError. (Thanks: Sebastian Ramacher)
* RSA.exportKey: Raise ValueError as documented when key format is
unknown. (Thanks: Sebastian Ramacher)
* RSA.exportKey: Always return bytes (Thanks: Sebastian Ramacher)
* Fix & re-enable some broken tests (Thanks: Sebastian Ramacher)
* Improve Python 3 compatibility
* Various documentation fixes and improvements
(Thanks: Anton Rieder, Legrandin, Sebastian Ramacher, Stefano Rivera)
* Various cleanups, especially for Python 3.

2.6.1

Not secure
=====
* [CVE-2013-1445] Fix PRNG not correctly reseeded in some situations.

In previous versions of PyCrypto, the Crypto.Random PRNG exhibits a
race condition that may cause forked processes to generate identical
sequences of 'random' numbers.

This is a fairly obscure bug that will (hopefully) not affect many
applications, but the failure scenario is pretty bad. Here is some
sample code that illustrates the problem:

from binascii import hexlify
import multiprocessing, pprint, time
import Crypto.Random

def task_main(arg):
a = Crypto.Random.get_random_bytes(8)
time.sleep(0.1)
b = Crypto.Random.get_random_bytes(8)
rdy, ack = arg
rdy.set()
ack.wait()
return "%s,%s" % (hexlify(a).decode(),
hexlify(b).decode())

n_procs = 4
manager = multiprocessing.Manager()
rdys = [manager.Event() for i in range(n_procs)]
acks = [manager.Event() for i in range(n_procs)]
Crypto.Random.get_random_bytes(1)
pool = multiprocessing.Pool(processes=n_procs,
initializer=Crypto.Random.atfork)
res_async = pool.map_async(task_main, zip(rdys, acks))
pool.close()
[rdy.wait() for rdy in rdys]
[ack.set() for ack in acks]
res = res_async.get()
pprint.pprint(sorted(res))
pool.join()

The output should be random, but it looked like this:

['c607803ae01aa8c0,2e4de6457a304b34',
'c607803ae01aa8c0,af80d08942b4c987',
'c607803ae01aa8c0,b0e4c0853de927c4',
'c607803ae01aa8c0,f0362585b3fceba4']

This release fixes the problem by resetting the rate-limiter when
Crypto.Random.atfork() is invoked. It also adds some tests and a
few related comments.

2.6

Not secure
===
* [CVE-2012-2417] Fix LP985164: insecure ElGamal key generation.
(thanks: Legrandin)

In the ElGamal schemes (for both encryption and signatures), g is
supposed to be the generator of the entire Z^*_p group. However, in
PyCrypto 2.5 and earlier, g is more simply the generator of a random
sub-group of Z^*_p.

The result is that the signature space (when the key is used for
signing) or the public key space (when the key is used for encryption)
may be greatly reduced from its expected size of log(p) bits, possibly
down to 1 bit (the worst case if the order of g is 2).

While it has not been confirmed, it has also been suggested that an
attacker might be able to use this fact to determine the private key.

Anyone using ElGamal keys should generate new keys as soon as practical.

Any additional information about this bug will be tracked at
https://bugs.launchpad.net/pycrypto/+bug/985164

* Huge documentation cleanup (thanks: Legrandin).

* Added more tests, including test vectors from NIST 800-38A
(thanks: Legrandin)

* Remove broken MODE_PGP, which never actually worked properly.
A new mode, MODE_OPENPGP, has been added for people wishing to write
OpenPGP implementations. Note that this does not implement the full
OpenPGP specification, only the "OpenPGP CFB mode" part of that
specification.
https://bugs.launchpad.net/pycrypto/+bug/996814

* Fix: getPrime with invalid input causes Python to abort with fatal error
https://bugs.launchpad.net/pycrypto/+bug/988431

* Fix: Segfaults within error-handling paths
(thanks: Paul Howarth & Dave Malcolm)
https://bugs.launchpad.net/pycrypto/+bug/934294

* Fix: Block ciphers allow empty string as IV
https://bugs.launchpad.net/pycrypto/+bug/997464

* Fix DevURandomRNG to work with Python3's new I/O stack.
(thanks: Sebastian Ramacher)

* Remove automagic dependencies on libgmp and libmpir, let the caller
disable them using args.

* Many other minor bug fixes and improvements (mostly thanks to Legrandin)

2.5

Not secure
===
* Added PKCS1 encryption schemes (v1.5 and OAEP). We now have
a decent, easy-to-use non-textbook RSA implementation. Yay!

* Added PKCS1 signature schemes (v1.5 and PSS). v1.5 required some
extensive changes to Hash modules to contain the algorithm specific
ASN.1 OID. To that end, we now always have a (thin) Python module to
hide the one in pure C.

* Added 2 standard Key Derivation Functions (PBKDF1 and PBKDF2).

* Added export/import of RSA keys in OpenSSH and PKCS8 formats.

* Added password-protected export/import of RSA keys (one old method
for PKCS8 PEM only).

* Added ability to generate RSA key pairs with configurable public
exponent e.

* Added ability to construct an RSA key pair even if only the private
exponent d is known, and not p and q.

* Added SHA-2 C source code (fully from Lorenz Quack).

* Unit tests for all the above.

* Updates to documentation (both inline and in Doc/pycrypt.rst)

* All of the above changes were put together by Legrandin (Thanks!)

* Minor bug fixes (setup.py and tests).

2.4.1

Not secure
=====
* Fix "error: Setup script exited with error: src/config.h: No such file or
directory" when installing via easy_install. (Sebastian Ramacher)

2.4

Not secure
===
* Python 3 support! (Thorsten E. Behrens, Anders Sundman)
PyCrypto now supports every version of Python from 2.1 through 3.2.

* Timing-attack countermeasures in _fastmath: When built against
libgmp version 5 or later, we use mpz_powm_sec instead of mpz_powm.
This should prevent the timing attack described by Geremy Condra at
PyCon 2011:
http://blip.tv/pycon-us-videos-2009-2010-2011/pycon-2011-through-the-side-channel-timing-and-implementation-attacks-in-python-4897955

* New hash modules (for Python >= 2.5 only): SHA224, SHA384, and
SHA512 (Frédéric Bertolus)

* Configuration using GNU autoconf. This should help fix a bunch of
build issues.

* Support using MPIR as an alternative to GMP.

* Improve the test command in setup.py, by allowing tests to be
performed on a single sub-package or module only. (Legrandin)

You can now do something like this:

python setup.py test -m Hash.SHA256 --skip-slow-tests

* Fix double-decref of "counter" when Cipher object initialisation
fails (Ryan Kelly)

* Apply patches from Debian's python-crypto 2.3-3 package (Jan
Dittberner, Sebastian Ramacher):
- fix-RSA-generate-exception.patch
- epydoc-exclude-introspect.patch
- no-usr-local.patch

* Fix launchpad bug 702835: "Import key code is not compatible with
GMP library" (Legrandin)

* More tests, better documentation, various bugfixes.

Page 1 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.