liboqs/configure.ac
Christian Paquin 6fee71699a Added optimized version of Picnic (#190)
* Replaced the implementation of Picnic with the optimized version of https://github.com/IAIK/Picnic.git.

Some notes:
 - Picnic is now a git submodule, built separately (build_picnic.sh) and linked into OQS.
 - The params are part of the Picnic library, no need to generate them separately.
 - The Picnic params have been renamed
 - Picnic has been disabled in the Visual Studio build (until the library supports VS)

* Deleted script to download old picnic implementation.

* Added picnic build commands to the configure script.

* Updated travis to build new picnic lib.

* Added note that clone must be recursive (to get picnic submodule).

* Removed dependency on m4ri and added picnic build instruction in travis (since apparently the configure scrip is not run as usual).

* Changed build_picnic.sh script invocation.

* install cmake3.8

Fix for PR 190

* commit

* commit

* Pulled down update to picnic submodule.

* pulled picnic update fixing compat macros failure

* Added openssl lib to test_sig linker if openssl is enabled.

* Disable Picnic on gcc < 5.

* Fixed travis.yml syntax error.

* Pulled updates to Picnic submodule (fixing build error on MacOS).

* Removed banned-functions test that only checks for bzero. For some strange reason, it doesn't work on travis while building picnic, even if bzero is not in the code.

* prettyprint

* Changed prettyprint's picnic exclusion dir.

* external lib changes

* Disable LTO in Picnic that prevents lib merging.

* Changed mode on build_picnic.sh.

* Added newline at the end of the file.

* Updated version of Picnic.

* Added patch to picnic to satisfy the global functions namespace convention.

* Added force option to patch to avoid error when rebuilding.

* Updated picnic-related entries, and added cmake files (obtained by travis).

* Updated ignore patch for picnic.

* Ignore mods (patched files) in 3rd party picnic library.

* Changed return code if no sig algs are configured, from error to success.
It's not really an error, and this makes the Travis build fail otherwise.

* Updated external picnic, and modified how it is patched and built (to avoid multiple patching).

* disabled Picnic on gcc 4

* Silenced picnic's dry-run patching (to avoid error messages if lib has already been patched).

* added comments to script

* Ignore (patched) submodule when checking for modified files.
Also delete a "grep -v" for picnic that meant to do the same thing, but
was in the wrong place after refactoring.

* Added --ignore-submodules to second call to git status

* Add temp/ to gitignore, to prevent Travis style-check failure on mac.
2017-12-20 09:54:45 -05:00

309 lines
9.8 KiB
Plaintext

# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# Init
AC_INIT([liboqs], [1.0.0], [])
LT_INIT([disable-shared])
AM_INIT_AUTOMAKE([subdir-objects no-dependencies])
# Configure
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/ds_benchmark.h])
AC_CONFIG_MACRO_DIRS([config])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_PROG_AS
# Checks for libraries.
AC_ARG_WITH(
[openssl-dir],
AS_HELP_STRING([--with-openssl-dir=dir],[openssl dir used locally (default /usr).]),
[AC_DEFINE_UNQUOTED(OPENSSLDIR, [$withval], [OPENSSL DIR used locally])
AC_SUBST(OPENSSL_DIR, [$withval])],
[AC_SUBST(OPENSSL_DIR, /usr)]
)
AC_ARG_WITH(
[gmp-dir],
AS_HELP_STRING([--with-gmp-dir=dir],[gmp dir used locally (default /usr).]),
[AC_DEFINE_UNQUOTED(GMPDIR, [$withval], [GMP DIR used locally])
AC_SUBST(GMP_DIR, [$withval])],
[AC_SUBST(GMP_DIR, /usr)]
)
AC_ARG_WITH(
[sodium-dir],
AS_HELP_STRING([--with-sodium-dir=dir],[sodium dir used locally (default /usr).]),
[AC_DEFINE_UNQUOTED(SODIUMDIR, [$withval], [SODIUM DIR used locally])
AC_SUBST(SODIUM_DIR, [$withval])],
[AC_SUBST(SODIUM_DIR, /usr)]
)
AC_ARG_WITH(
[m4ri-dir],
AS_HELP_STRING([--with-m4ri-dir=dir],[m4ri dir used locally (default /usr).]),
[AC_DEFINE_UNQUOTED(M4RIDIR, [$withval], [M4RI DIR used locally])
AC_SUBST(M4RI_DIR, [$withval])],
[AC_SUBST(M4RI_DIR, /usr)]
)
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stddef.h stdint.h stdlib.h string.h strings.h sys/time.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INT8_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([gettimeofday memmove memset pow sqrt strdup])
AC_CHECK_SIZEOF([size_t])
# Silent rules
#m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
######################################################################
# DOXYGEN SUPPORT
######################################################################
DX_HTML_FEATURE(ON)
DX_CHM_FEATURE(OFF)
DX_CHI_FEATURE(OFF)
DX_MAN_FEATURE(OFF)
DX_RTF_FEATURE(OFF)
DX_XML_FEATURE(OFF)
DX_PDF_FEATURE(OFF)
DX_PS_FEATURE(OFF)
DX_INIT_DOXYGEN([$PACKAGE_NAME],[doxygen.cfg])
######################################################################
ARG_DISBL_SET([aes-ni], [enable AES-NI.])
AM_CONDITIONAL([aes_ni], [test "x$aes_ni" = xtrue])
AM_CONDITIONAL([USE_AES_NI], [test "x$aes_ni" = xtrue])
ARG_ENABL_SET([openssl], [enable OPENSSL.])
AM_CONDITIONAL([openssl], [test "x$openssl" = xtrue])
AM_CONDITIONAL([USE_OPENSSL], [test "x$openssl" = xtrue])
ARG_ENABL_SET([kex-code-mcbits], [enable KEX-CODE-MCBITS.])
AM_CONDITIONAL([kex_code_mcbits], [test "x$kex_code_mcbits" = xtrue])
AM_CONDITIONAL([USE_MCBITS], [test "x$kex_code_mcbits" = xtrue])
ARG_ENABL_SET([kex-sidh-iqc-ref], [enable KEX-SIDH-IQC-REF.])
AM_CONDITIONAL([kex_sidh_iqc_ref], [test "x$kex_sidh_iqc_ref" = xtrue])
AM_CONDITIONAL([USE_SIDH_IQC], [test "x$kex_sidh_iqc_ref" = xtrue])
ARG_DISBL_SET([kex-lwe-frodo], [disable KEX-LWE-FRODO.])
AM_CONDITIONAL([kex_lwe_frodo], [test "x$kex_lwe_frodo" = xtrue])
AM_CONDITIONAL([USE_KEX_LWE_FRODO], [test "x$kex_lwe_frodo" = xtrue])
ARG_DISBL_SET([kex-mlwe-kyber], [disable KEX-MLWE-KYBER.])
AM_CONDITIONAL([kex_mlwe_kyber], [test "x$kex_mlwe_kyber" = xtrue])
AM_CONDITIONAL([USE_KEX_MLWE_KYBER], [test "x$kex_mlwe_kyber" = xtrue])
ARG_DISBL_SET([kex-ntru], [disable KEX-NTRU.])
AM_CONDITIONAL([kex_ntru], [test "x$kex_ntru" = xtrue])
AM_CONDITIONAL([USE_KEX_NTRU], [test "x$kex_ntru" = xtrue])
ARG_DISBL_SET([kex-rlwe-msrln16], [disable KEX-RLWE-MSRLN16.])
AM_CONDITIONAL([kex_rlwe_msrln16], [test "x$kex_rlwe_msrln16" = xtrue])
AM_CONDITIONAL([USE_KEX_RLWE_MSRLN16], [test "x$kex_rlwe_msrln16" = xtrue])
ARG_DISBL_SET([kex-rlwe-newhope], [disable KEX-RLWE-NEWHOPE.])
AM_CONDITIONAL([kex_rlwe_newhope], [test "x$kex_rlwe_newhope" = xtrue])
AM_CONDITIONAL([USE_KEX_RLWE_NEWHOPE], [test "x$kex_rlwe_newhope" = xtrue])
ARG_DISBL_SET([kex-sidh-cln16], [disable KEX-SIDH-CLN16.])
AM_CONDITIONAL([kex_sidh_cln16], [test "x$kex_sidh_cln16" = xtrue])
AM_CONDITIONAL([USE_KEX_SIDH_CLN16], [test "x$kex_sidh_cln16" = xtrue])
ARG_DISBL_SET([sig-picnic], [disable SIG-PICNIC.])
AM_CONDITIONAL([sig_picnic], [test "x$sig_picnic" = xtrue])
AM_CONDITIONAL([USE_SIG_PICNIC], [test "x$sig_picnic" = xtrue])
ARG_ENABL_SET([kex-rlwe-newhope-avx2], [enable KEX-RLWE-NEWHOPE-AVX2.])
AM_CONDITIONAL([kex_rlwe_newhope_avx2], [test "x$kex_rlwe_newhope_avx2" = xtrue])
AM_CONDITIONAL([USE_KEX_RLWE_NEWHOPE_AVX2], [test "x$kex_rlwe_newhope_avx2" = xtrue])
AC_CANONICAL_HOST
# Check for which host we are on and setup a few things
# specifically based on the host
case $host_os in
darwin* )
darwin=true
;;
linux-android*)
AM_CFLAGS=${AM_CFLAGS}" -pie "
linux=true
;;
linux*)
linux=true
;;
*)
#Default Case
AC_MSG_ERROR([Your platform is not currently supported])
;;
esac
AM_CONDITIONAL([ON_DARWIN], [test "x$darwin" = xtrue])
# Enable assembly optimizations here
# Appearenly asm optimizations do not work well with darwin
if test x"$linux" = x"true"; then
case $host_cpu in
x86_64* )
AM_CPPFLAGS=${AM_CPPFLAGS}" -DSIDH_ASM -march=x86-64"
x86_64=true
;;
aarch64* )
AM_CPPFLAGS=${AM_CPPFLAGS}" -DSIDH_ASM -march=armv8-a+crc"
arm64=true
;;
esac
fi
AM_CONDITIONAL([X86_64], [test "x$x86_64" = xtrue])
AM_CONDITIONAL([ARM64], [test "x$arm64" = xtrue])
# Common sources
SRCDIR=" src/common"
# Crypto sources
SRCDIR=${SRCDIR}" src/crypto/aes src/crypto/rand src/crypto/sha3 src/crypto/rand_urandom_aesctr src/crypto/rand_urandom_chacha20"
# KEX
SRCDIR=${SRCDIR}" src/kex"
SRCDIR=${SRCDIR}" src/kex_rlwe_bcns15"
if test x"$kex_lwe_frodo" = x"true"; then
SRCDIR=${SRCDIR}" src/kex_lwe_frodo"
AM_CPPFLAGS=${AM_CPPFLAGS}" -DENABLE_KEX_LWE_FRODO"
AC_DEFINE(ENABLE_KEX_LWE_FRODO, 1, "Define to 1 when FRODO enabled")
fi
if test x"$kex_mlwe_kyber" = x"true"; then
SRCDIR=${SRCDIR}" src/kex_mlwe_kyber"
AM_CPPFLAGS=${AM_CPPFLAGS}" -DENABLE_KEX_MLWE_KYBER"
AC_DEFINE(ENABLE_KEX_MLWE_KYBER, 1, "Define to 1 when KYBER enabled")
fi
if test x"$kex_ntru" = x"true"; then
SRCDIR=${SRCDIR}" src/kex_ntru"
AM_CPPFLAGS=${AM_CPPFLAGS}" -DENABLE_KEX_NTRU"
AC_DEFINE(ENABLE_KEX_NTRU, 1, "Define to 1 when NTRU enabled")
fi
if test x"$kex_rlwe_msrln16" = x"true"; then
SRCDIR=${SRCDIR}" src/kex_rlwe_msrln16"
AM_CPPFLAGS=${AM_CPPFLAGS}" -DENABLE_KEX_RLWE_MSRLN16"
AC_DEFINE(ENABLE_KEX_RLWE_MSRLN16, 1, "Define to 1 when RLWE MSRLN16 enabled")
fi
if test x"$kex_rlwe_newhope" = x"true"; then
SRCDIR=${SRCDIR}" src/kex_rlwe_newhope"
AM_CPPFLAGS=${AM_CPPFLAGS}" -DENABLE_KEX_RLWE_NEWHOPE"
AC_DEFINE(ENABLE_KEX_RLWE_NEWHOPE, 1, "Define to 1 when RLWE NEWHOPE enabled")
fi
if test x"$kex_sidh_cln16" = x"true"; then
SRCDIR=${SRCDIR}" src/kex_sidh_cln16"
AM_CPPFLAGS=${AM_CPPFLAGS}" -DENABLE_KEX_SIDH_CLN16"
AC_DEFINE(ENABLE_KEX_SIDH_CLN16, 1, "Define to 1 when SIDH CLN16 enabled")
fi
# Conditional KEX
if test x"$kex_code_mcbits" = x"true"; then
SRCDIR=${SRCDIR}" src/kex_code_mcbits"
fi
if test x"$kex_sidh_iqc_ref" = x"true"; then
SRCDIR=${SRCDIR}" src/kex_sidh_iqc_ref"
fi
# SIG
SRCDIR=${SRCDIR}" src/sig"
if test x"$sig_picnic" = x"true"; then
SRCDIR=${SRCDIR}" src/sig_picnic"
AM_CPPFLAGS=${AM_CPPFLAGS}" -DENABLE_SIG_PICNIC"
AC_CONFIG_COMMANDS_POST([echo Building Picnic library])
AC_CONFIG_COMMANDS_POST([cd src/sig_picnic])
AC_CONFIG_COMMANDS_POST([./build_picnic.sh])
AC_CONFIG_COMMANDS_POST([cd ../..])
fi
# Flags
AM_CPPFLAGS=${AM_CPPFLAGS}" -g -std=gnu11 -Wno-unused-function -Werror -Wpedantic -Wall -Wextra -DCONSTANT_TIME"
if test x"$aes_ni" = x"true"; then
AM_CPPFLAGS=${AM_CPPFLAGS}" -DAES_ENABLE_NI"
fi
if test x"$openssl" = x"true"; then
AM_CPPFLAGS=${AM_CPPFLAGS}" -DUSE_OPENSSL"
fi
if test x"$kex_code_mcbits" = x"true"; then
AM_CPPFLAGS=${AM_CPPFLAGS}" -DENABLE_CODE_MCBITS"
AC_DEFINE(ENABLE_CODE_MCBITS, 1, "Define to 1 when MCBITS enabled")
fi
if test x"$kex_sidh_iqc_ref" = x"true"; then
AM_CPPFLAGS=${AM_CPPFLAGS}" -DENABLE_SIDH_IQC_REF"
SRCDIR=${SRCDIR}" src/kex_sidh_iqc_ref"
AC_DEFINE(ENABLE_SIDH_IQC_REF, 1, "Define to 1 when SIDH IQC enabled")
fi
if test x"$kex_rlwe_newhope_avx2" = x"true"; then
SRCDIR=${SRCDIR}" src/kex_rlwe_newhope/avx2"
AM_CPPFLAGS=${AM_CPPFLAGS}" -DENABLE_KEX_RLWE_NEWHOPE_AVX2"
fi
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_CFLAGS)
AC_SUBST(SRCDIR)
AC_SUBST(USE_OPENSSL)
AC_SUBST(USE_AES_NI)
AC_SUBST(USE_KEX_NTRU)
AC_SUBST(USE_MCBITS)
AC_SUBST(USE_SIDH_IQC)
AC_SUBST(USE_KEX_LWE_FRODO)
AC_SUBST(USE_KEX_MLWE_KYBER)
AC_SUBST(USE_KEX_RLWE_MSRLN16)
AC_SUBST(USE_KEX_RLWE_NEWHOPE)
AC_SUBST(USE_KEX_SIDH_CLN16)
AC_SUBST(USE_SIG_PICNIC)
AC_SUBST(ON_DARWIN)
AC_SUBST(X86_64)
AC_SUBST(USE_KEX_RLWE_NEWHOPE_AVX2)
AC_CONFIG_FILES([Makefile
src/common/Makefile
src/kex/Makefile
src/crypto/sha3/Makefile
src/crypto/rand/Makefile
src/crypto/rand_urandom_chacha20/Makefile
src/crypto/rand_urandom_aesctr/Makefile
src/crypto/aes/Makefile
src/kex_rlwe_bcns15/Makefile
src/kex_rlwe_newhope/Makefile
src/kex_rlwe_msrln16/Makefile
src/kex_sidh_cln16/Makefile
src/kex_code_mcbits/Makefile
src/kex_ntru/Makefile
src/kex_sidh_iqc_ref/Makefile
src/kex_lwe_frodo/Makefile
src/sig/Makefile
src/sig_picnic/Makefile
src/kex_mlwe_kyber/Makefile
src/kex_rlwe_newhope/avx2/Makefile])
AC_OUTPUT