summaryrefslogtreecommitdiff
path: root/cipher/cipher.c
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2013-01-23 11:55:03 +0200
committerWerner Koch <wk@gnupg.org>2013-02-19 11:02:24 +0100
commit537f12ce072d568f9fa344c447d32b2e0efffbe8 (patch)
treebec3f13d3e200e70ac8594cc34927d95898c6a54 /cipher/cipher.c
parent09ac5d87d11aa0b1fa0e0a4184ab03b3671a73e2 (diff)
downloadlibgcrypt-537f12ce072d568f9fa344c447d32b2e0efffbe8.tar.gz
Camellia, prepare glue code for AES-NI/AVX implementation
* cipher/camellia-glue.c (ATTR_ALIGNED_16): Add macro. (CAMELLIA_encrypt_stack_burn_size): Add macro. (camellia_encrypt): Use macro above for stack burn size. (CAMELLIA_decrypt_stack_burn_size): Add macro. (camellia_decrypt): Use macro above for stack burn size. (_gcry_camellia_ctr_enc): New function. (_gcry_camellia_cbc_dec): New function. (selftest_ctr_128): New function. (selftest): Call function above. * cipher/cipher.c (gcry_cipher_open) [USE_CAMELLIA]: Register bulk functions for CBC-decryption and CTR-mode. * src/cipher.h (_gcry_camellia_ctr_enc): New prototype. (_gcry_camellia_cbc_dec): New prototype. -- AES-NI/AVX implementation needs multi-block input, so prepare glue code for that by adding bulk-functions for CBC-decryption and CTR-mode. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Diffstat (limited to 'cipher/cipher.c')
-rw-r--r--cipher/cipher.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/cipher/cipher.c b/cipher/cipher.c
index 389bf7a6..f1224af4 100644
--- a/cipher/cipher.c
+++ b/cipher/cipher.c
@@ -718,6 +718,14 @@ gcry_cipher_open (gcry_cipher_hd_t *handle,
h->bulk.ctr_enc = _gcry_aes_ctr_enc;
break;
#endif /*USE_AES*/
+#ifdef USE_CAMELLIA
+ case GCRY_CIPHER_CAMELLIA128:
+ case GCRY_CIPHER_CAMELLIA192:
+ case GCRY_CIPHER_CAMELLIA256:
+ h->bulk.cbc_dec = _gcry_camellia_cbc_dec;
+ h->bulk.ctr_enc = _gcry_camellia_ctr_enc;
+ break;
+#endif /*USE_CAMELLIA*/
default:
break;