Commit graph

183 commits

Author SHA1 Message Date
Legrandin
be12a401f1 Merge branch 'sha3' of https://github.com/bluviolin/pycrypto 2014-05-05 21:31:19 +02:00
Legrandin
31b22bac13 Merge branch 'salsa20' of https://github.com/bluviolin/pycrypto 2014-05-05 14:26:14 +02:00
Legrandin
d66d1f6277 Make Cipher.galois module private 2014-04-26 09:10:19 +02:00
Sebastian Ramacher
8b68505248 Make sure that ek and dk are aligned at 16 byte boundaries
ek and dk are used as operands in instructions that require 16 byte alignment.

Thanks to Greg Price for finding this issue.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-28 17:57:36 +01:00
Dwayne Litzenberger
af058ee6f5 Release v2.7a1 2013-10-21 11:23:43 -07:00
Legrandin
5d7ab24c51 Add support for GCM mode (AES only).
The main change done by this commit is adding support
for MODE_GCM (NIST SP 800 38D). Test vectors are included.

The mode uses a C extension (Crypto.Util.galois._ghash)
to compute the GHASH step. The C implementation is the most
basic one and it is still significantly (5x times) slower than CTR.
Optimizations can be introduced using tables (CPU/memory trade-off)
or even AES NI instructions on newer x86 CPUs.

This patch also simplifies Crypto.Cipher.blockalgo.py by:
 * removing duplicated code previously shared by digest() and verify().
 * removing duplicated code previously shared by Crypto.Hash.CMAC
   and Crypto.Cipher.block_algo (management of internal buffers
   for MACs that can only operate on block aligned data, like
   CMAC, CBCMAC, and now also GHASH).

