summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | Changes to allow pycrpyto to work on Python 3.x as well as 2.1 through 2.7Thorsten Behrens2010-12-2813-191/+942
| | | |
| * | | Change _fastmath.c to compile with VC++, add support for mpir as alternative ↵Thorsten Behrens2010-12-231-2/+9
| | | | | | | | | | | | | | | | to gmp
* | | | Added Lorenz Quack's native C implementation of all SHA-2 algorithmLegrandin2011-10-1610-251/+586
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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.
* | | | Fastmath can still be compiled with LIBGMP<=4.xLegrandin2011-09-201-9/+18
| | | |
* | | | Merged with upstream.Legrandin2011-09-207-10/+14
|\ \ \ \ | | |_|/ | |/| |
| * | | Merge pull request #6 from rfk/masterDwayne Litzenberger2011-06-131-1/+0
| |\ \ \ | | | | | | | | | | fix double-decref of counter when Cipher initialisation fails
| | * | | fix double-decref of "counter" when Cipher object initialisation failsRyan Kelly2011-03-071-1/+0
| | | |/ | | |/|
| * | | Add variable block size support to HMAC-SHA384 and HMAC-SHA512 which useFrédéric Bertolus2011-04-085-0/+5
| |/ / | | | | | | | | | block of 128 bytes long
| * | Replace calls to mpz_powm with mpz_powm_sec. This should help avoid some ↵Dwayne C. Litzenberger2011-02-211-9/+9
| |/ | | | | | | | | | | timing attacks. Thanks to Geremy Condra for pointing this out.
* | Add new() method to all remaining hash algorithms, so as to make them to ↵Legrandin2011-02-071-0/+6
| | | | | | | | work with PKCS#1 PSS. Add also test cases for it for every hash.
* | Factorization of n from d stops after 100 attempts, with test cases.Legrandin2011-02-061-4/+13
| |
* | Add OID to each hash algorithm.Legrandin2011-02-035-1/+55
| |
* | Keep p<q check while generating an RSA key, but tell people why really we do ↵Legrandin2011-01-191-3/+0
| | | | | | | | it (that is, because it helps a little the inversion step that follows).
* | Allow RSA to be generated with an arbitary public exponent e.Legrandin2011-01-181-5/+62
| | | | | | | | | | | | | | | | Small fix to importKey documentation (ASN.1 structure names were incorrect for public keys). Factors of an RSA private key are computed from private exponent d (both slowmath and fastmath).
* | Fix comments in rsaDecrypt(), to match what the code really does.Legrandin2011-01-161-2/+2
|/
* getRandomNumber API compatibility:Dwayne C. Litzenberger2010-08-021-6/+6
| | | | | | | | | | | | | Legrandin's getStrongPrime() patch changed the behaviour of Crypto.Util.number.getRandomNumber() to something that is more like what people would expect, but different from what we did before. This change modifies Crypto.Util.number in the following ways: - Rename getRandomNBitNumber -> getRandomNBitInteger and getRandomNumber -> getRandomInteger - Preserve old behaviour by making getRandomNumber work the same as getRandomNBitInteger. - Emit a DeprecationWarning when the old getRandomNumber is used.
* Fix potential uninitialized use of randfunc pointerDwayne C. Litzenberger2010-06-101-1/+1
| | | | This could occur if getRNG() returns NULL.
* Fix compiler warnings & clean up the code a bit.Dwayne C. Litzenberger2010-06-101-6/+10
|
* getStrongPrime() implementationLorenz Quack2010-06-101-10/+1582
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From http://lists.dlitz.net/pipermail/pycrypto/2009q4/000167.html, with the following explanation included in the email: === snip === Hi there! Here comes my monster patch. It includes a python and C version of getStrongPrime, rabinMillerTest and isPrime. there are also two small unit tests and some helper functions. They all take a randfunc and propagate them (or so I hope). The Rabin-Miller-Test uses random bases (non-deterministic). getStrongPrime and isPrime take an optional parameter "false_positive_prob" where one can specify the maximum probability that the prime is actually composite. Internally the functions calculate the Rabin-Miller rounds from this. It defaults to 1e-6 (1:1000000) which results in 10 rounds of Rabin-Miller testing. Please review this carefully. Even though I tried hard to get things right some bugs always slip through. maybe you could also review the way I acquire and release the GIL. It felt kind of ugly the way I did it but I don't see a better way just now. Concerning the public exponent e: I now know why it needs to be coprime to p-1 and q-1. The private exponent d is the inverse of e mod ((p-1)(q-1)). If e is not coprime to ((p-1)(q-1)) then the inverse does not exist [1]. The getStrongPrime take an optional argument e. if provided the function will make sure p-1 and e are coprime. if e is even (p-1)/2 will be coprime. if e is even then there is a additional constraint: p =/= q mod 8. I can't check for that in getStrongPrime of course but since we hardcoded e to be odd in _RSA.py this should pose no problem. The Baillie-PSW-Test is not included. I tried hard not to use any functionality new than 2.1 but if you find anything feel free to criticize. Also if I didn't get the coding style right either tell me or feel free to correct it yourself. have fun. //Lorenz [1] http://mathworld.wolfram.com/ModularInverse.html === snip ===
* Fix building PyCrypto on Win64 using MS Visual Studio 9.0.Dwayne C. Litzenberger2009-12-131-1/+2
| | | | | Thanks to Nevins Bartolomeo (https://launchpad.net/~nevins-bartolomeo) for contributing this fix.
* block_template.c: Re-acquire the GIL during a nasty error casev2.1.0alpha2Lorenz Quack2009-10-161-0/+2
| | | | | | This error should never occur, but we might as well handle it properly anyway. This fixes https://bugs.launchpad.net/pycrypto/+bug/452195
* Release the global interpreter lock during encryption, decryption, and hashing.Dwayne C. Litzenberger2009-10-127-36/+37
| | | | | | | These are the easy ones. We don't release the GIL on cipher initialization, hash initialization, or hash finalization, because those functions might make Python API calls, and we would need to add a mechism for re-acquiring the GIL in those cases.
* Counter: Add some assert() statementsDwayne C. Litzenberger2009-10-121-0/+18
|
* Check for counter wraparound when encrypting using MODE_CTRDwayne C. Litzenberger2009-10-123-8/+24
| | | | | - Add check_wraparound_func pointer to PCT_CounterObject - Call check_wraparound_func from block_template.c
* Counter: raise OverflowError by default when the counter wraps around.Dwayne C. Litzenberger2009-10-122-3/+18
| | | | | The old behaviour can be obtained by explicitly setting allow_wraparound=True when invoking Counter.new
* Counter: Add 'carry' attribute to counter objectsDwayne C. Litzenberger2009-10-122-2/+12
|
* Counter: Add disable_shortcut keyword argument (to be used for testing)Dwayne C. Litzenberger2009-10-122-13/+21
|
* block_template.c: Allow MODE_CTR to behave as a stream cipherDwayne C. Litzenberger2009-10-121-14/+55
|
* block_template.c: Call ALG_Encrypt when using MODE_CTR, rather than ↵Dwayne C. Litzenberger2009-10-111-57/+5
| | | | duplicating code in ALG_Decrypt
* Counter: Fix compiler warning: initialization from incompatible pointer typeDwayne C. Litzenberger2009-10-111-2/+2
|
* block_template.c: when using MODE_CFB, raise ValueError if segment_size is ↵Dwayne C. Litzenberger2009-10-101-3/+3
| | | | not a multiple of 8 bits
* block_template.c & stream_template.c: Add vim modelinesDwayne C. Litzenberger2009-10-102-0/+3
|
* Remove dead code related to IDEA and RC5Dwayne C. Litzenberger2009-10-101-37/+0
|
* Apply patch to release the GIL inside isPrime()Lorenz Quack2009-10-081-0/+2
| | | | This fixes https://bugs.launchpad.net/pycrypto/+bug/439958
* MD4.c: Update the legal noticeDwayne C. Litzenberger2009-08-031-3/+19
| | | | I have permission to do this. See the LEGAL directory.
* {block,stream,hash}_template.c: Replace the legal noticesDwayne C. Litzenberger2009-08-033-15/+54
| | | | I have permission to do this. See the LEGAL directory.
* _fastmath.c: Replace the legal noticeDwayne C. Litzenberger2009-08-031-3/+19
| | | | I have permission to do this. See the LEGAL directory.
* MD2.c: Replace the legal noticeDwayne C. Litzenberger2009-08-021-3/+19
| | | | I have permission to do this. See the LEGAL directory.
* ARC4.c: Replace the legal noticeDwayne C. Litzenberger2009-08-021-3/+19
| | | | I have permission to do this. See the LEGAL directory.
* SHA256.c: Replace the legal noticeDwayne C. Litzenberger2009-08-021-2/+23
| | | | I have permission to do this. See the LEGAL directory.
* ARC2.c: Replace the legal noticeDwayne C. Litzenberger2009-08-021-4/+35
| | | | | I have permission to do this (provided that the original "rc2.c" code really is in the public domain, which I think it is). See the LEGAL directory.
* DES3.c: Add legal noticeDwayne C. Litzenberger2009-08-021-0/+24
| | | | This is mainly for completeness. The file is almost empty.
* winrand.c: Replace the legal noticeDwayne C. Litzenberger2009-08-021-5/+16
| | | | I have permission to do this. See the LEGAL directory.
* XOR.c: Add attribution and replace the legal noticeDwayne C. Litzenberger2009-08-021-3/+17
| | | | I have permission to do this. See the LEGAL directory.
* tomcrypt_des.c: Add support for two-key Triple-DESDwayne C. Litzenberger2009-08-021-3/+13
| | | | | | | | PyCrypto 2.0.1 supported two-key 3DES, but the default LibTomCrypt imlementation does not. This commit adds two-key 3DES support to the bundled LibTomCrypt implementation.
* block_template.c: Fix what looks like some memory leaks that occur during errorsDwayne C. Litzenberger2009-08-021-0/+4
|
* block_template.c: Fix segfault when using MODE_CTR without specifying ↵Dwayne C. Litzenberger2009-08-021-1/+5
| | | | | | counter= argument Thanks to launchpad.net user "ucg" for noticing this bug.
* src/XOR.c: Fix bug where keys longer than 32 bytes are silently truncatedDwayne C. Litzenberger2009-08-021-3/+13
|
* Resurrect src/XOR.cakuchling2009-08-021-0/+52
| | | | | | | | This partly reverts commit 5b5b496c0f81f3595d0aebb8da5196492abae429. --author='akuchling <akuchling@rivest.dlitz.net>' used so that "git blame" will show the true author of the source code. The author of this *commit* is Dwayne C. Litzenberger.
* Crypto.PublicKey: Raise ValueError/TypeError/RuntimeError instead of the ↵Dwayne C. Litzenberger2009-04-251-9/+9
| | | | | | various custom "error" exceptions At some point, it might be a good idea to remove the custom error classes themselves.