summaryrefslogtreecommitdiff
path: root/src/block_template.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #62 (Fixes AESNI alignment bug)Dwayne Litzenberger2014-02-221-0/+1
|\
| * Add block_finalize to clean up block_state from ALGdeallocSebastian Ramacher2013-10-281-0/+1
| | | | | | | | | | | | This is the counterpart to block_init which is called from ALGnew. Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
* | Throw exception when IV is used with ECB or CTRLegrandin2014-02-211-0/+11
|/ | | | | | | | | | | | The IV parameter is currently ignored when initializing a cipher in ECB or CTR mode. For CTR mode, it is confusing: it takes some time to see that a different parameter is needed (the counter). For ECB mode, it is outright dangerous. This patch forces an exception to be raised.
* block_template: Fix compiler warning (%i -> %zi)Dwayne Litzenberger2013-10-201-1/+1
| | | | | | | | | | | This fixes this warning: In file included from src/CAST.c:453:0: src/block_template.c: In function ‘ALG_Encrypt’: src/block_template.c:426:12: warning: format ‘%i’ expects argument of type ‘int’, but argument 3 has type ‘Py_ssize_t’ [-Wformat=] ctr->buf_size, BLOCK_SIZE); ^
* Clarify message about incorrect length in the counter block.Legrandin2013-10-201-2/+2
| | | | | | When the counter function returns an incorrect counter block to the cipher in CTR mode, the error message includes both the required and the provided amount of data (in bytes).
* Fixed MODE_OFB requiring paddingdev-jjc2013-07-141-20/+42
| | | | | | Closes: https://bugs.launchpad.net/pycrypto/+bug/996193 Closes: https://github.com/dlitz/pycrypto/pull/26 [dlitz: Squashed and fixed whitespace.]
* Improve C extension autodocsDwayne Litzenberger2013-07-141-0/+23
| | | | | | | | - Add __all__ to C cipher & hash modules - Update hash module docstrings to document the block_size and digest_size variables. Closes: https://bugs.launchpad.net/pycrypto/+bug/1179255
* Py3k cleanup: bytes/string -> bytestring in error messagesDwayne Litzenberger2013-07-141-15/+3
|
* Py3k cleanup: Module initializationDwayne Litzenberger2013-07-141-26/+40
|
* Py3k cleanup: Always use tp_getattroDwayne Litzenberger2013-07-141-32/+12
|
* Py3k cleanup: PyMODINIT_FUNCDwayne Litzenberger2013-07-141-4/+0
|
* Py3k cleanup: PyVarObject_HEAD_INITDwayne Litzenberger2013-07-141-5/+0
|
* Py3k cleanup: PyType_ReadyDwayne Litzenberger2013-07-141-2/+3
|
* Py3k cleanup: PyInt_CheckExact & PyInt_AS_LONGDwayne Litzenberger2013-07-141-11/+0
|
* Py3k cleanup: staticforward and Py_TYPEDwayne Litzenberger2013-07-141-4/+2
|
* Py3k cleanup: METH_ODwayne Litzenberger2013-07-141-5/+0
|
* Py3k cleanup: PyModule_AddIntConstantDwayne Litzenberger2013-07-141-3/+0
|
* Py3k cleanup: Remove unused is_ALGobject macroDwayne Litzenberger2013-07-141-2/+0
|
* Py3k cleanup: Define PyInt_FromLong for Python 3.x and use itDwayne Litzenberger2013-07-141-4/+3
| | | | | | This is the first of a series of changes that aims to reduce code duplication between the Python 3 and Python 2 versions of the C extensions.
* Add ABI check when importing _counter from block_templateDwayne Litzenberger2013-07-141-0/+14
|
* Counter: Deprecate disable_shortcut; Remove __PCT_CTR_SHORTCUT__ entirelyDwayne Litzenberger2013-07-141-0/+1
| | | | | | | | | | | | The `disable_shortcut` option served as a workaround in case `__PCT_CTR_SHORTCUT__` leaked through a wrapper object, but I don't think anyone actually used it, and it was a bad idea to expose it as part of the public API. Now that we do strong type checking inside block_template.c, there shoujld be no need to ever use this option. It's now a no-op, retained for backward compatibility only. It will be removed in some future version of PyCrypto.
* Fix MODE_CTR memory leak under Python 3Dwayne Litzenberger2013-07-141-5/+13
| | | | | | | | | The leak arose from the string creation in this line: PyObject_HasAttr(counter, PyUnicode_FromString("__PCT_CTR_SHORTCUT__")) This commit replaces the __PCT_CTR_SHORTCUT__ hack with code that imports the _counter module and checks the appropriate types.
* Add pycrypto_common.h and clean up a bunch of miscellaneous includes & typedefsDwayne Litzenberger2013-04-211-12/+2
|
* Fix compiler warning about "_POSIX_C_SOURCE" being redefined in string.hDwayne Litzenberger2013-02-171-1/+1
| | | | The solution is to include Python.h before string.h is included.
* Fix block ciphers allowing empty string as IVDwayne C. Litzenberger2012-05-241-1/+1
| | | | Bug report: https://bugs.launchpad.net/pycrypto/+bug/997464
* In ALGnew, check the mode before checking other parametersDwayne C. Litzenberger2012-05-241-15/+15
|
* Removed PGP mode from block ciphersLegrandin2012-05-141-137/+9
|
* Merge branch 'master' into py3kDwayne C. Litzenberger2011-10-101-1/+0
|\ | | | | | | | | | | Conflicts: setup.py src/_fastmath.c
| * fix double-decref of "counter" when Cipher object initialisation failsRyan Kelly2011-03-071-1/+0
| |
* | Changes to allow pycrpyto to work on Python 3.x as well as 2.1 through 2.7Thorsten Behrens2010-12-281-25/+153
|/
* 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-121-1/+13
| | | | | | | 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.
* Check for counter wraparound when encrypting using MODE_CTRDwayne C. Litzenberger2009-10-121-0/+4
| | | | | - Add check_wraparound_func pointer to PCT_CounterObject - Call check_wraparound_func from block_template.c
* 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
* 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-101-0/+1
|
* Remove dead code related to IDEA and RC5Dwayne C. Litzenberger2009-10-101-37/+0
|
* {block,stream,hash}_template.c: Replace the legal noticesDwayne C. Litzenberger2009-08-031-5/+18
| | | | I have permission to do this. See the LEGAL directory.
* 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.
* Util.Counter: Speed up CTR mode using shortcutDwayne C. Litzenberger2008-10-191-44/+97
| | | | | This change allows CTR-mode ciphers to bypass the Python function call mechanism when using counter objects created using Crypto.Util.Counter.
* RC5: Fix buffer overrun and test failures.Dwayne C. Litzenberger2008-09-161-3/+3
| | | | | | | | | Before this fix, the RC5 module would overrun its "L" buffer whenever the specified number of rounds exceeded 49 (the runtime check allowed up to 255 rounds). Also, any time the length of the key was less than a multiple of 4 bytes, the RC5 module would operate incorrectly. This commit fixes both bugs.
* ARC2: Add 'effective_keylen' keyword parameter so we can pass the RFC 2268 testsDwayne C. Litzenberger2008-09-141-0/+23
|
* [project @ robey@lag.net-20060815024756-0ee4d018bde70abe]Robey Pointer2006-08-141-5/+5
| | | | fix a few gcc warnings about signed/unsigned char and system-header-defined macros
* [project @ akuchling-20020611190733-3139cc16cc4686a4]akuchling2002-06-111-0/+1
| | | | | [project @ 2002-06-11 12:07:33 by akuchling] Fix refcounting bug that caused core dumps (bug #567202, bug #567203
* [project @ akuchling-20020525015109-687c9cfd7ee58cf9]akuchling2002-05-241-1/+9
| | | | | | | | | [project @ 2002-05-24 18:51:09 by akuchling] Overwriting the object is safe in Python 2.2, but not in Python 2.1 because _PyObject_Del() looks at the type pointer to see if the type is GCed or not. Instead, just zap the block cipher states and all the other fields in ALGobject. In the allocator, set the counter field to NULL.
* [project @ akuchling-20020524234241-bc4dc6959b6bf706]akuchling2002-05-241-1/+1
| | | | | [project @ 2002-05-24 16:42:41 by akuchling] Oops: PyObject_Del is actually the name to use
* [project @ akuchling-20020524225121-d7c667dfcda3cee8]akuchling2002-05-241-2/+2
| | | | | [project @ 2002-05-24 15:51:21 by akuchling] Use canonical functions for allocating/deallocating objects