liboqs/Makefile.am
Vlad Gheorghiu 20348ca55d Vsoftco refactor oqs success (#219)
* refactoring

- Introduced typedef int OQS_status; in src/common/common.h and
refactored the
  code accordingly. Now it's easy to figure out whether the function
returns
  an error status or an int.

- Refactored hard-coded returns so now we return the OQS_status as
either
  OQS_SUCCESS or OQS_ERROR. OQS_RAND_get_system_entropy() and all other
  KEX/SIG API functions now return OQS_STATUS instead of int.

- Introduced src/common/oqs.h, which include all other necessary liboqs
  headers. All standalone programs now only #include <oqs/oqs.h>

- src/kex.c:23, the UNUSED macro was re-defined differently from
  oqs/common.h:25, so re-defined kex.c's UNUSED to UNUSED_KEX

- Got rid of PRINT_(PART)_HEX macros and introduced stand-alone
functions in
  src/common.h (with definitions in src/common.c)

    void OQS_print_hex_string(const char *label, uint8_t *str, size_t
len);
    void OQS_print_part_hex_string(const char *label, uint8_t *str,
size_t len, size_t sub_len);

* commit

fixed stdint.h missing #include

* commit

* commit

* commit

* These files are part of the patch

* Modified patch

* added oqs.h in the Windows build

* VS build

* Fixed VS build

* fixed VS build

* Fixed test_rand VS project

added WINDOWS macro in the VS configuration for test_rand
2018-01-30 10:30:26 -05:00

257 lines
6.8 KiB
Makefile

AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I config
# DOXYGEN SUPPORT
include aminclude.am
# ensure the distribution of the doxygen configuration file
EXTRA_DIST = doxygen.cfg
CLANGFORMAT ?= clang-format-3.9
SUBDIRS = ${SRCDIR}
BUILT_SOURCES = links
lib_LTLIBRARIES = liboqs.la libmerge_external.la
liboqs_la_SOURCES =
liboqs_la_LIBADD = src/common/libcommon.la
liboqs_la_LIBADD += src/crypto/aes/libaes.la
liboqs_la_LIBADD += src/crypto/rand/librand.la
liboqs_la_LIBADD += src/crypto/rand_urandom_aesctr/librandaesctr.la
liboqs_la_LIBADD += src/crypto/rand_urandom_chacha20/librandchacha20.la
liboqs_la_LIBADD += src/crypto/sha3/libsha3.la
liboqs_la_LIBADD += src/kex/libkex.la
if USE_KEX_RLWE_NEWHOPE_AVX2
liboqs_la_LIBADD += src/kex_rlwe_newhope/avx2/libnewhope_avx2.la
endif
if USE_KEX_LWE_FRODO
liboqs_la_LIBADD += src/kex_lwe_frodo/libfrodo.la
endif
if USE_KEX_NTRU
liboqs_la_LIBADD += src/kex_ntru/libntru.la
endif
liboqs_la_LIBADD += src/kex_rlwe_bcns15/libbcns15.la
if USE_KEX_RLWE_MSRLN16
liboqs_la_LIBADD += src/kex_rlwe_msrln16/libmsrln16.la
endif
if USE_KEX_RLWE_NEWHOPE
liboqs_la_LIBADD += src/kex_rlwe_newhope/libnewhope.la
endif
if USE_KEX_SIDH_MSR
liboqs_la_LIBADD += src/kex_sidh_msr/libsidhmsr.la
endif
liboqs_la_LIBADD += src/sig/libsig.la
if USE_MCBITS
liboqs_la_LIBADD += src/kex_code_mcbits/libmcbits.la
endif
if USE_SIDH_IQC
liboqs_la_LIBADD += src/kex_sidh_iqc_ref/libsidhiqc.la
endif
if USE_SIG_PICNIC
liboqs_la_LIBADD += src/sig_picnic/libpicnic_i.la
endif
installheaderdir=$(includedir)/oqs
installheader_HEADERS=config.h \
src/common/oqs.h \
src/common/common.h \
src/crypto/aes/aes.h \
src/crypto/rand/rand.h \
src/crypto/rand_urandom_aesctr/rand_urandom_aesctr.h \
src/crypto/rand_urandom_chacha20/rand_urandom_chacha20.h \
src/crypto/sha3/sha3.h \
src/kex/kex.h \
src/kex_lwe_frodo/kex_lwe_frodo.h \
src/kex_ntru/kex_ntru.h \
src/kex_rlwe_bcns15/kex_rlwe_bcns15.h \
src/kex_rlwe_msrln16/kex_rlwe_msrln16.h \
src/kex_rlwe_newhope/kex_rlwe_newhope.h \
src/kex_sidh_msr/kex_sidh_msr.h \
src/sig/sig.h
install-exec-local:
if USE_KEX_RLWE_NEWHOPE_AVX2
bash patches/apply-patch.sh kex_rlwe_newhope_avx2
endif
install-exec-hook:
mkdir -p $(includedir)/oqs
if USE_KEX_RLWE_NEWHOPE_AVX2
cp src/kex_rlwe_newhope/avx2/kex_rlwe_newhope_avx2.h $(includedir)/oqs
bash patches/cleanup-patch.sh kex_rlwe_newhope/avx2
endif
if USE_OPENSSL
cp src/sig_picnic/external/Picnic-master/picnic.h $(includedir)/oqs
endif
if USE_MCBITS
cp src/kex_code_mcbits/kex_code_mcbits.h $(includedir)/oqs
endif
if USE_SIDH_IQC
cp src/kex_sidh_iqc_ref/kex_sidh_iqc_ref.h $(includedir)/oqs
endif
libmerge_external.la:
if USE_SIG_PICNIC
mkdir -p temp && cp liboqs.a temp/ && cp src/sig_picnic/external/build/libpicnic_static.a temp/
cd temp && ar x liboqs.a && ar x libpicnic_static.a && ar cr liboqs.a *.o && ranlib liboqs.a && mv liboqs.a ../.libs
cd .. && rm -rf temp
endif
noinst_bin_PROGRAMS = test_kex test_aes test_rand
if USE_KEX_LWE_FRODO
noinst_bin_PROGRAMS += minimal_kex_oqs
endif
if USE_SIG_PICNIC
noinst_bin_PROGRAMS += test_sig minimal_sig_oqs
endif
noinst_bindir=$(prefix)/tests
test_kex_LDADD = liboqs.la -lm
test_kex_SOURCES = src/kex/test_kex.c
test_kex_CPPFLAGS = -I./include
test_kex_CPPFLAGS += $(AM_CPPFLAGS)
if USE_MCBITS
test_kex_LDADD += -L${SODIUM_DIR}/lib -lsodium
endif
if USE_OPENSSL
test_kex_LDADD += -L$(OPENSSL_DIR)/lib -lcrypto
endif
if USE_SIDH_IQC
test_kex_LDADD += -L$(GMP_DIR)/lib -lgmp
endif
if USE_SIG_PICNIC
test_sig_LDADD = liboqs.la -lm
test_sig_SOURCES = src/sig/test_sig.c
test_sig_CPPFLAGS = -I./include
test_sig_CPPFLAGS += $(AM_CPPFLAGS)
if USE_OPENSSL
test_sig_LDADD += -L$(OPENSSL_DIR)/lib -lcrypto
endif
minimal_sig_oqs_LDADD = liboqs.la -lm
minimal_sig_oqs_SOURCES = src/sig/minimal_sig_oqs.c
minimal_sig_oqs_CPPFLAGS = -I./include
minimal_sig_oqs_CPPFLAGS += $(AM_CPPFLAGS)
if USE_OPENSSL
minimal_sig_oqs_LDADD += -L$(OPENSSL_DIR)/lib -lcrypto
endif
endif # USE_SIG_PICNIC
if USE_KEX_LWE_FRODO
minimal_kex_oqs_LDADD = liboqs.la -lm
minimal_kex_oqs_SOURCES = src/kex/minimal_kex_oqs.c
minimal_kex_oqs_CPPFLAGS = -I./include
minimal_kex_oqs_CPPFLAGS += $(AM_CPPFLAGS)
if USE_MCBITS
minimal_kex_oqs_LDADD += -L${SODIUM_DIR}/lib -lsodium
endif
if USE_OPENSSL
minimal_kex_oqs_LDADD += -L$(OPENSSL_DIR)/lib -lcrypto
endif
if USE_SIDH_IQC
minimal_kex_oqs_LDADD += -L$(GMP_DIR)/lib -lgmp
endif
endif # USE_KEX_LWE_FRODO
test_aes_LDADD = liboqs.la -lm
test_aes_SOURCES = src/crypto/aes/test_aes.c
test_aes_CPPFLAGS = -I./include
test_aes_CPPFLAGS += $(AM_CPPFLAGS)
if USE_OPENSSL
test_aes_LDADD += -L$(OPENSSL_DIR)/lib -lcrypto
endif
test_rand_SOURCES = src/crypto/rand/test_rand.c
test_rand_CPPFLAGS = -Iinclude -Isrc/crypto/rand_urandom_aesctr/
test_rand_CPPFLAGS += $(AM_CPPFLAGS)
test_rand_LDADD = liboqs.la
if USE_OPENSSL
test_rand_LDADD += -L$(OPENSSL_DIR)/lib -lcrypto
else
if USE_AES_NI
test_rand_CPPFLAGS += -maes -msse2
endif
endif # USE_OPENSSL
test: clean-tests
make
./test_kex --quiet
./test_rand --quiet
./test_aes
if USE_SIG_PICNIC
./test_sig
./minimal_sig_oqs
endif
if USE_KEX_LWE_FRODO
./minimal_kex_oqs
endif
links:
$(MKDIR_P) include/oqs
cp -f config.h include/oqs
cp -f src/common/oqs.h include/oqs
cp -f src/common/common.h include/oqs
cp -f src/crypto/aes/aes.h include/oqs
cp -f src/crypto/rand/rand.h include/oqs
cp -f src/crypto/rand_urandom_aesctr/rand_urandom_aesctr.h include/oqs
cp -f src/crypto/rand_urandom_chacha20/rand_urandom_chacha20.h include/oqs
cp -f src/crypto/sha3/sha3.h include/oqs
cp -f src/kex/kex.h include/oqs
cp -f src/kex_lwe_frodo/kex_lwe_frodo.h include/oqs
cp -f src/kex_ntru/kex_ntru.h include/oqs
cp -f src/kex_rlwe_bcns15/kex_rlwe_bcns15.h include/oqs
cp -f src/kex_rlwe_msrln16/kex_rlwe_msrln16.h include/oqs
cp -f src/kex_rlwe_newhope/kex_rlwe_newhope.h include/oqs
if USE_KEX_RLWE_NEWHOPE_AVX2
bash patches/apply-patch.sh kex_rlwe_newhope_avx2
cp -f src/kex_rlwe_newhope/avx2/kex_rlwe_newhope_avx2.h include/oqs
endif
cp -f src/kex_sidh_msr/kex_sidh_msr.h include/oqs
cp -f src/sig/sig.h include/oqs
cp -f src/sig_picnic/sig_picnic.h include/oqs
$(LN_S) -f .libs/liboqs.a
if USE_MCBITS
cp -f src/kex_code_mcbits/kex_code_mcbits.h include/oqs
endif
if USE_SIDH_IQC
cp -f src/kex_sidh_iqc_ref/kex_sidh_iqc_ref.h include/oqs
$(LN_S) -f src/kex_sidh_iqc_ref/sample_params
endif
clean-local:
rm -f liboqs.a
rm -rf include
if USE_KEX_LWE_FRODO
rm -f minimal_kex_oqs
endif
if USE_SIG_PICNIC
rm -f test_sig
rm -f minimal_sig_oqs
endif
if USE_SIDH_IQC
rm -f sample_params
endif
clean-tests:
rm -f test_kex test_rand test_aes
prettyprint:
find src -name '*.c' -o -name '*.h' | grep -v sig_picnic/external* | grep -v "kex_rlwe_newhope/avx2" | grep -v "kex_sidh_msr" | xargs $(CLANGFORMAT) -style=file -i
docs: links
doxygen
cleanup-patch:
if USE_KEX_RLWE_NEWHOPE_AVX2
bash patches/cleanup-patch.sh kex_rlwe_newhope/avx2
endif