[dlitz@dlitz.net: Included changes from the following commits from the author's pull request:]
- [9c13f9c] Rename 'IV' parameter to 'nonce' for AEAD modes.
- [ca460a7] Made blockalgo.py more PEP-8 compliant;
            The second parameter of the _GHASH constructor
            is now the length of the block (block_size)
            and not the full module.
[dlitz@dlitz.net: Replaced MacMismatchError with ValueError]
[dlitz@dlitz.net: Replaced ApiUsageError with TypeError]
[dlitz@dlitz.net: Replaced renamed variable `ht` with original `h`]
[dlitz@dlitz.net: Whitespace fixed with "git rebase --whitespace=fix"]
2013-10-20 13:30:21 -07:00
Dwayne Litzenberger
d044a47833 This is the PyCrypto 2.6.1 release.
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iFYEABEKAAYFAlJcZFMACgkQm4qoyix3/7Df6wDfUkS+QVyb7quQJrBiLi3jLAin
 Otvcc25QTHgoTADePAglh6rbEOMNdyNUFinTeV1qwkOm/Q3YRiyiLA==
 =XujS
 -----END PGP SIGNATURE-----

Merge tag 'v2.6.1' (fix CVE-2013-1445)

This is the PyCrypto 2.6.1 release.

Dwayne Litzenberger (4):
      Random: Make Crypto.Random.atfork() set last_reseed=None (CVE-2013-1445)
      Fortuna: Add comments for reseed_interval and min_pool_size to FortunaAccumulator
      Update the ChangeLog
      Release v2.6.1
2013-10-20 13:28:46 -07:00
Dwayne Litzenberger
7fd528d03b Release v2.6.1
This release is identical to PyCrypto v2.6, except it fixes the
Crypto.Random race condition (CVE-2013-1445) and adds a few related
comments.
2013-10-14 14:37:38 -07:00
Legrandin
90d6d3dbcf Added support for PKCS#8-encrypted private keys.
The patch contains the following changes:

- Private RSA keys can be imported/exported in encrypted form,
  protected according to PKCS#8 and:

  * PBKDF2WithHMAC-SHA1AndDES-EDE3-CBC.
  * PBKDF2WithHMAC-SHA1AndAES128-CBC
  * PBKDF2WithHMAC-SHA1AndAES192-CBC
  * PBKDF2WithHMAC-SHA1AndAES256-CBC

  In addition to that, it is possible to import keys i the
  following weak formats:

  * pbeWithMD5AndDES-CBC
  * pbeWithSHA1AndRC2-CBC
  * pbeWithMD5AndRC2-CBC
  * pbeWithSHA1AndDES-CBC

- The following new module (and 1 new package) are added:

  * Crypto.Util.Padding for simple padding/unpadding logic
  * Crypto.IO._PBES for PBE-related PKCS#5 logic
  * Crypto.IO.PEM for PEM wrapping/unwrapping
  * Crypto.IO.PKCS8 for PKCS#8 wrapping/unwrapping

- All Object ID (OIDs) are now in dotted form to increase
  readability.

- Add AES support to PEM format (decode only).
  The PEM module can decrypt messages protected with AES-CBC.

- Update RSA import test cases.

- Updated to PKCS8 test cases
2013-07-14 21:16:46 -07:00
Fabrizio Tarizzo
24df7d3c5d Merge with upstream updates 2013-04-28 12:06:18 +02:00
Fabrizio Tarizzo
88c9f7d2d4 Put Keccak core in different file than SHA3 module
modified:   setup.py
	modified:   src/SHA3.c
	new file:   src/keccak.c
	new file:   src/keccak.h
2013-04-28 11:35:39 +02:00
Fabrizio Tarizzo
7cce0ce5d5 Implementation of the SHA-3 (Keccak) family 2013-04-28 11:35:38 +02:00
Fabrizio Tarizzo
ab4d12fcc1 use libtom macros, remove ecrypt directory 2013-04-28 10:42:40 +02:00
Fabrizio Tarizzo
92e6cd04a0 Implementation of the Salsa20 stream cipher
new file:   lib/Crypto/Cipher/Salsa20.py
	modified:   lib/Crypto/SelfTest/Cipher/__init__.py
	new file:   lib/Crypto/SelfTest/Cipher/test_Salsa20.py
	modified:   setup.py
	new file:   src/Salsa20.c
	new file:   src/salsa20/ecrypt-config.h
	new file:   src/salsa20/ecrypt-machine.h
	new file:   src/salsa20/ecrypt-portable.h
	new file:   src/salsa20/ecrypt-sync.h
	new file:   src/streamIV_template.c
2013-04-28 10:42:40 +02:00
Sebastian Ramacher
e1ce77b167 Initial AES-NI support 2013-04-21 20:41:18 -07:00
Dwayne Litzenberger
fd398a28e3 Hash: Speed up initialization by removing pure-Python wrappers
The pure Python wrappers around Crypto.Hash.* were convenient, but they
slowed down hash initialization by 4-7x.

There is a speed trade-off here: The MD5 and SHA1 objects are just
wrapped hashlib objects (or old-style md5/sha objects).  To maintain API
compatibility with the rest of PyCrypto, we still have to wrap them, so
they're slower to initialize than the rest of the hash functions.  If
hashlib ever adds a .new() method, we will automatically use hashlib
directly and gain the initialization speed-up.
2013-02-17 20:07:02 -08:00
Dwayne Litzenberger
95918a1a86 Use autoconf to generate compiler options
Hopefully this means we'll break on fewer platforms.

Also, remove some of the extra optimization flags (e.g. -O3
-fomit-frame-pointer), which don't really do much.
2013-02-16 13:09:42 -08:00
Sebastian Ramacher
68cce56d91 Use os.chmod instead of os.system("chmod ...") 2013-02-02 19:29:05 -08:00
Sebastian Ramacher
ab110a4113 Add build to TestCommand's sub_commands
... and run the sub_commands in TestCommand.run. So if python setup.py test is
executed before ever running the build target, the extension modules are built.

Bug: https://bugs.launchpad.net/pycrypto/+bug/1055256
Bug: https://bugs.launchpad.net/pycrypto/+bug/976171
2013-02-02 19:29:05 -08:00
Dwayne C. Litzenberger
3103b3789f setup.py: Add more compiler warnings and fix unsigned-signed comparisons 2012-07-03 12:16:53 -04:00
Dwayne C. Litzenberger
373ea760f2 Release v2.6 2012-05-24 08:51:04 -04:00
Dwayne C. Litzenberger
daeea78796 Remove -std=c99 when building using aCC compiler HP-UX
Bug report: https://bugs.launchpad.net/pycrypto/+bug/980358
2012-05-24 07:41:30 -04:00
Legrandin
d42c964da4 Add documentation for XOR cipher 2012-05-14 19:12:12 +02:00
Legrandin
b0cf21ed20 Added documentation for ARC4 2012-05-14 19:03:39 +02:00
Legrandin
6d58363281 Added documentation for CAST-128 2012-05-12 23:51:29 +02:00
Legrandin
a6e43870ee Added documentation for RC2 2012-05-12 23:33:13 +02:00
Legrandin
79bdbe0d55 Added documentation for Blowfish 2012-05-11 23:23:20 +02:00
Legrandin
c47425619c Added documentation for Triple DES. 2012-05-10 23:01:30 +02:00
Legrandin
6f9fe103a5 Added documentation for AES and DES.
A new module (blockalgo) has been added. It contains a class (BlockAlgo)
all ciphers derive from. The only purpose of such base class
is to centralize all general documentation applicable to all block
ciphers (e.g. modes) into a single file.
2012-05-10 19:16:50 +02:00
Dwayne C. Litzenberger
20ee929935 setup.py: Remove download_url so that easy_install downloads from PyPI 2012-01-28 02:32:41 -05:00
Dwayne C. Litzenberger
c7a1573f51 setup.py: PyCrypto is used by lots of people in production 2012-01-28 02:32:19 -05:00
Dwayne C. Litzenberger
3245543c8d Release v2.5 2012-01-13 12:16:38 -05:00
Dwayne C. Litzenberger
f34f3d3c1b Merge commit 'pkcs_20111222' 2012-01-13 09:57:33 -05:00
Thomas
0c2bb47352 Add trove classifiers to indicate Python 2 and 3 compatibility. 2012-01-12 14:02:09 +00:00
Legrandin
114ca5b4d4 Merge from upstream 2011-12-22 14:55:40 +01:00
Dwayne C. Litzenberger
62247ca754 Release v2.4.1 2011-11-04 15:17:40 -04:00
Sebastian Ramacher
6a62dc3006 Run build_configure from build_ext.
When installing with easy_install build_ext ist called directly. Thus we have to
ensure that build_configure is run before we're building the extensions in
build_ext.
2011-11-04 15:01:30 -04:00
Dwayne C. Litzenberger
a23efbfbb7 Bump to v2.4 2011-10-22 13:29:01 -04:00
Legrandin
c22fa18c0d Merged from upstream (py3k support) and modified so that all unit tests pass. 2011-10-18 23:20:26 +02:00
Legrandin
897b75983c Added Lorenz Quack's native C implementation of all SHA-2 algorithm
(as submitted here https://bugs.launchpad.net/pycrypto/+bug/544792)
so that they are available also in Python 2.1, 2.2, 2.3 and 2.4.

Regardless where the implementation comes from (Python standard
library or our native modules, depending on the Python version),
all Crypto.Hash objects are always used as front-ends.
2011-10-16 22:41:21 +02:00
Dwayne C. Litzenberger
323ce9ef95 Fix libgmp/libmpir autodetection 2011-10-10 19:15:50 -04:00
Dwayne C. Litzenberger
c90c797a58 Don't test SHA224/384/512 where hashlib isn't available (Python < 2.5) 2011-10-10 16:05:23 -04:00
Dwayne C. Litzenberger
7e490d9b3a setup.py: configure be quiet when --quiet is specified 2011-10-10 16:05:23 -04:00
Dwayne C. Litzenberger
c263294fe7 setup.py: Don't run ./configure if ./config.status already exists 2011-10-10 16:05:23 -04:00
Dwayne C. Litzenberger
bf38995ffa Merge branch 'master' into py3k
Conflicts:
	setup.py
	src/_fastmath.c
2011-10-10 14:51:07 -04:00
Dwayne C. Litzenberger
9cfb332b22 autoconf: only use side-channel secured mpz_powm_sec if it's available (libgmp 5 or later) 2011-10-10 14:49:26 -04:00
Legrandin
44ed631b69 Replace explicit search for gmp library with an attempt to compile a dummy C file dependent on it. 2011-09-27 18:55:06 +02:00
Anders Sundman
e226cd7f96 Merge from dlitz/master 2011-05-19 19:55:12 +02:00
Legrandin
1166875eb3 The final, tested PKCS#1 v1.5 signature module 2011-02-03 01:35:59 +01:00
Legrandin
abd276c5fa Improve the test command in setup.py, by allowing tests to be
performed on a single sub-package or module only.
2011-01-10 18:52:40 +01:00