diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-11-09 22:39:19 +0200 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-11-09 22:39:19 +0200 |
commit | df29831d008e32faf74091d080a415731418d158 (patch) | |
tree | 384cc216ede33e8aacb2363de307b171c36ed1d3 /cipher/camellia-glue.c | |
parent | 51501b638546665163bbb85a14308fdb99211a28 (diff) | |
download | libgcrypt-df29831d008e32faf74091d080a415731418d158.tar.gz |
Fix Serpent-AVX2 and Camellia-AVX2 counter modes
* cipher/camellia-aesni-avx2-amd64.S
(_gcry_camellia_aesni_avx2_ctr_enc): Byte-swap before checking for
overflow handling.
* cipher/camellia-glue.c (selftest_ctr_128, selftest_cfb_128)
(selftest_cbc_128): Add 16 to nblocks.
* cipher/cipher-selftest.c (_gcry_selftest_helper_ctr): Add test with
non-overflowing IV and modify overflow IV to detect broken endianness
handling.
* cipher/serpent-avx2-amd64.S (_gcry_serpent_avx2_ctr_enc): Byte-swap
before checking for overflow handling; Fix crazy-mixed-endian IV
construction to big-endian.
* cipher/serpent.c (selftest_ctr_128, selftest_cfb_128)
(selftest_cbc_128): Add 8 to nblocks.
--
The selftest for CTR was setting counter-IV to all '0xff' except last byte.
This had the effect that even with broken endianness handling Serpent-AVX2 and
Camellia-AVX2 passed the tests.
Patch corrects the CTR selftest and fixes the broken implementations.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/camellia-glue.c')
-rw-r--r-- | cipher/camellia-glue.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cipher/camellia-glue.c b/cipher/camellia-glue.c index 42b62d2c..b7ae0fc2 100644 --- a/cipher/camellia-glue.c +++ b/cipher/camellia-glue.c @@ -537,7 +537,7 @@ _gcry_camellia_cfb_dec(void *context, unsigned char *iv, static const char* selftest_ctr_128 (void) { - const int nblocks = 32+1; + const int nblocks = 32+16+1; const int blocksize = CAMELLIA_BLOCK_SIZE; const int context_size = sizeof(CAMELLIA_context); @@ -551,7 +551,7 @@ selftest_ctr_128 (void) static const char* selftest_cbc_128 (void) { - const int nblocks = 32+2; + const int nblocks = 32+16+2; const int blocksize = CAMELLIA_BLOCK_SIZE; const int context_size = sizeof(CAMELLIA_context); @@ -565,7 +565,7 @@ selftest_cbc_128 (void) static const char* selftest_cfb_128 (void) { - const int nblocks = 32+2; + const int nblocks = 32+16+2; const int blocksize = CAMELLIA_BLOCK_SIZE; const int context_size = sizeof(CAMELLIA_context); |