mirror of
https://github.com/open-quantum-safe/liboqs.git
synced 2025-10-04 00:02:01 -04:00
Autotools (#99)
* Autotools infrastructure * update for autotools * Readme update * More gitignore updates * Make prettyprint. * Formatting in README. * Makefile cleanups
This commit is contained in:
parent
d74a252ae8
commit
09cff0d2fd
30
.gitignore
vendored
30
.gitignore
vendored
@ -57,3 +57,33 @@ VisualStudio/**/*.user
|
||||
|
||||
# External sources
|
||||
external
|
||||
|
||||
#Autotools
|
||||
autom4te.cache
|
||||
.deps
|
||||
Makefile.in
|
||||
Makefile
|
||||
aclocal.m4
|
||||
compile
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.status
|
||||
config.sub
|
||||
config/libtool.m4
|
||||
config/ltoptions.m4
|
||||
config/ltsugar.m4
|
||||
config/ltversion.m4
|
||||
config/lt~obsolete.m4
|
||||
configure
|
||||
depcomp
|
||||
install-sh
|
||||
libtool
|
||||
ltmain.sh
|
||||
missing
|
||||
stamp-h1
|
||||
.libs
|
||||
.dirstamp
|
||||
|
||||
|
||||
|
27
.travis-tests.sh
Executable file
27
.travis-tests.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
autoreconf -i
|
||||
enable_disable_str=
|
||||
if [[ ${USE_OPENSSL} == 1 ]];then
|
||||
enable_disable_str="--enable-openssl"
|
||||
fi
|
||||
|
||||
if [[ ${AES_NI} == 0 ]];then
|
||||
enable_disable_str=${enable_disable_str}" --disable-aes-ni"
|
||||
fi
|
||||
|
||||
if [[ ${ENABLE_CODE_MCBITS} == 1 ]];then
|
||||
enable_disable_str="--enable-mcbits"
|
||||
fi
|
||||
|
||||
if [[ ${ENABLE_NTRU} == 1 ]];then
|
||||
enable_disable_str="--enable-ntru"
|
||||
fi
|
||||
|
||||
./configure ${enable_disable_str}
|
||||
make clean
|
||||
make
|
||||
make test
|
||||
for f in $(ls .travis/*-check.sh); do bash $f; done
|
||||
|
||||
|
@ -58,6 +58,4 @@ matrix:
|
||||
- bash download-and-build-ntru.sh
|
||||
|
||||
script:
|
||||
- CC=$CC_OQS make
|
||||
- CC=$CC_OQS make check
|
||||
- for f in $(ls .travis/*-check.sh); do bash $f; done
|
||||
- CC=$CC_OQS ./.travis-tests.sh
|
||||
|
218
Makefile
218
Makefile
@ -1,218 +0,0 @@
|
||||
CC ?= cc
|
||||
|
||||
AR = ar rcs
|
||||
CURL = curl
|
||||
RANLIB = ranlib
|
||||
LN = ln -s
|
||||
ECHO = echo
|
||||
CLANGFORMAT ?= clang-format
|
||||
|
||||
CFLAGS = -O3 -std=gnu11 -Wpedantic -Wall -Wextra -DCONSTANT_TIME
|
||||
LDFLAGS = -lm
|
||||
INCLUDES = -Iinclude
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
ifdef ARCH
|
||||
CFLAGS += $(ARCH)
|
||||
else
|
||||
CFLAGS += -march=x86-64
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
CFLAGS += -DSIDH_ASM
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef AES_NI
|
||||
AES_NI_LOCAL=$(AES_NI)
|
||||
else
|
||||
AES_NI_LOCAL=1
|
||||
endif
|
||||
ifeq ($(AES_NI_LOCAL),1)
|
||||
CFLAGS += -maes -msse2
|
||||
else
|
||||
CFLAGS += -DAES_DISABLE_NI
|
||||
endif
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifdef USE_OPENSSL
|
||||
CFLAGS += -DUSE_OPENSSL
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
OPENSSL_DIR=/usr
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
OPENSSL_DIR=/usr/local/opt/openssl
|
||||
endif
|
||||
INCLUDES += -I$(OPENSSL_DIR)/include
|
||||
LDFLAGS += -L$(OPENSSL_DIR)/lib -lcrypto
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
INCLUDES += -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
|
||||
ifdef ENABLE_CODE_MCBITS
|
||||
INCLUDES += -I/usr/local/include
|
||||
LDFLAGS += -L/usr/local/lib
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef ENABLE_CODE_MCBITS
|
||||
CFLAGS += -DENABLE_CODE_MCBITS
|
||||
LDFLAGS += -lsodium
|
||||
endif
|
||||
|
||||
ifdef ENABLE_NTRU
|
||||
CFLAGS += -DENABLE_NTRU
|
||||
INCLUDES += -Iexternal/NTRUEncrypt-master/include
|
||||
LDFLAGS += external/NTRUEncrypt-master/.libs/libntruencrypt.a
|
||||
endif
|
||||
|
||||
.PHONY: all check clean prettyprint
|
||||
|
||||
all: links lib tests
|
||||
|
||||
objs/%.o: src/%.c | links
|
||||
@mkdir -p $(@D)
|
||||
@$(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@
|
||||
@$(ECHO) "CC $<"
|
||||
|
||||
links:
|
||||
@$(RM) -r include/oqs
|
||||
@mkdir -p include/oqs
|
||||
@$(LN) ../../src/crypto/aes/aes.h include/oqs
|
||||
@$(LN) ../../src/crypto/sha3/sha3.h include/oqs
|
||||
@$(LN) ../../src/kex/kex.h include/oqs
|
||||
@$(LN) ../../src/kex_rlwe_bcns15/kex_rlwe_bcns15.h include/oqs
|
||||
@$(LN) ../../src/kex_rlwe_newhope/kex_rlwe_newhope.h include/oqs
|
||||
@$(LN) ../../src/kex_rlwe_msrln16/kex_rlwe_msrln16.h include/oqs
|
||||
@$(LN) ../../src/kex_lwe_frodo/kex_lwe_frodo.h include/oqs
|
||||
ifdef ENABLE_CODE_MCBITS
|
||||
@$(LN) ../../src/kex_code_mcbits/kex_code_mcbits.h include/oqs
|
||||
endif
|
||||
ifdef ENABLE_NTRU
|
||||
@$(LN) ../../src/kex_ntru/kex_ntru.h include/oqs
|
||||
endif
|
||||
@$(LN) ../../src/kex_sidh_cln16/kex_sidh_cln16.h include/oqs
|
||||
@$(LN) ../../src/crypto/rand/rand.h include/oqs
|
||||
@$(LN) ../../src/crypto/rand_urandom_chacha20/rand_urandom_chacha20.h include/oqs
|
||||
@$(LN) ../../src/crypto/rand_urandom_aesctr/rand_urandom_aesctr.h include/oqs
|
||||
@$(LN) ../../src/common/common.h include/oqs
|
||||
|
||||
#RAND_URANDOM_CHACHA
|
||||
RAND_URANDOM_CHACHA_OBJS := $(addprefix objs/crypto/rand_urandom_chacha20/, rand_urandom_chacha20.o)
|
||||
$(RAND_URANDOM_CHACHA_OBJS): src/crypto/rand_urandom_chacha20/rand_urandom_chacha20.h
|
||||
|
||||
#RAND_URANDOM_AESCTR
|
||||
RAND_URANDOM_AESCTR_OBJS := $(addprefix objs/crypto/rand_urandom_aesctr/, rand_urandom_aesctr.o)
|
||||
$(RAND_URANDOM_AESCTR_OBJS): src/crypto/rand_urandom_aesctr/rand_urandom_aesctr.h
|
||||
|
||||
#RAND
|
||||
objs/crypto/rand/rand.o: src/crypto/rand/rand.h
|
||||
|
||||
#KEX_RLWE_BCNS15
|
||||
KEX_RLWE_BCNS15_OBJS := $(addprefix objs/kex_rlwe_bcns15/, fft.o kex_rlwe_bcns15.o rlwe.o rlwe_kex.o)
|
||||
KEX_RLWE_BCNS15_HEADERS := $(addprefix src/kex_rlwe_bcns15/, kex_rlwe_bcns15.h local.h rlwe_a.h rlwe_table.h)
|
||||
$(KEX_RLWE_BCNS15_OBJS): $(KEX_RLWE_BCNS15_HEADERS)
|
||||
|
||||
#KEX_NEWHOPE
|
||||
KEX_RLWE_NEWHOPE_OBJS := $(addprefix objs/kex_rlwe_newhope/, kex_rlwe_newhope.o)
|
||||
KEX_RLWE_NEWHOPE_HEADERS := $(addprefix src/kex_rlwe_newhope/, kex_rlwe_newhope.h newhope.c params.h poly.c precomp.c)
|
||||
$(KEX_RLWE_NEWHOPE_OBJS): $(KEX_RLWE_NEWHOPE_HEADERS)
|
||||
|
||||
#KEX_RLWE_MSRLN16
|
||||
KEX_RLWE_MSRLN16_OBJS := $(addprefix objs/kex_rlwe_msrln16/, kex_rlwe_msrln16.o LatticeCrypto_kex.o ntt_constants.o)
|
||||
KEX_RLWE_MSRLN16_HEADERS := $(addprefix src/kex_rlwe_msrln16/, LatticeCrypto.h LatticeCrypto_priv.h kex_rlwe_msrln16.h )
|
||||
$(KEX_RLWE_MSRLN16_OBJS): $(KEX_RLWE_MSRLN16_HEADERS)
|
||||
|
||||
#KEX_LWE_FRODO
|
||||
KEX_LWE_FRODO_OBJS := $(addprefix objs/kex_lwe_frodo/, lwe.o kex_lwe_frodo.o lwe_noise.o)
|
||||
KEX_LWE_FRODO_HEADERS := $(addprefix src/kex_lwe_frodo/, kex_lwe_frodo.h local.h kex_lwe_frodo_macrify.c lwe_macrify.c)
|
||||
$(KEX_LWE_FRODO_OBJS): $(KEX_LWE_FRODO_HEADERS)
|
||||
|
||||
#KEX_SIDH_CLN16
|
||||
#ifneq(, $(findstring SIDH_ASM, $(CFLAGS)))
|
||||
objs/kex_sidh_cln16/fp_x64_asm.o: src/kex_sidh_cln16/AMD64/fp_x64_asm.S
|
||||
@mkdir -p $(@D)
|
||||
@$(CC) $(CFLAGS) -c -o $@ src/kex_sidh_cln16/AMD64/fp_x64_asm.S
|
||||
@$(ECHO) "CC $<"
|
||||
KEX_SIDH_CLN16_ASM_OBJS = fp_x64_asm.o
|
||||
#endif
|
||||
KEX_SIDH_CLN16_OBJS := $(addprefix objs/kex_sidh_cln16/, ec_isogeny.o fpx.o kex_sidh_cln16.o SIDH.o sidh_kex.o SIDH_setup.o validate.o $(KEX_SIDH_CLN16_ASM_OBJS))
|
||||
KEX_SIDH_CLN16_HEADERS := $(addprefix src/kex_sidh_cln16/, kex_sidh_cln16.h SIDH.h)
|
||||
$(KEX_SIDH_CLN16_OBJS): $(KEX_SIDH_CLN16_HEADERS)
|
||||
|
||||
#KEX_CODE_MCBITS
|
||||
KEX_CODE_MCBITS_SRC := src/kex_code_mcbits/external/operations.c
|
||||
KEX_CODE_MCBITS_SRC += $(wildcard src/kex_code_mcbits/*.c)
|
||||
KEX_CODE_MCBITS_OBJS := $(patsubst src/%.c, objs/%.o, $(KEX_CODE_MCBITS_SRC))
|
||||
KEX_CODE_MCBITS_HEADERS := $(wildcard src/kex_code_mcbits/external/*.h)
|
||||
KEX_CODE_MCBITS_HEADERS += $(wildcard src/kex_code_mcbits/*.h)
|
||||
$(KEX_CODE_MCBITS_OBJS): $(KEX_CODE_MCBITS_HEADERS)
|
||||
|
||||
# KEX_NTRU
|
||||
KEX_NTRU_SRC := src/kex_ntru/kex_ntru.c
|
||||
KEX_NTRU_OBJS := objs/kex_ntru/kex_ntru.o
|
||||
KEX_NTRU_HEADERS := src/kex_ntru/kex_ntru.h
|
||||
$(KEX_NTRU_OBJS): $(KEX_NTRU_HEADERS)
|
||||
|
||||
# AES
|
||||
AES_OBJS := $(addprefix objs/crypto/aes/, aes.o aes_c.o aes_ni.o)
|
||||
AES_HEADERS := $(addprefix src/crypto/aes/, aes.h)
|
||||
$(AES_OBJS): $(AES_HEADERS)
|
||||
|
||||
# COMMON
|
||||
COMMON_OBJS := $(addprefix objs/common/, common.o)
|
||||
COMMON_HEADERS := $(addprefix src/common/, common.h)
|
||||
$(COMMON_OBJS): $(COMMON_HEADERS)
|
||||
|
||||
# SHA3
|
||||
SHA3_OBJS := $(addprefix objs/crypto/sha3/, sha3.o)
|
||||
SHA3_HEADERS := $(addprefix src/crypto/sha3/, sha3.h)
|
||||
$(SHA3_OBJS): $(SHA3_HEADERS)
|
||||
|
||||
# KEX
|
||||
objs/kex/kex.o: src/kex/kex.h
|
||||
|
||||
# LIB
|
||||
|
||||
|
||||
RAND_OBJS := $(RAND_URANDOM_AESCTR_OBJS) $(RAND_URANDOM_CHACHA_OBJS) objs/crypto/rand/rand.o
|
||||
|
||||
KEX_OBJS := $(KEX_RLWE_BCNS15_OBJS) $(KEX_RLWE_NEWHOPE_OBJS) $(KEX_RLWE_MSRLN16_OBJS) $(KEX_LWE_FRODO_OBJS) $(KEX_SIDH_CLN16_OBJS) objs/kex/kex.o
|
||||
|
||||
ifdef ENABLE_CODE_MCBITS
|
||||
KEX_OBJS += $(KEX_CODE_MCBITS_OBJS)
|
||||
endif
|
||||
|
||||
ifdef ENABLE_NTRU
|
||||
KEX_OBJS += $(KEX_NTRU_OBJS)
|
||||
endif
|
||||
|
||||
lib: $(RAND_OBJS) $(KEX_OBJS) $(AES_OBJS) $(COMMON_OBJS) $(SHA3_OBJS)
|
||||
@rm -f liboqs.a
|
||||
@$(AR) liboqs.a $^
|
||||
@$(ECHO) "AR liboqs.a"
|
||||
@$(RANLIB) liboqs.a
|
||||
@$(ECHO) "RANLIB liboqs.a"
|
||||
|
||||
tests: lib src/crypto/rand/test_rand.c src/kex/test_kex.c src/crypto/aes/test_aes.c src/ds_benchmark.h
|
||||
@$(CC) $(CFLAGS) $(INCLUDES) -L. src/crypto/rand/test_rand.c -loqs $(LDFLAGS) -o test_rand
|
||||
@$(ECHO) "CC src/crypto/rand/test_rand.c"
|
||||
@$(CC) $(CFLAGS) $(INCLUDES) -L. src/kex/test_kex.c -loqs $(LDFLAGS) -o test_kex
|
||||
@$(ECHO) "CC src/kex/test_kex.c"
|
||||
@$(CC) $(CFLAGS) $(INCLUDES) -L. src/crypto/aes/test_aes.c -loqs $(LDFLAGS) -o test_aes
|
||||
@$(ECHO) "CC src/crypto/aes/test_aes.c"
|
||||
|
||||
docs: links
|
||||
doxygen
|
||||
|
||||
check: links tests
|
||||
./test_kex --quiet
|
||||
./test_rand --quiet
|
||||
./test_aes
|
||||
|
||||
clean:
|
||||
$(RM) -r docs/doxygen objs include
|
||||
$(RM) -r test_rand{,.dSYM} test_kex{,.dSYM} test_aes{,.dSYM} liboqs.a
|
||||
find . -name .DS_Store -type f -delete
|
||||
|
||||
prettyprint:
|
||||
find src -name '*.c' -o -name '*.h' | xargs $(CLANGFORMAT) -style=file -i
|
106
Makefile.am
Normal file
106
Makefile.am
Normal file
@ -0,0 +1,106 @@
|
||||
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
|
||||
|
||||
SUBDIRS = ${SRCDIR}
|
||||
|
||||
BUILT_SOURCES = links
|
||||
lib_LTLIBRARIES = liboqs.la
|
||||
liboqs_la_SOURCES =
|
||||
liboqs_la_LIBADD = src/common/libcommon.la src/kex/libkex.la src/crypto/rand/librand.la src/crypto/aes/libaes.la
|
||||
liboqs_la_LIBADD += src/crypto/rand_urandom_aesctr/librandaesctr.la src/crypto/sha3/libsha3.la
|
||||
liboqs_la_LIBADD += src/crypto/rand_urandom_chacha20/librandchacha20.la
|
||||
liboqs_la_LIBADD += src/kex_rlwe_bcns15/libbcns15.la src/kex_rlwe_newhope/libnewhope.la
|
||||
liboqs_la_LIBADD += src/kex_lwe_frodo/libfrodo.la src/kex_rlwe_msrln16/libmsrln16.la
|
||||
liboqs_la_LIBADD += src/kex_sidh_cln16/libcln16.la
|
||||
|
||||
if USE_MCBITS
|
||||
liboqs_la_LIBADD += src/kex_code_mcbits/libmcbits.la
|
||||
endif
|
||||
|
||||
if USE_NTRU
|
||||
liboqs_la_LIBADD += src/kex_ntru/libntru.la
|
||||
liboqs_la_LIBADD += external/NTRUEncrypt-master/.libs/libntruencrypt.la
|
||||
endif
|
||||
|
||||
noinst_bin_PROGRAMS = test_rand test_kex test_aes
|
||||
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_OPENSSL
|
||||
test_kex_LDADD += -lcrypto
|
||||
endif
|
||||
if USE_MCBITS
|
||||
test_kex_LDADD += -lsodium
|
||||
endif
|
||||
|
||||
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 += -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 += -lcrypto
|
||||
else
|
||||
if USE_AES_NI
|
||||
test_rand_CPPFLAGS += -maes -msse2
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
test:
|
||||
$(foreach s,$(ALLDIRS),make test -s -C $(s);)
|
||||
./test_kex
|
||||
./test_rand
|
||||
./test_aes
|
||||
|
||||
links:
|
||||
$(MKDIR_P) include/oqs
|
||||
$(LN_S) -f ../../src/common/common.h include/oqs
|
||||
$(LN_S) -f ../../src/crypto/aes/aes.h include/oqs
|
||||
$(LN_S) -f ../../src/crypto/sha3/sha3.h include/oqs
|
||||
$(LN_S) -f ../../src/kex/kex.h include/oqs
|
||||
$(LN_S) -f ../../src/crypto/rand/rand.h include/oqs
|
||||
$(LN_S) -f ../../src/crypto/rand_urandom_chacha20/rand_urandom_chacha20.h include/oqs
|
||||
$(LN_S) -f ../../src/crypto/rand_urandom_aesctr/rand_urandom_aesctr.h include/oqs
|
||||
$(LN_S) -f ../../src/kex_rlwe_newhope/kex_rlwe_newhope.h include/oqs
|
||||
$(LN_S) -f ../../src/kex_rlwe_msrln16/kex_rlwe_msrln16.h include/oqs
|
||||
$(LN_S) -f ../../src/kex_lwe_frodo/kex_lwe_frodo.h include/oqs
|
||||
$(LN_S) -f ../../src/kex_rlwe_bcns15/kex_rlwe_bcns15.h include/oqs
|
||||
$(LN_S) -f ../../src/kex_sidh_cln16/kex_sidh_cln16.h include/oqs
|
||||
$(LN_S) -f .libs/liboqs.a
|
||||
if USE_MCBITS
|
||||
$(LN_S) -f ../../src/kex_code_mcbits/kex_code_mcbits.h include/oqs
|
||||
endif
|
||||
if USE_NTRU
|
||||
$(LN_S) -f ../../src/kex_ntru/kex_ntru.h include/oqs
|
||||
endif
|
||||
|
||||
clean-local:
|
||||
rm -f liboqs.a
|
||||
|
||||
prettyprint:
|
||||
find src -name '*.c' -o -name '*.h' | xargs $(CLANGFORMAT) -style=file -i
|
||||
|
||||
docs: links
|
||||
doxygen
|
||||
|
11
README.md
11
README.md
@ -41,6 +41,9 @@ Builds have been tested on Mac OS X 10.11.6, macOS 10.12, Ubuntu 16.04.1, and Wi
|
||||
|
||||
To build, clone or download the source from GitHub, then simply type:
|
||||
|
||||
autoreconf -i
|
||||
./configure
|
||||
make clean
|
||||
make
|
||||
|
||||
This will generate:
|
||||
@ -52,7 +55,7 @@ This will generate:
|
||||
|
||||
To run the tests, simply type:
|
||||
|
||||
make check
|
||||
make test
|
||||
|
||||
To run benchmarks, run
|
||||
|
||||
@ -93,8 +96,9 @@ The `kex_code_mcbits` key exchange method is not enabled by default. In order t
|
||||
2. Build liboqs with the following option:
|
||||
|
||||
~~~
|
||||
./configure --enable-mcbits
|
||||
make clean
|
||||
make ENABLE_CODE_MCBITS=1
|
||||
make
|
||||
~~~
|
||||
|
||||
### Building with `kex_ntru` enabled
|
||||
@ -105,8 +109,9 @@ The `kex_ntru` key exchange method is not enabled by default. In order to enabl
|
||||
2. Build liboqs with the following option:
|
||||
|
||||
~~~
|
||||
./configure --enable-ntru
|
||||
make clean
|
||||
make ENABLE_NTRU=1
|
||||
make
|
||||
~~~
|
||||
|
||||
Documentation
|
||||
|
321
acinclude.m4
Normal file
321
acinclude.m4
Normal file
@ -0,0 +1,321 @@
|
||||
# This file is part of Autoconf. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004 Oren Ben-Kiki
|
||||
# This file is distributed under the same terms as the Autoconf macro files.
|
||||
|
||||
########## CHANGELOG ##################
|
||||
# 2009-01-14 Martin Mann
|
||||
# * DX_ARG_ABLE : new variable 'DX_FLAG_DX_CURRENT_FEATURE'
|
||||
# * DX_CLEAR_DEPEND : use of explicit variable 'DX_FLAG_DX_CURRENT_FEATURE'
|
||||
# in AC_SUBST instead of 'DX_FLAG[]DX_CURRENT_FEATURE' which is rejected by
|
||||
# newer autotools
|
||||
|
||||
# Generate automatic documentation using Doxygen. Works in concert with the
|
||||
# aminclude.m4 file and a compatible doxygen configuration file. Defines the
|
||||
# following public macros:
|
||||
#
|
||||
# DX_???_FEATURE(ON|OFF) - control the default setting fo a Doxygen feature.
|
||||
# Supported features are 'DOXYGEN' itself, 'DOT' for generating graphics,
|
||||
# 'HTML' for plain HTML, 'CHM' for compressed HTML help (for MS users), 'CHI'
|
||||
# for generating a seperate .chi file by the .chm file, and 'MAN', 'RTF',
|
||||
# 'XML', 'PDF' and 'PS' for the appropriate output formats. The environment
|
||||
# variable DOXYGEN_PAPER_SIZE may be specified to override the default 'a4wide'
|
||||
# paper size.
|
||||
#
|
||||
# By default, HTML, PDF and PS documentation is generated as this seems to be
|
||||
# the most popular and portable combination. MAN pages created by Doxygen are
|
||||
# usually problematic, though by picking an appropriate subset and doing some
|
||||
# massaging they might be better than nothing. CHM and RTF are specific for MS
|
||||
# (note that you can't generate both HTML and CHM at the same time). The XML is
|
||||
# rather useless unless you apply specialized post-processing to it.
|
||||
#
|
||||
# The macro mainly controls the default state of the feature. The use can
|
||||
# override the default by specifying --enable or --disable. The macros ensure
|
||||
# that contradictory flags are not given (e.g., --enable-doxygen-html and
|
||||
# --enable-doxygen-chm, --enable-doxygen-anything with --disable-doxygen, etc.)
|
||||
# Finally, each feature will be automatically disabled (with a warning) if the
|
||||
# required programs are missing.
|
||||
#
|
||||
# Once all the feature defaults have been specified, call DX_INIT_DOXYGEN with
|
||||
# the following parameters: a one-word name for the project for use as a
|
||||
# filename base etc., an optional configuration file name (the default is
|
||||
# 'Doxyfile', the same as Doxygen's default), and an optional output directory
|
||||
# name (the default is 'doxygen-doc').
|
||||
|
||||
## ----------##
|
||||
## Defaults. ##
|
||||
## ----------##
|
||||
|
||||
DX_ENV=""
|
||||
AC_DEFUN([DX_FEATURE_doc], ON)
|
||||
AC_DEFUN([DX_FEATURE_dot], ON)
|
||||
AC_DEFUN([DX_FEATURE_man], OFF)
|
||||
AC_DEFUN([DX_FEATURE_html], ON)
|
||||
AC_DEFUN([DX_FEATURE_chm], OFF)
|
||||
AC_DEFUN([DX_FEATURE_chi], OFF)
|
||||
AC_DEFUN([DX_FEATURE_rtf], OFF)
|
||||
AC_DEFUN([DX_FEATURE_xml], OFF)
|
||||
AC_DEFUN([DX_FEATURE_pdf], ON)
|
||||
AC_DEFUN([DX_FEATURE_ps], ON)
|
||||
|
||||
## --------------- ##
|
||||
## Private macros. ##
|
||||
## --------------- ##
|
||||
|
||||
# DX_ENV_APPEND(VARIABLE, VALUE)
|
||||
# ------------------------------
|
||||
# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen.
|
||||
AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])])
|
||||
|
||||
# DX_DIRNAME_EXPR
|
||||
# ---------------
|
||||
# Expand into a shell expression prints the directory part of a path.
|
||||
AC_DEFUN([DX_DIRNAME_EXPR],
|
||||
[[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']])
|
||||
|
||||
# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF)
|
||||
# -------------------------------------
|
||||
# Expands according to the M4 (static) status of the feature.
|
||||
AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])])
|
||||
|
||||
# DX_REQUIRE_PROG(VARIABLE, PROGRAM)
|
||||
# ----------------------------------
|
||||
# Require the specified program to be found for the DX_CURRENT_FEATURE to work.
|
||||
AC_DEFUN([DX_REQUIRE_PROG], [
|
||||
AC_PATH_TOOL([$1], [$2])
|
||||
if test "$DX_FLAG_DX_CURRENT_FEATURE$$1" = 1; then
|
||||
AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION])
|
||||
AC_SUBST([DX_FLAG_DX_CURRENT_FEATURE], 0)
|
||||
fi
|
||||
])
|
||||
|
||||
# DX_TEST_FEATURE(FEATURE)
|
||||
# ------------------------
|
||||
# Expand to a shell expression testing whether the feature is active.
|
||||
AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1])
|
||||
|
||||
# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE)
|
||||
# -------------------------------------------------
|
||||
# Verify that a required features has the right state before trying to turn on
|
||||
# the DX_CURRENT_FEATURE.
|
||||
AC_DEFUN([DX_CHECK_DEPEND], [
|
||||
test "$DX_FLAG_$1" = "$2" \
|
||||
|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1,
|
||||
requires, contradicts) doxygen-DX_CURRENT_FEATURE])
|
||||
])
|
||||
|
||||
# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE)
|
||||
# ----------------------------------------------------------
|
||||
# Turn off the DX_CURRENT_FEATURE if the required feature is off.
|
||||
AC_DEFUN([DX_CLEAR_DEPEND], [
|
||||
test "$DX_FLAG_$1" = "$2" || AC_SUBST([DX_FLAG_DX_CURRENT_FEATURE], 0)
|
||||
])
|
||||
|
||||
|
||||
# DX_FEATURE_ARG(FEATURE, DESCRIPTION,
|
||||
# CHECK_DEPEND, CLEAR_DEPEND,
|
||||
# REQUIRE, DO-IF-ON, DO-IF-OFF)
|
||||
# --------------------------------------------
|
||||
# Parse the command-line option controlling a feature. CHECK_DEPEND is called
|
||||
# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND),
|
||||
# otherwise CLEAR_DEPEND is called to turn off the default state if a required
|
||||
# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional
|
||||
# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and
|
||||
# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature.
|
||||
AC_DEFUN([DX_ARG_ABLE], [
|
||||
AC_DEFUN([DX_CURRENT_FEATURE], [$1])
|
||||
AC_DEFUN([DX_FLAG_DX_CURRENT_FEATURE], [DX_FLAG_$1])
|
||||
AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2])
|
||||
AC_ARG_ENABLE(doxygen-$1,
|
||||
[AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1],
|
||||
[--enable-doxygen-$1]),
|
||||
DX_IF_FEATURE([$1], [don't $2], [$2]))],
|
||||
[
|
||||
case "$enableval" in
|
||||
#(
|
||||
y|Y|yes|Yes|YES)
|
||||
AC_SUBST([DX_FLAG_$1], 1)
|
||||
$3
|
||||
;; #(
|
||||
n|N|no|No|NO)
|
||||
AC_SUBST([DX_FLAG_$1], 0)
|
||||
;; #(
|
||||
*)
|
||||
AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1])
|
||||
;;
|
||||
esac
|
||||
], [
|
||||
AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)])
|
||||
$4
|
||||
])
|
||||
if DX_TEST_FEATURE([$1]); then
|
||||
$5
|
||||
:
|
||||
fi
|
||||
if DX_TEST_FEATURE([$1]); then
|
||||
AM_CONDITIONAL(DX_COND_$1, :)
|
||||
$6
|
||||
:
|
||||
else
|
||||
AM_CONDITIONAL(DX_COND_$1, false)
|
||||
$7
|
||||
:
|
||||
fi
|
||||
])
|
||||
|
||||
## -------------- ##
|
||||
## Public macros. ##
|
||||
## -------------- ##
|
||||
|
||||
# DX_XXX_FEATURE(DEFAULT_STATE)
|
||||
# -----------------------------
|
||||
AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])])
|
||||
AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])])
|
||||
AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])])
|
||||
AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])])
|
||||
AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])])
|
||||
AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])])
|
||||
AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
|
||||
AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
|
||||
AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])])
|
||||
AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])])
|
||||
|
||||
# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR])
|
||||
# ---------------------------------------------------------
|
||||
# PROJECT also serves as the base name for the documentation files.
|
||||
# The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc".
|
||||
AC_DEFUN([DX_INIT_DOXYGEN], [
|
||||
|
||||
# Files:
|
||||
AC_SUBST([DX_PROJECT], [$1])
|
||||
AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])])
|
||||
AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])])
|
||||
|
||||
# Environment variables used inside doxygen.cfg:
|
||||
DX_ENV_APPEND(SRCDIR, $srcdir)
|
||||
DX_ENV_APPEND(PROJECT, $DX_PROJECT)
|
||||
DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
|
||||
DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
|
||||
|
||||
# Doxygen itself:
|
||||
DX_ARG_ABLE(doc, [generate any doxygen documentation],
|
||||
[],
|
||||
[],
|
||||
[DX_REQUIRE_PROG([DX_DOXYGEN], doxygen)
|
||||
DX_REQUIRE_PROG([DX_PERL], perl)],
|
||||
[DX_ENV_APPEND(PERL_PATH, $DX_PERL)])
|
||||
|
||||
# Dot for graphics:
|
||||
DX_ARG_ABLE(dot, [generate graphics for doxygen documentation],
|
||||
[DX_CHECK_DEPEND(doc, 1)],
|
||||
[DX_CLEAR_DEPEND(doc, 1)],
|
||||
[DX_REQUIRE_PROG([DX_DOT], dot)],
|
||||
[DX_ENV_APPEND(HAVE_DOT, YES)
|
||||
DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])],
|
||||
[DX_ENV_APPEND(HAVE_DOT, NO)])
|
||||
|
||||
# Man pages generation:
|
||||
DX_ARG_ABLE(man, [generate doxygen manual pages],
|
||||
[DX_CHECK_DEPEND(doc, 1)],
|
||||
[DX_CLEAR_DEPEND(doc, 1)],
|
||||
[],
|
||||
[DX_ENV_APPEND(GENERATE_MAN, YES)],
|
||||
[DX_ENV_APPEND(GENERATE_MAN, NO)])
|
||||
|
||||
# RTF file generation:
|
||||
DX_ARG_ABLE(rtf, [generate doxygen RTF documentation],
|
||||
[DX_CHECK_DEPEND(doc, 1)],
|
||||
[DX_CLEAR_DEPEND(doc, 1)],
|
||||
[],
|
||||
[DX_ENV_APPEND(GENERATE_RTF, YES)],
|
||||
[DX_ENV_APPEND(GENERATE_RTF, NO)])
|
||||
|
||||
# XML file generation:
|
||||
DX_ARG_ABLE(xml, [generate doxygen XML documentation],
|
||||
[DX_CHECK_DEPEND(doc, 1)],
|
||||
[DX_CLEAR_DEPEND(doc, 1)],
|
||||
[],
|
||||
[DX_ENV_APPEND(GENERATE_XML, YES)],
|
||||
[DX_ENV_APPEND(GENERATE_XML, NO)])
|
||||
|
||||
# (Compressed) HTML help generation:
|
||||
DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation],
|
||||
[DX_CHECK_DEPEND(doc, 1)],
|
||||
[DX_CLEAR_DEPEND(doc, 1)],
|
||||
[DX_REQUIRE_PROG([DX_HHC], hhc)],
|
||||
[DX_ENV_APPEND(HHC_PATH, $DX_HHC)
|
||||
DX_ENV_APPEND(GENERATE_HTML, YES)
|
||||
DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
|
||||
[DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
|
||||
|
||||
# Seperate CHI file generation.
|
||||
DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file],
|
||||
[DX_CHECK_DEPEND(chm, 1)],
|
||||
[DX_CLEAR_DEPEND(chm, 1)],
|
||||
[],
|
||||
[DX_ENV_APPEND(GENERATE_CHI, YES)],
|
||||
[DX_ENV_APPEND(GENERATE_CHI, NO)])
|
||||
|
||||
# Plain HTML pages generation:
|
||||
DX_ARG_ABLE(html, [generate doxygen plain HTML documentation],
|
||||
[DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)],
|
||||
[DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)],
|
||||
[],
|
||||
[DX_ENV_APPEND(GENERATE_HTML, YES)],
|
||||
[DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)])
|
||||
|
||||
# PostScript file generation:
|
||||
DX_ARG_ABLE(ps, [generate doxygen PostScript documentation],
|
||||
[DX_CHECK_DEPEND(doc, 1)],
|
||||
[DX_CLEAR_DEPEND(doc, 1)],
|
||||
[DX_REQUIRE_PROG([DX_LATEX], latex)
|
||||
DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
|
||||
DX_REQUIRE_PROG([DX_DVIPS], dvips)
|
||||
DX_REQUIRE_PROG([DX_EGREP], egrep)])
|
||||
|
||||
# PDF file generation:
|
||||
DX_ARG_ABLE(pdf, [generate doxygen PDF documentation],
|
||||
[DX_CHECK_DEPEND(doc, 1)],
|
||||
[DX_CLEAR_DEPEND(doc, 1)],
|
||||
[DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex)
|
||||
DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
|
||||
DX_REQUIRE_PROG([DX_EGREP], egrep)])
|
||||
|
||||
# LaTeX generation for PS and/or PDF:
|
||||
if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then
|
||||
AM_CONDITIONAL(DX_COND_latex, :)
|
||||
DX_ENV_APPEND(GENERATE_LATEX, YES)
|
||||
else
|
||||
AM_CONDITIONAL(DX_COND_latex, false)
|
||||
DX_ENV_APPEND(GENERATE_LATEX, NO)
|
||||
fi
|
||||
|
||||
# Paper size for PS and/or PDF:
|
||||
AC_ARG_VAR(DOXYGEN_PAPER_SIZE,
|
||||
[a4wide (default), a4, letter, legal or executive])
|
||||
case "$DOXYGEN_PAPER_SIZE" in
|
||||
#(
|
||||
"")
|
||||
AC_SUBST(DOXYGEN_PAPER_SIZE, "")
|
||||
;; #(
|
||||
a4wide|a4|letter|legal|executive)
|
||||
DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE)
|
||||
;; #(
|
||||
*)
|
||||
AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'])
|
||||
;;
|
||||
esac
|
||||
|
||||
#For debugging:
|
||||
#echo DX_FLAG_doc=$DX_FLAG_doc
|
||||
#echo DX_FLAG_dot=$DX_FLAG_dot
|
||||
#echo DX_FLAG_man=$DX_FLAG_man
|
||||
#echo DX_FLAG_html=$DX_FLAG_html
|
||||
#echo DX_FLAG_chm=$DX_FLAG_chm
|
||||
#echo DX_FLAG_chi=$DX_FLAG_chi
|
||||
#echo DX_FLAG_rtf=$DX_FLAG_rtf
|
||||
#echo DX_FLAG_xml=$DX_FLAG_xml
|
||||
#echo DX_FLAG_pdf=$DX_FLAG_pdf
|
||||
#echo DX_FLAG_ps=$DX_FLAG_ps
|
||||
#echo DX_ENV=$DX_ENV
|
||||
])
|
186
aminclude.am
Normal file
186
aminclude.am
Normal file
@ -0,0 +1,186 @@
|
||||
# Copyright (C) 2004 Oren Ben-Kiki
|
||||
# This file is distributed under the same terms as the Automake macro files.
|
||||
|
||||
# Generate automatic documentation using Doxygen. Goals and variables values
|
||||
# are controlled by the various DX_COND_??? conditionals set by autoconf.
|
||||
#
|
||||
# The provided goals are:
|
||||
# doxygen-doc: Generate all doxygen documentation.
|
||||
# doxygen-run: Run doxygen, which will generate some of the documentation
|
||||
# (HTML, CHM, CHI, MAN, RTF, XML) but will not do the post
|
||||
# processing required for the rest of it (PS, PDF, and some MAN).
|
||||
# doxygen-man: Rename some doxygen generated man pages.
|
||||
# doxygen-ps: Generate doxygen PostScript documentation.
|
||||
# doxygen-pdf: Generate doxygen PDF documentation.
|
||||
#
|
||||
# Note that by default these are not integrated into the automake goals. If
|
||||
# doxygen is used to generate man pages, you can achieve this integration by
|
||||
# setting man3_MANS to the list of man pages generated and then adding the
|
||||
# dependency:
|
||||
#
|
||||
# $(man3_MANS): doxygen-doc
|
||||
#
|
||||
# This will cause make to run doxygen and generate all the documentation.
|
||||
#
|
||||
# The following variable is intended for use in Makefile.am:
|
||||
#
|
||||
# DX_CLEANFILES = everything to clean.
|
||||
#
|
||||
# This is usually added to MOSTLYCLEANFILES.
|
||||
|
||||
## --------------------------------- ##
|
||||
## Format-independent Doxygen rules. ##
|
||||
## --------------------------------- ##
|
||||
|
||||
if DX_COND_doc
|
||||
|
||||
## ------------------------------- ##
|
||||
## Rules specific for HTML output. ##
|
||||
## ------------------------------- ##
|
||||
|
||||
if DX_COND_html
|
||||
|
||||
DX_CLEAN_HTML = @DX_DOCDIR@/html
|
||||
|
||||
endif DX_COND_html
|
||||
|
||||
## ------------------------------ ##
|
||||
## Rules specific for CHM output. ##
|
||||
## ------------------------------ ##
|
||||
|
||||
if DX_COND_chm
|
||||
|
||||
DX_CLEAN_CHM = @DX_DOCDIR@/chm
|
||||
|
||||
if DX_COND_chi
|
||||
|
||||
DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
|
||||
|
||||
endif DX_COND_chi
|
||||
|
||||
endif DX_COND_chm
|
||||
|
||||
## ------------------------------ ##
|
||||
## Rules specific for MAN output. ##
|
||||
## ------------------------------ ##
|
||||
|
||||
if DX_COND_man
|
||||
|
||||
DX_CLEAN_MAN = @DX_DOCDIR@/man
|
||||
|
||||
endif DX_COND_man
|
||||
|
||||
## ------------------------------ ##
|
||||
## Rules specific for RTF output. ##
|
||||
## ------------------------------ ##
|
||||
|
||||
if DX_COND_rtf
|
||||
|
||||
DX_CLEAN_RTF = @DX_DOCDIR@/rtf
|
||||
|
||||
endif DX_COND_rtf
|
||||
|
||||
## ------------------------------ ##
|
||||
## Rules specific for XML output. ##
|
||||
## ------------------------------ ##
|
||||
|
||||
if DX_COND_xml
|
||||
|
||||
DX_CLEAN_XML = @DX_DOCDIR@/xml
|
||||
|
||||
endif DX_COND_xml
|
||||
|
||||
## ----------------------------- ##
|
||||
## Rules specific for PS output. ##
|
||||
## ----------------------------- ##
|
||||
|
||||
if DX_COND_ps
|
||||
|
||||
DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
|
||||
|
||||
DX_PS_GOAL = doxygen-ps
|
||||
|
||||
doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
|
||||
|
||||
@DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
|
||||
cd @DX_DOCDIR@/latex; \
|
||||
rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
|
||||
$(DX_LATEX) refman.tex; \
|
||||
$(MAKEINDEX_PATH) refman.idx; \
|
||||
$(DX_LATEX) refman.tex; \
|
||||
countdown=5; \
|
||||
while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
|
||||
refman.log > /dev/null 2>&1 \
|
||||
&& test $$countdown -gt 0; do \
|
||||
$(DX_LATEX) refman.tex; \
|
||||
countdown=`expr $$countdown - 1`; \
|
||||
done; \
|
||||
$(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
|
||||
|
||||
endif DX_COND_ps
|
||||
|
||||
## ------------------------------ ##
|
||||
## Rules specific for PDF output. ##
|
||||
## ------------------------------ ##
|
||||
|
||||
if DX_COND_pdf
|
||||
|
||||
DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
|
||||
|
||||
DX_PDF_GOAL = doxygen-pdf
|
||||
|
||||
doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
|
||||
|
||||
@DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
|
||||
cd @DX_DOCDIR@/latex; \
|
||||
rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
|
||||
$(DX_PDFLATEX) refman.tex; \
|
||||
$(DX_MAKEINDEX) refman.idx; \
|
||||
$(DX_PDFLATEX) refman.tex; \
|
||||
countdown=5; \
|
||||
while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
|
||||
refman.log > /dev/null 2>&1 \
|
||||
&& test $$countdown -gt 0; do \
|
||||
$(DX_PDFLATEX) refman.tex; \
|
||||
countdown=`expr $$countdown - 1`; \
|
||||
done; \
|
||||
mv refman.pdf ../@PACKAGE@.pdf
|
||||
|
||||
endif DX_COND_pdf
|
||||
|
||||
## ------------------------------------------------- ##
|
||||
## Rules specific for LaTeX (shared for PS and PDF). ##
|
||||
## ------------------------------------------------- ##
|
||||
|
||||
if DX_COND_latex
|
||||
|
||||
DX_CLEAN_LATEX = @DX_DOCDIR@/latex
|
||||
|
||||
endif DX_COND_latex
|
||||
|
||||
.PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
|
||||
|
||||
.INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
|
||||
|
||||
doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
|
||||
|
||||
doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
|
||||
|
||||
@DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
|
||||
rm -rf @DX_DOCDIR@
|
||||
$(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
|
||||
|
||||
DX_CLEANFILES = \
|
||||
@DX_DOCDIR@/@PACKAGE@.tag \
|
||||
-r \
|
||||
$(DX_CLEAN_HTML) \
|
||||
$(DX_CLEAN_CHM) \
|
||||
$(DX_CLEAN_CHI) \
|
||||
$(DX_CLEAN_MAN) \
|
||||
$(DX_CLEAN_RTF) \
|
||||
$(DX_CLEAN_XML) \
|
||||
$(DX_CLEAN_PS) \
|
||||
$(DX_CLEAN_PDF) \
|
||||
$(DX_CLEAN_LATEX)
|
||||
|
||||
endif DX_COND_doc
|
0
config/.gitkeep
Normal file
0
config/.gitkeep
Normal file
146
configure.ac
Normal file
146
configure.ac
Normal file
@ -0,0 +1,146 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
#AC_PREREQ([2.69])
|
||||
AC_INIT([liboqs], [1.0.0], [])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CXX
|
||||
AC_PROG_AWK
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_MKDIR_P
|
||||
AM_PROG_AS
|
||||
AM_INIT_AUTOMAKE([subdir-objects])
|
||||
m4_include(m4/macros/enable-disable.m4)
|
||||
LT_INIT([disable-shared])
|
||||
AC_CHECK_SIZEOF([size_t])
|
||||
# Checks for libraries.
|
||||
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stddef.h stdint.h stdlib.h string.h strings.h unistd.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_INLINE
|
||||
AC_TYPE_INT32_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([memset strdup])
|
||||
|
||||
######################################################################
|
||||
# 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([mcbits], [enable CODE-MCBITS.])
|
||||
AM_CONDITIONAL([mcbits], [test "x$mcbits" = xtrue])
|
||||
AM_CONDITIONAL([USE_MCBITS], [test "x$mcbits" = xtrue])
|
||||
|
||||
ARG_ENABL_SET([ntru], [enable NTRU.])
|
||||
AM_CONDITIONAL([ntru], [test "x$ntru" = xtrue])
|
||||
AM_CONDITIONAL([USE_NTRU], [test "x$ntru" = xtrue])
|
||||
|
||||
|
||||
AM_CPPFLAGS="-O3 -std=gnu11 -Wpedantic -Wall -Wextra -DCONSTANT_TIME"
|
||||
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* )
|
||||
OPENSSL_DIR=/usr/local/opt/openssl
|
||||
;;
|
||||
linux*)
|
||||
OPENSSL_DIR=/usr
|
||||
if test x"${ac_cv_sizeof_size_t}" = x"8";then
|
||||
AM_CPPFLAGS=${AM_CPPFLAGS}" -DSIDH_ASM -march=x86-64"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
#Default Case
|
||||
AC_MSG_ERROR([Your platform is not currently supported])
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
SRCDIR=" src/common src/crypto/aes src/kex src/crypto/rand src/crypto/sha3"
|
||||
SRCDIR=${SRCDIR}" src/crypto/rand_urandom_aesctr src/crypto/rand_urandom_chacha20"
|
||||
SRCDIR=${SRCDIR}" src/kex_rlwe_bcns15/"
|
||||
SRCDIR=${SRCDIR}" src/kex_rlwe_newhope"
|
||||
SRCDIR=${SRCDIR}" src/kex_lwe_frodo"
|
||||
SRCDIR=${SRCDIR}" src/kex_rlwe_msrln16"
|
||||
SRCDIR=${SRCDIR}" src/kex_sidh_cln16"
|
||||
|
||||
|
||||
|
||||
if test x"$ntru" = x"true"; then
|
||||
AM_CPPFLAGS=${AM_CPPFLAGS}" -DENABLE_NTRU"
|
||||
SRCDIR=${SRCDIR}" src/kex_ntru"
|
||||
fi
|
||||
|
||||
if test x"$mcbits" = x"true"; then
|
||||
AM_CPPFLAGS=${AM_CPPFLAGS}" -DENABLE_CODE_MCBITS"
|
||||
SRCDIR=${SRCDIR}" src/kex_code_mcbits"
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
AC_SUBST(AM_CPPFLAGS)
|
||||
AC_SUBST(SRCDIR)
|
||||
AC_SUBST(OPENSSL_DIR)
|
||||
AC_SUBST(USE_OPENSSL)
|
||||
AC_SUBST(USE_AES_NI)
|
||||
AC_SUBST(USE_NTRU)
|
||||
AC_SUBST(USE_MCBITS)
|
||||
|
||||
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_lwe_frodo/Makefile])
|
||||
|
||||
AC_OUTPUT
|
39
m4/macros/enable-disable.m4
Normal file
39
m4/macros/enable-disable.m4
Normal file
@ -0,0 +1,39 @@
|
||||
# ARG_ENABL_SET(option, help)
|
||||
# ---------------------------
|
||||
# Create a --enable-$1 option with helptext, set a variable $1 to true/false
|
||||
# All $1 are collected in the variable $disabled_by_default
|
||||
AC_DEFUN([ARG_ENABL_SET],
|
||||
[AC_ARG_ENABLE(
|
||||
[$1],
|
||||
AS_HELP_STRING([--enable-$1], [$2]),
|
||||
[patsubst([$1], [-], [_])_given=true
|
||||
if test x$enableval = xyes; then
|
||||
patsubst([$1], [-], [_])=true
|
||||
else
|
||||
patsubst([$1], [-], [_])=false
|
||||
fi],
|
||||
[patsubst([$1], [-], [_])=false
|
||||
patsubst([$1], [-], [_])_given=false]
|
||||
)
|
||||
disabled_by_default=${disabled_by_default}" patsubst([$1], [-], [_])"]
|
||||
)
|
||||
|
||||
# ARG_DISBL_SET(option, help)
|
||||
# ---------------------------
|
||||
# Create a --disable-$1 option with helptext, set a variable $1 to true/false
|
||||
# All $1 are collected in the variable $enabled_by_default
|
||||
AC_DEFUN([ARG_DISBL_SET],
|
||||
[AC_ARG_ENABLE(
|
||||
[$1],
|
||||
AS_HELP_STRING([--disable-$1], [$2]),
|
||||
[patsubst([$1], [-], [_])_given=true
|
||||
if test x$enableval = xyes; then
|
||||
patsubst([$1], [-], [_])=true
|
||||
else
|
||||
patsubst([$1], [-], [_])=false
|
||||
fi],
|
||||
[patsubst([$1], [-], [_])=true
|
||||
patsubst([$1], [-], [_])_given=false]
|
||||
)
|
||||
enabled_by_default=${enabled_by_default}" patsubst([$1], [-], [_])"]
|
||||
)
|
8
src/common/Makefile.am
Normal file
8
src/common/Makefile.am
Normal file
@ -0,0 +1,8 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LTLIBRARIES = libcommon.la
|
||||
|
||||
libcommon_la_SOURCES = common.c
|
||||
|
||||
libcommon_la_CPPFLAGS = -I../../include
|
||||
libcommon_la_CPPFLAGS += $(AM_CPPFLAGS)
|
||||
|
18
src/crypto/aes/Makefile.am
Normal file
18
src/crypto/aes/Makefile.am
Normal file
@ -0,0 +1,18 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LTLIBRARIES = libaes.la
|
||||
|
||||
libaes_la_SOURCES = aes.c
|
||||
|
||||
libaes_la_CPPFLAGS = -I../../../include
|
||||
if USE_OPENSSL
|
||||
libaes_la_CPPFLAGS += -I$(OPENSSL_DIR)/include
|
||||
endif
|
||||
|
||||
if USE_AES_NI
|
||||
libaes_la_CPPFLAGS += -maes -msse2
|
||||
libaes_la_SOURCES += aes_ni.c
|
||||
endif
|
||||
|
||||
libaes_la_SOURCES += aes_c.c
|
||||
libaes_la_CPPFLAGS += $(AM_CPPFLAGS)
|
||||
|
@ -8,7 +8,7 @@ void OQS_AES128_load_schedule(const uint8_t *key, void **schedule, int for_encry
|
||||
oqs_aes128_load_schedule_ossl(key, schedule, for_encryption);
|
||||
#else
|
||||
for_encryption++; // need some dummy operation to avoid unused parameter warning
|
||||
#ifndef AES_DISABLE_NI
|
||||
#ifdef AES_ENABLE_NI
|
||||
oqs_aes128_load_schedule_ni(key, schedule);
|
||||
#else
|
||||
oqs_aes128_load_schedule_c(key, schedule);
|
||||
@ -20,7 +20,7 @@ void OQS_AES128_free_schedule(void *schedule) {
|
||||
#ifdef USE_OPENSSL
|
||||
oqs_aes128_free_schedule_ossl(schedule);
|
||||
#else
|
||||
#ifndef AES_DISABLE_NI
|
||||
#ifdef AES_ENABLE_NI
|
||||
oqs_aes128_free_schedule_ni(schedule);
|
||||
#else
|
||||
oqs_aes128_free_schedule_c(schedule);
|
||||
@ -32,7 +32,7 @@ void OQS_AES128_ECB_enc(const uint8_t *plaintext, const size_t plaintext_len, co
|
||||
#ifdef USE_OPENSSL
|
||||
oqs_aes128_ecb_enc_ossl(plaintext, plaintext_len, key, ciphertext);
|
||||
#else
|
||||
#ifndef AES_DISABLE_NI
|
||||
#ifdef AES_ENABLE_NI
|
||||
oqs_aes128_ecb_enc_ni(plaintext, plaintext_len, key, ciphertext);
|
||||
#else
|
||||
oqs_aes128_ecb_enc_c(plaintext, plaintext_len, key, ciphertext);
|
||||
@ -44,7 +44,7 @@ void OQS_AES128_ECB_dec(const uint8_t *ciphertext, const size_t ciphertext_len,
|
||||
#ifdef USE_OPENSSL
|
||||
oqs_aes128_ecb_dec_ossl(ciphertext, ciphertext_len, key, plaintext);
|
||||
#else
|
||||
#ifndef AES_DISABLE_NI
|
||||
#ifdef AES_ENABLE_NI
|
||||
oqs_aes128_ecb_dec_ni(ciphertext, ciphertext_len, key, plaintext);
|
||||
#else
|
||||
oqs_aes128_ecb_dec_c(ciphertext, ciphertext_len, key, plaintext);
|
||||
@ -56,7 +56,7 @@ void OQS_AES128_ECB_enc_sch(const uint8_t *plaintext, const size_t plaintext_len
|
||||
#ifdef USE_OPENSSL
|
||||
oqs_aes128_ecb_enc_sch_ossl(plaintext, plaintext_len, schedule, ciphertext);
|
||||
#else
|
||||
#ifndef AES_DISABLE_NI
|
||||
#ifdef AES_ENABLE_NI
|
||||
oqs_aes128_ecb_enc_sch_ni(plaintext, plaintext_len, schedule, ciphertext);
|
||||
#else
|
||||
oqs_aes128_ecb_enc_sch_c(plaintext, plaintext_len, schedule, ciphertext);
|
||||
@ -68,7 +68,7 @@ void OQS_AES128_ECB_dec_sch(const uint8_t *ciphertext, const size_t ciphertext_l
|
||||
#ifdef USE_OPENSSL
|
||||
oqs_aes128_ecb_dec_sch_ossl(ciphertext, ciphertext_len, schedule, plaintext);
|
||||
#else
|
||||
#ifndef AES_DISABLE_NI
|
||||
#ifdef AES_ENABLE_NI
|
||||
oqs_aes128_ecb_dec_sch_ni(ciphertext, ciphertext_len, schedule, plaintext);
|
||||
#else
|
||||
oqs_aes128_ecb_dec_sch_c(ciphertext, ciphertext_len, schedule, plaintext);
|
||||
@ -76,12 +76,14 @@ void OQS_AES128_ECB_dec_sch(const uint8_t *ciphertext, const size_t ciphertext_l
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef AES_ENABLE_NI
|
||||
inline void oqs_aes128_ecb_enc_ni(const uint8_t *plaintext, const size_t plaintext_len, const uint8_t *key, uint8_t *ciphertext) {
|
||||
void *schedule = NULL;
|
||||
oqs_aes128_load_schedule_ni(key, &schedule);
|
||||
oqs_aes128_ecb_enc_sch_ni(plaintext, plaintext_len, schedule, ciphertext);
|
||||
oqs_aes128_free_schedule_ni(schedule);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void oqs_aes128_ecb_enc_c(const uint8_t *plaintext, const size_t plaintext_len, const uint8_t *key, uint8_t *ciphertext) {
|
||||
void *schedule = NULL;
|
||||
@ -90,12 +92,14 @@ inline void oqs_aes128_ecb_enc_c(const uint8_t *plaintext, const size_t plaintex
|
||||
oqs_aes128_free_schedule_c(schedule);
|
||||
}
|
||||
|
||||
#ifdef AES_ENABLE_NI
|
||||
inline void oqs_aes128_ecb_enc_sch_ni(const uint8_t *plaintext, const size_t plaintext_len, const void *schedule, uint8_t *ciphertext) {
|
||||
assert(plaintext_len % 16 == 0);
|
||||
for (size_t block = 0; block < plaintext_len / 16; block++) {
|
||||
oqs_aes128_enc_ni(plaintext + (16 * block), schedule, ciphertext + (16 * block));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void oqs_aes128_ecb_enc_sch_c(const uint8_t *plaintext, const size_t plaintext_len, const void *schedule, uint8_t *ciphertext) {
|
||||
assert(plaintext_len % 16 == 0);
|
||||
@ -104,12 +108,14 @@ inline void oqs_aes128_ecb_enc_sch_c(const uint8_t *plaintext, const size_t plai
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef AES_ENABLE_NI
|
||||
inline void oqs_aes128_ecb_dec_ni(const uint8_t *ciphertext, const size_t ciphertext_len, const uint8_t *key, uint8_t *plaintext) {
|
||||
void *schedule = NULL;
|
||||
oqs_aes128_load_schedule_ni(key, &schedule);
|
||||
oqs_aes128_ecb_dec_sch_ni(ciphertext, ciphertext_len, schedule, plaintext);
|
||||
oqs_aes128_free_schedule_ni(schedule);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void oqs_aes128_ecb_dec_c(const uint8_t *ciphertext, const size_t ciphertext_len, const uint8_t *key, uint8_t *plaintext) {
|
||||
void *schedule = NULL;
|
||||
@ -118,12 +124,14 @@ inline void oqs_aes128_ecb_dec_c(const uint8_t *ciphertext, const size_t ciphert
|
||||
oqs_aes128_free_schedule_c(schedule);
|
||||
}
|
||||
|
||||
#ifdef AES_ENABLE_NI
|
||||
inline void oqs_aes128_ecb_dec_sch_ni(const uint8_t *ciphertext, const size_t ciphertext_len, const void *schedule, uint8_t *plaintext) {
|
||||
assert(ciphertext_len % 16 == 0);
|
||||
for (size_t block = 0; block < ciphertext_len / 16; block++) {
|
||||
oqs_aes128_dec_ni(ciphertext + (16 * block), schedule, plaintext + (16 * block));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void oqs_aes128_ecb_dec_sch_c(const uint8_t *ciphertext, const size_t ciphertext_len, const void *schedule, uint8_t *plaintext) {
|
||||
assert(ciphertext_len % 16 == 0);
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef AES_DISABLE_NI
|
||||
#ifndef AES_ENABLE_NI
|
||||
#include <assert.h>
|
||||
void oqs_aes128_load_schedule_ni(UNUSED const uint8_t *key, UNUSED void **_schedule) {
|
||||
assert(0);
|
||||
|
@ -48,7 +48,7 @@ static int test_aes128_correctness_c(OQS_RAND *rand) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef AES_DISABLE_NI
|
||||
#ifdef AES_ENABLE_NI
|
||||
static int test_aes128_correctness_ni(OQS_RAND *rand) {
|
||||
uint8_t key[16], plaintext[16], ciphertext[16], decrypted[16];
|
||||
void *schedule = NULL;
|
||||
@ -173,7 +173,7 @@ static void speed_aes128_c(OQS_RAND *rand) {
|
||||
oqs_aes128_free_schedule_c(schedule);
|
||||
}
|
||||
|
||||
#ifndef AES_DISABLE_NI
|
||||
#ifdef AES_ENABLE_NI
|
||||
|
||||
static void speed_aes128_ni(OQS_RAND *rand) {
|
||||
uint8_t key[16], plaintext[320], ciphertext[320], decrypted[320];
|
||||
@ -239,12 +239,12 @@ int main(int argc, char **argv) {
|
||||
goto err;
|
||||
}
|
||||
TEST_REPEATEDLY(test_aes128_correctness_c(rand));
|
||||
#ifndef AES_DISABLE_NI
|
||||
#ifdef AES_ENABLE_NI
|
||||
TEST_REPEATEDLY(test_aes128_correctness_ni(rand));
|
||||
TEST_REPEATEDLY(test_aes128_c_equals_ni(rand));
|
||||
#endif
|
||||
TEST_REPEATEDLY(test_aes128_ecb_correctness_c(rand));
|
||||
#ifndef AES_DISABLE_NI
|
||||
#ifdef AES_ENABLE_NI
|
||||
TEST_REPEATEDLY(test_aes128_ecb_correctness_ni(rand));
|
||||
#endif
|
||||
#ifdef USE_OPENSSL
|
||||
@ -256,7 +256,7 @@ int main(int argc, char **argv) {
|
||||
printf("=== test_aes performance ===\n");
|
||||
PRINT_TIMER_HEADER
|
||||
speed_aes128_c(rand);
|
||||
#ifndef AES_DISABLE_NI
|
||||
#ifdef AES_ENABLE_NI
|
||||
speed_aes128_ni(rand);
|
||||
#endif
|
||||
#ifdef USE_OPENSSL
|
||||
|
8
src/crypto/rand/Makefile.am
Normal file
8
src/crypto/rand/Makefile.am
Normal file
@ -0,0 +1,8 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LTLIBRARIES = librand.la
|
||||
|
||||
librand_la_SOURCES = rand.c
|
||||
|
||||
librand_la_CPPFLAGS = -I../../../include
|
||||
librand_la_CPPFLAGS += $(AM_CPPFLAGS)
|
||||
|
7
src/crypto/rand_urandom_aesctr/Makefile.am
Normal file
7
src/crypto/rand_urandom_aesctr/Makefile.am
Normal file
@ -0,0 +1,7 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LTLIBRARIES = librandaesctr.la
|
||||
|
||||
librandaesctr_la_SOURCES = rand_urandom_aesctr.c
|
||||
librandaesctr_la_CPPFLAGS = -I../../../include -I.
|
||||
librandaesctr_la_CPPFLAGS += $(AM_CPPFLAGS)
|
||||
|
8
src/crypto/rand_urandom_chacha20/Makefile.am
Normal file
8
src/crypto/rand_urandom_chacha20/Makefile.am
Normal file
@ -0,0 +1,8 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LTLIBRARIES = librandchacha20.la
|
||||
|
||||
librandchacha20_la_SOURCES = rand_urandom_chacha20.c
|
||||
|
||||
librandchacha20_la_CPPFLAGS = -I../../../include -I.
|
||||
librandchacha20_la_CPPFLAGS += $(AM_CPPFLAGS)
|
||||
|
8
src/crypto/sha3/Makefile.am
Normal file
8
src/crypto/sha3/Makefile.am
Normal file
@ -0,0 +1,8 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LTLIBRARIES = libsha3.la
|
||||
|
||||
libsha3_la_SOURCES = sha3.c
|
||||
|
||||
libsha3_la_CPPFLAGS = -I../../../include -I.
|
||||
libsha3_la_CPPFLAGS += $(AM_CPPFLAGS)
|
||||
|
8
src/kex/Makefile.am
Normal file
8
src/kex/Makefile.am
Normal file
@ -0,0 +1,8 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LTLIBRARIES = libkex.la
|
||||
|
||||
libkex_la_SOURCES = kex.c
|
||||
|
||||
libkex_la_CPPFLAGS = -I../../include
|
||||
libkex_la_CPPFLAGS += $(AM_CPPFLAGS)
|
||||
|
9
src/kex_code_mcbits/Makefile.am
Normal file
9
src/kex_code_mcbits/Makefile.am
Normal file
@ -0,0 +1,9 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LTLIBRARIES = libmcbits.la
|
||||
|
||||
libmcbits_la_SOURCES = external/operations.c kex_code_mcbits.c
|
||||
|
||||
libmcbits_la_CPPFLAGS = -I../../include
|
||||
|
||||
libmcbits_la_CPPFLAGS += $(AM_CPPFLAGS)
|
||||
|
7
src/kex_lwe_frodo/Makefile.am
Normal file
7
src/kex_lwe_frodo/Makefile.am
Normal file
@ -0,0 +1,7 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LTLIBRARIES = libfrodo.la
|
||||
|
||||
libfrodo_la_SOURCES = kex_lwe_frodo.c lwe.c lwe_noise.c
|
||||
libfrodo_la_CPPFLAGS = -I../../include -I.
|
||||
libfrodo_la_CPPFLAGS += $(AM_CPPFLAGS)
|
||||
|
8
src/kex_ntru/Makefile.am
Normal file
8
src/kex_ntru/Makefile.am
Normal file
@ -0,0 +1,8 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LTLIBRARIES = libntru.la
|
||||
|
||||
|
||||
libntru_la_SOURCES = kex_ntru.c
|
||||
libntru_la_CPPFLAGS = -I../../include -I../../external/NTRUEncrypt-master/include
|
||||
libntru_la_CPPFLAGS += $(AM_CPPFLAGS)
|
||||
|
9
src/kex_rlwe_bcns15/Makefile.am
Normal file
9
src/kex_rlwe_bcns15/Makefile.am
Normal file
@ -0,0 +1,9 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LTLIBRARIES = libbcns15.la
|
||||
|
||||
|
||||
libbcns15_la_SOURCES = fft.c kex_rlwe_bcns15.c rlwe.c rlwe_kex.c
|
||||
|
||||
libbcns15_la_CPPFLAGS = -I../../include
|
||||
libbcns15_la_CPPFLAGS += $(AM_CPPFLAGS)
|
||||
|
8
src/kex_rlwe_msrln16/Makefile.am
Normal file
8
src/kex_rlwe_msrln16/Makefile.am
Normal file
@ -0,0 +1,8 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LTLIBRARIES = libmsrln16.la
|
||||
|
||||
|
||||
libmsrln16_la_SOURCES = kex_rlwe_msrln16.c LatticeCrypto_kex.c ntt_constants.c
|
||||
libmsrln16_la_CPPFLAGS = -I../../include
|
||||
libmsrln16_la_CPPFLAGS += $(AM_CPPFLAGS)
|
||||
|
8
src/kex_rlwe_newhope/Makefile.am
Normal file
8
src/kex_rlwe_newhope/Makefile.am
Normal file
@ -0,0 +1,8 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LTLIBRARIES = libnewhope.la
|
||||
|
||||
libnewhope_la_SOURCES = kex_rlwe_newhope.c newhope.c poly.c precomp.c
|
||||
|
||||
libnewhope_la_CPPFLAGS = -I../../include -I.
|
||||
libnewhope_la_CPPFLAGS += $(AM_CPPFLAGS)
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef PARAMS_H
|
||||
#define PARAMS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define PARAM_N 1024
|
||||
|
||||
#define PARAM_K 16 /* used in sampler */
|
||||
@ -13,6 +15,12 @@
|
||||
#define NEWHOPE_SENDABYTES (POLY_BYTES + NEWHOPE_SEEDBYTES)
|
||||
#define NEWHOPE_SENDBBYTES (POLY_BYTES + NEWHOPE_RECBYTES)
|
||||
|
||||
extern uint16_t bitrev_table[];
|
||||
extern uint16_t omegas_montgomery[];
|
||||
extern uint16_t omegas_inv_montgomery[];
|
||||
extern uint16_t psis_inv_montgomery[];
|
||||
extern uint16_t psis_bitrev_montgomery[];
|
||||
|
||||
#if defined(WINDOWS)
|
||||
typedef unsigned __int16 uint16_t;
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "params.h"
|
||||
#include <oqs/rand.h>
|
||||
#include <oqs/sha3.h>
|
||||
|
||||
typedef struct {
|
||||
uint16_t coeffs[PARAM_N];
|
||||
|
File diff suppressed because one or more lines are too long
8
src/kex_sidh_cln16/Makefile.am
Normal file
8
src/kex_sidh_cln16/Makefile.am
Normal file
@ -0,0 +1,8 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LTLIBRARIES = libcln16.la
|
||||
|
||||
|
||||
libcln16_la_SOURCES = ec_isogeny.c fpx.c kex_sidh_cln16.c SIDH.c sidh_kex.c SIDH_setup.c validate.c AMD64/fp_x64_asm.S
|
||||
libcln16_la_CPPFLAGS = -I../../include -I.-fPIC
|
||||
libcln16_la_CPPFLAGS += $(AM_CPPFLAGS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user