Commit d5cb83ea authored by Niels Möller's avatar Niels Möller

Prepare for additional fat functions.

parent 27a3ddf6
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
......
......@@ -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
......
......@@ -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);
......@@ -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
......
......@@ -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)
{
......
......@@ -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. */
......
......@@ -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)
......
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment