]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Prepare for additional fat functions.
authorNiels Möller <nisse@lysator.liu.se>
Sun, 25 Jan 2015 20:12:24 +0000 (21:12 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Sun, 25 Jan 2015 20:12:24 +0000 (21:12 +0100)
ChangeLog
configure.ac
fat-setup.h
sha1-compress.c
sha256-compress.c

index ad386a68720359317cc969abf3c9aa1cde1063e6..f56bd56afb518747d91264d1ca009866c52f5d47 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 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
index ad6dfca84c1659cdcd87a4f2ff53fa906457c3e1..5e7384d764ed27593e13fe4642134a8b3bc60270 100644 (file)
@@ -307,7 +307,8 @@ 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 \
-  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=""
@@ -413,6 +414,8 @@ AH_VERBATIM([HAVE_NATIVE],
 #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
index 7c0bbf6654281f9d640c284ba528717c5a0e3d13..09e8c3715c9b2725c3a75a0f725ff75563cbd951 100644 (file)
@@ -154,6 +154,9 @@ 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);
 
+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);
 
index 769a4cfb17406de9856b469c7ef92826f739a8cd..377b9c1e5fc9506489865cc74e605deebd47bd81 100644 (file)
 #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
index 5c32f931cf4687730470346d8343b416b98da772..156c8cf9832965b5cb6014fbaf99773f5b5c73cb 100644 (file)
     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)
 {