borg/attic/testsuite
Thomas Waldmann 6c7c2e2e40 cleanup crypto.pyx, make it easier to adapt to other modes
There were some small issues:

 a) it never called EVP_EncryptFinal_ex.
For CTR mode, this had no visible consequences as EVP_EncryptUpdate already yielded all ciphertext.
For cleanliness and to have correctness even in other modes, the missing call was added.

b) decrypt = encrypt hack
This is a nice hack to abbreviate, but it only works for modes without padding and without authentication.
For cleanliness and to have correctness even in other modes, the missing usage of the decrypt api was added.

c) outl == inl assumption
Again, True for CTR mode, but not for padding or authenticating modes.
Fixed so it computes the ciphertext / plaintext length based on api return values.

Other changes:
As encrypt and decrypt API calls are different even for initialization/reset, added a is_encrypt flag.

Defensive output buffer allocation. Added the length of one extra AES block (16bytes) so it would
work even with padding modes. 16bytes are needed because a full block of padding might get
added when the plaintext was a multiple of aes block size.

These changes are based on some experimental code I did for aes-cbc and aes-gcm.
While we likely won't ever want aes-cbc in attic (maybe gcm though?), I think it is cleaner
to not make too many mode specific assumptions and hacks, but just use the API as it
was meant to be used.
2015-03-03 19:19:28 +01:00
..
__init__.py Added support for stripping leading path segments 2014-08-02 22:15:21 +02:00
archive.py check: Make item stream resync a bit more robust 2014-03-04 21:15:52 +01:00
archiver.py Fix "Number of files" output for attic info. 2014-10-27 22:00:56 +01:00
chunker.py Reuse chunker buffer between files. 2014-08-03 15:04:41 +02:00
crypto.py cleanup crypto.pyx, make it easier to adapt to other modes 2015-03-03 19:19:28 +01:00
hashindex.py HashIndex: Switch to a non-mmap based implementation 2014-07-10 15:32:29 +02:00
helpers.py Fix minor location parser bug. 2014-08-08 23:34:27 +02:00
key.py Crypto code cleanup and test improvements. 2013-08-12 14:39:14 +02:00
lrucache.py Project rename 2013-07-09 20:14:18 +02:00
mock.py Automatically replay segments to rebuild missing repository index 2014-02-20 23:49:35 +01:00
platform.py acl: Added workaround for old Linux systems 2014-08-01 15:50:18 +02:00
repository.py Introduce a separate exception for missing repository objects 2014-10-09 20:41:47 +02:00
run.py Project rename 2013-07-09 20:14:18 +02:00
xattr.py xattr: Fix issue with empty (0 bytes) xattr values. 2014-12-14 14:28:33 +01:00