2015-01-25 Niels Möller <nisse@lysator.liu.se>
+ * sha1-compress.c: Prepare for fat build with C and assembly
+ implementations.
+ * sha256-compress.c: Likewise.
+
+ * fat-setup.h (sha1_compress_func, sha256_compress_func): New typedefs.
+
+ * configure.ac (asm_nettle_optional_list): Added
+ sha1-compress-2.asm and sha256-compress-2.asm, and corresponding
+ HAVE_NATIVE_*.
+
From Martin Storsjö:
* arm: Add .arch directives for armv6. This allows building these
files as part of a fat build, even if the assembler by default
# 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 \
- salsa20-core-internal-2.asm sha3-permute-2.asm sha512-compress-2.asm \
+ salsa20-core-internal-2.asm sha1-compress-2.asm sha256-compress-2.asm \
+ sha3-permute-2.asm sha512-compress-2.asm \
umac-nh-n-2.asm umac-nh-2.asm"
asm_hogweed_optional_list=""
#undef HAVE_NATIVE_ecc_521_redc
#undef HAVE_NATIVE_gcm_hash8
#undef HAVE_NATIVE_salsa20_core
+#undef HAVE_NATIVE_sha1_compress
+#undef HAVE_NATIVE_sha256_compress
#undef HAVE_NATIVE_sha512_compress
#undef HAVE_NATIVE_sha3_permute
#undef HAVE_NATIVE_umac_nh
typedef void salsa20_core_func (uint32_t *dst, const uint32_t *src, unsigned rounds);
+typedef void sha1_compress_func(uint32_t *state, const uint8_t *input);
+typedef void sha256_compress_func(uint32_t *state, const uint8_t *input, const uint32_t *k);
+
struct sha3_state;
typedef void sha3_permute_func (struct sha3_state *state);
#define subRound(a, b, c, d, e, f, k, data) \
( e += ROTL32( 5, a ) + f( b, c, d ) + k + data, b = ROTL32( 30, b ) )
+/* For fat builds */
+#if HAVE_NATIVE_sha1_compress
+void
+_nettle_sha1_compress_c(uint32_t *state, const uint8_t *input);
+#define _nettle_sha1_compress _nettle_sha1_compress_c
+#endif
+
/* Perform the SHA transformation. Note that this code, like MD5, seems to
break some optimizing compilers due to the complexity of the expressions
and the size of the basic block. It may be necessary to split it into
h += S0(a) + Majority(a,b,c); \
} while (0)
+/* For fat builds */
+#if HAVE_NATIVE_sha256_compress
+void
+_nettle_sha256_compress_c(uint32_t *state, const uint8_t *input, const uint32_t *k);
+#define _nettle_sha256_compress _nettle_sha256_compress_c
+#endif
+
void
_nettle_sha256_compress(uint32_t *state, const uint8_t *input, const uint32_t *k)
{