Replace the aes256gcm implementation with Romain Dolbeau's implementation

which is slightly faster than mine.
Reimplement features from the previous implementation: add batch mode and
use two passes in the decryption function in order to check the tag before
decrypting.
This commit is contained in:
Frank Denis 2015-10-10 10:49:54 +02:00
parent ef1417bc2f
commit ab2e86748e
5 changed files with 706 additions and 387 deletions

View File

@ -32,6 +32,9 @@ scrypt Colin Percival
Implementors
============
crypto_aead/aes256gcm/aesni Romain Dolbeau
Frank Denis
crypto_aead/chacha20poly1305 Frank Denis
crypto_box/curve25519xsalsa20poly1305 Daniel J. Bernstein

View File

@ -211,13 +211,8 @@ AX_CHECK_COMPILE_FLAG([-Wwrite-strings], [CFLAGS="$CFLAGS -Wwrite-strings"])
AX_CHECK_COMPILE_FLAG([-Wdiv-by-zero], [CFLAGS="$CFLAGS -Wdiv-by-zero"])
AX_CHECK_COMPILE_FLAG([-Wsometimes-uninitialized], [CFLAGS="$CFLAGS -Wsometimes-uninitialized"])
AX_CHECK_COMPILE_FLAG([$CFLAGS -mmmx], [CFLAGS="$CFLAGS -mmmx"])
AX_CHECK_COMPILE_FLAG([$CFLAGS -msse], [CFLAGS="$CFLAGS -msse"])
AX_CHECK_COMPILE_FLAG([$CFLAGS -msse2], [CFLAGS="$CFLAGS -msse2"])
AX_CHECK_COMPILE_FLAG([$CFLAGS -msse3], [CFLAGS="$CFLAGS -msse3"])
AX_CHECK_COMPILE_FLAG([$CFLAGS -mssse3], [CFLAGS="$CFLAGS -mssse3"])
AX_CHECK_COMPILE_FLAG([$CFLAGS -maes], [CFLAGS="$CFLAGS -maes"])
AX_CHECK_COMPILE_FLAG([$CFLAGS -mpclmul], [CFLAGS="$CFLAGS -mpclmul"])
AC_MSG_CHECKING([Checking if we can compile for westmere])
AX_CHECK_COMPILE_FLAG([-march=westmere $CFLAGS], [CFLAGS="-march=westmere $CFLAGS"])
AC_ARG_VAR([CWFLAGS], [define to compilation flags for generating extra warnings])

View File

@ -12,11 +12,24 @@ extern "C" {
#endif
#define crypto_aead_aes256gcm_KEYBYTES 32U
#define crypto_aead_aes256gcm_NSECBYTES 0U
#define crypto_aead_aes256gcm_NPUBBYTES 12U
#define crypto_aead_aes256gcm_ABYTES 16U
SODIUM_EXPORT
size_t crypto_aead_aes256gcm_aesni_keybytes(void);
typedef CRYPTO_ALIGN(128) unsigned char crypto_aead_aes256gcm_aesni_state[384];
#define crypto_aead_aes256gcm_NSECBYTES 0U
SODIUM_EXPORT
size_t crypto_aead_aes256gcm_aesni_nsecbytes(void);
#define crypto_aead_aes256gcm_NPUBBYTES 12U
SODIUM_EXPORT
size_t crypto_aead_aes256gcm_aesni_npubbytes(void);
#define crypto_aead_aes256gcm_ABYTES 16U
SODIUM_EXPORT
size_t crypto_aead_aes256gcm_aesni_abytes(void);
typedef CRYPTO_ALIGN(16) unsigned char crypto_aead_aes256gcm_aesni_state[272];
SODIUM_EXPORT
size_t crypto_aead_aes256gcm_aesni_statebytes(void);
SODIUM_EXPORT
int crypto_aead_aes256gcm_aesni_encrypt(unsigned char *c,

View File

@ -30,7 +30,7 @@
#endif
#ifndef CRYPTO_ALIGN
# if defined(_MSC_VER)
# if defined(__INTEL_COMPILER) || defined(_MSC_VER)
# define CRYPTO_ALIGN(x) __declspec(align(x))
# else
# define CRYPTO_ALIGN(x) __attribute__((aligned(x)))