Commit 9e811915 authored by Niels Möller's avatar Niels Möller

Merge branch 'fat-library' into master.

parents 9fc33577 508290d6
2015-01-25 Niels Möller <nisse@lysator.liu.se>
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
targets a lower architecture version.
2015-01-23 Niels Möller <nisse@lysator.liu.se>
* fat-setup.h (DEFINE_FAT_FUNC): Check value of function pointer,
before calling fat_init. Should be correct even without memory
barrier.
* fat-x86_64.c (fat_init): Deleted static variable initialized.
The checks of the relevant pointer in DEFINE_FAT_FUNC is more
robust.
* fat-arm.c (fat_init): Likewise.
2015-01-21 Niels Möller <nisse@lysator.liu.se>
* fat-arm.c (fat_init): Setup for use of neon assembly functions.
* arm/fat/salsa20-core-internal-2.asm: New file.
* arm/fat/sha3-permute-2.asm: New file.
* arm/fat/sha512-compress-2.asm: New file.
* arm/fat/umac-nh-2.asm: New file.
* arm/fat/umac-nh-n-2.asm: New file.
* 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
environment variable.
* fat-x86_64.c (get_x86_features): New function. Check
NETTLE_FAT_OVERRIDE environment variable.
(fat_init): Use it.
* fat-setup.h (secure_getenv) [!HAVE_SECURE_GETENV]: Dummy
definition, returning NULL.
(ENV_OVERRIDE): New constant.
* configure.ac: Check for secure_getenv function.
2015-01-19 Niels Möller <nisse@lysator.liu.se>
* configure.ac: Fat library setup for arm.
* fat-arm.c: New file.
* arm/fat/aes-encrypt-internal.asm: New files.
* arm/fat/aes-encrypt-internal-2.asm: New file.
* arm/fat/aes-decrypt-internal.asm: New file.
* arm/fat/aes-decrypt-internal-2.asm: New file.
* Makefile.in (DISTFILES): Added fat-setup.h.
* fat-setup.h: New file, declarations moved from...
* fat-x86_64.c: ... old location
2015-01-17 Niels Möller <nisse@lysator.liu.se>
* fat-x86_64.c (DECLARE_FAT_FUNC, DEFINE_FAT_FUNC)
(DECLARE_FAT_FUNC_VAR): New macros, to define needed resolver and
wrapper functions.
* config.m4.in (SYMBOL_PREFIX): Define from from autoconf
ASM_SYMBOL_PREFIX.
(C_NAMS): move definition to...
* asm.m4 (C_NAME): Define here, also take fat_transform.
(fat_suffix): Replaced by...
(fat_transform): New macro, taking symbol nama as argument.
Updated all uses of fat_suffix.
* fat-x86_64.c: Updated for internal "_nettle" prefix on
cpu-specific memxor functions.
* fat-x86_64.c: Set up for sse2 vs non-sse2 memxor. Patch by Nikos
Mavrogiannopoulos.
* configure.ac (asm_nettle_optional_list): Added memxor-2.asm.
* x86_64/fat/memxor-2.asm: New file.
* x86_64/fat/memxor.asm: New file.
* x86_64/memxor.asm: Use ifdef, not ifelse, for testing USE_SSE2.
2015-01-16 Niels Möller <nisse@lysator.liu.se>
* configure.ac (OPT_NETTLE_SOURCES): New substituted variable.
(asm_path): Fixed x86_64 fat setup. Include only x86_64 and
x86_64/fat in the asm_path. Put fat-x86_64.c in
OPT_NETTLE_SOURCES, with no symlinking.
* fat-x86_64.c: Renamed,...
* x86_64/fat/fat.c: ... from old name.
2015-01-13 Niels Möller <nisse@lysator.liu.se>
* x86_64/fat/fat.c: For constructor hack, check
HAVE_GCC_ATTRIBUTE, not __GNUC__. Also support sun compilers, as
suggested by Nikos Mavrogiannopoulos, and attch the constructor
attribute directly to fat_init.
(fat_constructor): Deleted wrapper function.
* x86_64/fat/fat.c: New file, initialization for x86_64 fat
library.
* x86_64/fat/cpuid.asm (_nettle_cpuid): New file and function.
* x86_64/fat/aes-encrypt-internal.asm: New file, including
x86_64/aes-encrypt-internal.asm, after setting fat_suffix to
_x86_64.
* x86_64/fat/aes-decrypt-internal.asm: New file, analogous setup.
* x86_64/fat/aes-encrypt-internal-2.asm: New file, including
x86_64/aesni/aes-encrypt-internal.asm, after setting fat_suffix to
_aesni.
* x86_64/fat/aes-decrypt-internal.asm-2: New file, analogous
setup.
* configure.ac: New command line option --enable-fat.
(asm_nettle_optional_list): Added cpuid.asm, fat.c,
aes-encrypt-internal-2.asm, and aes-decrypt-internal-2.asm.
* asm.m4 (fat_suffix): New suffix added to symbol names.
* x86_64/aesni/aes-encrypt-internal.asm: Use explicit .byte
sequences for aes instructions, don't rely on assembler support.
* x86_64/aesni/aes-decrypt-internal.asm: Likewise.
* aclocal.m4 (NETTLE_CHECK_IFUNC): New macro, checking for ifunc
and settting HAVE_LINK_IFUNC if working.
* configure.ac: Use it.
2015-01-12 Niels Möller <nisse@lysator.liu.se>
* asm.m4 (DECLARE_FUNC): New macro, extracted from PROLOGUE.
(PROLOGUE): Use it.
* configure.ac (OPT_NETTLE_OBJS, OPT_HOGWEED_OBJS): Renamed
substituted variables, and list the object files rather than
source files.
(OPT_ASM_NETTLE_SOURCES, OPT_ASM_HOGWEED_SOURCES): ...Old names.
* Makefile.in (OPT_NETTLE_OBJS, OPT_HOGWEED_OBJS): Use new
variables.
2015-01-11 Niels Möller <nisse@lysator.liu.se>
* x86_64/aesni/aes-decrypt-internal.asm: New file.
......
......@@ -12,9 +12,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = $(INSTALL_PROGRAM) -s
MKDIR_P = @MKDIR_P@
OPT_ASM_NETTLE_SOURCES = @OPT_ASM_NETTLE_SOURCES@
OPT_ASM_HOGWEED_SOURCES = @OPT_ASM_HOGWEED_SOURCES@
OPT_NETTLE_OBJS = @OPT_NETTLE_OBJS@
OPT_HOGWEED_OBJS = @OPT_HOGWEED_OBJS@
OPT_NETTLE_SOURCES = @OPT_NETTLE_SOURCES@
OPT_HOGWEED_SOURCES = @IF_MINI_GMP@ mini-gmp.c
SUBDIRS = tools testsuite examples
......@@ -134,7 +135,8 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c \
umac-poly64.c umac-poly128.c umac-set-key.c \
umac32.c umac64.c umac96.c umac128.c \
write-be32.c write-le32.c write-le64.c \
yarrow256.c yarrow_key_event.c
yarrow256.c yarrow_key_event.c \
$(OPT_NETTLE_SOURCES)
hogweed_SOURCES = sexp.c sexp-format.c \
sexp-transport.c sexp-transport-format.c \
......@@ -204,6 +206,10 @@ SOURCES = $(nettle_SOURCES) $(hogweed_SOURCES) \
$(getopt_SOURCES) $(internal_SOURCES) \
aesdata.c desdata.c twofishdata.c shadata.c gcmdata.c eccdata.c
# FIXME: $(SOURCES) includes $(OPT_NETTLE_SOURCES) and
# $(OPT_HOGWEED_SOURCES), which means that inclusion in this list
# depends on which sources where included in the build. It needs to
# always include all files, and we no duplicates.
DISTFILES = $(SOURCES) $(HEADERS) getopt.h getopt_int.h \
.bootstrap run-tests \
aclocal.m4 configure.ac \
......@@ -217,14 +223,14 @@ DISTFILES = $(SOURCES) $(HEADERS) getopt.h getopt_int.h \
aes-internal.h camellia-internal.h serpent-internal.h \
cast128_sboxes.h desinfo.h desCode.h \
memxor-internal.h nettle-internal.h nettle-write.h \
gmp-glue.h ecc-internal.h \
gmp-glue.h ecc-internal.h fat-setup.h \
mini-gmp.h mini-gmp.c asm.m4 \
nettle.texinfo nettle.info nettle.html nettle.pdf sha-example.c
# Rules building static libraries
nettle_OBJS = $(nettle_SOURCES:.c=.$(OBJEXT)) $(OPT_ASM_NETTLE_SOURCES:.asm=.$(OBJEXT))
nettle_OBJS = $(nettle_SOURCES:.c=.$(OBJEXT)) $(OPT_NETTLE_OBJS)
hogweed_OBJS = $(hogweed_SOURCES:.c=.$(OBJEXT)) $(OPT_ASM_HOGWEED_SOURCES:.asm=.$(OBJEXT))
hogweed_OBJS = $(hogweed_SOURCES:.c=.$(OBJEXT)) $(OPT_HOGWEED_OBJS)
libnettle.a: $(nettle_OBJS)
-rm -f $@
......
......@@ -643,6 +643,41 @@ foo:
fi
])
dnl NETTLE_CHECK_IFUNC
dnl ------------------
dnl Check if __attribute__ ((ifunc(...))) works
AC_DEFUN([NETTLE_CHECK_IFUNC],
[AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([for ifunc support],
nettle_cv_link_ifunc,
AC_LINK_IFELSE([AC_LANG_PROGRAM([
static int
foo_imp(int x)
{
return 1;
}
typedef void void_func (void);
static void_func *
foo_resolv(void)
{
return (void_func *) foo_imp;
}
int foo (int x) __attribute__ ((ifunc("foo_resolv")));
],[
return foo(0);
])],
[nettle_cv_link_ifunc=yes],
[nettle_cv_link_ifunc=no]))
AH_TEMPLATE([HAVE_LINK_IFUNC], [Define if compiler and linker supports __attribute__ ifunc])
if test "x$nettle_cv_link_ifunc" = xyes ; then
AC_DEFINE(HAVE_LINK_IFUNC)
fi
])
dnl @synopsis AX_CREATE_STDINT_H [( HEADER-TO-GENERATE [, HEADERS-TO-CHECK])]
dnl
dnl the "ISO C9X: 7.18 Integer types <stdint.h>" section requires the
......
C arm/fat/aes-decrypt-internal-2.asm
ifelse(<
Copyright (C) 2015 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/.
>)
define(<fat_transform>, <$1_armv6>)
include_src(<arm/v6/aes-decrypt-internal.asm>)
C arm/fat/aes-decrypt-internal.asm
ifelse(<
Copyright (C) 2015 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/.
>)
define(<fat_transform>, <$1_arm>)
include_src(<arm/aes-decrypt-internal.asm>)
C arm/fat/aes-encrypt-internal-2.asm
ifelse(<
Copyright (C) 2015 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/.
>)
define(<fat_transform>, <$1_armv6>)
include_src(<arm/v6/aes-encrypt-internal.asm>)
C arm/fat/aes-encrypt-internal.asm
ifelse(<
Copyright (C) 2015 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/.
>)
define(<fat_transform>, <$1_arm>)
include_src(<arm/aes-encrypt-internal.asm>)
C arm/fat/salsa20-core-internal-2.asm
ifelse(<
Copyright (C) 2015 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_salsa20_core) picked up by configure
define(<fat_transform>, <$1_neon>)
include_src(<arm/neon/salsa20-core-internal.asm>)
C arm/fat/sha3-permute-2.asm
ifelse(<
Copyright (C) 2015 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_sha3_permute) picked up by configure
define(<fat_transform>, <_$1_neon>)
include_src(<arm/neon/sha3-permute.asm>)
C arm/fat/sha3-compress-2.asm
ifelse(<
Copyright (C) 2015 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_sha512_compress) picked up by configure
define(<fat_transform>, <$1_neon>)
include_src(<arm/neon/sha512-compress.asm>)
C arm/fat/umac-nh-2.asm
ifelse(<
Copyright (C) 2015 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_umac_nh) picked up by configure
define(<fat_transform>, <$1_neon>)
include_src(<arm/neon/umac-nh.asm>)
C arm/fat/umac-nh-n-2.asm
ifelse(<
Copyright (C) 2015 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_umac_nh_n) picked up by configure
define(<fat_transform>, <$1_neon>)
include_src(<arm/neon/umac-nh-n.asm>)
......@@ -30,6 +30,8 @@ ifelse(<
not, see http://www.gnu.org/licenses/.
>)
.arch armv6
include_src(<arm/aes.m4>)
define(<PARAM_ROUNDS>, <r0>)
......
......@@ -30,6 +30,8 @@ ifelse(<
not, see http://www.gnu.org/licenses/.
>)
.arch armv6
include_src(<arm/aes.m4>)
C Benchmarked at at 706, 870, 963 cycles/block on cortex A9,
......
......@@ -31,6 +31,7 @@ ifelse(<
>)
.file "sha1-compress.asm"
.arch armv6
define(<STATE>, <r0>)
define(<INPUT>, <r1>)
......
......@@ -31,6 +31,7 @@ ifelse(<
>)
.file "sha256-compress.asm"
.arch armv6
define(<STATE>, <r0>)
define(<INPUT>, <r1>)
......
......@@ -12,22 +12,25 @@ changecom()dnl
dnl Including files from the srcdir
define(<include_src>, <include(srcdir/$1)>)dnl
dnl Pseudo ops
dnl default definition, changed in fat builds
define(<fat_transform>, <$1>)
define(<C_NAME>, <SYMBOL_PREFIX<>fat_transform($1)>)
define(<PROLOGUE>,
dnl Pseudo ops
define(<DECLARE_FUNC>,
<ifelse(ELF_STYLE,yes,
<.globl C_NAME($1)
.type C_NAME($1),TYPE_FUNCTION
C_NAME($1):>,
COFF_STYLE, <yes>,
<.globl C_NAME($1)
.def C_NAME($1)
<.type $1,TYPE_FUNCTION>,
COFF_STYLE, yes,
<.def $1
.scl 2
.type 32