* x86_64/aesni/cbc-aes128-encrypt.asm: New file.
* x86_64/aesni/cbc-aes192-encrypt.asm: New file.
* x86_64/aesni/cbc-aes256-encrypt.asm: New file.
- * configure.ac (asm_replace_list): Add new asm files.
+ * x86_64/fat/cbc-aes128-encrypt-2.asm: New file.
+ * x86_64/fat/cbc-aes192-encrypt-2.asm: New file.
+ * x86_64/fat/cbc-aes256-encrypt-2.asm: New file.
+ * configure.ac (asm_nettle_optional_list, asm_replace_list): Add
+ new asm files.
+ * fat-setup.h (cbc_aes128_encrypt_func, cbc_aes192_encrypt_func)
+ (cbc_aes256_encrypt_func): New typedefs.
+ * fat-x86_64.c (fat_init): Use new functions, when aesni is available
2021-09-08 Niels Möller <nisse@lysator.liu.se>
#include "cbc.h"
+/* For fat builds */
+#if HAVE_NATIVE_aes128_encrypt
+void
+_nettle_cbc_aes128_encrypt_c(struct cbc_aes128_ctx *ctx,
+ size_t length, uint8_t *dst,
+ const uint8_t *src);
+# define nettle_cbc_aes128_encrypt _nettle_cbc_aes128_encrypt_c
+#endif
+
void
cbc_aes128_encrypt(struct cbc_aes128_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src)
{
#include "cbc.h"
+/* For fat builds */
+#if HAVE_NATIVE_aes192_encrypt
+void
+_nettle_cbc_aes192_encrypt_c(struct cbc_aes192_ctx *ctx,
+ size_t length, uint8_t *dst,
+ const uint8_t *src);
+# define nettle_cbc_aes192_encrypt _nettle_cbc_aes192_encrypt_c
+#endif
+
void
cbc_aes192_encrypt(struct cbc_aes192_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src)
{
#include "cbc.h"
+/* For fat builds */
+#if HAVE_NATIVE_aes256_encrypt
+void
+_nettle_cbc_aes256_encrypt_c(struct cbc_aes256_ctx *ctx,
+ size_t length, uint8_t *dst,
+ const uint8_t *src);
+# define nettle_cbc_aes256_encrypt _nettle_cbc_aes256_encrypt_c
+#endif
+
void
cbc_aes256_encrypt(struct cbc_aes256_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src)
{
aes192-encrypt-2.asm aes192-decrypt-2.asm \
aes256-set-encrypt-key-2.asm aes256-set-decrypt-key-2.asm \
aes256-encrypt-2.asm aes256-decrypt-2.asm \
+ cbc-aes128-encrypt-2.asm cbc-aes192-encrypt-2.asm cbc-aes256-encrypt-2.asm \
chacha-2core.asm chacha-3core.asm chacha-4core.asm chacha-core-internal-2.asm \
salsa20-2core.asm salsa20-core-internal-2.asm \
sha1-compress-2.asm sha256-compress-2.asm \
#undef HAVE_NATIVE_aes256_invert_key
#undef HAVE_NATIVE_aes256_set_decrypt_key
#undef HAVE_NATIVE_aes256_set_encrypt_key
+#undef HAVE_NATIVE_cbc_aes128_encrypt
+#undef HAVE_NATIVE_cbc_aes192_encrypt
+#undef HAVE_NATIVE_cbc_aes256_encrypt
#undef HAVE_NATIVE_chacha_core
#undef HAVE_NATIVE_chacha_2core
#undef HAVE_NATIVE_chacha_3core
typedef void aes256_invert_key_func (struct aes256_ctx *dst, const struct aes256_ctx *src);
typedef void aes256_crypt_func (const struct aes256_ctx *ctx, size_t length, uint8_t *dst,
const uint8_t *src);
+
+struct cbc_aes128_ctx;
+typedef void cbc_aes128_encrypt_func (struct cbc_aes128_ctx *ctx,
+ size_t length, uint8_t *dst, const uint8_t *src);
+struct cbc_aes192_ctx;
+typedef void cbc_aes192_encrypt_func (struct cbc_aes192_ctx *ctx,
+ size_t length, uint8_t *dst, const uint8_t *src);
+struct cbc_aes256_ctx;
+typedef void cbc_aes256_encrypt_func (struct cbc_aes256_ctx *ctx,
+ size_t length, uint8_t *dst, const uint8_t *src);
DECLARE_FAT_FUNC_VAR(aes256_decrypt, aes256_crypt_func, c)
DECLARE_FAT_FUNC_VAR(aes256_decrypt, aes256_crypt_func, aesni)
+DECLARE_FAT_FUNC(nettle_cbc_aes128_encrypt, cbc_aes128_encrypt_func);
+DECLARE_FAT_FUNC_VAR(cbc_aes128_encrypt, cbc_aes128_encrypt_func, c);
+DECLARE_FAT_FUNC_VAR(cbc_aes128_encrypt, cbc_aes128_encrypt_func, aesni);
+DECLARE_FAT_FUNC(nettle_cbc_aes192_encrypt, cbc_aes192_encrypt_func);
+DECLARE_FAT_FUNC_VAR(cbc_aes192_encrypt, cbc_aes192_encrypt_func, c);
+DECLARE_FAT_FUNC_VAR(cbc_aes192_encrypt, cbc_aes192_encrypt_func, aesni);
+DECLARE_FAT_FUNC(nettle_cbc_aes256_encrypt, cbc_aes256_encrypt_func);
+DECLARE_FAT_FUNC_VAR(cbc_aes256_encrypt, cbc_aes256_encrypt_func, c);
+DECLARE_FAT_FUNC_VAR(cbc_aes256_encrypt, cbc_aes256_encrypt_func, aesni);
+
DECLARE_FAT_FUNC(nettle_memxor, memxor_func)
DECLARE_FAT_FUNC_VAR(memxor, memxor_func, x86_64)
DECLARE_FAT_FUNC_VAR(memxor, memxor_func, sse2)
nettle_aes192_decrypt_vec = _nettle_aes192_decrypt_aesni;
nettle_aes256_encrypt_vec = _nettle_aes256_encrypt_aesni;
nettle_aes256_decrypt_vec = _nettle_aes256_decrypt_aesni;
+ nettle_cbc_aes128_encrypt_vec = _nettle_cbc_aes128_encrypt_aesni;
+ nettle_cbc_aes192_encrypt_vec = _nettle_cbc_aes192_encrypt_aesni;
+ nettle_cbc_aes256_encrypt_vec = _nettle_cbc_aes256_encrypt_aesni;
}
else
{
nettle_aes192_decrypt_vec = _nettle_aes192_decrypt_c;
nettle_aes256_encrypt_vec = _nettle_aes256_encrypt_c;
nettle_aes256_decrypt_vec = _nettle_aes256_decrypt_c;
+ nettle_cbc_aes128_encrypt_vec = _nettle_cbc_aes128_encrypt_c;
+ nettle_cbc_aes192_encrypt_vec = _nettle_cbc_aes192_encrypt_c;
+ nettle_cbc_aes256_encrypt_vec = _nettle_cbc_aes256_encrypt_c;
}
if (features.have_sha_ni)
uint8_t *dst,const uint8_t *src),
(ctx, length, dst, src))
+DEFINE_FAT_FUNC(nettle_cbc_aes128_encrypt, void,
+ (struct cbc_aes128_ctx *ctx,
+ size_t length, uint8_t *dst, const uint8_t *src),
+ (ctx, length, dst, src))
+DEFINE_FAT_FUNC(nettle_cbc_aes192_encrypt, void,
+ (struct cbc_aes192_ctx *ctx,
+ size_t length, uint8_t *dst, const uint8_t *src),
+ (ctx, length, dst, src))
+DEFINE_FAT_FUNC(nettle_cbc_aes256_encrypt, void,
+ (struct cbc_aes256_ctx *ctx,
+ size_t length, uint8_t *dst, const uint8_t *src),
+ (ctx, length, dst, src))
+
DEFINE_FAT_FUNC(nettle_memxor, void *,
(void *dst, const void *src, size_t n),
(dst, src, n))
--- /dev/null
+C x86_64/fat/cbc-aes128-encrypt.asm
+
+ifelse(`
+ Copyright (C) 2021 Niels Möller
+
+ This file is part of GNU Nettle.
+
+ GNU Nettle is free software: you can redistribute it and/or
+ modify it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ or both in parallel, as here.
+
+ GNU Nettle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see http://www.gnu.org/licenses/.
+')
+
+dnl PROLOGUE(nettle_cbc_aes128_encrypt) picked up by configure
+
+define(`fat_transform', `_$1_aesni')
+include_src(`x86_64/aesni/cbc-aes128-encrypt.asm')
--- /dev/null
+C x86_64/fat/cbc_aes192-encrypt.asm
+
+ifelse(`
+ Copyright (C) 2021 Niels Möller
+
+ This file is part of GNU Nettle.
+
+ GNU Nettle is free software: you can redistribute it and/or
+ modify it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ or both in parallel, as here.
+
+ GNU Nettle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see http://www.gnu.org/licenses/.
+')
+
+dnl PROLOGUE(nettle_cbc_aes192_encrypt) picked up by configure
+
+define(`fat_transform', `_$1_aesni')
+include_src(`x86_64/aesni/cbc-aes192-encrypt.asm')
--- /dev/null
+C x86_64/fat/cbc_aes256-encrypt.asm
+
+ifelse(`
+ Copyright (C) 2021 Niels Möller
+
+ This file is part of GNU Nettle.
+
+ GNU Nettle is free software: you can redistribute it and/or
+ modify it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ or both in parallel, as here.
+
+ GNU Nettle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see http://www.gnu.org/licenses/.
+')
+
+dnl PROLOGUE(nettle_cbc_aes256_encrypt) picked up by configure
+
+define(`fat_transform', `_$1_aesni')
+include_src(`x86_64/aesni/cbc-aes256-encrypt.asm')