diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2015-07-26 23:39:51 +0300 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2015-07-27 11:47:18 +0300 |
commit | e950052bc6f5ff11a7c23091ff3f6b5cc431e875 (patch) | |
tree | 291e96b0a2ed67cac7f5e8bb5f95ef699ddb1094 /cipher/rijndael.c | |
parent | adbdca0d58f9c06dc3850b95e3455e179c1e6960 (diff) | |
download | libgcrypt-e950052bc6f5ff11a7c23091ff3f6b5cc431e875.tar.gz |
Reduce amount of duplicated code in OCB bulk implementations
* cipher/cipher-ocb.c (_gcry_cipher_ocb_authenticate)
(ocb_crypt): Change bulk function to return number of unprocessed
blocks.
* src/cipher.h (_gcry_aes_ocb_crypt, _gcry_aes_ocb_auth)
(_gcry_camellia_ocb_crypt, _gcry_camellia_ocb_auth)
(_gcry_serpent_ocb_crypt, _gcry_serpent_ocb_auth)
(_gcry_twofish_ocb_crypt, _gcry_twofish_ocb_auth): Change return type
to 'size_t'.
* cipher/camellia-glue.c (get_l): Only if USE_AESNI_AVX or
USE_AESNI_AVX2 defined.
(_gcry_camellia_ocb_crypt, _gcry_camellia_ocb_auth): Change return type
to 'size_t' and return remaining blocks; Remove unaccelerated common
code path. Enable remaining common code only if USE_AESNI_AVX or
USE_AESNI_AVX2 defined; Remove unaccelerated common code.
* cipher/rijndael.c (_gcry_aes_ocb_crypt, _gcry_aes_ocb_auth): Change
return type to 'size_t' and return zero.
* cipher/serpent.c (get_l): Only if USE_SSE2, USE_AVX2 or USE_NEON
defined.
(_gcry_serpent_ocb_crypt, _gcry_serpent_ocb_auth): Change return type
to 'size_t' and return remaining blocks; Remove unaccelerated common
code path. Enable remaining common code only if USE_SSE2, USE_AVX2 or
USE_NEON defined; Remove unaccelerated common code.
* cipher/twofish.c (get_l): Only if USE_AMD64_ASM defined.
(_gcry_twofish_ocb_crypt, _gcry_twofish_ocb_auth): Change return type
to 'size_t' and return remaining blocks; Remove unaccelerated common
code path. Enable remaining common code only if USE_AMD64_ASM defined;
Remove unaccelerated common code.
--
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/rijndael.c')
-rw-r--r-- | cipher/rijndael.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cipher/rijndael.c b/cipher/rijndael.c index 1fe16d60..4368c6da 100644 --- a/cipher/rijndael.c +++ b/cipher/rijndael.c @@ -1200,7 +1200,7 @@ _gcry_aes_cbc_dec (void *context, unsigned char *iv, /* Bulk encryption/decryption of complete blocks in OCB mode. */ -void +size_t _gcry_aes_ocb_crypt (gcry_cipher_hd_t c, void *outbuf_arg, const void *inbuf_arg, size_t nblocks, int encrypt) { @@ -1303,11 +1303,13 @@ _gcry_aes_ocb_crypt (gcry_cipher_hd_t c, void *outbuf_arg, if (burn_depth) _gcry_burn_stack (burn_depth + 4 * sizeof(void *)); + + return 0; } /* Bulk authentication of complete blocks in OCB mode. */ -void +size_t _gcry_aes_ocb_auth (gcry_cipher_hd_t c, const void *abuf_arg, size_t nblocks) { RIJNDAEL_context *ctx = (void *)&c->context.c; @@ -1364,6 +1366,8 @@ _gcry_aes_ocb_auth (gcry_cipher_hd_t c, const void *abuf_arg, size_t nblocks) if (burn_depth) _gcry_burn_stack (burn_depth + 4 * sizeof(void *)); + + return 0; } |