+2020-11-24 Niels Möller <nisse@lysator.liu.se>
+
+ Enable ppc chacha_2core in fat builds.
+ * configure.ac: Add HAVE_NATIVE_fat_chacha_2core.
+ * chacha-crypt.c: Check HAVE_NATIVE_fat_chacha_2core.
+ * chacha-internal.h (_chacha_crypt_2core, _chacha_crypt32_2core):
+ Add declarations.
+ * fat-ppc.c (fat_init): Use _nettle_chacha_crypt_2core and
+ _nettle_chacha_crypt32_2core when altivec is available.
+ * powerpc64/fat/chacha-2core.asm: New file, including p7 version.
+
2020-11-23 Niels Möller <nisse@lysator.liu.se>
* powerpc64/p7/chacha-2core.asm: New file.
#elif HAVE_NATIVE_chacha_2core
#define _chacha_crypt_2core chacha_crypt
#define _chacha_crypt32_2core chacha_crypt32
-#elif !HAVE_NATIVE_fat_chacha_3core
+#elif !(HAVE_NATIVE_fat_chacha_3core || HAVE_NATIVE_fat_chacha_2core)
#undef _chacha_crypt_1core
#undef _chacha_crypt32_1core
#define _chacha_crypt_1core chacha_crypt
}
#endif
-#if HAVE_NATIVE_chacha_2core
+#if HAVE_NATIVE_chacha_2core || HAVE_NATIVE_fat_chacha_2core
void
_chacha_crypt_2core(struct chacha_ctx *ctx,
size_t length,
}
#endif
-#if HAVE_NATIVE_chacha_2core
+#if HAVE_NATIVE_chacha_2core || HAVE_NATIVE_fat_chacha_2core
void
_chacha_crypt32_2core(struct chacha_ctx *ctx,
size_t length,
}
#endif
-#if !HAVE_NATIVE_chacha_3core
+#if !(HAVE_NATIVE_chacha_3core || HAVE_NATIVE_chacha_2core)
void
_chacha_crypt32_1core(struct chacha_ctx *ctx,
size_t length,
#define _chacha_3core _nettle_chacha_3core
#define _chacha_3core32 _nettle_chacha_3core32
#define _chacha_crypt_1core _nettle_chacha_crypt_1core
+#define _chacha_crypt_2core _nettle_chacha_crypt_2core
#define _chacha_crypt_3core _nettle_chacha_crypt_3core
#define _chacha_crypt32_1core _nettle_chacha_crypt32_1core
+#define _chacha_crypt32_2core _nettle_chacha_crypt32_2core
#define _chacha_crypt32_3core _nettle_chacha_crypt32_3core
void
uint8_t *dst,
const uint8_t *src);
+void
+_chacha_crypt_2core(struct chacha_ctx *ctx,
+ size_t length,
+ uint8_t *dst,
+ const uint8_t *src);
+
void
_chacha_crypt_3core(struct chacha_ctx *ctx,
size_t length,
uint8_t *dst,
const uint8_t *src);
+void
+_chacha_crypt32_2core(struct chacha_ctx *ctx,
+ size_t length,
+ uint8_t *dst,
+ const uint8_t *src);
+
void
_chacha_crypt32_3core(struct chacha_ctx *ctx,
size_t length,
#undef HAVE_NATIVE_chacha_core
#undef HAVE_NATIVE_chacha_2core
#undef HAVE_NATIVE_chacha_3core
+#undef HAVE_NATIVE_fat_chacha_2core
#undef HAVE_NATIVE_fat_chacha_3core
#undef HAVE_NATIVE_ecc_curve25519_modp
#undef HAVE_NATIVE_ecc_curve448_modp
#include "nettle-types.h"
#include "aes-internal.h"
+#include "chacha-internal.h"
#include "gcm.h"
#include "fat-setup.h"
DECLARE_FAT_FUNC_VAR(chacha_core, chacha_core_func, c);
DECLARE_FAT_FUNC_VAR(chacha_core, chacha_core_func, altivec);
+DECLARE_FAT_FUNC(nettle_chacha_crypt, chacha_crypt_func)
+DECLARE_FAT_FUNC_VAR(chacha_crypt, chacha_crypt_func, 1core)
+DECLARE_FAT_FUNC_VAR(chacha_crypt, chacha_crypt_func, 3core)
+
+DECLARE_FAT_FUNC(nettle_chacha_crypt32, chacha_crypt_func)
+DECLARE_FAT_FUNC_VAR(chacha_crypt32, chacha_crypt_func, 1core)
+DECLARE_FAT_FUNC_VAR(chacha_crypt32, chacha_crypt_func, 3core)
+
static void CONSTRUCTOR
fat_init (void)
{
if (verbose)
fprintf (stderr, "libnettle: enabling altivec code.\n");
_nettle_chacha_core_vec = _nettle_chacha_core_altivec;
+ nettle_chacha_crypt_vec = _nettle_chacha_crypt_2core;
+ nettle_chacha_crypt32_vec = _nettle_chacha_crypt32_2core;
}
else
{
_nettle_chacha_core_vec = _nettle_chacha_core_c;
+ nettle_chacha_crypt_vec = _nettle_chacha_crypt_1core;
+ nettle_chacha_crypt32_vec = _nettle_chacha_crypt32_1core;
}
}
DEFINE_FAT_FUNC(_nettle_chacha_core, void,
(uint32_t *dst, const uint32_t *src, unsigned rounds),
(dst, src, rounds))
+
+DEFINE_FAT_FUNC(nettle_chacha_crypt, void,
+ (struct chacha_ctx *ctx,
+ size_t length,
+ uint8_t *dst,
+ const uint8_t *src),
+ (ctx, length, dst, src))
+
+DEFINE_FAT_FUNC(nettle_chacha_crypt32, void,
+ (struct chacha_ctx *ctx,
+ size_t length,
+ uint8_t *dst,
+ const uint8_t *src),
+ (ctx, length, dst, src))
--- /dev/null
+C powerpc64/fat/chacha-2core.asm
+
+
+ifelse(`
+ Copyright (C) 2020 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_fat_chacha_2core) picked up by configure
+
+include_src(`powerpc64/p7/chacha-2core.asm')