Add size optimized cipher block copy and xor functions master
authorJussi Kivilinna <jussi.kivilinna@iki.fi>
Sat, 21 Jul 2018 08:56:46 +0000 (11:56 +0300)
committerJussi Kivilinna <jussi.kivilinna@iki.fi>
Sat, 21 Jul 2018 08:56:46 +0000 (11:56 +0300)
commit86e5e06a97ae13b8bbf6923ecc76e02b9c429b46
treecedf1ba84f981293efe492dd2cff3991cb6013ed
parent9660c3fafd732b1857bb2697c6f43aed077b9ad6
Add size optimized cipher block copy and xor functions

* cipher/bufhelp.h (buf_get_he32, buf_put_he32, buf_get_he64)
(buf_put_he64): New.
* cipher/cipher-internal.h (cipher_block_cpy, cipher_block_xor)
(cipher_block_xor_1, cipher_block_xor_2dst, cipher_block_xor_n_copy_2)
(cipher_block_xor_n_copy): New.
* cipher/cipher-gcm-intel-pclmul.c
(_gcry_ghash_setup_intel_pclmul): Use assembly for swapping endianness
instead of buf_get_be64 and buf_cpy.
* cipher/blowfish.c: Use new cipher_block_* functions for cipher block
sized buf_cpy/xor* operations.
* cipher/camellia-glue.c: Ditto.
* cipher/cast5.c: Ditto.
* cipher/cipher-aeswrap.c: Ditto.
* cipher/cipher-cbc.c: Ditto.
* cipher/cipher-ccm.c: Ditto.
* cipher/cipher-cfb.c: Ditto.
* cipher/cipher-cmac.c: Ditto.
* cipher/cipher-ctr.c: Ditto.
* cipher/cipher-eax.c: Ditto.
* cipher/cipher-gcm.c: Ditto.
* cipher/cipher-ocb.c: Ditto.
* cipher/cipher-ofb.c: Ditto.
* cipher/cipher-xts.c: Ditto.
* cipher/des.c: Ditto.
* cipher/rijndael.c: Ditto.
* cipher/serpent.c: Ditto.
* cipher/twofish.c: Ditto.
--

This commit adds size-optimized functions for copying and xoring
cipher block sized buffers. These functions also allow GCC to use
inline auto-vectorization for block cipher copying and xoring on
higher optimization levels.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
21 files changed:
cipher/blowfish.c
cipher/bufhelp.h
cipher/camellia-glue.c
cipher/cast5.c
cipher/cipher-aeswrap.c
cipher/cipher-cbc.c
cipher/cipher-ccm.c
cipher/cipher-cfb.c
cipher/cipher-cmac.c
cipher/cipher-ctr.c
cipher/cipher-eax.c
cipher/cipher-gcm-intel-pclmul.c
cipher/cipher-gcm.c
cipher/cipher-internal.h
cipher/cipher-ocb.c
cipher/cipher-ofb.c
cipher/cipher-xts.c
cipher/des.c
cipher/rijndael.c
cipher/serpent.c
cipher/twofish.c