summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--configure.ac14
-rw-r--r--fat-setup.h11
-rw-r--r--salsa20-core-internal.c7
-rw-r--r--sha3-permute.c7
-rw-r--r--sha512-compress.c7
-rw-r--r--umac-nh-n.c8
-rw-r--r--umac-nh.c7
8 files changed, 71 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 67a0baaa..fa25c0ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2015-01-21 Niels Möller <nisse@lysator.liu.se>
+
+ * salsa20-core-internal.c: Prepare for fat build with C and
+ assembly implementations.
+ * sha512-compress.c: Likewise.
+ * sha3-permute.c: Likewise.
+ * umac-nh.c: Likewise.
+ * umac-nh-n.c: Likewise.
+
+ * configure.ac (asm_nettle_optional_list): Added more *-2.asm
+ files, and corresponding HAVE_NATIVE_* defines. Recognize PROLOGUE
+ macro in asm files, also when not at the start of the line.
+
2015-01-20 Niels Möller <nisse@lysator.liu.se>
* fat-arm.c (get_arm_features): Check NETTLE_FAT_OVERRIDE
diff --git a/configure.ac b/configure.ac
index 7b2690d9..ad6dfca8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -306,7 +306,10 @@ asm_replace_list="aes-encrypt-internal.asm aes-decrypt-internal.asm \
# Assembler files which generate additional object files if they are used.
asm_nettle_optional_list="gcm-hash8.asm cpuid.asm \
- aes-encrypt-internal-2.asm aes-decrypt-internal-2.asm memxor-2.asm"
+ aes-encrypt-internal-2.asm aes-decrypt-internal-2.asm memxor-2.asm \
+ salsa20-core-internal-2.asm sha3-permute-2.asm sha512-compress-2.asm \
+ umac-nh-n-2.asm umac-nh-2.asm"
+
asm_hogweed_optional_list=""
if test "x$enable_public_key" = "xyes" ; then
asm_hogweed_optional_list="ecc-192-modp.asm ecc-224-modp.asm \
@@ -343,7 +346,7 @@ if test "x$enable_assembler" = xyes ; then
AC_DEFINE_UNQUOTED(HAVE_NATIVE_$tmp_func)
eval HAVE_NATIVE_$tmp_func=yes
done <<EOF
-[`sed -n 's/[^ ]*PROLOGUE(_*\(nettle_\)*\([^)]*\)).*$/\2/p' < "$srcdir/$asm_dir/$tmp_n"`]
+[`sed -n 's/^.*[^ ]*PROLOGUE(_*\(nettle_\)*\([^)]*\)).*$/\2/p' < "$srcdir/$asm_dir/$tmp_n"`]
EOF
OPT_NETTLE_OBJS="$OPT_NETTLE_OBJS $tmp_b"'.$(OBJEXT)'
break
@@ -408,7 +411,12 @@ AH_VERBATIM([HAVE_NATIVE],
#undef HAVE_NATIVE_ecc_384_redc
#undef HAVE_NATIVE_ecc_521_modp
#undef HAVE_NATIVE_ecc_521_redc
-#undef HAVE_NATIVE_gcm_hash8])
+#undef HAVE_NATIVE_gcm_hash8
+#undef HAVE_NATIVE_salsa20_core
+#undef HAVE_NATIVE_sha512_compress
+#undef HAVE_NATIVE_sha3_permute
+#undef HAVE_NATIVE_umac_nh
+#undef HAVE_NATIVE_umac_nh_n])
if test "x$enable_pic" = xyes; then
LSH_CCPIC
diff --git a/fat-setup.h b/fat-setup.h
index f437b4ee..ea78a188 100644
--- a/fat-setup.h
+++ b/fat-setup.h
@@ -142,3 +142,14 @@ typedef void aes_crypt_internal_func (unsigned rounds, const uint32_t *keys,
const uint8_t *src);
typedef void *(memxor_func)(void *dst, const void *src, size_t n);
+
+typedef void salsa20_core_func (uint32_t *dst, const uint32_t *src, unsigned rounds);
+
+struct sha3_state;
+typedef void sha3_permute_func (struct sha3_state *state);
+
+typedef void sha512_compress_func (uint64_t *state, const uint8_t *input, const uint64_t *k);
+
+typedef uint64_t umac_nh_func (const uint32_t *key, unsigned length, const uint8_t *msg);
+typedef void umac_nh_n_func (uint64_t *out, unsigned n, const uint32_t *key,
+ unsigned length, const uint8_t *msg);
diff --git a/salsa20-core-internal.c b/salsa20-core-internal.c
index 08cd8367..c26057d5 100644
--- a/salsa20-core-internal.c
+++ b/salsa20-core-internal.c
@@ -48,6 +48,13 @@
#include "macros.h"
+/* For fat builds */
+#if HAVE_NATIVE_salsa20_core
+void
+_nettle_salsa20_core_c(uint32_t *dst, const uint32_t *src, unsigned rounds);
+#define _nettle_salsa20_core _nettle_salsa20_core_c
+#endif
+
#ifndef SALSA20_DEBUG
# define SALSA20_DEBUG 0
#endif
diff --git a/sha3-permute.c b/sha3-permute.c
index b80e6258..14fb0d4c 100644
--- a/sha3-permute.c
+++ b/sha3-permute.c
@@ -41,6 +41,13 @@
#define SHA3_ROUNDS 24
+/* For fat builds */
+#if HAVE_NATIVE_sha3_permute
+void
+_nettle_sha3_permute_c(struct sha3_state *state);
+#define nettle_sha3_permute _nettle_sha3_permute_c
+#endif
+
void
sha3_permute (struct sha3_state *state)
{
diff --git a/sha512-compress.c b/sha512-compress.c
index 59cda41f..24007f28 100644
--- a/sha512-compress.c
+++ b/sha512-compress.c
@@ -59,6 +59,13 @@
/* A block, treated as a sequence of 64-bit words. */
#define SHA512_DATA_LENGTH 16
+/* For fat builds */
+#if HAVE_NATIVE_sha512_compress
+void
+_nettle_sha512_compress_c (uint64_t *state, const uint8_t *input, const uint64_t *k);
+#define _nettle_sha512_compress _nettle_sha512_compress_c
+#endif
+
/* The SHA512 functions. The Choice function is the same as the SHA1
function f1, and the majority function is the same as the SHA1 f3
function, and the same as for SHA256. */
diff --git a/umac-nh-n.c b/umac-nh-n.c
index e4430b0e..e9233716 100644
--- a/umac-nh-n.c
+++ b/umac-nh-n.c
@@ -39,6 +39,14 @@
#include "umac.h"
#include "macros.h"
+/* For fat builds */
+#if HAVE_NATIVE_umac_nh_n
+void
+_nettle_umac_nh_n_c (uint64_t *out, unsigned n, const uint32_t *key,
+ unsigned length, const uint8_t *msg);
+#define _nettle_umac_nh_n _nettle_umac_nh_n_c
+#endif
+
void
_umac_nh_n (uint64_t *out, unsigned n, const uint32_t *key,
unsigned length, const uint8_t *msg)
diff --git a/umac-nh.c b/umac-nh.c
index 9d371755..ab1b392a 100644
--- a/umac-nh.c
+++ b/umac-nh.c
@@ -38,6 +38,13 @@
#include "umac.h"
#include "macros.h"
+/* For fat builds */
+#if HAVE_NATIVE_umac_nh
+uint64_t
+_nettle_umac_nh_c (const uint32_t *key, unsigned length, const uint8_t *msg);
+#define _nettle_umac_nh _nettle_umac_nh_c
+#endif
+
uint64_t
_umac_nh (const uint32_t *key, unsigned length, const uint8_t *msg)
{