summaryrefslogtreecommitdiff
path: root/src/libstrongswan/plugins
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2016-10-20 16:18:38 +0200
committerYves-Alexis Perez <corsac@debian.org>2016-10-20 16:18:38 +0200
commit25663e04c3ab01ef8dc9f906608282319cfea2db (patch)
treea0ca5e70f66d74dbe552c996a4f3a285cdfc35e4 /src/libstrongswan/plugins
parentbf372706c469764d59e9f29c39e3ecbebd72b8d2 (diff)
downloadvyos-strongswan-25663e04c3ab01ef8dc9f906608282319cfea2db.tar.gz
vyos-strongswan-25663e04c3ab01ef8dc9f906608282319cfea2db.zip
New upstream version 5.5.1
Diffstat (limited to 'src/libstrongswan/plugins')
-rw-r--r--src/libstrongswan/plugins/acert/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/aes/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/aesni/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/af_alg/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/agent/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/bliss/Makefile.am21
-rw-r--r--src/libstrongswan/plugins/bliss/Makefile.in42
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_fft.c199
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_fft.h71
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_fft_params.c215
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_fft_params.h75
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_huffman.c2
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_param_set.c24
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_param_set.h58
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_plugin.c16
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_private_key.c80
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_public_key.c42
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_public_key.h8
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_sampler.c17
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_sampler.h6
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_signature.c6
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_signature.h4
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_utils.c18
-rw-r--r--src/libstrongswan/plugins/bliss/bliss_utils.h28
-rw-r--r--src/libstrongswan/plugins/bliss/tests/Makefile.am3
-rw-r--r--src/libstrongswan/plugins/bliss/tests/Makefile.in28
-rw-r--r--src/libstrongswan/plugins/bliss/tests/bliss_tests.h3
-rw-r--r--src/libstrongswan/plugins/bliss/tests/suites/test_bliss_fft.c110
-rw-r--r--src/libstrongswan/plugins/bliss/tests/suites/test_bliss_sampler.c6
-rw-r--r--src/libstrongswan/plugins/bliss/tests/suites/test_bliss_signature.c4
-rw-r--r--src/libstrongswan/plugins/blowfish/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/ccm/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/chapoly/Makefile.am3
-rw-r--r--src/libstrongswan/plugins/chapoly/Makefile.in11
-rw-r--r--src/libstrongswan/plugins/chapoly/chapoly_plugin.c3
-rw-r--r--src/libstrongswan/plugins/chapoly/chapoly_xof.c173
-rw-r--r--src/libstrongswan/plugins/chapoly/chapoly_xof.h49
-rw-r--r--src/libstrongswan/plugins/cmac/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/constraints/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/ctr/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/curl/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/des/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/dnskey/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/files/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/fips_prf/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/gcm/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/gcrypt/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c12
-rw-r--r--src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c16
-rw-r--r--src/libstrongswan/plugins/gmp/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/gmp/gmp_plugin.c40
-rw-r--r--src/libstrongswan/plugins/gmp/gmp_rsa_private_key.c20
-rw-r--r--src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c24
-rw-r--r--src/libstrongswan/plugins/hmac/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/keychain/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/ldap/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/ldap/ldap_fetcher.c3
-rw-r--r--src/libstrongswan/plugins/md4/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/md5/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/mgf1/Makefile.am17
-rw-r--r--src/libstrongswan/plugins/mgf1/Makefile.in791
-rw-r--r--src/libstrongswan/plugins/mgf1/mgf1_plugin.c81
-rw-r--r--src/libstrongswan/plugins/mgf1/mgf1_plugin.h42
-rw-r--r--src/libstrongswan/plugins/mgf1/mgf1_xof.c285
-rw-r--r--src/libstrongswan/plugins/mgf1/mgf1_xof.h49
-rw-r--r--src/libstrongswan/plugins/mysql/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/newhope/Makefile.am33
-rw-r--r--src/libstrongswan/plugins/newhope/Makefile.in818
-rw-r--r--src/libstrongswan/plugins/newhope/newhope_ke.c622
-rw-r--r--src/libstrongswan/plugins/newhope/newhope_ke.h50
-rw-r--r--src/libstrongswan/plugins/newhope/newhope_noise.c160
-rw-r--r--src/libstrongswan/plugins/newhope/newhope_noise.h70
-rw-r--r--src/libstrongswan/plugins/newhope/newhope_plugin.c78
-rw-r--r--src/libstrongswan/plugins/newhope/newhope_plugin.h42
-rw-r--r--src/libstrongswan/plugins/newhope/newhope_reconciliation.c217
-rw-r--r--src/libstrongswan/plugins/newhope/newhope_reconciliation.h70
-rw-r--r--src/libstrongswan/plugins/newhope/tests/Makefile.am25
-rw-r--r--src/libstrongswan/plugins/newhope/tests/Makefile.in929
-rw-r--r--src/libstrongswan/plugins/newhope/tests/newhope_tests.c60
-rw-r--r--src/libstrongswan/plugins/newhope/tests/newhope_tests.h18
-rw-r--r--src/libstrongswan/plugins/newhope/tests/suites/test_newhope_ke.c193
-rw-r--r--src/libstrongswan/plugins/newhope/tests/suites/test_newhope_noise.c676
-rw-r--r--src/libstrongswan/plugins/newhope/tests/suites/test_newhope_reconciliation.c344
-rw-r--r--src/libstrongswan/plugins/nonce/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/ntru/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/ntru/ntru_ke.c13
-rw-r--r--src/libstrongswan/plugins/ntru/ntru_param_set.c6
-rw-r--r--src/libstrongswan/plugins/ntru/ntru_param_set.h96
-rw-r--r--src/libstrongswan/plugins/ntru/ntru_plugin.c14
-rw-r--r--src/libstrongswan/plugins/ntru/ntru_poly.c13
-rw-r--r--src/libstrongswan/plugins/ntru/ntru_poly.h9
-rw-r--r--src/libstrongswan/plugins/ntru/ntru_private_key.c39
-rw-r--r--src/libstrongswan/plugins/ntru/ntru_private_key.h3
-rw-r--r--src/libstrongswan/plugins/ntru/ntru_public_key.c18
-rw-r--r--src/libstrongswan/plugins/ntru/ntru_public_key.h2
-rw-r--r--src/libstrongswan/plugins/ntru/ntru_trits.c11
-rw-r--r--src/libstrongswan/plugins/ntru/ntru_trits.h8
-rw-r--r--src/libstrongswan/plugins/openssl/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_ec_private_key.c25
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_ec_private_key.h14
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_gcm.c6
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_pkcs12.c4
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_plugin.c70
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c41
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_rsa_private_key.h14
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_rsa_public_key.c12
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_util.h7
-rw-r--r--src/libstrongswan/plugins/padlock/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/padlock/padlock_sha1_hasher.c11
-rw-r--r--src/libstrongswan/plugins/pem/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/pgp/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/pkcs1/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/pkcs1/pkcs1_builder.c72
-rw-r--r--src/libstrongswan/plugins/pkcs1/pkcs1_plugin.c6
-rw-r--r--src/libstrongswan/plugins/pkcs11/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c164
-rw-r--r--src/libstrongswan/plugins/pkcs12/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/pkcs7/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/pkcs8/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/plugin_feature.c21
-rw-r--r--src/libstrongswan/plugins/plugin_feature.h6
-rw-r--r--src/libstrongswan/plugins/pubkey/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/random/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/rc2/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/rdrand/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/revocation/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/revocation/revocation_validator.c35
-rw-r--r--src/libstrongswan/plugins/sha1/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/sha2/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/sha3/Makefile.am5
-rw-r--r--src/libstrongswan/plugins/sha3/Makefile.in15
-rw-r--r--src/libstrongswan/plugins/sha3/sha3_hasher.c447
-rw-r--r--src/libstrongswan/plugins/sha3/sha3_keccak.c498
-rw-r--r--src/libstrongswan/plugins/sha3/sha3_keccak.h82
-rw-r--r--src/libstrongswan/plugins/sha3/sha3_plugin.c6
-rw-r--r--src/libstrongswan/plugins/sha3/sha3_shake.c143
-rw-r--r--src/libstrongswan/plugins/sha3/sha3_shake.h48
-rw-r--r--src/libstrongswan/plugins/soup/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/sqlite/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/sshkey/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/test_vectors/Makefile.am2
-rw-r--r--src/libstrongswan/plugins/test_vectors/Makefile.in28
-rw-r--r--src/libstrongswan/plugins/test_vectors/test_vectors.h15
-rw-r--r--src/libstrongswan/plugins/test_vectors/test_vectors/chacha20_xof.c81
-rw-r--r--src/libstrongswan/plugins/test_vectors/test_vectors/sha3.c1
-rw-r--r--src/libstrongswan/plugins/test_vectors/test_vectors/sha3_shake.c472
-rw-r--r--src/libstrongswan/plugins/test_vectors/test_vectors_plugin.c16
-rw-r--r--src/libstrongswan/plugins/unbound/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/unbound/unbound_response.c3
-rw-r--r--src/libstrongswan/plugins/unbound/unbound_rr.c2
-rw-r--r--src/libstrongswan/plugins/winhttp/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/x509/Makefile.in5
-rw-r--r--src/libstrongswan/plugins/xcbc/Makefile.in5
153 files changed, 8330 insertions, 1629 deletions
diff --git a/src/libstrongswan/plugins/acert/Makefile.in b/src/libstrongswan/plugins/acert/Makefile.in
index a1ee0f83e..210d7c227 100644
--- a/src/libstrongswan/plugins/acert/Makefile.in
+++ b/src/libstrongswan/plugins/acert/Makefile.in
@@ -351,7 +351,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -385,8 +384,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -440,6 +437,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/aes/Makefile.in b/src/libstrongswan/plugins/aes/Makefile.in
index 02cd0f832..9e926ac19 100644
--- a/src/libstrongswan/plugins/aes/Makefile.in
+++ b/src/libstrongswan/plugins/aes/Makefile.in
@@ -350,7 +350,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -384,8 +383,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -439,6 +436,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/aesni/Makefile.in b/src/libstrongswan/plugins/aesni/Makefile.in
index 576b6dafc..ea41ab353 100644
--- a/src/libstrongswan/plugins/aesni/Makefile.in
+++ b/src/libstrongswan/plugins/aesni/Makefile.in
@@ -353,7 +353,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -387,8 +386,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -442,6 +439,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/af_alg/Makefile.in b/src/libstrongswan/plugins/af_alg/Makefile.in
index 1f092287b..aa3be4220 100644
--- a/src/libstrongswan/plugins/af_alg/Makefile.in
+++ b/src/libstrongswan/plugins/af_alg/Makefile.in
@@ -354,7 +354,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -388,8 +387,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -443,6 +440,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/agent/Makefile.in b/src/libstrongswan/plugins/agent/Makefile.in
index 5e1b1f38a..4441558fa 100644
--- a/src/libstrongswan/plugins/agent/Makefile.in
+++ b/src/libstrongswan/plugins/agent/Makefile.in
@@ -352,7 +352,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -386,8 +385,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -441,6 +438,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/bliss/Makefile.am b/src/libstrongswan/plugins/bliss/Makefile.am
index e2aaaf55c..b2d09427e 100644
--- a/src/libstrongswan/plugins/bliss/Makefile.am
+++ b/src/libstrongswan/plugins/bliss/Makefile.am
@@ -1,5 +1,6 @@
AM_CPPFLAGS = \
- -I$(top_srcdir)/src/libstrongswan
+ -I$(top_srcdir)/src/libstrongswan \
+ -I$(top_srcdir)/src/libstrongswan/math/libnttfft
AM_CFLAGS = \
$(PLUGIN_CFLAGS) \
@@ -7,9 +8,12 @@ AM_CFLAGS = \
# these file are also used by bliss_huffman
noinst_LTLIBRARIES = libbliss-params.la
+
libbliss_params_la_SOURCES = \
- bliss_param_set.h bliss_param_set.c \
- bliss_fft_params.h bliss_fft_params.c
+ bliss_param_set.h bliss_param_set.c
+
+libbliss_params_la_LIBADD = \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la
# these files are also used by the tests, we can't directly refer to them
# because of the subdirectory, which would cause distclean to fail
@@ -20,12 +24,14 @@ libbliss_la_SOURCES = \
bliss_signature.h bliss_signature.c \
bliss_utils.h bliss_utils.c \
bliss_bitpacker.h bliss_bitpacker.c \
- bliss_fft.h bliss_fft.c \
bliss_huffman_code.h bliss_huffman_code.c \
bliss_huffman_code_1.c bliss_huffman_code_3.c bliss_huffman_code_4.c \
bliss_huffman_coder.h bliss_huffman_coder.c \
bliss_sampler.h bliss_sampler.c
-libbliss_la_LIBADD = libbliss-params.la
+
+libbliss_la_LIBADD = \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la \
+ libbliss-params.la
if MONOLITHIC
noinst_LTLIBRARIES += libstrongswan-bliss.la
@@ -43,7 +49,10 @@ libstrongswan_bliss_la_LIBADD = libbliss.la
noinst_PROGRAMS = bliss_huffman
bliss_huffman_SOURCES = bliss_huffman.c
-bliss_huffman_LDADD = -lm libbliss-params.la
+
+bliss_huffman_LDADD = -lm \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la \
+ libbliss-params.la
recreate-bliss-huffman : bliss_huffman bliss_huffman_code.h
$(AM_V_GEN) \
diff --git a/src/libstrongswan/plugins/bliss/Makefile.in b/src/libstrongswan/plugins/bliss/Makefile.in
index 389e20ed4..746709b23 100644
--- a/src/libstrongswan/plugins/bliss/Makefile.in
+++ b/src/libstrongswan/plugins/bliss/Makefile.in
@@ -139,17 +139,20 @@ am__uninstall_files_from_dir = { \
}
am__installdirs = "$(DESTDIR)$(plugindir)"
LTLIBRARIES = $(noinst_LTLIBRARIES) $(plugin_LTLIBRARIES)
-libbliss_params_la_LIBADD =
-am_libbliss_params_la_OBJECTS = bliss_param_set.lo bliss_fft_params.lo
+libbliss_params_la_DEPENDENCIES = \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la
+am_libbliss_params_la_OBJECTS = bliss_param_set.lo
libbliss_params_la_OBJECTS = $(am_libbliss_params_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
-libbliss_la_DEPENDENCIES = libbliss-params.la
+libbliss_la_DEPENDENCIES = \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la \
+ libbliss-params.la
am_libbliss_la_OBJECTS = bliss_private_key.lo bliss_public_key.lo \
bliss_signature.lo bliss_utils.lo bliss_bitpacker.lo \
- bliss_fft.lo bliss_huffman_code.lo bliss_huffman_code_1.lo \
+ bliss_huffman_code.lo bliss_huffman_code_1.lo \
bliss_huffman_code_3.lo bliss_huffman_code_4.lo \
bliss_huffman_coder.lo bliss_sampler.lo
libbliss_la_OBJECTS = $(am_libbliss_la_OBJECTS)
@@ -166,7 +169,9 @@ libstrongswan_bliss_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
PROGRAMS = $(noinst_PROGRAMS)
am_bliss_huffman_OBJECTS = bliss_huffman.$(OBJEXT)
bliss_huffman_OBJECTS = $(am_bliss_huffman_OBJECTS)
-bliss_huffman_DEPENDENCIES = libbliss-params.la
+bliss_huffman_DEPENDENCIES = \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la \
+ libbliss-params.la
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
@@ -370,7 +375,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -404,8 +408,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -459,11 +461,14 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
AM_CPPFLAGS = \
- -I$(top_srcdir)/src/libstrongswan
+ -I$(top_srcdir)/src/libstrongswan \
+ -I$(top_srcdir)/src/libstrongswan/math/libnttfft
AM_CFLAGS = \
$(PLUGIN_CFLAGS) \
@@ -476,8 +481,10 @@ AM_CFLAGS = \
# because of the subdirectory, which would cause distclean to fail
noinst_LTLIBRARIES = libbliss-params.la libbliss.la $(am__append_1)
libbliss_params_la_SOURCES = \
- bliss_param_set.h bliss_param_set.c \
- bliss_fft_params.h bliss_fft_params.c
+ bliss_param_set.h bliss_param_set.c
+
+libbliss_params_la_LIBADD = \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la
libbliss_la_SOURCES = \
bliss_private_key.h bliss_private_key.c \
@@ -485,13 +492,15 @@ libbliss_la_SOURCES = \
bliss_signature.h bliss_signature.c \
bliss_utils.h bliss_utils.c \
bliss_bitpacker.h bliss_bitpacker.c \
- bliss_fft.h bliss_fft.c \
bliss_huffman_code.h bliss_huffman_code.c \
bliss_huffman_code_1.c bliss_huffman_code_3.c bliss_huffman_code_4.c \
bliss_huffman_coder.h bliss_huffman_coder.c \
bliss_sampler.h bliss_sampler.c
-libbliss_la_LIBADD = libbliss-params.la
+libbliss_la_LIBADD = \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la \
+ libbliss-params.la
+
@MONOLITHIC_FALSE@plugin_LTLIBRARIES = libstrongswan-bliss.la
libstrongswan_bliss_la_SOURCES = \
bliss_plugin.h bliss_plugin.c
@@ -499,7 +508,10 @@ libstrongswan_bliss_la_SOURCES = \
libstrongswan_bliss_la_LDFLAGS = -module -avoid-version
libstrongswan_bliss_la_LIBADD = libbliss.la
bliss_huffman_SOURCES = bliss_huffman.c
-bliss_huffman_LDADD = -lm libbliss-params.la
+bliss_huffman_LDADD = -lm \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la \
+ libbliss-params.la
+
all: all-am
.SUFFIXES:
@@ -609,8 +621,6 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bliss_bitpacker.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bliss_fft.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bliss_fft_params.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bliss_huffman.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bliss_huffman_code.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bliss_huffman_code_1.Plo@am__quote@
diff --git a/src/libstrongswan/plugins/bliss/bliss_fft.c b/src/libstrongswan/plugins/bliss/bliss_fft.c
deleted file mode 100644
index 033c2144e..000000000
--- a/src/libstrongswan/plugins/bliss/bliss_fft.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (C) 2014 Andreas Steffen
- * HSR Hochschule fuer Technik Rapperswil
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
- *
- * This program 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.
- */
-
-#include "bliss_fft.h"
-
-typedef struct private_bliss_fft_t private_bliss_fft_t;
-
-/**
- * Private data structure for bliss_fft_t object
- */
-struct private_bliss_fft_t {
- /**
- * Public interface.
- */
- bliss_fft_t public;
-
- /**
- * FFT parameter set used as constants
- */
- bliss_fft_params_t *p;
-
-};
-
-METHOD(bliss_fft_t, get_size, uint16_t,
- private_bliss_fft_t *this)
-{
- return this->p->n;
-}
-
-METHOD(bliss_fft_t, get_modulus, uint16_t,
- private_bliss_fft_t *this)
-{
- return this->p->q;
-}
-
-/**
- * Do an FFT butterfly operation
- *
- * x[i1] ---|+|------- x[i1]
- * \/
- * /\ w[iw]
- * x[i2] ---|-|--|*|-- x[i2]
- *
- */
-static void butterfly(private_bliss_fft_t *this, uint32_t *x, int i1,int i2,
- int iw)
-{
- uint32_t xp, xm;
-
- xp = x[i1] + x[i2];
- xm = x[i1] + (this->p->q - x[i2]);
- if (xp >= this->p->q)
- {
- xp -= this->p->q;
- }
- x[i1] = xp;
- x[i2] = (xm * this->p->w[iw]) % this->p->q;
-}
-
-/**
- * Trivial butterfly operation of last FFT stage
- */
-static void butterfly_last(private_bliss_fft_t *this, uint32_t *x, int i1)
-{
- uint32_t xp, xm;
- int i2 = i1 + 1;
-
- xp = x[i1] + x[i2];
- xm = x[i1] + (this->p->q - x[i2]);
- if (xp >= this->p->q)
- {
- xp -= this->p->q;
- }
- if (xm >= this->p->q)
- {
- xm -= this->p->q;
- }
- x[i1] = xp;
- x[i2] = xm;
-}
-
-METHOD(bliss_fft_t, transform, void,
- private_bliss_fft_t *this, uint32_t *a, uint32_t *b, bool inverse)
-{
- int stage, i, j, k, m, n, t, iw, i_rev;
- uint16_t q;
- uint32_t tmp;
-
- /* we are going to use the transform size n and the modulus q a lot */
- n = this->p->n;
- q = this->p->q;
-
- if (!inverse)
- {
- /* apply linear phase needed for negative wrapped convolution */
- for (i = 0; i < n; i++)
- {
- b[i] = (a[i] * this->p->w[i]) % q;
- }
- }
- else if (a != b)
- {
- /* copy if input and output array are not the same */
- for (i = 0; i < n; i++)
- {
- b[i] = a[i];
- }
- }
-
- m = n;
- k = 1;
-
- for (stage = this->p->stages; stage > 0; stage--)
- {
- m >>= 1;
- t = 0;
-
- for (j = 0; j < k; j++)
- {
- if (stage == 1)
- {
- butterfly_last(this, b, t);
- }
- else
- {
- for (i = 0; i < m; i++)
- {
- iw = 2 * (inverse ? (n - i * k) : (i * k));
- butterfly(this, b, t + i, t + i + m, iw);
- }
- }
- t += 2*m;
- }
- k <<= 1;
- }
-
- /* Sort output in bit-reverse order */
- for (i = 0; i < n; i++)
- {
- i_rev = this->p->rev[i];
-
- if (i_rev > i)
- {
- tmp = b[i];
- b[i] = b[i_rev];
- b[i_rev] = tmp;
- }
- }
-
- /**
- * Compensate the linear phase needed for negative wrapped convolution
- * and normalize the output array with 1/n mod q after the inverse FFT.
- */
- if (inverse)
- {
- for (i = 0; i < n; i++)
- {
- b[i] = (((b[i] * this->p->w[2*n - i]) % q) * this->p->n_inv) % q;
- }
- }
-}
-
-METHOD(bliss_fft_t, destroy, void,
- private_bliss_fft_t *this)
-{
- free(this);
-}
-
-/**
- * See header.
- */
-bliss_fft_t *bliss_fft_create(bliss_fft_params_t *params)
-{
- private_bliss_fft_t *this;
-
- INIT(this,
- .public = {
- .get_size = _get_size,
- .get_modulus = _get_modulus,
- .transform = _transform,
- .destroy = _destroy,
- },
- .p = params,
- );
-
- return &this->public;
-}
diff --git a/src/libstrongswan/plugins/bliss/bliss_fft.h b/src/libstrongswan/plugins/bliss/bliss_fft.h
deleted file mode 100644
index a79edd2be..000000000
--- a/src/libstrongswan/plugins/bliss/bliss_fft.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2014 Andreas Steffen
- * HSR Hochschule fuer Technik Rapperswil
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
- *
- * This program 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.
- */
-
-/**
- * @defgroup bliss_fft bliss_fft
- * @{ @ingroup bliss_p
- */
-
-#ifndef BLISS_FFT_H_
-#define BLISS_FFT_H_
-
-#include "bliss_fft_params.h"
-
-#include <library.h>
-
-typedef struct bliss_fft_t bliss_fft_t;
-
-/**
- * Implements a Number Theoretic Transform (NTT) via the FFT algorithm
- */
-struct bliss_fft_t {
-
- /**
- * Get the size of the Number Theoretic Transform
- *
- * @result Transform size
- */
- uint16_t (*get_size)(bliss_fft_t *this);
-
- /**
- * Get the prime modulus of the Number Theoretic Transform
- *
- * @result Prime modulus
- */
- uint16_t (*get_modulus)(bliss_fft_t *this);
-
- /**
- * Compute the [inverse] NTT of a polynomial
- *
- * @param a Coefficient of input polynomial
- * @param b Coefficient of output polynomial
- * @param inverse TRUE if the inverse NTT has to be computed
- */
- void (*transform)(bliss_fft_t *this, uint32_t *a, uint32_t *b, bool inverse);
-
- /**
- * Destroy bliss_fft_t object
- */
- void (*destroy)(bliss_fft_t *this);
-};
-
-/**
- * Create a bliss_fft_t object for a given FFT parameter set
- *
- * @param params FFT parameters
- */
-bliss_fft_t *bliss_fft_create(bliss_fft_params_t *params);
-
-#endif /** BLISS_FFT_H_ @}*/
diff --git a/src/libstrongswan/plugins/bliss/bliss_fft_params.c b/src/libstrongswan/plugins/bliss/bliss_fft_params.c
deleted file mode 100644
index c892c06e6..000000000
--- a/src/libstrongswan/plugins/bliss/bliss_fft_params.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright (C) 2014 Andreas Steffen
- * HSR Hochschule fuer Technik Rapperswil
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
- *
- * This program 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.
- */
-
-#include "bliss_fft_params.h"
-
-/**
- * FFT parameters for q = 12289 and 2n = 1024
- */
-static uint16_t w_12289_1024[] = {
- 1, 49, 2401, 7048, 1260, 295, 2166, 7822, 2319, 3030,
- 1002, 12231, 9447, 8210, 9042, 654, 7468, 9551, 1017, 677,
- 8595, 3329, 3364, 5079, 3091, 3991, 11224, 9260, 11336, 2459,
- 9890, 5339, 3542, 1512, 354, 5057, 2013, 325, 3636, 6118,
- 4846, 3963, 9852, 3477, 10616, 4046, 1630, 6136, 5728, 10314,
- 1537, 1579, 3637, 6167, 7247, 11011, 11112, 3772, 493, 11868,
- 3949, 9166, 6730, 10256, 10984, 9789, 390, 6821, 2426, 8273,
- 12129, 4449, 9088, 2908, 7313, 1956, 9821, 1958, 9919, 6760,
- 11726, 9280, 27, 1323, 3382, 5961, 9442, 7965, 9326, 2281,
- 1168, 8076, 2476, 10723, 9289, 468, 10643, 5369, 5012, 12097,
-
- 2881, 5990, 10863, 3860, 4805, 1954, 9723, 9445, 8112, 4240,
- 11136, 4948, 8961, 8974, 9611, 3957, 9558, 1360, 5195, 8775,
- 12149, 5429, 7952, 8689, 7935, 7856, 3985, 10930, 7143, 5915,
- 7188, 8120, 4632, 5766, 12176, 6752, 11334, 2361, 5088, 3532,
- 1022, 922, 8311, 1702, 9664, 6554, 1632, 6234, 10530, 12121,
- 4057, 2169, 7969, 9522, 11885, 4782, 827, 3656, 7098, 3710,
- 9744, 10474, 9377, 4780, 729, 11143, 5291, 1190, 9154, 6142,
- 6022, 142, 6958, 9139, 5407, 6874, 5023, 347, 4714, 9784,
- 145, 7105, 4053, 1973, 10654, 5908, 6845, 3602, 4452, 9235,
- 10111, 3879, 5736, 10706, 8456, 8807, 1428, 8527, 12286, 12142,
-
- 5086, 3434, 8509, 11404, 5791, 1112, 5332, 3199, 9283, 174,
- 8526, 12237, 9741, 10327, 2174, 8214, 9238, 10258, 11082, 2302,
- 2197, 9341, 3016, 316, 3195, 9087, 2859, 4912, 7197, 8561,
- 1663, 7753, 11227, 9407, 6250, 11314, 1381, 6224, 10040, 400,
- 7311, 1858, 5019, 151, 7399, 6170, 7394, 5925, 7678, 7552,
- 1378, 6077, 2837, 3834, 3531, 973, 10810, 1263, 442, 9369,
- 4388, 6099, 3915, 7500, 11119, 4115, 5011, 12048, 480, 11231,
- 9603, 3565, 2639, 6421, 7404, 6415, 7110, 4298, 1689, 9027,
- 12208, 8320, 2143, 6695, 8541, 683, 8889, 5446, 8785, 350,
- 4861, 4698, 9000, 10885, 4938, 8471, 9542, 576, 3646, 6608,
-
- 4278, 709, 10163, 6427, 7698, 8532, 242, 11858, 3459, 9734,
- 9984, 9945, 8034, 418, 8193, 8209, 8993, 10542, 420, 8291,
- 722, 10800, 773, 1010, 334, 4077, 3149, 6833, 3014, 218,
- 10682, 7280, 339, 4322, 2865, 5206, 9314, 1693, 9223, 9523,
- 11934, 7183, 7875, 4916, 7393, 5876, 5277, 504, 118, 5782,
- 671, 8301, 1212, 10232, 9808, 1321, 3284, 1159, 7635, 5445,
- 8736, 10238, 10102, 3438, 8705, 8719, 9405, 6152, 6512, 11863,
- 3704, 9450, 8357, 3956, 9509, 11248, 10436, 7515, 11854, 3263,
- 130, 6370, 4905, 6854, 4043, 1483, 11222, 9162, 6534, 652,
- 7370, 4749, 11499, 10446, 8005, 11286, 9, 441, 9320, 1987,
-
- 11340, 2655, 7205, 8953, 8582, 2692, 9018, 11767, 11289, 156,
- 7644, 5886, 5767, 12225, 9153, 6093, 3621, 5383, 5698, 8844,
- 3241, 11341, 2704, 9606, 3712, 9842, 2987, 11184, 7300, 1319,
- 3186, 8646, 5828, 2925, 8146, 5906, 6747, 11089, 2645, 6715,
- 9521, 11836, 2381, 6068, 2396, 6803, 1544, 1922, 8155, 6347,
- 3778, 787, 1696, 9370, 4437, 8500, 10963, 8760, 11414, 6281,
- 544, 2078, 3510, 12233, 9545, 723, 10849, 3174, 8058, 1594,
- 4372, 5315, 2366, 5333, 3248, 11684, 7222, 9786, 243, 11907,
- 5860, 4493, 11244, 10240, 10200, 8240, 10512, 11239, 9995, 10484,
- 9867, 4212, 9764, 11454, 8241, 10561, 1351, 4754, 11744, 10162,
-
- 6378, 5297, 1484, 11271, 11563, 1293, 1912, 7665, 6915, 7032,
- 476, 11035, 12288, 12240, 9888, 5241, 11029, 11994, 10123, 4467,
- 9970, 9259, 11287, 58, 2842, 4079, 3247, 11635, 4821, 2738,
- 11272, 11612, 3694, 8960, 8925, 7210, 9198, 8298, 1065, 3029,
- 953, 9830, 2399, 6950, 8747, 10777, 11935, 7232, 10276, 11964,
- 8653, 6171, 7443, 8326, 2437, 8812, 1673, 8243, 10659, 6153,
- 6561, 1975, 10752, 10710, 8652, 6122, 5042, 1278, 1177, 8517,
- 11796, 421, 8340, 3123, 5559, 2033, 1305, 2500, 11899, 5468,
- 9863, 4016, 160, 7840, 3201, 9381, 4976, 10333, 2468, 10331,
- 2370, 5529, 563, 3009, 12262, 10966, 8907, 6328, 2847, 4324,
-
- 2963, 10008, 11121, 4213, 9813, 1566, 3000, 11821, 1646, 6920,
- 7277, 192, 9408, 6299, 1426, 8429, 7484, 10335, 2566, 2844,
- 4177, 8049, 1153, 7341, 3328, 3315, 2678, 8332, 2731, 10929,
- 7094, 3514, 140, 6860, 4337, 3600, 4354, 4433, 8304, 1359,
- 5146, 6374, 5101, 4169, 7657, 6523, 113, 5537, 955, 9928,
- 7201, 8757, 11267, 11367, 3978, 10587, 2625, 5735, 10657, 6055,
- 1759, 168, 8232, 10120, 4320, 2767, 404, 7507, 11462, 8633,
- 5191, 8579, 2545, 1815, 2912, 7509, 11560, 1146, 6998, 11099,
- 3135, 6147, 6267, 12147, 5331, 3150, 6882, 5415, 7266, 11942,
- 7575, 2505, 12144, 5184, 8236, 10316, 1635, 6381, 5444, 8687,
-
- 7837, 3054, 2178, 8410, 6553, 1583, 3833, 3482, 10861, 3762,
- 3, 147, 7203, 8855, 3780, 885, 6498, 11177, 6957, 9090,
- 3006, 12115, 3763, 52, 2548, 1962, 10115, 4075, 3051, 2031,
- 1207, 9987, 10092, 2948, 9273, 11973, 9094, 3202, 9430, 7377,
- 5092, 3728, 10626, 4536, 1062, 2882, 6039, 975, 10908, 6065,
- 2249, 11889, 4978, 10431, 7270, 12138, 4890, 6119, 4895, 6364,
- 4611, 4737, 10911, 6212, 9452, 8455, 8758, 11316, 1479, 11026,
- 11847, 2920, 7901, 6190, 8374, 4789, 1170, 8174, 7278, 241,
- 11809, 1058, 2686, 8724, 9650, 5868, 4885, 5874, 5179, 7991,
- 10600, 3262, 81, 3969, 10146, 5594, 3748, 11606, 3400, 6843,
-
- 3504, 11939, 7428, 7591, 3289, 1404, 7351, 3818, 2747, 11713,
- 8643, 5681, 8011, 11580, 2126, 5862, 4591, 3757, 12047, 431,
- 8830, 2555, 2305, 2344, 4255, 11871, 4096, 4080, 3296, 1747,
- 11869, 3998, 11567, 1489, 11516, 11279, 11955, 8212, 9140, 5456,
- 9275, 12071, 1607, 5009, 11950, 7967, 9424, 7083, 2975, 10596,
- 3066, 2766, 355, 5106, 4414, 7373, 4896, 6413, 7012, 11785,
- 12171, 6507, 11618, 3988, 11077, 2057, 2481, 10968, 9005, 11130,
- 4654, 6844, 3553, 2051, 2187, 8851, 3584, 3570, 2884, 6137,
- 5777, 426, 8585, 2839, 3932, 8333, 2780, 1041, 1853, 4774,
- 435, 9026, 12159, 5919, 7384, 5435, 8246, 10806, 1067, 3127,
-
- 5755, 11637, 4919, 7540, 790, 1843, 4284, 1003, 12280, 11848,
- 2969, 10302, 949, 9634, 5084, 3336, 3707, 9597, 3271, 522,
- 1000, 12133, 4645, 6403, 6522, 64, 3136, 6196, 8668, 6906,
- 6591, 3445, 9048, 948, 9585, 2683, 8577, 2447, 9302, 1105,
- 4989, 10970, 9103, 3643, 6461, 9364, 4143, 6383, 5542, 1200,
- 9644, 5574, 2768, 453, 9908, 6221, 9893, 5486, 10745, 10367,
- 4134, 5942, 8511, 11502, 10593, 2919, 7852, 3789, 1326, 3529,
- 875, 6008, 11745, 10211, 8779, 56, 2744, 11566, 1440, 9115,
- 4231, 10695, 7917, 6974, 9923, 6956, 9041, 605, 5067, 2503,
- 12046, 382, 6429, 7796, 1045, 2049, 2089, 4049, 1777, 1050,
-
- 2294, 1805, 2422, 8077, 2525, 835, 4048, 1728, 10938, 7535,
- 545, 2127, 5911, 6992, 10805, 1018, 726, 10996, 10377, 4624,
- 5374, 5257, 11813, 1254, 1
-};
-
-/**
- * Bit-reversed indices for n = 512
- */
-static uint16_t rev_512[] = {
- 0, 256, 128, 384, 64, 320, 192, 448, 32, 288,
- 160, 416, 96, 352, 224, 480, 16, 272, 144, 400,
- 80, 336, 208, 464, 48, 304, 176, 432, 112, 368,
- 240, 496, 8, 264, 136, 392, 72, 328, 200, 456,
- 40, 296, 168, 424, 104, 360, 232, 488, 24, 280,
- 152, 408, 88, 344, 216, 472, 56, 312, 184, 440,
- 120, 376, 248, 504, 4, 260, 132, 388, 68, 324,
- 196, 452, 36, 292, 164, 420, 100, 356, 228, 484,
- 20, 276, 148, 404, 84, 340, 212, 468, 52, 308,
- 180, 436, 116, 372, 244, 500, 12, 268, 140, 396,
-
- 76, 332, 204, 460, 44, 300, 172, 428, 108, 364,
- 236, 492, 28, 284, 156, 412, 92, 348, 220, 476,
- 60, 316, 188, 444, 124, 380, 252, 508, 2, 258,
- 130, 386, 66, 322, 194, 450, 34, 290, 162, 418,
- 98, 354, 226, 482, 18, 274, 146, 402, 82, 338,
- 210, 466, 50, 306, 178, 434, 114, 370, 242, 498,
- 10, 266, 138, 394, 74, 330, 202, 458, 42, 298,
- 170, 426, 106, 362, 234, 490, 26, 282, 154, 410,
- 90, 346, 218, 474, 58, 314, 186, 442, 122, 378,
- 250, 506, 6, 262, 134, 390, 70, 326, 198, 454,
-
- 38, 294, 166, 422, 102, 358, 230, 486, 22, 278,
- 150, 406, 86, 342, 214, 470, 54, 310, 182, 438,
- 118, 374, 246, 502, 14, 270, 142, 398, 78, 334,
- 206, 462, 46, 302, 174, 430, 110, 366, 238, 494,
- 30, 286, 158, 414, 94, 350, 222, 478, 62, 318,
- 190, 446, 126, 382, 254, 510, 1, 257, 129, 385,
- 65, 321, 193, 449, 33, 289, 161, 417, 97, 353,
- 225, 481, 17, 273, 145, 401, 81, 337, 209, 465,
- 49, 305, 177, 433, 113, 369, 241, 497, 9, 265,
- 137, 393, 73, 329, 201, 457, 41, 297, 169, 425,
-
- 105, 361, 233, 489, 25, 281, 153, 409, 89, 345,
- 217, 473, 57, 313, 185, 441, 121, 377, 249, 505,
- 5, 261, 133, 389, 69, 325, 197, 453, 37, 293,
- 165, 421, 101, 357, 229, 485, 21, 277, 149, 405,
- 85, 341, 213, 469, 53, 309, 181, 437, 117, 373,
- 245, 501, 13, 269, 141, 397, 77, 333, 205, 461,
- 45, 301, 173, 429, 109, 365, 237, 493, 29, 285,
- 157, 413, 93, 349, 221, 477, 61, 317, 189, 445,
- 125, 381, 253, 509, 3, 259, 131, 387, 67, 323,
- 195, 451, 35, 291, 163, 419, 99, 355, 227, 483,
-
- 19, 275, 147, 403, 83, 339, 211, 467, 51, 307,
- 179, 435, 115, 371, 243, 499, 11, 267, 139, 395,
- 75, 331, 203, 459, 43, 299, 171, 427, 107, 363,
- 235, 491, 27, 283, 155, 411, 91, 347, 219, 475,
- 59, 315, 187, 443, 123, 379, 251, 507, 7, 263,
- 135, 391, 71, 327, 199, 455, 39, 295, 167, 423,
- 103, 359, 231, 487, 23, 279, 151, 407, 87, 343,
- 215, 471, 55, 311, 183, 439, 119, 375, 247, 503,
- 15, 271, 143, 399, 79, 335, 207, 463, 47, 303,
- 175, 431, 111, 367, 239, 495, 31, 287, 159, 415,
-
- 95, 351, 223, 479, 63, 319, 191, 447, 127, 383,
- 255, 511
-};
-
-bliss_fft_params_t bliss_fft_12289_512 = {
- 12289, 512, 12265, 9, w_12289_1024, rev_512
-};
-
-/**
- * FFT parameters for q = 17 and n = 16
- */
-static uint16_t w_17_16[] = {
- 1, 3, 9, 10, 13, 5, 15, 11, 16, 14, 8, 7, 4, 12, 2, 6, 1 };
-
-/**
- * Bit-reversed indices for n = 8
- */
-static uint16_t rev_8[] = { 0, 4, 2, 6, 1, 5, 3, 7 };
-
-bliss_fft_params_t bliss_fft_17_8 = { 17, 8, 15, 3, w_17_16, rev_8 };
diff --git a/src/libstrongswan/plugins/bliss/bliss_fft_params.h b/src/libstrongswan/plugins/bliss/bliss_fft_params.h
deleted file mode 100644
index 31b151b67..000000000
--- a/src/libstrongswan/plugins/bliss/bliss_fft_params.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2014 Andreas Steffen
- * HSR Hochschule fuer Technik Rapperswil
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
- *
- * This program 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.
- */
-
-/**
- * @defgroup bliss_fft_params bliss_fft_params
- * @{ @ingroup bliss_p
- */
-
-#ifndef BLISS_FFT_PARAMS_H_
-#define BLISS_FFT_PARAMS_H_
-
-#include <library.h>
-
-typedef struct bliss_fft_params_t bliss_fft_params_t;
-
-/**
- * Defines the parameters for an NTT computed via the FFT algorithm
- */
-struct bliss_fft_params_t {
-
- /**
- * Prime modulus
- */
- uint16_t q;
-
- /**
- * Size of the FFT with the condition k * n = q-1
- */
- uint16_t n;
-
- /**
- * Inverse of n mod q used for normalization of the FFT
- */
- uint16_t n_inv;
-
- /**
- * Number of FFT stages stages = log2(n)
- */
- uint16_t stages;
-
- /**
- * FFT twiddle factors (n-th roots of unity)
- */
- uint16_t *w;
-
- /**
- * FFT bit reversal
- */
- uint16_t *rev;
-
-};
-
-/**
- * FFT parameters for q = 12289 and n = 512
- */
-extern bliss_fft_params_t bliss_fft_12289_512;
-
-/**
- * FFT parameters for q = 17 and n = 8
- */
-extern bliss_fft_params_t bliss_fft_17_8;
-
-#endif /** BLISS_FFT_PARAMS_H_ @}*/
diff --git a/src/libstrongswan/plugins/bliss/bliss_huffman.c b/src/libstrongswan/plugins/bliss/bliss_huffman.c
index 647234fd8..71e75d6bf 100644
--- a/src/libstrongswan/plugins/bliss/bliss_huffman.c
+++ b/src/libstrongswan/plugins/bliss/bliss_huffman.c
@@ -209,7 +209,7 @@ static void remove_node(node_t *list, node_t **last, node_t *node)
*/
int main(int argc, char *argv[])
{
- bliss_param_set_t *set;
+ const bliss_param_set_t *set;
int dx, bliss_type, depth = 1, groups, groups_left, pairs = 1;
int i_max = 9, k_max = 8, index_max = (2*k_max - 1) * i_max;
int i, i_top, k, k_top;
diff --git a/src/libstrongswan/plugins/bliss/bliss_param_set.c b/src/libstrongswan/plugins/bliss/bliss_param_set.c
index 3781a588f..b6649d771 100644
--- a/src/libstrongswan/plugins/bliss/bliss_param_set.c
+++ b/src/libstrongswan/plugins/bliss/bliss_param_set.c
@@ -33,7 +33,7 @@ ENUM(bliss_param_set_id_names, BLISS_I, BLISS_B_IV,
*
* c[i] = exp(-2^i/f), i = 0..20, with f = k_sigma^2 / ln 2 = 93'076.9
*/
-static uint8_t c_bliss_i[] = {
+static const uint8_t c_bliss_i[] = {
255, 255, 75, 191, 247, 94, 30, 51, 147, 246, 89, 59, 99, 248, 26, 128,
255, 254, 151, 128, 109, 166, 88, 143, 30, 175, 149, 20, 240, 81, 138, 111,
255, 253, 47, 2, 214, 243, 188, 76, 236, 235, 40, 62, 54, 35, 33, 205,
@@ -62,7 +62,7 @@ static uint8_t c_bliss_i[] = {
*
* c[i] = exp(-2^i/f), i = 0..20, with f = k_sigma^2 / ln 2 = 125'550.5
*/
-static uint8_t c_bliss_iii[] = {
+static const uint8_t c_bliss_iii[] = {
255, 255, 122, 95, 16, 128, 14, 195, 60, 90, 166, 191, 205, 26, 144, 204,
255, 254, 244, 190, 102, 192, 187, 141, 169, 92, 33, 30, 170, 141, 184, 56,
255, 253, 233, 125, 228, 131, 93, 148, 121, 92, 52, 122, 149, 96, 29, 66,
@@ -91,7 +91,7 @@ static uint8_t c_bliss_iii[] = {
*
* c[i] = exp(-2^i/f), i = 0..21, with f = k_sigma^2 / ln 2 = 147'732.0
*/
-static uint8_t c_bliss_iv[] = {
+static const uint8_t c_bliss_iv[] = {
255, 255, 142, 111, 102, 2, 141, 87, 150, 42, 18, 70, 6, 224, 18, 70,
255, 255, 28, 222, 254, 102, 20, 78, 133, 78, 189, 107, 29, 7, 23, 193,
255, 254, 57, 190, 198, 79, 181, 181, 108, 75, 142, 145, 45, 238, 193, 29,
@@ -119,7 +119,7 @@ static uint8_t c_bliss_iv[] = {
/**
* BLISS signature parameter set definitions
*/
-static bliss_param_set_t bliss_param_sets[] = {
+static const bliss_param_set_t bliss_param_sets[] = {
/* BLISS-I scheme */
{
@@ -131,7 +131,7 @@ static bliss_param_set_t bliss_param_sets[] = {
.q2_inv = 6145,
.n = 512,
.n_bits = 9,
- .fft_params = &bliss_fft_12289_512,
+ .fft_params = &ntt_fft_12289_512,
.non_zero1 = 154,
.non_zero2 = 0,
.kappa = 23,
@@ -161,7 +161,7 @@ static bliss_param_set_t bliss_param_sets[] = {
.q2_inv = 6145,
.n = 512,
.n_bits = 9,
- .fft_params = &bliss_fft_12289_512,
+ .fft_params = &ntt_fft_12289_512,
.non_zero1 = 216,
.non_zero2 = 16,
.kappa = 30,
@@ -191,7 +191,7 @@ static bliss_param_set_t bliss_param_sets[] = {
.q2_inv = 6145,
.n = 512,
.n_bits = 9,
- .fft_params = &bliss_fft_12289_512,
+ .fft_params = &ntt_fft_12289_512,
.non_zero1 = 231,
.non_zero2 = 31,
.kappa = 39,
@@ -221,7 +221,7 @@ static bliss_param_set_t bliss_param_sets[] = {
.q2_inv = 6145,
.n = 512,
.n_bits = 9,
- .fft_params = &bliss_fft_12289_512,
+ .fft_params = &ntt_fft_12289_512,
.non_zero1 = 154,
.non_zero2 = 0,
.kappa = 23,
@@ -251,7 +251,7 @@ static bliss_param_set_t bliss_param_sets[] = {
.q2_inv = 6145,
.n = 512,
.n_bits = 9,
- .fft_params = &bliss_fft_12289_512,
+ .fft_params = &ntt_fft_12289_512,
.non_zero1 = 216,
.non_zero2 = 16,
.kappa = 30,
@@ -281,7 +281,7 @@ static bliss_param_set_t bliss_param_sets[] = {
.q2_inv = 6145,
.n = 512,
.n_bits = 9,
- .fft_params = &bliss_fft_12289_512,
+ .fft_params = &ntt_fft_12289_512,
.non_zero1 = 231,
.non_zero2 = 31,
.kappa = 39,
@@ -306,7 +306,7 @@ static bliss_param_set_t bliss_param_sets[] = {
/**
* See header.
*/
-bliss_param_set_t* bliss_param_set_get_by_id(bliss_param_set_id_t id)
+const bliss_param_set_t* bliss_param_set_get_by_id(bliss_param_set_id_t id)
{
int i;
@@ -324,7 +324,7 @@ bliss_param_set_t* bliss_param_set_get_by_id(bliss_param_set_id_t id)
/**
* See header.
*/
-bliss_param_set_t* bliss_param_set_get_by_oid(int oid)
+const bliss_param_set_t* bliss_param_set_get_by_oid(int oid)
{
int i;
diff --git a/src/libstrongswan/plugins/bliss/bliss_param_set.h b/src/libstrongswan/plugins/bliss/bliss_param_set.h
index 33a8009ff..8c043b925 100644
--- a/src/libstrongswan/plugins/bliss/bliss_param_set.h
+++ b/src/libstrongswan/plugins/bliss/bliss_param_set.h
@@ -24,7 +24,7 @@
typedef enum bliss_param_set_id_t bliss_param_set_id_t;
typedef struct bliss_param_set_t bliss_param_set_t;
-#include "bliss_fft_params.h"
+#include "ntt_fft_params.h"
#include "bliss_huffman_code.h"
#include <library.h>
@@ -53,132 +53,132 @@ struct bliss_param_set_t {
/**
* BLISS parameter set ID
*/
- bliss_param_set_id_t id;
+ const bliss_param_set_id_t id;
/**
* BLISS parameter set OID
*/
- int oid;
+ const int oid;
/**
* Security strength in bits
*/
- uint16_t strength;
+ const uint16_t strength;
/**
* Prime modulus
*/
- uint16_t q;
+ const uint16_t q;
/**
* Number of bits in q
*/
- uint16_t q_bits;
+ const uint16_t q_bits;
/**
* Inverse of (q + 2) mod 2q
*/
- uint16_t q2_inv;
+ const uint16_t q2_inv;
/**
* Ring dimension equal to the number of polynomial coefficients
*/
- uint16_t n;
+ const uint16_t n;
/**
* Number of bits in n
*/
- uint16_t n_bits;
+ const uint16_t n_bits;
/**
* FFT parameters
*/
- bliss_fft_params_t *fft_params;
+ const ntt_fft_params_t *fft_params;
/**
* Number of [-1, +1] secret key coefficients
*/
- uint16_t non_zero1;
+ const uint16_t non_zero1;
/**
* Number of [-2, +2] secret key coefficients
*/
- uint16_t non_zero2;
+ const uint16_t non_zero2;
/**
* Number of secret key terms that go into Nk(S) norm
*/
- uint16_t kappa;
+ const uint16_t kappa;
/**
* Maximum Nk(S) tolerable NK(S) norm (BLISS only)
*/
- uint32_t nks_max;
+ const uint32_t nks_max;
/**
* Maximum value Pmax for ||Sc'||^2 norm (BLISS-B only)
*/
- uint32_t p_max;
+ const uint32_t p_max;
/**
* Standard deviation sigma
*/
- uint16_t sigma;
+ const uint16_t sigma;
/**
* k_sigma = ceiling[ sqrt(2*ln 2) * sigma ]
*/
- uint16_t k_sigma;
+ const uint16_t k_sigma;
/**
* Number of bits in k_sigma
*/
- uint16_t k_sigma_bits;
+ const uint16_t k_sigma_bits;
/**
* Coefficients for Bernoulli sampling with exponential biases
*/
- uint8_t *c;
+ const uint8_t *c;
/**
* Number of columns in Bernoulli coefficient table
*/
- size_t c_cols;
+ const size_t c_cols;
/**
* Number of rows in Bernoulli coefficient table
*/
- size_t c_rows;
+ const size_t c_rows;
/**
* Number of bits in z1
*/
- uint16_t z1_bits;
+ const uint16_t z1_bits;
/**
* Number of z2 bits to be dropped after rounding
*/
- uint16_t d;
+ const uint16_t d;
/**
* Modulus p = floor(2q / 2^d) applied after bit dropping
*/
- uint16_t p;
+ const uint16_t p;
/**
* M = sigma^2 / alpha_rejection^2
*/
- uint32_t M;
+ const uint32_t M;
/**
* B_infinity bound
*/
- uint16_t B_inf;
+ const uint16_t B_inf;
/**
* B_verify bound
*/
- uint32_t B_l2;
+ const uint32_t B_l2;
};
@@ -188,7 +188,7 @@ struct bliss_param_set_t {
* @param id BLISS parameter set ID
* @return BLISS parameter set
*/
-bliss_param_set_t* bliss_param_set_get_by_id(bliss_param_set_id_t id);
+const bliss_param_set_t* bliss_param_set_get_by_id(bliss_param_set_id_t id);
/**
* Get BLISS signature parameter set by BLISS parameter set OID
@@ -196,6 +196,6 @@ bliss_param_set_t* bliss_param_set_get_by_id(bliss_param_set_id_t id);
* @param oid BLISS parameter set OID
* @return BLISS parameter set
*/
-bliss_param_set_t* bliss_param_set_get_by_oid(int oid);
+const bliss_param_set_t* bliss_param_set_get_by_oid(int oid);
#endif /** BLISS_PARAM_SET_H_ @}*/
diff --git a/src/libstrongswan/plugins/bliss/bliss_plugin.c b/src/libstrongswan/plugins/bliss/bliss_plugin.c
index 4adcf1e76..cdf3e96ea 100644
--- a/src/libstrongswan/plugins/bliss/bliss_plugin.c
+++ b/src/libstrongswan/plugins/bliss/bliss_plugin.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Andreas Steffen
+ * Copyright (C) 2014-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -50,6 +50,8 @@ METHOD(plugin_t, get_features, int,
PLUGIN_REGISTER(PRIVKEY_GEN, bliss_private_key_gen, FALSE),
PLUGIN_PROVIDE(PRIVKEY_GEN, KEY_BLISS),
PLUGIN_DEPENDS(RNG, RNG_TRUE),
+ PLUGIN_SDEPEND(XOF, XOF_MGF1_SHA1),
+ PLUGIN_SDEPEND(XOF, XOF_MGF1_SHA256),
PLUGIN_REGISTER(PUBKEY, bliss_public_key_load, TRUE),
PLUGIN_PROVIDE(PUBKEY, KEY_BLISS),
PLUGIN_REGISTER(PUBKEY, bliss_public_key_load, TRUE),
@@ -57,29 +59,41 @@ METHOD(plugin_t, get_features, int,
/* signature schemes, private */
PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_BLISS_WITH_SHA2_256),
PLUGIN_DEPENDS(HASHER, HASH_SHA256),
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA512),
PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_BLISS_WITH_SHA2_384),
PLUGIN_DEPENDS(HASHER, HASH_SHA384),
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA512),
PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_BLISS_WITH_SHA2_512),
PLUGIN_DEPENDS(HASHER, HASH_SHA512),
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA512),
PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_BLISS_WITH_SHA3_256),
PLUGIN_DEPENDS(HASHER, HASH_SHA3_256),
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA512),
PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_BLISS_WITH_SHA3_384),
PLUGIN_DEPENDS(HASHER, HASH_SHA3_384),
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA512),
PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_BLISS_WITH_SHA3_512),
PLUGIN_DEPENDS(HASHER, HASH_SHA3_512),
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA512),
/* signature verification schemes */
PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_BLISS_WITH_SHA2_256),
PLUGIN_DEPENDS(HASHER, HASH_SHA256),
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA512),
PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_BLISS_WITH_SHA2_384),
PLUGIN_DEPENDS(HASHER, HASH_SHA384),
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA512),
PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_BLISS_WITH_SHA2_512),
PLUGIN_DEPENDS(HASHER, HASH_SHA512),
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA512),
PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_BLISS_WITH_SHA3_256),
PLUGIN_DEPENDS(HASHER, HASH_SHA3_256),
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA512),
PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_BLISS_WITH_SHA3_384),
PLUGIN_DEPENDS(HASHER, HASH_SHA3_384),
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA512),
PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_BLISS_WITH_SHA3_512),
PLUGIN_DEPENDS(HASHER, HASH_SHA3_512),
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA512),
};
*features = f;
diff --git a/src/libstrongswan/plugins/bliss/bliss_private_key.c b/src/libstrongswan/plugins/bliss/bliss_private_key.c
index 20bbc6ac5..25253ed37 100644
--- a/src/libstrongswan/plugins/bliss/bliss_private_key.c
+++ b/src/libstrongswan/plugins/bliss/bliss_private_key.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2015 Andreas Steffen
+ * Copyright (C) 2014-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -20,9 +20,10 @@
#include "bliss_sampler.h"
#include "bliss_signature.h"
#include "bliss_bitpacker.h"
-#include "bliss_fft.h"
+#include "ntt_fft.h"
+#include "ntt_fft_reduce.h"
-#include <crypto/mgf1/mgf1_bitspender.h>
+#include <crypto/xofs/xof_bitspender.h>
#include <asn1/asn1.h>
#include <asn1/asn1_parser.h>
#include <asn1/oid.h>
@@ -46,7 +47,7 @@ struct private_bliss_private_key_t {
/**
* BLISS signature parameter set
*/
- bliss_param_set_t *set;
+ const bliss_param_set_t *set;
/**
* BLISS secret key S1 (coefficients of polynomial f)
@@ -64,6 +65,11 @@ struct private_bliss_private_key_t {
uint32_t *A;
/**
+ * NTT of BLISS public key in Montgomery representation Ar = rA mod
+ */
+ uint32_t *Ar;
+
+ /**
* reference count
*/
refcount_t ref;
@@ -163,12 +169,12 @@ static void greedy_sc(int8_t *s1, int8_t *s2, int n, uint16_t *c_indices,
static bool sign_bliss(private_bliss_private_key_t *this, hash_algorithm_t alg,
chunk_t data, chunk_t *signature)
{
- bliss_fft_t *fft;
+ ntt_fft_t *fft;
bliss_signature_t *sig;
bliss_sampler_t *sampler = NULL;
rng_t *rng;
hasher_t *hasher;
- hash_algorithm_t mgf1_alg, oracle_alg;
+ ext_out_function_t mgf1_alg, oracle_alg;
size_t mgf1_seed_len;
uint8_t mgf1_seed_buf[HASH_SIZE_SHA512], data_hash_buf[HASH_SIZE_SHA512];
chunk_t mgf1_seed, data_hash;
@@ -203,12 +209,12 @@ static bool sign_bliss(private_bliss_private_key_t *this, hash_algorithm_t alg,
/* Set MGF1 hash algorithm and seed length based on security strength */
if (this->set->strength > 160)
{
- mgf1_alg = HASH_SHA256;
+ mgf1_alg = XOF_MGF1_SHA256;
mgf1_seed_len = HASH_SIZE_SHA256;
}
else
{
- mgf1_alg = HASH_SHA1;
+ mgf1_alg = XOF_MGF1_SHA1;
mgf1_seed_len = HASH_SIZE_SHA1;
}
mgf1_seed = chunk_create(mgf1_seed_buf, mgf1_seed_len);
@@ -220,7 +226,7 @@ static bool sign_bliss(private_bliss_private_key_t *this, hash_algorithm_t alg,
}
/* MGF1 hash algorithm to be used for random oracle */
- oracle_alg = HASH_SHA512;
+ oracle_alg = XOF_MGF1_SHA512;
/* Initialize a couple of needed variables */
n = this->set->n;
@@ -241,7 +247,7 @@ static bool sign_bliss(private_bliss_private_key_t *this, hash_algorithm_t alg,
y2 = z2;
ud = z2d;
- fft = bliss_fft_create(this->set->fft_params);
+ fft = ntt_fft_create(this->set->fft_params);
/* Use of the enhanced BLISS-B signature algorithm? */
switch (this->set->id)
@@ -337,7 +343,7 @@ static bool sign_bliss(private_bliss_private_key_t *this, hash_algorithm_t alg,
for (i = 0; i < n; i++)
{
- ay[i] = (this->A[i] * ay[i]) % q;
+ ay[i] = ntt_fft_mreduce(this->Ar[i] * ay[i], this->set->fft_params);
}
fft->transform(fft, ay, ay, TRUE);
@@ -668,6 +674,7 @@ METHOD(private_key_t, destroy, void,
free(this->s2);
}
free(this->A);
+ free(this->Ar);
free(this);
}
}
@@ -795,13 +802,13 @@ static uint32_t nks_norm(int8_t *s1, int8_t *s2, int n, uint16_t kappa)
/**
* Compute the inverse x1 of x modulo q as x^(-1) = x^(q-2) mod q
*/
-static uint32_t invert(uint32_t x, uint16_t q)
+static uint32_t invert(private_bliss_private_key_t *this, uint32_t x)
{
uint32_t x1, x2;
uint16_t q2;
int i, i_max;
- q2 = q - 2;
+ q2 = this->set->q - 2;
x1 = (q2 & 1) ? x : 1;
x2 = x;
i_max = 15;
@@ -812,11 +819,11 @@ static uint32_t invert(uint32_t x, uint16_t q)
}
for (i = 1; i <= i_max; i++)
{
- x2 = (x2 * x2) % q;
+ x2 = ntt_fft_mreduce(x2 * x2, this->set->fft_params);
if (q2 & (1 << i))
{
- x1 = (x1 * x2) % q;
+ x1 = ntt_fft_mreduce(x1 * x2, this->set->fft_params);
}
}
@@ -827,14 +834,14 @@ static uint32_t invert(uint32_t x, uint16_t q)
* Create a vector with sparse and small coefficients from seed
*/
static int8_t* create_vector_from_seed(private_bliss_private_key_t *this,
- hash_algorithm_t alg, chunk_t seed)
+ ext_out_function_t alg, chunk_t seed)
{
- mgf1_bitspender_t *bitspender;
+ xof_bitspender_t *bitspender;
uint32_t index, sign;
int8_t *vector;
int non_zero;
- bitspender = mgf1_bitspender_create(alg, seed, FALSE);
+ bitspender = xof_bitspender_create(alg, seed, FALSE);
if (!bitspender)
{
return NULL;
@@ -903,7 +910,7 @@ static bool create_secret(private_bliss_private_key_t *this, rng_t *rng,
int i, n;
chunk_t seed;
size_t seed_len;
- hash_algorithm_t alg;
+ ext_out_function_t alg;
n = this->set->n;
*s1 = NULL;
@@ -912,12 +919,12 @@ static bool create_secret(private_bliss_private_key_t *this, rng_t *rng,
/* Set MGF1 hash algorithm and seed length based on security strength */
if (this->set->strength > 160)
{
- alg = HASH_SHA256;
+ alg = XOF_MGF1_SHA256;
seed_len = HASH_SIZE_SHA256;
}
else
{
- alg = HASH_SHA1;
+ alg = XOF_MGF1_SHA1;
seed_len = HASH_SIZE_SHA1;
}
seed = chunk_create(seed_buf, seed_len);
@@ -1000,8 +1007,8 @@ bliss_private_key_t *bliss_private_key_gen(key_type_t type, va_list args)
uint32_t *S1, *S2, *a;
uint16_t q;
bool success = FALSE;
- bliss_param_set_t *set;
- bliss_fft_t *fft;
+ const bliss_param_set_t *set;
+ ntt_fft_t *fft;
rng_t *rng;
while (TRUE)
@@ -1062,13 +1069,14 @@ bliss_private_key_t *bliss_private_key_gen(key_type_t type, va_list args)
this->set = set;
/* We derive the public key from the private key using the FFT */
- fft = bliss_fft_create(set->fft_params);
+ fft = ntt_fft_create(set->fft_params);
/* Some vectors needed to derive the publi key */
S1 = malloc(n * sizeof(uint32_t));
S2 = malloc(n * sizeof(uint32_t));
a = malloc(n * sizeof(uint32_t));
- this->A = malloc(n * sizeof(uint32_t));
+ this->A = malloc(n * sizeof(uint32_t));
+ this->Ar = malloc(n * sizeof(uint32_t));
/* Instantiate a true random generator */
rng = lib->crypto->create_rng(lib->crypto, RNG_TRUE);
@@ -1091,6 +1099,7 @@ bliss_private_key_t *bliss_private_key_gen(key_type_t type, va_list args)
fft->transform(fft, S2, S2, FALSE);
success = TRUE;
+
for (i = 0; i < n; i++)
{
if (S1[i] == 0)
@@ -1103,8 +1112,9 @@ bliss_private_key_t *bliss_private_key_gen(key_type_t type, va_list args)
success = FALSE;
break;
}
- this->A[i] = invert(S1[i], q);
- this->A[i] = (S2[i] * this->A[i]) % q;
+ this->Ar[i] = invert(this, S1[i]);
+ this->Ar[i] = ntt_fft_mreduce(S2[i] * this->Ar[i], set->fft_params);
+ this->A[i] = ntt_fft_mreduce(this->Ar[i], set->fft_params);
}
}
while (!success && trials < SECRET_KEY_TRIALS_MAX);
@@ -1114,13 +1124,15 @@ bliss_private_key_t *bliss_private_key_gen(key_type_t type, va_list args)
if (success)
{
- fft->transform(fft, this->A, a, TRUE);
+ fft->transform(fft, this->Ar, a, TRUE);
DBG4(DBG_LIB, " i f g a F G A");
for (i = 0; i < n; i++)
{
DBG4(DBG_LIB, "%4d %3d %3d %5u %5u %5u %5u",
- i, this->s1[i], this->s2[i], a[i], S1[i], S2[i], this->A[i]);
+ i, this->s1[i], this->s2[i],
+ ntt_fft_mreduce(a[i], set->fft_params),
+ S1[i], S2[i], this->A[i]);
}
}
else
@@ -1167,7 +1179,7 @@ bliss_private_key_t *bliss_private_key_load(key_type_t type, va_list args)
asn1_parser_t *parser;
size_t s_bits = 0;
int8_t s, s_min = 0, s_max = 0;
- uint32_t s_sign = 0x02, s_mask = 0xfffffffc, value;
+ uint32_t s_sign = 0x02, s_mask = 0xfffffffc, value, r2;
bool success = FALSE;
int objectID, oid, i;
@@ -1248,6 +1260,14 @@ bliss_private_key_t *bliss_private_key_load(key_type_t type, va_list args)
{
goto end;
}
+ this->Ar = malloc(this->set->n * sizeof(uint32_t));
+ r2 = this->set->fft_params->r2;
+
+ for (i = 0; i < this->set->n; i++)
+ {
+ this->Ar[i] = ntt_fft_mreduce(this->A[i] * r2,
+ this->set->fft_params);
+ }
break;
case PRIV_KEY_SECRET1:
if (object.len != 1 + (s_bits * this->set->n + 7)/8)
diff --git a/src/libstrongswan/plugins/bliss/bliss_public_key.c b/src/libstrongswan/plugins/bliss/bliss_public_key.c
index 93d1165eb..f7ddbbfd2 100644
--- a/src/libstrongswan/plugins/bliss/bliss_public_key.c
+++ b/src/libstrongswan/plugins/bliss/bliss_public_key.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Andreas Steffen
+ * Copyright (C) 2014-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -16,7 +16,8 @@
#include "bliss_public_key.h"
#include "bliss_signature.h"
#include "bliss_bitpacker.h"
-#include "bliss_fft.h"
+#include "ntt_fft.h"
+#include "ntt_fft_reduce.h"
#include "bliss_utils.h"
#include <asn1/asn1.h>
@@ -37,7 +38,7 @@ struct private_bliss_public_key_t {
/**
* BLISS signature parameter set
*/
- bliss_param_set_t *set;
+ const bliss_param_set_t *set;
/**
* NTT of BLISS public key a (coefficients of polynomial (2g + 1)/f)
@@ -45,6 +46,11 @@ struct private_bliss_public_key_t {
uint32_t *A;
/**
+ * NTT of BLISS public key in Montgomery representation Ar = rA mod
+ */
+ uint32_t *Ar;
+
+ /**
* reference counter
*/
refcount_t ref;
@@ -70,8 +76,8 @@ static bool verify_bliss(private_bliss_public_key_t *this, hash_algorithm_t alg,
uint8_t data_hash_buf[HASH_SIZE_SHA512];
chunk_t data_hash;
hasher_t *hasher;
- hash_algorithm_t oracle_alg;
- bliss_fft_t *fft;
+ ext_out_function_t oracle_alg;
+ ntt_fft_t *fft;
bliss_signature_t *sig;
bool success = FALSE;
@@ -104,7 +110,7 @@ static bool verify_bliss(private_bliss_public_key_t *this, hash_algorithm_t alg,
}
/* MGF1 hash algorithm to be used for random oracle */
- oracle_alg = HASH_SHA512;
+ oracle_alg = XOF_MGF1_SHA512;
/* Initialize a couple of needed variables */
n = this->set->n;
@@ -120,12 +126,12 @@ static bool verify_bliss(private_bliss_public_key_t *this, hash_algorithm_t alg,
{
az[i] = z1[i] < 0 ? q + z1[i] : z1[i];
}
- fft = bliss_fft_create(this->set->fft_params);
+ fft = ntt_fft_create(this->set->fft_params);
fft->transform(fft, az, az, FALSE);
for (i = 0; i < n; i++)
{
- az[i] = (this->A[i] * az[i]) % q;
+ az[i] = ntt_fft_mreduce(this->Ar[i] * az[i], this->set->fft_params);
}
fft->transform(fft, az, az, TRUE);
@@ -279,6 +285,7 @@ METHOD(public_key_t, destroy, void,
{
lib->encoding->clear_cache(lib->encoding, this);
free(this->A);
+ free(this->Ar);
free(this);
}
}
@@ -304,7 +311,8 @@ bliss_public_key_t *bliss_public_key_load(key_type_t type, va_list args)
chunk_t blob = chunk_empty, object, param;
asn1_parser_t *parser;
bool success = FALSE;
- int objectID, oid;
+ int objectID, oid, i;
+ uint32_t r2;
while (TRUE)
{
@@ -380,6 +388,14 @@ bliss_public_key_t *bliss_public_key_load(key_type_t type, va_list args)
{
goto end;
}
+ this->Ar = malloc(this->set->n * sizeof(uint32_t));
+ r2 = this->set->fft_params->r2;
+
+ for (i = 0; i < this->set->n; i++)
+ {
+ this->Ar[i] = ntt_fft_mreduce(this->A[i] * r2,
+ this->set->fft_params);
+ }
break;
}
}
@@ -399,7 +415,7 @@ end:
/**
* See header.
*/
-bool bliss_public_key_from_asn1(chunk_t object, bliss_param_set_t *set,
+bool bliss_public_key_from_asn1(chunk_t object, const bliss_param_set_t *set,
uint32_t **pubkey)
{
bliss_bitpacker_t *packer;
@@ -438,7 +454,7 @@ bool bliss_public_key_from_asn1(chunk_t object, bliss_param_set_t *set,
/**
* See header.
*/
-chunk_t bliss_public_key_encode(uint32_t *pubkey, bliss_param_set_t *set)
+chunk_t bliss_public_key_encode(uint32_t *pubkey, const bliss_param_set_t *set)
{
bliss_bitpacker_t *packer;
chunk_t encoding;
@@ -460,7 +476,7 @@ chunk_t bliss_public_key_encode(uint32_t *pubkey, bliss_param_set_t *set)
* See header.
*/
chunk_t bliss_public_key_info_encode(int oid, uint32_t *pubkey,
- bliss_param_set_t *set)
+ const bliss_param_set_t *set)
{
chunk_t encoding, pubkey_encoding;
@@ -479,7 +495,7 @@ chunk_t bliss_public_key_info_encode(int oid, uint32_t *pubkey,
* See header.
*/
bool bliss_public_key_fingerprint(int oid, uint32_t *pubkey,
- bliss_param_set_t *set,
+ const bliss_param_set_t *set,
cred_encoding_type_t type, chunk_t *fp)
{
hasher_t *hasher;
diff --git a/src/libstrongswan/plugins/bliss/bliss_public_key.h b/src/libstrongswan/plugins/bliss/bliss_public_key.h
index cd8f231b2..d8dd2df5c 100644
--- a/src/libstrongswan/plugins/bliss/bliss_public_key.h
+++ b/src/libstrongswan/plugins/bliss/bliss_public_key.h
@@ -61,7 +61,7 @@ bliss_public_key_t *bliss_public_key_load(key_type_t type, va_list args);
* @param pubkey coefficients of public key vector
* @return TRUE if parsing successful
*/
-bool bliss_public_key_from_asn1(chunk_t object, bliss_param_set_t *set,
+bool bliss_public_key_from_asn1(chunk_t object, const bliss_param_set_t *set,
uint32_t **pubkey);
/**
@@ -71,7 +71,7 @@ bool bliss_public_key_from_asn1(chunk_t object, bliss_param_set_t *set,
* @param set BLISS parameter set for the public key vector
* @result ASN.1 encoded subjectPublicKey
*/
-chunk_t bliss_public_key_encode(uint32_t *pubkey, bliss_param_set_t *set);
+chunk_t bliss_public_key_encode(uint32_t *pubkey, const bliss_param_set_t *set);
/**
* Encode a BLISS subjectPublicKeyInfo record in ASN.1 DER format
@@ -82,7 +82,7 @@ chunk_t bliss_public_key_encode(uint32_t *pubkey, bliss_param_set_t *set);
* @result ASN.1 encoded subjectPublicKeyInfo record
*/
chunk_t bliss_public_key_info_encode(int oid, uint32_t *pubkey,
- bliss_param_set_t *set);
+ const bliss_param_set_t *set);
/**
* Generate a BLISS public key fingerprint
@@ -95,7 +95,7 @@ chunk_t bliss_public_key_info_encode(int oid, uint32_t *pubkey,
* @result TRUE if generation was successful
*/
bool bliss_public_key_fingerprint(int oid, uint32_t *pubkey,
- bliss_param_set_t *set,
+ const bliss_param_set_t *set,
cred_encoding_type_t type, chunk_t *fp);
#endif /** BLISS_PUBLIC_KEY_H_ @}*/
diff --git a/src/libstrongswan/plugins/bliss/bliss_sampler.c b/src/libstrongswan/plugins/bliss/bliss_sampler.c
index fa45a2fac..fb29d6622 100644
--- a/src/libstrongswan/plugins/bliss/bliss_sampler.c
+++ b/src/libstrongswan/plugins/bliss/bliss_sampler.c
@@ -17,7 +17,7 @@
typedef struct private_bliss_sampler_t private_bliss_sampler_t;
-#include <crypto/mgf1/mgf1_bitspender.h>
+#include <crypto/xofs/xof_bitspender.h>
/**
* Private data of a bliss_sampler_t object.
@@ -32,12 +32,12 @@ struct private_bliss_sampler_t {
/**
* BLISS parameter the rejection sampling is to be based on
*/
- bliss_param_set_t *set;
+ const bliss_param_set_t *set;
/**
* Bitspender used for random rejection sampling
*/
- mgf1_bitspender_t *bitspender;
+ xof_bitspender_t *bitspender;
};
@@ -45,7 +45,8 @@ METHOD(bliss_sampler_t, bernoulli_exp, bool,
private_bliss_sampler_t *this, uint32_t x, bool *accepted)
{
uint32_t x_mask;
- uint8_t *c, u;
+ uint8_t u;
+ const uint8_t *c;
int i;
x_mask = 1 << (this->set->c_rows - 1);
@@ -221,13 +222,13 @@ METHOD(bliss_sampler_t, destroy, void,
/**
* See header.
*/
-bliss_sampler_t *bliss_sampler_create(hash_algorithm_t alg, chunk_t seed,
- bliss_param_set_t *set)
+bliss_sampler_t *bliss_sampler_create(ext_out_function_t alg, chunk_t seed,
+ const bliss_param_set_t *set)
{
private_bliss_sampler_t *this;
- mgf1_bitspender_t *bitspender;
+ xof_bitspender_t *bitspender;
- bitspender = mgf1_bitspender_create(alg, seed, FALSE);
+ bitspender = xof_bitspender_create(alg, seed, FALSE);
if (!bitspender)
{
return NULL;
diff --git a/src/libstrongswan/plugins/bliss/bliss_sampler.h b/src/libstrongswan/plugins/bliss/bliss_sampler.h
index 2c75d4480..3e6d3d003 100644
--- a/src/libstrongswan/plugins/bliss/bliss_sampler.h
+++ b/src/libstrongswan/plugins/bliss/bliss_sampler.h
@@ -84,11 +84,11 @@ struct bliss_sampler_t {
/**
* Create a bliss_sampler_t object.
*
- * @param alg Hash algorithm to be used for the internal bitspender
+ * @param alg XOF to be used for the internal bitspender
* @param seed Seed used to initialize the internal bitspender
* @param set BLISS parameter set to be used
*/
-bliss_sampler_t *bliss_sampler_create(hash_algorithm_t alg, chunk_t seed,
- bliss_param_set_t *set);
+bliss_sampler_t *bliss_sampler_create(ext_out_function_t alg, chunk_t seed,
+ const bliss_param_set_t *set);
#endif /** BLISS_SAMPLER_H_ @}*/
diff --git a/src/libstrongswan/plugins/bliss/bliss_signature.c b/src/libstrongswan/plugins/bliss/bliss_signature.c
index e603da399..f4e1bff30 100644
--- a/src/libstrongswan/plugins/bliss/bliss_signature.c
+++ b/src/libstrongswan/plugins/bliss/bliss_signature.c
@@ -32,7 +32,7 @@ struct private_bliss_signature_t {
/**
* BLISS signature parameter set
*/
- bliss_param_set_t *set;
+ const bliss_param_set_t *set;
/**
* BLISS signature vector z1 of size n
@@ -134,7 +134,7 @@ METHOD(bliss_signature_t, destroy, void,
/**
* See header.
*/
-bliss_signature_t *bliss_signature_create(bliss_param_set_t *set)
+bliss_signature_t *bliss_signature_create(const bliss_param_set_t *set)
{
private_bliss_signature_t *this;
@@ -156,7 +156,7 @@ bliss_signature_t *bliss_signature_create(bliss_param_set_t *set)
/**
* See header.
*/
-bliss_signature_t *bliss_signature_create_from_data(bliss_param_set_t *set,
+bliss_signature_t *bliss_signature_create_from_data(const bliss_param_set_t *set,
chunk_t encoding)
{
private_bliss_signature_t *this;
diff --git a/src/libstrongswan/plugins/bliss/bliss_signature.h b/src/libstrongswan/plugins/bliss/bliss_signature.h
index d37f5398b..20ed6c0a2 100644
--- a/src/libstrongswan/plugins/bliss/bliss_signature.h
+++ b/src/libstrongswan/plugins/bliss/bliss_signature.h
@@ -61,7 +61,7 @@ struct bliss_signature_t {
*
* @param set BLISS parameter set
*/
-bliss_signature_t *bliss_signature_create(bliss_param_set_t *set);
+bliss_signature_t *bliss_signature_create(const bliss_param_set_t *set);
/**
* Create a BLISS signature object from encoding.
@@ -69,7 +69,7 @@ bliss_signature_t *bliss_signature_create(bliss_param_set_t *set);
* @param set BLISS parameter set
* @param encoding binary signature encoding
*/
-bliss_signature_t *bliss_signature_create_from_data(bliss_param_set_t *set,
+bliss_signature_t *bliss_signature_create_from_data(const bliss_param_set_t *set,
chunk_t encoding);
#endif /** BLISS_SIGNATURE_H_ @}*/
diff --git a/src/libstrongswan/plugins/bliss/bliss_utils.c b/src/libstrongswan/plugins/bliss/bliss_utils.c
index 5e313ff26..5baa1f89a 100644
--- a/src/libstrongswan/plugins/bliss/bliss_utils.c
+++ b/src/libstrongswan/plugins/bliss/bliss_utils.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Andreas Steffen
+ * Copyright (C) 2014-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -17,7 +17,7 @@
#include <asn1/asn1.h>
#include <crypto/hashers/hasher.h>
-#include <crypto/mgf1/mgf1_bitspender.h>
+#include <crypto/xofs/xof_bitspender.h>
#include <utils/debug.h>
/**
@@ -39,7 +39,8 @@ int32_t bliss_utils_scalar_product(int32_t *x, int32_t *y, int n)
/**
* See header.
*/
-void bliss_utils_round_and_drop(bliss_param_set_t *set, int32_t *x, int16_t *xd)
+void bliss_utils_round_and_drop(const bliss_param_set_t *set,
+ int32_t *x, int16_t *xd)
{
int32_t factor;
int i;
@@ -55,8 +56,8 @@ void bliss_utils_round_and_drop(bliss_param_set_t *set, int32_t *x, int16_t *xd)
/**
* See header.
*/
-bool bliss_utils_generate_c(hash_algorithm_t alg, chunk_t data_hash,
- uint16_t *ud, bliss_param_set_t *set,
+bool bliss_utils_generate_c(ext_out_function_t alg, chunk_t data_hash,
+ uint16_t *ud, const bliss_param_set_t *set,
uint16_t *c_indices)
{
int i, index_trials = 0, index_found = 0;
@@ -64,7 +65,7 @@ bool bliss_utils_generate_c(hash_algorithm_t alg, chunk_t data_hash,
uint32_t index;
uint8_t *seed_pos;
chunk_t seed;
- mgf1_bitspender_t *bitspender;
+ xof_bitspender_t *bitspender;
seed = chunk_alloca(data_hash.len + set->n * sizeof(uint16_t));
@@ -79,7 +80,7 @@ bool bliss_utils_generate_c(hash_algorithm_t alg, chunk_t data_hash,
seed_pos += sizeof(uint16_t);
}
- bitspender = mgf1_bitspender_create(alg, seed, FALSE);
+ bitspender = xof_bitspender_create(alg, seed, FALSE);
if (!bitspender)
{
return NULL;
@@ -117,7 +118,8 @@ bool bliss_utils_generate_c(hash_algorithm_t alg, chunk_t data_hash,
/**
* See header.
*/
-bool bliss_utils_check_norms(bliss_param_set_t *set, int32_t *z1, int16_t *z2d)
+bool bliss_utils_check_norms(const bliss_param_set_t *set,
+ int32_t *z1, int16_t *z2d)
{
int32_t z2ds[set->n];
int32_t z1_min, z1_max, norm;
diff --git a/src/libstrongswan/plugins/bliss/bliss_utils.h b/src/libstrongswan/plugins/bliss/bliss_utils.h
index 156968dd7..bfaf3c475 100644
--- a/src/libstrongswan/plugins/bliss/bliss_utils.h
+++ b/src/libstrongswan/plugins/bliss/bliss_utils.h
@@ -42,29 +42,31 @@ int32_t bliss_utils_scalar_product(int32_t *x, int32_t *y, int n);
* @param x input vector x of size n
* @param xd rounded vector x with d bits dropped
*/
-void bliss_utils_round_and_drop(bliss_param_set_t *set, int32_t *x, int16_t *xd);
+void bliss_utils_round_and_drop(const bliss_param_set_t *set,
+ int32_t *x, int16_t *xd);
/**
* Generate the binary challenge vector c as an array of kappa indices
*
- * @param alg hash algorithm to be used for the internal oracle
- * @param data_hash hash of the data to be signed
- * @param ud input vector ud of size n
- * @param set BLISS parameter set to be used (n, n_bits, kappa)
- * @param c_indices indexes of non-zero challenge coefficients
+ * @param alg XOF to be used for the internal oracle
+ * @param data_hash hash of the data to be signed
+ * @param ud input vector ud of size n
+ * @param set BLISS parameter set to be used (n, n_bits, kappa)
+ * @param c_indices indexes of non-zero challenge coefficients
*/
-bool bliss_utils_generate_c(hash_algorithm_t alg, chunk_t data_hash,
- uint16_t *ud, bliss_param_set_t *set,
+bool bliss_utils_generate_c(ext_out_function_t alg, chunk_t data_hash,
+ uint16_t *ud, const bliss_param_set_t *set,
uint16_t *c_indices);
/**
* Check the infinity and l2 norms of the vectors z1 and z2d << d
*
- * @param set BLISS parameter set
- * @param z1 input vector
- * @param z2d input vector
- * @result TRUE if infinite and l2 norms do not exceed boundaries
+ * @param set BLISS parameter set
+ * @param z1 input vector
+ * @param z2d input vector
+ * @result TRUE if infinite and l2 norms do not exceed boundaries
*/
-bool bliss_utils_check_norms(bliss_param_set_t *set, int32_t *z1, int16_t *z2d);
+bool bliss_utils_check_norms(const bliss_param_set_t *set,
+ int32_t *z1, int16_t *z2d);
#endif /** BLISS_UTILS_H_ @}*/
diff --git a/src/libstrongswan/plugins/bliss/tests/Makefile.am b/src/libstrongswan/plugins/bliss/tests/Makefile.am
index bd87753f5..1ec8d551f 100644
--- a/src/libstrongswan/plugins/bliss/tests/Makefile.am
+++ b/src/libstrongswan/plugins/bliss/tests/Makefile.am
@@ -3,7 +3,6 @@ TESTS = bliss_tests
check_PROGRAMS = $(TESTS)
bliss_tests_SOURCES = \
- suites/test_bliss_fft.c \
suites/test_bliss_bitpacker.c \
suites/test_bliss_huffman.c \
suites/test_bliss_keys.c \
@@ -15,6 +14,7 @@ bliss_tests_SOURCES = \
bliss_tests_CFLAGS = \
-I$(top_srcdir)/src/libstrongswan \
-I$(top_srcdir)/src/libstrongswan/tests \
+ -I$(top_srcdir)/src/libstrongswan/math/libnttfft \
-I$(top_srcdir)/src/libstrongswan/plugins/bliss \
-DPLUGINDIR=\""$(abs_top_builddir)/src/libstrongswan/plugins\"" \
-DPLUGINS=\""${s_plugins}\"" \
@@ -24,4 +24,5 @@ bliss_tests_LDFLAGS = @COVERAGE_LDFLAGS@
bliss_tests_LDADD = \
$(top_builddir)/src/libstrongswan/libstrongswan.la \
$(top_builddir)/src/libstrongswan/tests/libtest.la \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la \
../libbliss.la
diff --git a/src/libstrongswan/plugins/bliss/tests/Makefile.in b/src/libstrongswan/plugins/bliss/tests/Makefile.in
index 85619c551..05f95dc61 100644
--- a/src/libstrongswan/plugins/bliss/tests/Makefile.in
+++ b/src/libstrongswan/plugins/bliss/tests/Makefile.in
@@ -110,7 +110,7 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__EXEEXT_1 = bliss_tests$(EXEEXT)
am__dirstamp = $(am__leading_dot)dirstamp
-am_bliss_tests_OBJECTS = suites/bliss_tests-test_bliss_fft.$(OBJEXT) \
+am_bliss_tests_OBJECTS = \
suites/bliss_tests-test_bliss_bitpacker.$(OBJEXT) \
suites/bliss_tests-test_bliss_huffman.$(OBJEXT) \
suites/bliss_tests-test_bliss_keys.$(OBJEXT) \
@@ -122,6 +122,7 @@ bliss_tests_OBJECTS = $(am_bliss_tests_OBJECTS)
bliss_tests_DEPENDENCIES = \
$(top_builddir)/src/libstrongswan/libstrongswan.la \
$(top_builddir)/src/libstrongswan/tests/libtest.la \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la \
../libbliss.la
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -353,7 +354,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -387,8 +387,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -442,11 +440,12 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
bliss_tests_SOURCES = \
- suites/test_bliss_fft.c \
suites/test_bliss_bitpacker.c \
suites/test_bliss_huffman.c \
suites/test_bliss_keys.c \
@@ -458,6 +457,7 @@ bliss_tests_SOURCES = \
bliss_tests_CFLAGS = \
-I$(top_srcdir)/src/libstrongswan \
-I$(top_srcdir)/src/libstrongswan/tests \
+ -I$(top_srcdir)/src/libstrongswan/math/libnttfft \
-I$(top_srcdir)/src/libstrongswan/plugins/bliss \
-DPLUGINDIR=\""$(abs_top_builddir)/src/libstrongswan/plugins\"" \
-DPLUGINS=\""${s_plugins}\"" \
@@ -467,6 +467,7 @@ bliss_tests_LDFLAGS = @COVERAGE_LDFLAGS@
bliss_tests_LDADD = \
$(top_builddir)/src/libstrongswan/libstrongswan.la \
$(top_builddir)/src/libstrongswan/tests/libtest.la \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la \
../libbliss.la
all: all-am
@@ -517,8 +518,6 @@ suites/$(am__dirstamp):
suites/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) suites/$(DEPDIR)
@: > suites/$(DEPDIR)/$(am__dirstamp)
-suites/bliss_tests-test_bliss_fft.$(OBJEXT): suites/$(am__dirstamp) \
- suites/$(DEPDIR)/$(am__dirstamp)
suites/bliss_tests-test_bliss_bitpacker.$(OBJEXT): \
suites/$(am__dirstamp) suites/$(DEPDIR)/$(am__dirstamp)
suites/bliss_tests-test_bliss_huffman.$(OBJEXT): \
@@ -545,7 +544,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bliss_tests-bliss_tests.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@suites/$(DEPDIR)/bliss_tests-test_bliss_bitpacker.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@suites/$(DEPDIR)/bliss_tests-test_bliss_fft.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@suites/$(DEPDIR)/bliss_tests-test_bliss_huffman.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@suites/$(DEPDIR)/bliss_tests-test_bliss_keys.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@suites/$(DEPDIR)/bliss_tests-test_bliss_sampler.Po@am__quote@
@@ -576,20 +574,6 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
-suites/bliss_tests-test_bliss_fft.o: suites/test_bliss_fft.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bliss_tests_CFLAGS) $(CFLAGS) -MT suites/bliss_tests-test_bliss_fft.o -MD -MP -MF suites/$(DEPDIR)/bliss_tests-test_bliss_fft.Tpo -c -o suites/bliss_tests-test_bliss_fft.o `test -f 'suites/test_bliss_fft.c' || echo '$(srcdir)/'`suites/test_bliss_fft.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) suites/$(DEPDIR)/bliss_tests-test_bliss_fft.Tpo suites/$(DEPDIR)/bliss_tests-test_bliss_fft.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='suites/test_bliss_fft.c' object='suites/bliss_tests-test_bliss_fft.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bliss_tests_CFLAGS) $(CFLAGS) -c -o suites/bliss_tests-test_bliss_fft.o `test -f 'suites/test_bliss_fft.c' || echo '$(srcdir)/'`suites/test_bliss_fft.c
-
-suites/bliss_tests-test_bliss_fft.obj: suites/test_bliss_fft.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bliss_tests_CFLAGS) $(CFLAGS) -MT suites/bliss_tests-test_bliss_fft.obj -MD -MP -MF suites/$(DEPDIR)/bliss_tests-test_bliss_fft.Tpo -c -o suites/bliss_tests-test_bliss_fft.obj `if test -f 'suites/test_bliss_fft.c'; then $(CYGPATH_W) 'suites/test_bliss_fft.c'; else $(CYGPATH_W) '$(srcdir)/suites/test_bliss_fft.c'; fi`
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) suites/$(DEPDIR)/bliss_tests-test_bliss_fft.Tpo suites/$(DEPDIR)/bliss_tests-test_bliss_fft.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='suites/test_bliss_fft.c' object='suites/bliss_tests-test_bliss_fft.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bliss_tests_CFLAGS) $(CFLAGS) -c -o suites/bliss_tests-test_bliss_fft.obj `if test -f 'suites/test_bliss_fft.c'; then $(CYGPATH_W) 'suites/test_bliss_fft.c'; else $(CYGPATH_W) '$(srcdir)/suites/test_bliss_fft.c'; fi`
-
suites/bliss_tests-test_bliss_bitpacker.o: suites/test_bliss_bitpacker.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bliss_tests_CFLAGS) $(CFLAGS) -MT suites/bliss_tests-test_bliss_bitpacker.o -MD -MP -MF suites/$(DEPDIR)/bliss_tests-test_bliss_bitpacker.Tpo -c -o suites/bliss_tests-test_bliss_bitpacker.o `test -f 'suites/test_bliss_bitpacker.c' || echo '$(srcdir)/'`suites/test_bliss_bitpacker.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) suites/$(DEPDIR)/bliss_tests-test_bliss_bitpacker.Tpo suites/$(DEPDIR)/bliss_tests-test_bliss_bitpacker.Po
diff --git a/src/libstrongswan/plugins/bliss/tests/bliss_tests.h b/src/libstrongswan/plugins/bliss/tests/bliss_tests.h
index f0959cc08..61f37d5a1 100644
--- a/src/libstrongswan/plugins/bliss/tests/bliss_tests.h
+++ b/src/libstrongswan/plugins/bliss/tests/bliss_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2015 Andreas Steffen
+ * Copyright (C) 2014-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -13,7 +13,6 @@
* for more details.
*/
-TEST_SUITE(bliss_fft_suite_create)
TEST_SUITE(bliss_bitpacker_suite_create)
TEST_SUITE(bliss_huffman_suite_create)
TEST_SUITE(bliss_keys_suite_create)
diff --git a/src/libstrongswan/plugins/bliss/tests/suites/test_bliss_fft.c b/src/libstrongswan/plugins/bliss/tests/suites/test_bliss_fft.c
deleted file mode 100644
index 009aaf802..000000000
--- a/src/libstrongswan/plugins/bliss/tests/suites/test_bliss_fft.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2014 Andreas Steffen
- * HSR Hochschule fuer Technik Rapperswil
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
- *
- * This program 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.
- */
-
-#include "test_suite.h"
-
-#include <bliss_fft.h>
-
-static bliss_fft_params_t *fft_params[] = {
- &bliss_fft_17_8,
- &bliss_fft_12289_512
-};
-
-START_TEST(test_bliss_fft_impulse)
-{
- bliss_fft_t *fft;
- uint16_t n = fft_params[_i]->n;
- uint32_t x[n], X[n];
- int i;
-
- for (i = 0; i < n; i++)
- {
- x[i] = 0;
- }
- x[0] = 1;
-
- fft = bliss_fft_create(fft_params[_i]);
- fft->transform(fft, x, X, FALSE);
-
- for (i = 0; i < n; i++)
- {
- ck_assert(X[i] == 1);
- }
- fft->transform(fft, X, x, TRUE);
-
- for (i = 0; i < n; i++)
- {
- ck_assert(x[i] == (i == 0));
- }
- fft->destroy(fft);
-}
-END_TEST
-
-START_TEST(test_bliss_fft_wrap)
-{
- bliss_fft_t *fft;
- uint16_t n = fft_params[_i]->n;
- uint16_t q = fft_params[_i]->q;
- uint32_t x[n],y[n], X[n], Y[n];
- int i, j;
-
- for (i = 0; i < n; i++)
- {
- x[i] = i;
- y[i] = 0;
- }
- fft = bliss_fft_create(fft_params[_i]);
- ck_assert(fft->get_size(fft) == n);
- ck_assert(fft->get_modulus(fft) == q);
- fft->transform(fft, x, X, FALSE);
-
- for (j = 0; j < n; j++)
- {
- y[j] = 1;
- fft->transform(fft, y, Y, FALSE);
-
- for (i = 0; i < n; i++)
- {
- Y[i] = (X[i] * Y[i]) % q;
- }
- fft->transform(fft, Y, Y, TRUE);
-
- for (i = 0; i < n; i++)
- {
- ck_assert(Y[i] == ( i < j ? q - n - i + j : i - j));
- }
- y[j] = 0;
- }
- fft->destroy(fft);
-}
-END_TEST
-
-Suite *bliss_fft_suite_create()
-{
- Suite *s;
- TCase *tc;
-
- s = suite_create("bliss_fft");
-
- tc = tcase_create("impulse");
- tcase_add_loop_test(tc, test_bliss_fft_impulse, 0, countof(fft_params));
- suite_add_tcase(s, tc);
-
- tc = tcase_create("negative_wrap");
- tcase_add_loop_test(tc, test_bliss_fft_wrap, 0, countof(fft_params));
- suite_add_tcase(s, tc);
-
- return s;
-}
diff --git a/src/libstrongswan/plugins/bliss/tests/suites/test_bliss_sampler.c b/src/libstrongswan/plugins/bliss/tests/suites/test_bliss_sampler.c
index 1bd1266ad..26c5b60e6 100644
--- a/src/libstrongswan/plugins/bliss/tests/suites/test_bliss_sampler.c
+++ b/src/libstrongswan/plugins/bliss/tests/suites/test_bliss_sampler.c
@@ -22,16 +22,16 @@ static u_int key_size[] = { 1, 3, 4};
START_TEST(test_bliss_sampler_gaussian)
{
bliss_sampler_t *sampler;
- bliss_param_set_t *set;
+ const bliss_param_set_t *set;
int i, k, count;
uint32_t hist[8], sign[3];
int32_t z;
- hash_algorithm_t alg;
+ ext_out_function_t alg;
size_t seed_len;
chunk_t seed;
set = bliss_param_set_get_by_id(key_size[_i]);
- alg = HASH_SHA256;
+ alg = XOF_MGF1_SHA256;
seed_len = 32;
count = 10000000;
diff --git a/src/libstrongswan/plugins/bliss/tests/suites/test_bliss_signature.c b/src/libstrongswan/plugins/bliss/tests/suites/test_bliss_signature.c
index 2a2f48c53..6f566506a 100644
--- a/src/libstrongswan/plugins/bliss/tests/suites/test_bliss_signature.c
+++ b/src/libstrongswan/plugins/bliss/tests/suites/test_bliss_signature.c
@@ -95,8 +95,8 @@ static chunk_t data = chunk_from_chars(
START_TEST(test_bliss_signature_fail)
{
- bliss_param_set_t set2 = { .id = BLISS_B_II };
- bliss_param_set_t *set;
+ const bliss_param_set_t set2 = { .id = BLISS_B_II };
+ const bliss_param_set_t *set;
bliss_signature_t *signature;
chunk_t encoding;
int k;
diff --git a/src/libstrongswan/plugins/blowfish/Makefile.in b/src/libstrongswan/plugins/blowfish/Makefile.in
index d54331163..895af626b 100644
--- a/src/libstrongswan/plugins/blowfish/Makefile.in
+++ b/src/libstrongswan/plugins/blowfish/Makefile.in
@@ -353,7 +353,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -387,8 +386,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -442,6 +439,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/ccm/Makefile.in b/src/libstrongswan/plugins/ccm/Makefile.in
index d93b0479c..39caacdcd 100644
--- a/src/libstrongswan/plugins/ccm/Makefile.in
+++ b/src/libstrongswan/plugins/ccm/Makefile.in
@@ -350,7 +350,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -384,8 +383,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -439,6 +436,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/chapoly/Makefile.am b/src/libstrongswan/plugins/chapoly/Makefile.am
index 1753de0c7..d6d577c86 100644
--- a/src/libstrongswan/plugins/chapoly/Makefile.am
+++ b/src/libstrongswan/plugins/chapoly/Makefile.am
@@ -15,7 +15,8 @@ libstrongswan_chapoly_la_SOURCES = \
chapoly_plugin.h chapoly_plugin.c \
chapoly_drv.h chapoly_drv.c \
chapoly_drv_portable.h chapoly_drv_portable.c \
- chapoly_aead.h chapoly_aead.c
+ chapoly_aead.h chapoly_aead.c \
+ chapoly_xof.h chapoly_xof.c
noinst_LTLIBRARIES += libchapoly-drv-ssse3.la
libchapoly_drv_ssse3_la_SOURCES = chapoly_drv_ssse3.h chapoly_drv_ssse3.c
diff --git a/src/libstrongswan/plugins/chapoly/Makefile.in b/src/libstrongswan/plugins/chapoly/Makefile.in
index d5b77a990..c0de9d83d 100644
--- a/src/libstrongswan/plugins/chapoly/Makefile.in
+++ b/src/libstrongswan/plugins/chapoly/Makefile.in
@@ -152,7 +152,7 @@ libchapoly_drv_ssse3_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(LDFLAGS) -o $@
libstrongswan_chapoly_la_DEPENDENCIES = libchapoly-drv-ssse3.la
am_libstrongswan_chapoly_la_OBJECTS = chapoly_plugin.lo chapoly_drv.lo \
- chapoly_drv_portable.lo chapoly_aead.lo
+ chapoly_drv_portable.lo chapoly_aead.lo chapoly_xof.lo
libstrongswan_chapoly_la_OBJECTS = \
$(am_libstrongswan_chapoly_la_OBJECTS)
libstrongswan_chapoly_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
@@ -365,7 +365,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -399,8 +398,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -454,6 +451,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
@@ -469,7 +468,8 @@ libstrongswan_chapoly_la_SOURCES = \
chapoly_plugin.h chapoly_plugin.c \
chapoly_drv.h chapoly_drv.c \
chapoly_drv_portable.h chapoly_drv_portable.c \
- chapoly_aead.h chapoly_aead.c
+ chapoly_aead.h chapoly_aead.c \
+ chapoly_xof.h chapoly_xof.c
libchapoly_drv_ssse3_la_SOURCES = chapoly_drv_ssse3.h chapoly_drv_ssse3.c
@USE_X86X64_TRUE@libchapoly_drv_ssse3_la_CFLAGS = $(PLUGIN_CFLAGS) -mssse3
@@ -573,6 +573,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chapoly_drv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chapoly_drv_portable.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chapoly_plugin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chapoly_xof.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchapoly_drv_ssse3_la-chapoly_drv_ssse3.Plo@am__quote@
.c.o:
diff --git a/src/libstrongswan/plugins/chapoly/chapoly_plugin.c b/src/libstrongswan/plugins/chapoly/chapoly_plugin.c
index 02e7121d6..447960bd0 100644
--- a/src/libstrongswan/plugins/chapoly/chapoly_plugin.c
+++ b/src/libstrongswan/plugins/chapoly/chapoly_plugin.c
@@ -15,6 +15,7 @@
#include "chapoly_plugin.h"
#include "chapoly_aead.h"
+#include "chapoly_xof.h"
#include <library.h>
@@ -43,6 +44,8 @@ METHOD(plugin_t, get_features, int,
static plugin_feature_t f[] = {
PLUGIN_REGISTER(AEAD, chapoly_aead_create),
PLUGIN_PROVIDE(AEAD, ENCR_CHACHA20_POLY1305, 32),
+ PLUGIN_REGISTER(XOF, chapoly_xof_create),
+ PLUGIN_PROVIDE(XOF, XOF_CHACHA20),
};
*features = f;
return countof(f);
diff --git a/src/libstrongswan/plugins/chapoly/chapoly_xof.c b/src/libstrongswan/plugins/chapoly/chapoly_xof.c
new file mode 100644
index 000000000..2740a55b4
--- /dev/null
+++ b/src/libstrongswan/plugins/chapoly/chapoly_xof.c
@@ -0,0 +1,173 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+#include "chapoly_xof.h"
+#include "chapoly_drv.h"
+
+typedef struct private_chapoly_xof_t private_chapoly_xof_t;
+
+/**
+ * Private data of an chapoly_xof_t object.
+ */
+struct private_chapoly_xof_t {
+
+ /**
+ * Public chapoly_xof_t interface.
+ */
+ chapoly_xof_t public;
+
+ /**
+ * Latest block of the ChaCha20 stream.
+ */
+ uint8_t stream[CHACHA_BLOCK_SIZE];
+
+ /**
+ * Index pointing to the current position in the stream
+ */
+ u_int stream_index;
+
+ /**
+ * Driver backend
+ */
+ chapoly_drv_t *drv;
+};
+
+METHOD(xof_t, get_type, ext_out_function_t,
+ private_chapoly_xof_t *this)
+{
+ return XOF_CHACHA20;
+}
+
+METHOD(xof_t, get_bytes, bool,
+ private_chapoly_xof_t *this, size_t out_len, uint8_t *buffer)
+{
+ size_t index = 0, len, blocks;
+
+ /* empty the stream buffer first */
+ len = min(out_len, CHACHA_BLOCK_SIZE - this->stream_index);
+ if (len)
+ {
+ memcpy(buffer, this->stream + this->stream_index, len);
+ index += len;
+ this->stream_index += len;
+ }
+
+ /* copy whole stream blocks directly to output buffer */
+ blocks = (out_len - index) / CHACHA_BLOCK_SIZE;
+ while (blocks--)
+ {
+ if (!this->drv->chacha(this->drv, buffer + index))
+ {
+ return FALSE;
+ }
+ index += CHACHA_BLOCK_SIZE;
+ }
+
+ /* refill the stream buffer if some more output bytes are needed */
+ len = out_len - index;
+ if (len)
+ {
+ if (!this->drv->chacha(this->drv, this->stream))
+ {
+ return FALSE;
+ }
+ memcpy(buffer + index, this->stream, len);
+ this->stream_index = len;
+ }
+
+ return TRUE;
+}
+
+METHOD(xof_t, allocate_bytes, bool,
+ private_chapoly_xof_t *this, size_t out_len, chunk_t *chunk)
+{
+ *chunk = chunk_alloc(out_len);
+
+ if (!get_bytes(this, out_len, chunk->ptr))
+ {
+ chunk_free(chunk);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+METHOD(xof_t, get_block_size, size_t,
+ private_chapoly_xof_t *this)
+{
+ return CHACHA_BLOCK_SIZE;
+}
+
+METHOD(xof_t, get_seed_size, size_t,
+ private_chapoly_xof_t *this)
+{
+ return CHACHA_KEY_SIZE + CHACHA_SALT_SIZE + CHACHA_IV_SIZE;
+}
+
+METHOD(xof_t, set_seed, bool,
+ private_chapoly_xof_t *this, chunk_t seed)
+{
+ this->stream_index = CHACHA_BLOCK_SIZE;
+
+ return seed.len == get_seed_size(this) &&
+ this->drv->set_key(this->drv, "expand 32-byte k",
+ seed.ptr, seed.ptr + CHACHA_KEY_SIZE) &&
+ this->drv->init(this->drv,
+ seed.ptr + CHACHA_KEY_SIZE + CHACHA_SALT_SIZE);
+}
+
+METHOD(xof_t, destroy, void,
+ private_chapoly_xof_t *this)
+{
+ this->drv->destroy(this->drv);
+ free(this);
+}
+
+/**
+ * See header
+ */
+chapoly_xof_t *chapoly_xof_create(ext_out_function_t algorithm)
+{
+ private_chapoly_xof_t *this;
+ chapoly_drv_t *drv;
+
+ if (algorithm != XOF_CHACHA20)
+ {
+ return NULL;
+ }
+
+ drv = chapoly_drv_probe();
+ if (!drv)
+ {
+ return NULL;
+ }
+
+ INIT(this,
+ .public = {
+ .xof_interface = {
+ .get_type = _get_type,
+ .get_bytes = _get_bytes,
+ .allocate_bytes = _allocate_bytes,
+ .get_block_size = _get_block_size,
+ .get_seed_size = _get_seed_size,
+ .set_seed = _set_seed,
+ .destroy = _destroy,
+ },
+ },
+ .drv = drv,
+ );
+
+ return &this->public;
+}
diff --git a/src/libstrongswan/plugins/chapoly/chapoly_xof.h b/src/libstrongswan/plugins/chapoly/chapoly_xof.h
new file mode 100644
index 000000000..cd0586fad
--- /dev/null
+++ b/src/libstrongswan/plugins/chapoly/chapoly_xof.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+/**
+ * @defgroup chapoly_xof chapoly_xof
+ * @{ @ingroup chapoly
+ */
+
+#ifndef CHAPOLY_XOF_H_
+#define CHAPOLY_XOF_H_
+
+#include <crypto/aead.h>
+
+typedef struct chapoly_xof_t chapoly_xof_t;
+
+/**
+ * ChaCha20 XOF implementation
+ *
+ * Based on RFC 7539 ChaCha20 stream initialized with block counter = 1
+ */
+struct chapoly_xof_t {
+
+ /**
+ * Generic xof_t interface for this Extended Output Function (XOF).
+ */
+ xof_t xof_interface;
+};
+
+/**
+ * Create a chapoly_xof instance.
+ *
+ * @param algorithm XOF_CHACHA20
+ * @return chapoly_xof_t object, NULL if not supported
+ */
+chapoly_xof_t *chapoly_xof_create(ext_out_function_t algorithm);
+
+#endif /** CHAPOLY_XOF_H_ @}*/
diff --git a/src/libstrongswan/plugins/cmac/Makefile.in b/src/libstrongswan/plugins/cmac/Makefile.in
index 2703dc4cc..24702df73 100644
--- a/src/libstrongswan/plugins/cmac/Makefile.in
+++ b/src/libstrongswan/plugins/cmac/Makefile.in
@@ -350,7 +350,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -384,8 +383,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -439,6 +436,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/constraints/Makefile.in b/src/libstrongswan/plugins/constraints/Makefile.in
index 90fd6bd6b..56b4835fd 100644
--- a/src/libstrongswan/plugins/constraints/Makefile.in
+++ b/src/libstrongswan/plugins/constraints/Makefile.in
@@ -353,7 +353,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -387,8 +386,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -442,6 +439,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/ctr/Makefile.in b/src/libstrongswan/plugins/ctr/Makefile.in
index 94a7f112c..16d177e8a 100644
--- a/src/libstrongswan/plugins/ctr/Makefile.in
+++ b/src/libstrongswan/plugins/ctr/Makefile.in
@@ -350,7 +350,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -384,8 +383,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -439,6 +436,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/curl/Makefile.in b/src/libstrongswan/plugins/curl/Makefile.in
index 5092c542c..7aad683cc 100644
--- a/src/libstrongswan/plugins/curl/Makefile.in
+++ b/src/libstrongswan/plugins/curl/Makefile.in
@@ -350,7 +350,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -384,8 +383,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -439,6 +436,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/des/Makefile.in b/src/libstrongswan/plugins/des/Makefile.in
index c2e49b66f..78905859b 100644
--- a/src/libstrongswan/plugins/des/Makefile.in
+++ b/src/libstrongswan/plugins/des/Makefile.in
@@ -350,7 +350,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -384,8 +383,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -439,6 +436,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/dnskey/Makefile.in b/src/libstrongswan/plugins/dnskey/Makefile.in
index 1481f8dd8..327ebd36a 100644
--- a/src/libstrongswan/plugins/dnskey/Makefile.in
+++ b/src/libstrongswan/plugins/dnskey/Makefile.in
@@ -353,7 +353,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -387,8 +386,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -442,6 +439,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/files/Makefile.in b/src/libstrongswan/plugins/files/Makefile.in
index 7623a9507..4bfe127bb 100644
--- a/src/libstrongswan/plugins/files/Makefile.in
+++ b/src/libstrongswan/plugins/files/Makefile.in
@@ -351,7 +351,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -385,8 +384,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -440,6 +437,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/fips_prf/Makefile.in b/src/libstrongswan/plugins/fips_prf/Makefile.in
index 7c2ae7ce5..cceb70548 100644
--- a/src/libstrongswan/plugins/fips_prf/Makefile.in
+++ b/src/libstrongswan/plugins/fips_prf/Makefile.in
@@ -352,7 +352,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -386,8 +385,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -441,6 +438,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/gcm/Makefile.in b/src/libstrongswan/plugins/gcm/Makefile.in
index eb4a0aef0..fb649f4b3 100644
--- a/src/libstrongswan/plugins/gcm/Makefile.in
+++ b/src/libstrongswan/plugins/gcm/Makefile.in
@@ -350,7 +350,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -384,8 +383,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -439,6 +436,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/gcrypt/Makefile.in b/src/libstrongswan/plugins/gcrypt/Makefile.in
index 727cc2497..f2396f4cd 100644
--- a/src/libstrongswan/plugins/gcrypt/Makefile.in
+++ b/src/libstrongswan/plugins/gcrypt/Makefile.in
@@ -354,7 +354,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -388,8 +387,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -443,6 +440,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c b/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c
index 938a46490..15b876b3f 100644
--- a/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c
+++ b/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c
@@ -206,16 +206,16 @@ METHOD(private_key_t, sign, bool,
{
case SIGN_RSA_EMSA_PKCS1_NULL:
return sign_raw(this, data, sig);
- case SIGN_RSA_EMSA_PKCS1_SHA1:
- return sign_pkcs1(this, HASH_SHA1, "sha1", data, sig);
- case SIGN_RSA_EMSA_PKCS1_SHA224:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_224:
return sign_pkcs1(this, HASH_SHA224, "sha224", data, sig);
- case SIGN_RSA_EMSA_PKCS1_SHA256:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_256:
return sign_pkcs1(this, HASH_SHA256, "sha256", data, sig);
- case SIGN_RSA_EMSA_PKCS1_SHA384:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_384:
return sign_pkcs1(this, HASH_SHA384, "sha384", data, sig);
- case SIGN_RSA_EMSA_PKCS1_SHA512:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_512:
return sign_pkcs1(this, HASH_SHA512, "sha512", data, sig);
+ case SIGN_RSA_EMSA_PKCS1_SHA1:
+ return sign_pkcs1(this, HASH_SHA1, "sha1", data, sig);
case SIGN_RSA_EMSA_PKCS1_MD5:
return sign_pkcs1(this, HASH_MD5, "md5", data, sig);
default:
diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c b/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c
index 291287a8f..90829e052 100644
--- a/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c
+++ b/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c
@@ -173,18 +173,18 @@ METHOD(public_key_t, verify, bool,
{
case SIGN_RSA_EMSA_PKCS1_NULL:
return verify_raw(this, data, signature);
- case SIGN_RSA_EMSA_PKCS1_MD5:
- return verify_pkcs1(this, HASH_MD5, "md5", data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA1:
- return verify_pkcs1(this, HASH_SHA1, "sha1", data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA224:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_224:
return verify_pkcs1(this, HASH_SHA224, "sha224", data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA256:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_256:
return verify_pkcs1(this, HASH_SHA256, "sha256", data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA384:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_384:
return verify_pkcs1(this, HASH_SHA384, "sha384", data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA512:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_512:
return verify_pkcs1(this, HASH_SHA512, "sha512", data, signature);
+ case SIGN_RSA_EMSA_PKCS1_SHA1:
+ return verify_pkcs1(this, HASH_SHA1, "sha1", data, signature);
+ case SIGN_RSA_EMSA_PKCS1_MD5:
+ return verify_pkcs1(this, HASH_MD5, "md5", data, signature);
default:
DBG1(DBG_LIB, "signature scheme %N not supported in RSA",
signature_scheme_names, scheme);
diff --git a/src/libstrongswan/plugins/gmp/Makefile.in b/src/libstrongswan/plugins/gmp/Makefile.in
index 32d5bebf0..bee1f8042 100644
--- a/src/libstrongswan/plugins/gmp/Makefile.in
+++ b/src/libstrongswan/plugins/gmp/Makefile.in
@@ -351,7 +351,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -385,8 +384,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -440,6 +437,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/gmp/gmp_plugin.c b/src/libstrongswan/plugins/gmp/gmp_plugin.c
index ea75896a1..c75975301 100644
--- a/src/libstrongswan/plugins/gmp/gmp_plugin.c
+++ b/src/libstrongswan/plugins/gmp/gmp_plugin.c
@@ -80,30 +80,46 @@ METHOD(plugin_t, get_features, int,
PLUGIN_PROVIDE(PUBKEY, KEY_RSA),
/* signature schemes, private */
PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_NULL),
- PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA1),
- PLUGIN_DEPENDS(HASHER, HASH_SHA1),
- PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA224),
+ PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA2_224),
PLUGIN_DEPENDS(HASHER, HASH_SHA224),
- PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA256),
+ PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA2_256),
PLUGIN_DEPENDS(HASHER, HASH_SHA256),
- PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA384),
+ PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA2_384),
PLUGIN_DEPENDS(HASHER, HASH_SHA384),
- PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA512),
+ PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA2_512),
PLUGIN_DEPENDS(HASHER, HASH_SHA512),
+ PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA3_224),
+ PLUGIN_DEPENDS(HASHER, HASH_SHA3_224),
+ PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA3_256),
+ PLUGIN_DEPENDS(HASHER, HASH_SHA3_256),
+ PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA3_384),
+ PLUGIN_DEPENDS(HASHER, HASH_SHA3_384),
+ PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA3_512),
+ PLUGIN_DEPENDS(HASHER, HASH_SHA3_512),
+ PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA1),
+ PLUGIN_DEPENDS(HASHER, HASH_SHA1),
PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_MD5),
PLUGIN_DEPENDS(HASHER, HASH_MD5),
/* signature verification schemes */
PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_NULL),
- PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA1),
- PLUGIN_DEPENDS(HASHER, HASH_SHA1),
- PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA224),
+ PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA2_224),
PLUGIN_DEPENDS(HASHER, HASH_SHA224),
- PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA256),
+ PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA2_256),
PLUGIN_DEPENDS(HASHER, HASH_SHA256),
- PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA384),
+ PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA2_384),
PLUGIN_DEPENDS(HASHER, HASH_SHA384),
- PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA512),
+ PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA2_512),
PLUGIN_DEPENDS(HASHER, HASH_SHA512),
+ PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA3_224),
+ PLUGIN_DEPENDS(HASHER, HASH_SHA3_224),
+ PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA3_256),
+ PLUGIN_DEPENDS(HASHER, HASH_SHA3_256),
+ PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA3_384),
+ PLUGIN_DEPENDS(HASHER, HASH_SHA3_384),
+ PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA3_512),
+ PLUGIN_DEPENDS(HASHER, HASH_SHA3_512),
+ PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA1),
+ PLUGIN_DEPENDS(HASHER, HASH_SHA1),
PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_MD5),
PLUGIN_DEPENDS(HASHER, HASH_MD5),
/* en-/decryption schemes */
diff --git a/src/libstrongswan/plugins/gmp/gmp_rsa_private_key.c b/src/libstrongswan/plugins/gmp/gmp_rsa_private_key.c
index e5d418ea4..21b420866 100644
--- a/src/libstrongswan/plugins/gmp/gmp_rsa_private_key.c
+++ b/src/libstrongswan/plugins/gmp/gmp_rsa_private_key.c
@@ -347,16 +347,24 @@ METHOD(private_key_t, sign, bool,
{
case SIGN_RSA_EMSA_PKCS1_NULL:
return build_emsa_pkcs1_signature(this, HASH_UNKNOWN, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA1:
- return build_emsa_pkcs1_signature(this, HASH_SHA1, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA224:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_224:
return build_emsa_pkcs1_signature(this, HASH_SHA224, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA256:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_256:
return build_emsa_pkcs1_signature(this, HASH_SHA256, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA384:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_384:
return build_emsa_pkcs1_signature(this, HASH_SHA384, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA512:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_512:
return build_emsa_pkcs1_signature(this, HASH_SHA512, data, signature);
+ case SIGN_RSA_EMSA_PKCS1_SHA3_224:
+ return build_emsa_pkcs1_signature(this, HASH_SHA3_224, data, signature);
+ case SIGN_RSA_EMSA_PKCS1_SHA3_256:
+ return build_emsa_pkcs1_signature(this, HASH_SHA3_256, data, signature);
+ case SIGN_RSA_EMSA_PKCS1_SHA3_384:
+ return build_emsa_pkcs1_signature(this, HASH_SHA3_384, data, signature);
+ case SIGN_RSA_EMSA_PKCS1_SHA3_512:
+ return build_emsa_pkcs1_signature(this, HASH_SHA3_512, data, signature);
+ case SIGN_RSA_EMSA_PKCS1_SHA1:
+ return build_emsa_pkcs1_signature(this, HASH_SHA1, data, signature);
case SIGN_RSA_EMSA_PKCS1_MD5:
return build_emsa_pkcs1_signature(this, HASH_MD5, data, signature);
default:
diff --git a/src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c b/src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c
index e738908e2..2b2c7f249 100644
--- a/src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c
+++ b/src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c
@@ -291,18 +291,26 @@ METHOD(public_key_t, verify, bool,
{
case SIGN_RSA_EMSA_PKCS1_NULL:
return verify_emsa_pkcs1_signature(this, HASH_UNKNOWN, data, signature);
- case SIGN_RSA_EMSA_PKCS1_MD5:
- return verify_emsa_pkcs1_signature(this, HASH_MD5, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA1:
- return verify_emsa_pkcs1_signature(this, HASH_SHA1, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA224:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_224:
return verify_emsa_pkcs1_signature(this, HASH_SHA224, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA256:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_256:
return verify_emsa_pkcs1_signature(this, HASH_SHA256, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA384:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_384:
return verify_emsa_pkcs1_signature(this, HASH_SHA384, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA512:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_512:
return verify_emsa_pkcs1_signature(this, HASH_SHA512, data, signature);
+ case SIGN_RSA_EMSA_PKCS1_SHA3_224:
+ return verify_emsa_pkcs1_signature(this, HASH_SHA3_224, data, signature);
+ case SIGN_RSA_EMSA_PKCS1_SHA3_256:
+ return verify_emsa_pkcs1_signature(this, HASH_SHA3_256, data, signature);
+ case SIGN_RSA_EMSA_PKCS1_SHA3_384:
+ return verify_emsa_pkcs1_signature(this, HASH_SHA3_384, data, signature);
+ case SIGN_RSA_EMSA_PKCS1_SHA3_512:
+ return verify_emsa_pkcs1_signature(this, HASH_SHA3_512, data, signature);
+ case SIGN_RSA_EMSA_PKCS1_SHA1:
+ return verify_emsa_pkcs1_signature(this, HASH_SHA1, data, signature);
+ case SIGN_RSA_EMSA_PKCS1_MD5:
+ return verify_emsa_pkcs1_signature(this, HASH_MD5, data, signature);
default:
DBG1(DBG_LIB, "signature scheme %N not supported in RSA",
signature_scheme_names, scheme);
diff --git a/src/libstrongswan/plugins/hmac/Makefile.in b/src/libstrongswan/plugins/hmac/Makefile.in
index 6d8a845c0..c6e4e8d93 100644
--- a/src/libstrongswan/plugins/hmac/Makefile.in
+++ b/src/libstrongswan/plugins/hmac/Makefile.in
@@ -350,7 +350,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -384,8 +383,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -439,6 +436,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/keychain/Makefile.in b/src/libstrongswan/plugins/keychain/Makefile.in
index e290c807d..1f5ae3549 100644
--- a/src/libstrongswan/plugins/keychain/Makefile.in
+++ b/src/libstrongswan/plugins/keychain/Makefile.in
@@ -353,7 +353,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -387,8 +386,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -442,6 +439,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/ldap/Makefile.in b/src/libstrongswan/plugins/ldap/Makefile.in
index 429cd9e8e..9c448cd9f 100644
--- a/src/libstrongswan/plugins/ldap/Makefile.in
+++ b/src/libstrongswan/plugins/ldap/Makefile.in
@@ -350,7 +350,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -384,8 +383,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -439,6 +436,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/ldap/ldap_fetcher.c b/src/libstrongswan/plugins/ldap/ldap_fetcher.c
index fe4c55545..635d5fc0e 100644
--- a/src/libstrongswan/plugins/ldap/ldap_fetcher.c
+++ b/src/libstrongswan/plugins/ldap/ldap_fetcher.c
@@ -93,8 +93,7 @@ static bool parse(LDAP *ldap, LDAPMessage *result, chunk_t *response)
}
else
{
- DBG1(DBG_LIB, "finding first LDAP entry failed: %s",
- ldap_err2string(ldap_result2error(ldap, entry, 0)));
+ DBG1(DBG_LIB, "finding first LDAP entry failed");
}
return success;
}
diff --git a/src/libstrongswan/plugins/md4/Makefile.in b/src/libstrongswan/plugins/md4/Makefile.in
index 669856c59..d336a5342 100644
--- a/src/libstrongswan/plugins/md4/Makefile.in
+++ b/src/libstrongswan/plugins/md4/Makefile.in
@@ -350,7 +350,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -384,8 +383,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -439,6 +436,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/md5/Makefile.in b/src/libstrongswan/plugins/md5/Makefile.in
index d937ca348..a31d0a245 100644
--- a/src/libstrongswan/plugins/md5/Makefile.in
+++ b/src/libstrongswan/plugins/md5/Makefile.in
@@ -350,7 +350,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -384,8 +383,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -439,6 +436,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/mgf1/Makefile.am b/src/libstrongswan/plugins/mgf1/Makefile.am
new file mode 100644
index 000000000..8df227f9f
--- /dev/null
+++ b/src/libstrongswan/plugins/mgf1/Makefile.am
@@ -0,0 +1,17 @@
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/libstrongswan
+
+AM_CFLAGS = \
+ $(PLUGIN_CFLAGS)
+
+if MONOLITHIC
+noinst_LTLIBRARIES = libstrongswan-mgf1.la
+else
+plugin_LTLIBRARIES = libstrongswan-mgf1.la
+endif
+
+libstrongswan_mgf1_la_SOURCES = \
+ mgf1_plugin.h mgf1_plugin.c \
+ mgf1_xof.h mgf1_xof.c
+
+libstrongswan_mgf1_la_LDFLAGS = -module -avoid-version
diff --git a/src/libstrongswan/plugins/mgf1/Makefile.in b/src/libstrongswan/plugins/mgf1/Makefile.in
new file mode 100644
index 000000000..189e214d7
--- /dev/null
+++ b/src/libstrongswan/plugins/mgf1/Makefile.in
@@ -0,0 +1,791 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src/libstrongswan/plugins/mgf1
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/config/libtool.m4 \
+ $(top_srcdir)/m4/config/ltoptions.m4 \
+ $(top_srcdir)/m4/config/ltsugar.m4 \
+ $(top_srcdir)/m4/config/ltversion.m4 \
+ $(top_srcdir)/m4/config/lt~obsolete.m4 \
+ $(top_srcdir)/m4/macros/split-package-version.m4 \
+ $(top_srcdir)/m4/macros/with.m4 \
+ $(top_srcdir)/m4/macros/enable-disable.m4 \
+ $(top_srcdir)/m4/macros/add-plugin.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(plugindir)"
+LTLIBRARIES = $(noinst_LTLIBRARIES) $(plugin_LTLIBRARIES)
+libstrongswan_mgf1_la_LIBADD =
+am_libstrongswan_mgf1_la_OBJECTS = mgf1_plugin.lo mgf1_xof.lo
+libstrongswan_mgf1_la_OBJECTS = $(am_libstrongswan_mgf1_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+libstrongswan_mgf1_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(libstrongswan_mgf1_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
+@MONOLITHIC_FALSE@am_libstrongswan_mgf1_la_rpath = -rpath $(plugindir)
+@MONOLITHIC_TRUE@am_libstrongswan_mgf1_la_rpath =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(libstrongswan_mgf1_la_SOURCES)
+DIST_SOURCES = $(libstrongswan_mgf1_la_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+ATOMICLIB = @ATOMICLIB@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BFDLIB = @BFDLIB@
+BTLIB = @BTLIB@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COVERAGE_CFLAGS = @COVERAGE_CFLAGS@
+COVERAGE_LDFLAGS = @COVERAGE_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLIB = @DLLIB@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+EASY_INSTALL = @EASY_INSTALL@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GEM = @GEM@
+GENHTML = @GENHTML@
+GPERF = @GPERF@
+GPRBUILD = @GPRBUILD@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LCOV = @LCOV@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MYSQLCFLAG = @MYSQLCFLAG@
+MYSQLCONFIG = @MYSQLCONFIG@
+MYSQLLIB = @MYSQLLIB@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_LIB = @OPENSSL_LIB@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PACKAGE_VERSION_BUILD = @PACKAGE_VERSION_BUILD@
+PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@
+PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@
+PACKAGE_VERSION_REVIEW = @PACKAGE_VERSION_REVIEW@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PLUGIN_CFLAGS = @PLUGIN_CFLAGS@
+PTHREADLIB = @PTHREADLIB@
+PYTHON = @PYTHON@
+PYTHONEGGINSTALLDIR = @PYTHONEGGINSTALLDIR@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PACKAGE_VERSION = @PYTHON_PACKAGE_VERSION@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+PY_TEST = @PY_TEST@
+RANLIB = @RANLIB@
+RTLIB = @RTLIB@
+RUBY = @RUBY@
+RUBYGEMDIR = @RUBYGEMDIR@
+RUBYINCLUDE = @RUBYINCLUDE@
+RUBYLIB = @RUBYLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOCKLIB = @SOCKLIB@
+STRIP = @STRIP@
+UNWINDLIB = @UNWINDLIB@
+VERSION = @VERSION@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+aikgen_plugins = @aikgen_plugins@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+attest_plugins = @attest_plugins@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+c_plugins = @c_plugins@
+charon_natt_port = @charon_natt_port@
+charon_plugins = @charon_plugins@
+charon_udp_port = @charon_udp_port@
+clearsilver_LIBS = @clearsilver_LIBS@
+cmd_plugins = @cmd_plugins@
+datadir = @datadir@
+datarootdir = @datarootdir@
+dev_headers = @dev_headers@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+fips_mode = @fips_mode@
+gtk_CFLAGS = @gtk_CFLAGS@
+gtk_LIBS = @gtk_LIBS@
+h_plugins = @h_plugins@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+imcvdir = @imcvdir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+ipsec_script = @ipsec_script@
+ipsec_script_upper = @ipsec_script_upper@
+ipsecdir = @ipsecdir@
+ipsecgroup = @ipsecgroup@
+ipseclibdir = @ipseclibdir@
+ipsecuser = @ipsecuser@
+json_CFLAGS = @json_CFLAGS@
+json_LIBS = @json_LIBS@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libiptc_CFLAGS = @libiptc_CFLAGS@
+libiptc_LIBS = @libiptc_LIBS@
+linux_headers = @linux_headers@
+localedir = @localedir@
+localstatedir = @localstatedir@
+manager_plugins = @manager_plugins@
+mandir = @mandir@
+medsrv_plugins = @medsrv_plugins@
+mkdir_p = @mkdir_p@
+nm_CFLAGS = @nm_CFLAGS@
+nm_LIBS = @nm_LIBS@
+nm_ca_dir = @nm_ca_dir@
+nm_plugins = @nm_plugins@
+oldincludedir = @oldincludedir@
+pcsclite_CFLAGS = @pcsclite_CFLAGS@
+pcsclite_LIBS = @pcsclite_LIBS@
+pdfdir = @pdfdir@
+piddir = @piddir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+pki_plugins = @pki_plugins@
+plugindir = @plugindir@
+pool_plugins = @pool_plugins@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+random_device = @random_device@
+resolv_conf = @resolv_conf@
+routing_table = @routing_table@
+routing_table_prio = @routing_table_prio@
+runstatedir = @runstatedir@
+s_plugins = @s_plugins@
+sbindir = @sbindir@
+scepclient_plugins = @scepclient_plugins@
+scripts_plugins = @scripts_plugins@
+sharedstatedir = @sharedstatedir@
+soup_CFLAGS = @soup_CFLAGS@
+soup_LIBS = @soup_LIBS@
+srcdir = @srcdir@
+starter_plugins = @starter_plugins@
+strongswan_conf = @strongswan_conf@
+strongswan_options = @strongswan_options@
+swanctldir = @swanctldir@
+sysconfdir = @sysconfdir@
+systemd_CFLAGS = @systemd_CFLAGS@
+systemd_LIBS = @systemd_LIBS@
+systemd_daemon_CFLAGS = @systemd_daemon_CFLAGS@
+systemd_daemon_LIBS = @systemd_daemon_LIBS@
+systemd_journal_CFLAGS = @systemd_journal_CFLAGS@
+systemd_journal_LIBS = @systemd_journal_LIBS@
+systemdsystemunitdir = @systemdsystemunitdir@
+t_plugins = @t_plugins@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
+urandom_device = @urandom_device@
+xml_CFLAGS = @xml_CFLAGS@
+xml_LIBS = @xml_LIBS@
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/libstrongswan
+
+AM_CFLAGS = \
+ $(PLUGIN_CFLAGS)
+
+@MONOLITHIC_TRUE@noinst_LTLIBRARIES = libstrongswan-mgf1.la
+@MONOLITHIC_FALSE@plugin_LTLIBRARIES = libstrongswan-mgf1.la
+libstrongswan_mgf1_la_SOURCES = \
+ mgf1_plugin.h mgf1_plugin.c \
+ mgf1_xof.h mgf1_xof.c
+
+libstrongswan_mgf1_la_LDFLAGS = -module -avoid-version
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libstrongswan/plugins/mgf1/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/libstrongswan/plugins/mgf1/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
+ }
+
+uninstall-pluginLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \
+ done
+
+clean-pluginLTLIBRARIES:
+ -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
+ @list='$(plugin_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+libstrongswan-mgf1.la: $(libstrongswan_mgf1_la_OBJECTS) $(libstrongswan_mgf1_la_DEPENDENCIES) $(EXTRA_libstrongswan_mgf1_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libstrongswan_mgf1_la_LINK) $(am_libstrongswan_mgf1_la_rpath) $(libstrongswan_mgf1_la_OBJECTS) $(libstrongswan_mgf1_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mgf1_plugin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mgf1_xof.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(plugindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ clean-pluginLTLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pluginLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pluginLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES clean-pluginLTLIBRARIES \
+ cscopelist-am ctags ctags-am distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-pluginLTLIBRARIES install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+ uninstall-am uninstall-pluginLTLIBRARIES
+
+.PRECIOUS: Makefile
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/libstrongswan/plugins/mgf1/mgf1_plugin.c b/src/libstrongswan/plugins/mgf1/mgf1_plugin.c
new file mode 100644
index 000000000..8df3ac261
--- /dev/null
+++ b/src/libstrongswan/plugins/mgf1/mgf1_plugin.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+#include "mgf1_plugin.h"
+#include "mgf1_xof.h"
+
+#include <library.h>
+
+typedef struct private_mgf1_plugin_t private_mgf1_plugin_t;
+
+/**
+ * private data of mgf1_plugin
+ */
+struct private_mgf1_plugin_t {
+
+ /**
+ * public functions
+ */
+ mgf1_plugin_t public;
+};
+
+METHOD(plugin_t, get_name, char*,
+ private_mgf1_plugin_t *this)
+{
+ return "mgf1";
+}
+
+METHOD(plugin_t, get_features, int,
+ private_mgf1_plugin_t *this, plugin_feature_t *features[])
+{
+ static plugin_feature_t f[] = {
+ PLUGIN_REGISTER(XOF, mgf1_xof_create),
+ PLUGIN_PROVIDE(XOF, XOF_MGF1_SHA1),
+ PLUGIN_DEPENDS(HASHER, HASH_SHA1),
+ PLUGIN_PROVIDE(XOF, XOF_MGF1_SHA256),
+ PLUGIN_DEPENDS(HASHER, HASH_SHA256),
+ PLUGIN_PROVIDE(XOF, XOF_MGF1_SHA512),
+ PLUGIN_DEPENDS(HASHER, HASH_SHA512),
+ };
+ *features = f;
+ return countof(f);
+}
+
+METHOD(plugin_t, destroy, void,
+ private_mgf1_plugin_t *this)
+{
+ free(this);
+}
+
+/*
+ * see header file
+ */
+plugin_t *mgf1_plugin_create()
+{
+ private_mgf1_plugin_t *this;
+
+ INIT(this,
+ .public = {
+ .plugin = {
+ .get_name = _get_name,
+ .get_features = _get_features,
+ .destroy = _destroy,
+ },
+ },
+ );
+
+ return &this->public.plugin;
+}
+
diff --git a/src/libstrongswan/plugins/mgf1/mgf1_plugin.h b/src/libstrongswan/plugins/mgf1/mgf1_plugin.h
new file mode 100644
index 000000000..50105ca29
--- /dev/null
+++ b/src/libstrongswan/plugins/mgf1/mgf1_plugin.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+/**
+ * @defgroup mgf1_p mgf1
+ * @ingroup plugins
+ *
+ * @defgroup mgf1_plugin mgf1_plugin
+ * @{ @ingroup mgf1_p
+ */
+
+#ifndef MGF1_PLUGIN_H_
+#define MGF1_PLUGIN_H_
+
+#include <plugins/plugin.h>
+
+typedef struct mgf1_plugin_t mgf1_plugin_t;
+
+/**
+ * Plugin implementing the MGF1 Mask Generator Function in software.
+ */
+struct mgf1_plugin_t {
+
+ /**
+ * implements plugin interface
+ */
+ plugin_t plugin;
+};
+
+#endif /** MGF1_PLUGIN_H_ @}*/
diff --git a/src/libstrongswan/plugins/mgf1/mgf1_xof.c b/src/libstrongswan/plugins/mgf1/mgf1_xof.c
new file mode 100644
index 000000000..0f5fda952
--- /dev/null
+++ b/src/libstrongswan/plugins/mgf1/mgf1_xof.c
@@ -0,0 +1,285 @@
+/*
+ * Copyright (C) 2013-2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+#include "mgf1_xof.h"
+
+#include "crypto/hashers/hasher.h"
+#include "utils/debug.h"
+
+typedef struct private_mgf1_xof_t private_mgf1_xof_t;
+
+/**
+ * Private data of an mgf1_xof_t object.
+ */
+struct private_mgf1_xof_t {
+
+ /**
+ * Public mgf1_xof_t interface.
+ */
+ mgf1_xof_t public;
+
+ /**
+ * XOF type of the MGF1 Mask Generation Function
+ */
+ ext_out_function_t type;
+
+ /**
+ * Hasher the MGF1 Mask Generation Function is based on
+ */
+ hasher_t *hasher;
+
+ /**
+ * Is the seed hashed before using it as a seed for MGF1 ?
+ */
+ bool hash_seed;
+
+ /**
+ * Counter
+ */
+ uint32_t counter;
+
+ /**
+ * Set if counter has reached 2^32
+ */
+ bool overflow;
+
+ /**
+ * Current state to be hashed
+ */
+ chunk_t state;
+
+ /**
+ * Position of the 4 octet counter string
+ */
+ uint8_t *ctr_str;
+
+ /**
+ * Latest hash block
+ */
+ uint8_t buf[HASH_SIZE_SHA512];
+
+ /**
+ * Index pointing to the current position in the hash block
+ */
+ size_t buf_index;
+
+};
+
+METHOD(xof_t, get_type, ext_out_function_t,
+ private_mgf1_xof_t *this)
+{
+ return this->type;
+}
+
+static bool get_next_block(private_mgf1_xof_t *this, uint8_t *buffer)
+{
+ /* detect overflow, set counter string and increment counter */
+ if (this->overflow)
+ {
+ DBG1(DBG_LIB, "MGF1 overflow occurred");
+ return FALSE;
+ }
+ htoun32(this->ctr_str, this->counter++);
+ if (this->counter == 0)
+ {
+ this->overflow = TRUE;
+ }
+
+ /* get the next block from the hash function */
+ if (!this->hasher->get_hash(this->hasher, this->state, buffer))
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+METHOD(xof_t, get_bytes, bool,
+ private_mgf1_xof_t *this, size_t out_len, uint8_t *buffer)
+{
+ size_t index = 0, blocks, len, hash_size;
+
+ hash_size = this->hasher->get_hash_size(this->hasher);
+
+ /* empty the current hash block buffer first */
+ len = min(out_len, hash_size - this->buf_index);
+ if (len)
+ {
+ memcpy(buffer, this->buf + this->buf_index, len);
+ index += len;
+ this->buf_index += len;
+ }
+
+ /* copy whole hash blocks directly to output buffer */
+ blocks = (out_len - index) / hash_size;
+ while (blocks--)
+ {
+ if (!get_next_block(this, buffer + index))
+ {
+ return FALSE;
+ }
+ index += hash_size;
+ }
+
+ /* get another hash block if some more output bytes are needed */
+ len = out_len - index;
+ if (len)
+ {
+ if (!get_next_block(this, this->buf))
+ {
+ return FALSE;
+ }
+ memcpy(buffer + index, this->buf, len);
+ this->buf_index = len;
+ }
+
+ return TRUE;
+}
+
+METHOD(xof_t, allocate_bytes, bool,
+ private_mgf1_xof_t *this, size_t out_len, chunk_t *chunk)
+{
+ *chunk = chunk_alloc(out_len);
+
+ if (!get_bytes(this, out_len, chunk->ptr))
+ {
+ chunk_free(chunk);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+METHOD(xof_t, get_block_size, size_t,
+ private_mgf1_xof_t *this)
+{
+ return this->hasher->get_hash_size(this->hasher);
+}
+
+METHOD(xof_t, get_seed_size, size_t,
+ private_mgf1_xof_t *this)
+{
+ return this->hasher->get_hash_size(this->hasher);
+}
+
+METHOD(xof_t, set_seed, bool,
+ private_mgf1_xof_t *this, chunk_t seed)
+{
+ size_t hash_size, state_len;
+
+ if (seed.len == 0)
+ {
+ DBG1(DBG_LIB, "empty seed for MGF1");
+ return FALSE;
+ }
+
+ /* determine state size and allocate space accordingly */
+ hash_size = this->hasher->get_hash_size(this->hasher);
+ state_len = (this->hash_seed ? hash_size : seed.len) + 4;
+ chunk_clear(&this->state);
+ this->state = chunk_alloc(state_len);
+
+ /* hash block buffer is empty */
+ this->buf_index = hash_size;
+
+ /* reset counter */
+ this->counter = 0;
+
+ /* determine position of the 4 octet counter string */
+ this->ctr_str = this->state.ptr + state_len - 4;
+
+ if (this->hash_seed)
+ {
+ if (!this->hasher->get_hash(this->hasher, seed, this->state.ptr))
+ {
+ DBG1(DBG_LIB, "failed to hash seed for MGF1");
+ return FALSE;
+ }
+ }
+ else
+ {
+ memcpy(this->state.ptr, seed.ptr, seed.len);
+ }
+
+ return TRUE;
+}
+
+METHOD(xof_t, destroy, void,
+ private_mgf1_xof_t *this)
+{
+ this->hasher->destroy(this->hasher);
+ chunk_clear(&this->state);
+ free(this);
+}
+
+METHOD(mgf1_t, set_hash_seed, void,
+ private_mgf1_xof_t *this, bool yes)
+{
+ this->hash_seed = yes;
+}
+
+/*
+ * Described in header.
+ */
+mgf1_xof_t *mgf1_xof_create(ext_out_function_t algorithm)
+{
+ private_mgf1_xof_t *this;
+ hash_algorithm_t hash_alg;
+ hasher_t *hasher;
+
+ switch (algorithm)
+ {
+ case XOF_MGF1_SHA1:
+ hash_alg = HASH_SHA1;
+ break;
+ case XOF_MGF1_SHA256:
+ hash_alg = HASH_SHA256;
+ break;
+ case XOF_MGF1_SHA512:
+ hash_alg = HASH_SHA512;
+ break;
+ default:
+ return NULL;
+ }
+
+ hasher = lib->crypto->create_hasher(lib->crypto, hash_alg);
+ if (!hasher)
+ {
+ DBG1(DBG_LIB, "failed to create %N hasher for MGF1",
+ hash_algorithm_names, hash_alg);
+ return NULL;
+ }
+
+ INIT(this,
+ .public = {
+ .mgf1_interface = {
+ .xof_interface = {
+ .get_type = _get_type,
+ .get_bytes = _get_bytes,
+ .allocate_bytes = _allocate_bytes,
+ .get_block_size = _get_block_size,
+ .get_seed_size = _get_seed_size,
+ .set_seed = _set_seed,
+ .destroy = _destroy,
+ },
+ .set_hash_seed = _set_hash_seed,
+ },
+ },
+ .type = algorithm,
+ .hasher = hasher,
+ );
+
+ return &this->public;
+}
diff --git a/src/libstrongswan/plugins/mgf1/mgf1_xof.h b/src/libstrongswan/plugins/mgf1/mgf1_xof.h
new file mode 100644
index 000000000..9d60a807d
--- /dev/null
+++ b/src/libstrongswan/plugins/mgf1/mgf1_xof.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+/**
+ * @defgroup mgf1_xof mgf1_xof
+ * @{ @ingroup crypto
+ */
+
+#ifndef MGF1_XOF_H_
+#define MGF1_XOF_H_
+
+typedef struct mgf1_xof_t mgf1_xof_t;
+
+#include <crypto/xofs/mgf1.h>
+
+/**
+ * Implements the PKCS#1 MGF1_XOF Mask Generation Function based on a hash
+ * function defined in section 10.2.1 of RFC 2437
+ */
+struct mgf1_xof_t {
+
+ /**
+ * mgf1_t interface for this Extended Output Function (XOF).
+ */
+ mgf1_t mgf1_interface;
+};
+
+/**
+ * Create an mgf1_xof_t object
+ *
+ * @param algorithm XOF_MGF1_SHA1, XOF_MGF1_SHA256 or XOF_MGF1_SHA512
+ * @return mgf1_xof_t object, NULL if not supported
+ */
+mgf1_xof_t *mgf1_xof_create(ext_out_function_t algorithm);
+
+#endif /** MGF1_XOF_H_ @}*/
+
diff --git a/src/libstrongswan/plugins/mysql/Makefile.in b/src/libstrongswan/plugins/mysql/Makefile.in
index 821dbc138..57dab351e 100644
--- a/src/libstrongswan/plugins/mysql/Makefile.in
+++ b/src/libstrongswan/plugins/mysql/Makefile.in
@@ -352,7 +352,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -386,8 +385,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -441,6 +438,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/newhope/Makefile.am b/src/libstrongswan/plugins/newhope/Makefile.am
new file mode 100644
index 000000000..b01987d22
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/Makefile.am
@@ -0,0 +1,33 @@
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/libstrongswan \
+ -I$(top_srcdir)/src/libstrongswan/math/libnttfft
+
+AM_CFLAGS = \
+ $(PLUGIN_CFLAGS) \
+ @COVERAGE_CFLAGS@
+
+# these files are also used by the tests, we can't directly refer to them
+# because of the subdirectory, which would cause distclean to fail
+noinst_LTLIBRARIES = libnewhope.la
+libnewhope_la_SOURCES = \
+ newhope_ke.h newhope_ke.c \
+ newhope_noise.h newhope_noise.c \
+ newhope_reconciliation.h newhope_reconciliation.c
+
+libnewhope_la_LIBADD = \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la
+
+if MONOLITHIC
+noinst_LTLIBRARIES += libstrongswan-newhope.la
+else
+plugin_LTLIBRARIES = libstrongswan-newhope.la
+endif
+
+libstrongswan_newhope_la_SOURCES = \
+ newhope_plugin.h newhope_plugin.c
+
+libstrongswan_newhope_la_LDFLAGS = -module -avoid-version
+
+libstrongswan_newhope_la_LIBADD = libnewhope.la
+
+
diff --git a/src/libstrongswan/plugins/newhope/Makefile.in b/src/libstrongswan/plugins/newhope/Makefile.in
new file mode 100644
index 000000000..be31fb29c
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/Makefile.in
@@ -0,0 +1,818 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@MONOLITHIC_TRUE@am__append_1 = libstrongswan-newhope.la
+subdir = src/libstrongswan/plugins/newhope
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/config/libtool.m4 \
+ $(top_srcdir)/m4/config/ltoptions.m4 \
+ $(top_srcdir)/m4/config/ltsugar.m4 \
+ $(top_srcdir)/m4/config/ltversion.m4 \
+ $(top_srcdir)/m4/config/lt~obsolete.m4 \
+ $(top_srcdir)/m4/macros/split-package-version.m4 \
+ $(top_srcdir)/m4/macros/with.m4 \
+ $(top_srcdir)/m4/macros/enable-disable.m4 \
+ $(top_srcdir)/m4/macros/add-plugin.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(plugindir)"
+LTLIBRARIES = $(noinst_LTLIBRARIES) $(plugin_LTLIBRARIES)
+libnewhope_la_DEPENDENCIES = \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la
+am_libnewhope_la_OBJECTS = newhope_ke.lo newhope_noise.lo \
+ newhope_reconciliation.lo
+libnewhope_la_OBJECTS = $(am_libnewhope_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+libstrongswan_newhope_la_DEPENDENCIES = libnewhope.la
+am_libstrongswan_newhope_la_OBJECTS = newhope_plugin.lo
+libstrongswan_newhope_la_OBJECTS = \
+ $(am_libstrongswan_newhope_la_OBJECTS)
+libstrongswan_newhope_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(libstrongswan_newhope_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
+@MONOLITHIC_FALSE@am_libstrongswan_newhope_la_rpath = -rpath \
+@MONOLITHIC_FALSE@ $(plugindir)
+@MONOLITHIC_TRUE@am_libstrongswan_newhope_la_rpath =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(libnewhope_la_SOURCES) $(libstrongswan_newhope_la_SOURCES)
+DIST_SOURCES = $(libnewhope_la_SOURCES) \
+ $(libstrongswan_newhope_la_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+ATOMICLIB = @ATOMICLIB@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BFDLIB = @BFDLIB@
+BTLIB = @BTLIB@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COVERAGE_CFLAGS = @COVERAGE_CFLAGS@
+COVERAGE_LDFLAGS = @COVERAGE_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLIB = @DLLIB@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+EASY_INSTALL = @EASY_INSTALL@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GEM = @GEM@
+GENHTML = @GENHTML@
+GPERF = @GPERF@
+GPRBUILD = @GPRBUILD@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LCOV = @LCOV@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MYSQLCFLAG = @MYSQLCFLAG@
+MYSQLCONFIG = @MYSQLCONFIG@
+MYSQLLIB = @MYSQLLIB@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_LIB = @OPENSSL_LIB@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PACKAGE_VERSION_BUILD = @PACKAGE_VERSION_BUILD@
+PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@
+PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@
+PACKAGE_VERSION_REVIEW = @PACKAGE_VERSION_REVIEW@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PLUGIN_CFLAGS = @PLUGIN_CFLAGS@
+PTHREADLIB = @PTHREADLIB@
+PYTHON = @PYTHON@
+PYTHONEGGINSTALLDIR = @PYTHONEGGINSTALLDIR@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PACKAGE_VERSION = @PYTHON_PACKAGE_VERSION@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+PY_TEST = @PY_TEST@
+RANLIB = @RANLIB@
+RTLIB = @RTLIB@
+RUBY = @RUBY@
+RUBYGEMDIR = @RUBYGEMDIR@
+RUBYINCLUDE = @RUBYINCLUDE@
+RUBYLIB = @RUBYLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOCKLIB = @SOCKLIB@
+STRIP = @STRIP@
+UNWINDLIB = @UNWINDLIB@
+VERSION = @VERSION@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+aikgen_plugins = @aikgen_plugins@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+attest_plugins = @attest_plugins@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+c_plugins = @c_plugins@
+charon_natt_port = @charon_natt_port@
+charon_plugins = @charon_plugins@
+charon_udp_port = @charon_udp_port@
+clearsilver_LIBS = @clearsilver_LIBS@
+cmd_plugins = @cmd_plugins@
+datadir = @datadir@
+datarootdir = @datarootdir@
+dev_headers = @dev_headers@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+fips_mode = @fips_mode@
+gtk_CFLAGS = @gtk_CFLAGS@
+gtk_LIBS = @gtk_LIBS@
+h_plugins = @h_plugins@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+imcvdir = @imcvdir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+ipsec_script = @ipsec_script@
+ipsec_script_upper = @ipsec_script_upper@
+ipsecdir = @ipsecdir@
+ipsecgroup = @ipsecgroup@
+ipseclibdir = @ipseclibdir@
+ipsecuser = @ipsecuser@
+json_CFLAGS = @json_CFLAGS@
+json_LIBS = @json_LIBS@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libiptc_CFLAGS = @libiptc_CFLAGS@
+libiptc_LIBS = @libiptc_LIBS@
+linux_headers = @linux_headers@
+localedir = @localedir@
+localstatedir = @localstatedir@
+manager_plugins = @manager_plugins@
+mandir = @mandir@
+medsrv_plugins = @medsrv_plugins@
+mkdir_p = @mkdir_p@
+nm_CFLAGS = @nm_CFLAGS@
+nm_LIBS = @nm_LIBS@
+nm_ca_dir = @nm_ca_dir@
+nm_plugins = @nm_plugins@
+oldincludedir = @oldincludedir@
+pcsclite_CFLAGS = @pcsclite_CFLAGS@
+pcsclite_LIBS = @pcsclite_LIBS@
+pdfdir = @pdfdir@
+piddir = @piddir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+pki_plugins = @pki_plugins@
+plugindir = @plugindir@
+pool_plugins = @pool_plugins@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+random_device = @random_device@
+resolv_conf = @resolv_conf@
+routing_table = @routing_table@
+routing_table_prio = @routing_table_prio@
+runstatedir = @runstatedir@
+s_plugins = @s_plugins@
+sbindir = @sbindir@
+scepclient_plugins = @scepclient_plugins@
+scripts_plugins = @scripts_plugins@
+sharedstatedir = @sharedstatedir@
+soup_CFLAGS = @soup_CFLAGS@
+soup_LIBS = @soup_LIBS@
+srcdir = @srcdir@
+starter_plugins = @starter_plugins@
+strongswan_conf = @strongswan_conf@
+strongswan_options = @strongswan_options@
+swanctldir = @swanctldir@
+sysconfdir = @sysconfdir@
+systemd_CFLAGS = @systemd_CFLAGS@
+systemd_LIBS = @systemd_LIBS@
+systemd_daemon_CFLAGS = @systemd_daemon_CFLAGS@
+systemd_daemon_LIBS = @systemd_daemon_LIBS@
+systemd_journal_CFLAGS = @systemd_journal_CFLAGS@
+systemd_journal_LIBS = @systemd_journal_LIBS@
+systemdsystemunitdir = @systemdsystemunitdir@
+t_plugins = @t_plugins@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
+urandom_device = @urandom_device@
+xml_CFLAGS = @xml_CFLAGS@
+xml_LIBS = @xml_LIBS@
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/libstrongswan \
+ -I$(top_srcdir)/src/libstrongswan/math/libnttfft
+
+AM_CFLAGS = \
+ $(PLUGIN_CFLAGS) \
+ @COVERAGE_CFLAGS@
+
+
+# these files are also used by the tests, we can't directly refer to them
+# because of the subdirectory, which would cause distclean to fail
+noinst_LTLIBRARIES = libnewhope.la $(am__append_1)
+libnewhope_la_SOURCES = \
+ newhope_ke.h newhope_ke.c \
+ newhope_noise.h newhope_noise.c \
+ newhope_reconciliation.h newhope_reconciliation.c
+
+libnewhope_la_LIBADD = \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la
+
+@MONOLITHIC_FALSE@plugin_LTLIBRARIES = libstrongswan-newhope.la
+libstrongswan_newhope_la_SOURCES = \
+ newhope_plugin.h newhope_plugin.c
+
+libstrongswan_newhope_la_LDFLAGS = -module -avoid-version
+libstrongswan_newhope_la_LIBADD = libnewhope.la
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libstrongswan/plugins/newhope/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/libstrongswan/plugins/newhope/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
+ }
+
+uninstall-pluginLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \
+ done
+
+clean-pluginLTLIBRARIES:
+ -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
+ @list='$(plugin_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+libnewhope.la: $(libnewhope_la_OBJECTS) $(libnewhope_la_DEPENDENCIES) $(EXTRA_libnewhope_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(libnewhope_la_OBJECTS) $(libnewhope_la_LIBADD) $(LIBS)
+
+libstrongswan-newhope.la: $(libstrongswan_newhope_la_OBJECTS) $(libstrongswan_newhope_la_DEPENDENCIES) $(EXTRA_libstrongswan_newhope_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libstrongswan_newhope_la_LINK) $(am_libstrongswan_newhope_la_rpath) $(libstrongswan_newhope_la_OBJECTS) $(libstrongswan_newhope_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newhope_ke.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newhope_noise.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newhope_plugin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newhope_reconciliation.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(plugindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ clean-pluginLTLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pluginLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pluginLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES clean-pluginLTLIBRARIES \
+ cscopelist-am ctags ctags-am distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-pluginLTLIBRARIES install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+ uninstall-am uninstall-pluginLTLIBRARIES
+
+.PRECIOUS: Makefile
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/libstrongswan/plugins/newhope/newhope_ke.c b/src/libstrongswan/plugins/newhope/newhope_ke.c
new file mode 100644
index 000000000..28956d5fb
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/newhope_ke.c
@@ -0,0 +1,622 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * Based on public domain code by Erdem Alkim, Léo Ducas, Thomas Pöppelmann,
+ * and Peter Schwabe.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+#include "newhope_ke.h"
+#include "newhope_noise.h"
+#include "newhope_reconciliation.h"
+
+#include <ntt_fft.h>
+#include <ntt_fft_reduce.h>
+#include <crypto/diffie_hellman.h>
+#include <utils/debug.h>
+
+static const int seed_len = 32; /* 256 bits */
+static const int poly_len = 1792; /* size of 1024 packed 14-bit coefficients */
+static const int rec_len = 256; /* size of 1024 packed 2-bit coefficients */
+
+typedef struct private_newhope_ke_t private_newhope_ke_t;
+
+/**
+ * Private data of an newhope_ke_t object.
+ */
+struct private_newhope_ke_t {
+
+ /**
+ * Public newhope_ke_t interface.
+ */
+ newhope_ke_t public;
+
+ /**
+ * FFT parameter set
+ */
+ const ntt_fft_params_t *params;
+
+ /**
+ * Secret noise polynomial s
+ */
+ uint32_t *s;
+
+ /**
+ * Output polynomial u = a * NTT(s') + NTT(e')
+ */
+ uint32_t *u;
+
+ /**
+ * Error reconciliation help bits
+ */
+ uint8_t *r;
+
+ /**
+ * Shared secret
+ */
+ chunk_t shared_secret;
+
+};
+
+/**
+ * Derive 14-bit coefficients of polynomial a from 256 bit random seed
+ * using the SHAKE128 extended output function
+ */
+static uint32_t* derive_a_poly(private_newhope_ke_t *this, chunk_t seed)
+{
+ uint32_t *a;
+ uint8_t x[2];
+ int i = 0;
+ xof_t *xof;
+
+ xof = lib->crypto->create_xof(lib->crypto, XOF_SHAKE_128);
+ if (!xof)
+ {
+ DBG1(DBG_LIB, "could not instantiate SHAKE128 XOF");
+ return NULL;
+ }
+
+ if (!xof->set_seed(xof, seed))
+ {
+ DBG1(DBG_LIB, "could not set seed of SHAKE128 XOF");
+ xof->destroy(xof);
+ return NULL;
+ }
+
+ /* allocate dynamic memory for polynomial a */
+ a = (uint32_t*)malloc(this->params->n * sizeof(uint32_t));
+
+ while (i < this->params->n)
+ {
+ if (!xof->get_bytes(xof, sizeof(x), x))
+ {
+ DBG1(DBG_LIB, "could not get bytes from SHAKE128 XOF");
+ xof->destroy(xof);
+ free(a);
+ return NULL;
+ }
+
+ /*
+ * Treat x as a 16 bit unsigned little endian integer
+ * and truncate to 14 bits
+ */
+ a[i] = uletoh16(x) & 0x3fff;
+
+ if (a[i] < this->params->q)
+ {
+ i++;
+ }
+ }
+ xof->destroy(xof);
+
+ return a;
+}
+
+/**
+ * Pack four 14-bit coefficients into seven consecutive bytes
+ *
+ * 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |L 0 0 0 0 0 0 0|L 1 H 0 0 0 0 0|M 1 1 1 1 1 1 1|L 2 2 2 H 1 1 1|
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |M 2 2 2 2 2 2 2|L 3 3 3 3 3 H 2|H 3 3 3 3 3 3 3|L 0 0 0 0 0 0 0|
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+static void pack_poly(private_newhope_ke_t *this, uint8_t *x, uint32_t *p)
+{
+ int i;
+
+ for (i = 0; i < this->params->n; i += 4)
+ {
+ *x++ = (p[i] & 0xff );
+ *x++ = (p[i] >> 8) | (p[i+1] << 6);
+ *x++ = (p[i+1] >> 2);
+ *x++ = (p[i+1] >> 10) | (p[i+2] << 4);
+ *x++ = (p[i+2] >> 4);
+ *x++ = (p[i+2] >> 12) | (p[i+3] << 2);
+ *x++ = (p[i+3] >> 6);
+ }
+}
+
+/**
+ * Unpack seven consecutive bytes into four 14-bit coefficients
+ */
+static uint32_t* unpack_poly(private_newhope_ke_t * this, uint8_t *x)
+{
+ uint32_t *p;
+ int i;
+
+ p = (uint32_t*)malloc(this->params->n * sizeof(uint32_t));
+
+ for (i = 0; i < this->params->n; i += 4)
+ {
+ p[i] = x[0] | (((uint32_t)x[1] & 0x3f) << 8);
+ p[i+1] = (x[1] >> 6) | (((uint32_t)x[2]) << 2)
+ | (((uint32_t)x[3] & 0x0f) << 10);
+ p[i+2] = (x[3] >> 4) | (((uint32_t)x[4]) << 4)
+ | (((uint32_t)x[5] & 0x03) << 12);
+ p[i+3] = (x[5] >> 2) | (((uint32_t)x[6]) << 6);
+ x += 7;
+ }
+ for (i = 0; i < this->params->n; i++)
+ {
+ if (p[i] >= this->params->q)
+ {
+ DBG1(DBG_LIB, "polynomial coefficient must be smaller than %u",
+ this->params->q);
+ free(p);
+ return NULL;
+ }
+ }
+ return p;
+}
+
+/**
+ * Multiply and add polynomials in the frequency domain
+ */
+static uint32_t* multiply_add_poly(private_newhope_ke_t *this,
+ uint32_t *a, uint32_t *e)
+{
+ ntt_fft_t *fft;
+ uint32_t *b, t;
+ int i;
+
+ /* transform s and h to frequency domain */
+ fft = ntt_fft_create(this->params);
+ fft->transform(fft, this->s, this->s, FALSE);
+ fft->transform(fft, e, e, FALSE);
+ fft->destroy(fft);
+
+ b = (uint32_t*)malloc(this->params->n * sizeof(uint32_t));
+
+ /* compute b = a * s + e in the frequency domain */
+ for (i = 0; i < this->params->n; i++)
+ {
+ /* convert a[i] to Montgomery domain */
+ t = ntt_fft_mreduce(a[i] * this->params->r2, this->params);
+
+ /* compute b[i] = a[i] * s[i] + e[i] in Montgomery domain */
+ t = ntt_fft_mreduce(t * this->s[i], this->params) + e[i];
+
+ /* exit Montgomery domain before transmitting polynomial b */
+ b[i] = ntt_fft_mreduce(t, this->params);
+ }
+ memwipe(e, this->params->n * sizeof(uint32_t));
+
+ return b;
+}
+
+/**
+ * Multiply polynomials in the frequency domain and return to time domain
+ */
+static uint32_t* multiply_ntt_inv_poly(private_newhope_ke_t *this, uint32_t *b)
+{
+ ntt_fft_t *fft;
+ uint32_t *v, t;
+ int i;
+
+ v = (uint32_t*)malloc(this->params->n * sizeof(uint32_t));
+
+ for (i = 0; i < this->params->n; i++)
+ {
+ /* convert b[i] to Montgomery domain */
+ t = ntt_fft_mreduce(b[i] * this->params->r2, this->params);
+
+ /* compute v[i] = b[i] * s[i] in Montgomery domain */
+ v[i] = ntt_fft_mreduce(t * this->s[i], this->params);
+ }
+
+ /* transform v back to time domain */
+ fft = ntt_fft_create(this->params);
+ fft->transform(fft, v, v, TRUE);
+ fft->destroy(fft);
+
+ return v;
+}
+
+/**
+ * Pack four 2-bit coefficents into one byte
+ */
+static void pack_rec(private_newhope_ke_t *this, uint8_t *x, uint8_t *r)
+{
+ int i;
+
+ for (i = 0; i < this->params->n; i += 4)
+ {
+ *x++ = r[i] | r[i+1] << 2 | r[i+2] << 4 | r[i+3] << 6;
+ }
+}
+
+static uint8_t* unpack_rec(private_newhope_ke_t *this, uint8_t *x)
+{
+ uint8_t *r;
+ int i;
+
+ r = (uint8_t*)malloc(this->params->n);
+
+ for (i = 0; i < this->params->n; i += 4)
+ {
+ r[i] = (*x) & 0x03;
+ r[i+1] = (*x >> 2) & 0x03;
+ r[i+2] = (*x >> 4) & 0x03;
+ r[i+3] = (*x >> 6) & 0x03;
+ x++;
+ }
+
+ return r;
+}
+
+METHOD(diffie_hellman_t, get_my_public_value, bool,
+ private_newhope_ke_t *this, chunk_t *value)
+{
+ uint16_t n, q;
+ int i;
+
+ /* Define some often-used constants */
+ n = this->params->n;
+ q = this->params->q;
+
+ /* are we the initiator? */
+ if (this->u == NULL)
+ {
+ rng_t *rng;
+ uint32_t *a = NULL, *b = NULL, *e = NULL;
+ uint8_t noise_seed_buf[seed_len];
+ chunk_t noise_seed = { noise_seed_buf, seed_len};
+ chunk_t a_seed;
+ newhope_noise_t *noise = NULL;
+ bool success = FALSE;
+
+ /* allocate space for public output value */
+ *value = chunk_alloc(poly_len + seed_len);
+ a_seed = chunk_create(value->ptr + poly_len, seed_len);
+
+ /* create polynomial a from 256 bit random seed */
+ rng = lib->crypto->create_rng(lib->crypto, RNG_STRONG);
+ if (!rng)
+ {
+ DBG1(DBG_LIB, "could not instatiate random source");
+ return FALSE;
+ }
+ if (!rng->get_bytes(rng, seed_len, a_seed.ptr))
+ {
+ DBG1(DBG_LIB, "could not generate seed for polynomial a");
+ goto end;
+ }
+
+ a = derive_a_poly(this, a_seed);
+ if (a == NULL)
+ {
+ goto end;
+ }
+
+ /* generate random seed for the derivation of noise polynomials */
+ if (!rng->get_bytes(rng, seed_len, noise_seed.ptr))
+ {
+ DBG1(DBG_LIB, "could not generate seed for noise polynomials");
+ goto end;
+ }
+
+ /* create noise polynomial generator */
+ noise = newhope_noise_create(noise_seed);
+ if (!noise)
+ {
+ goto end;
+ }
+
+ /* create noise polynomial s from seed with nonce = 0x00 */
+ this->s = noise->get_binomial_words(noise, 0x00, n, q);
+ if (this->s == NULL)
+ {
+ goto end;
+ }
+
+ /* create noise polynomial e from seed with nonce = 0x01 */
+ e = noise->get_binomial_words(noise, 0x01, n, q);
+ if (e == NULL)
+ {
+ goto end;
+ }
+
+ /* compute b = a * NTT(s) + NTT(e) */
+ b = multiply_add_poly(this, a, e);
+
+ DBG3(DBG_LIB, " i a[i] b[i]");
+ for (i = 0; i < n; i++)
+ {
+ DBG3(DBG_LIB, "%4d %5u %5u", i, a[i], b[i]);
+ }
+
+ /* pack coefficients of polynomial b */
+ pack_poly(this, value->ptr, b);
+ success = TRUE;
+
+ end:
+ rng->destroy(rng);
+ DESTROY_IF(noise);
+ free(a);
+ free(b);
+ free(e);
+
+ if (!success)
+ {
+ chunk_free(value);
+ }
+ return success;
+ }
+ else
+ {
+ DBG3(DBG_LIB, " i u[i] r[i]");
+ for (i = 0; i < n; i++)
+ {
+ DBG3(DBG_LIB, "%4d %5u %5u", i, this->u[i], this->r[i]);
+ }
+
+ /* allocate space for public output value */
+ *value = chunk_alloc(poly_len + rec_len);
+
+ /* pack coefficients of polynomial u */
+ pack_poly(this, value->ptr, this->u);
+
+ /* pack coefficients of polynomial r */
+ pack_rec(this, value->ptr + poly_len, this->r);
+
+ return TRUE;
+ }
+}
+
+METHOD(diffie_hellman_t, get_shared_secret, bool,
+ private_newhope_ke_t *this, chunk_t *secret)
+{
+ if (this->shared_secret.len == 0)
+ {
+ *secret = chunk_empty;
+ return FALSE;
+ }
+ *secret = chunk_clone(this->shared_secret);
+
+ return TRUE;
+}
+
+METHOD(diffie_hellman_t, set_other_public_value, bool,
+ private_newhope_ke_t *this, chunk_t value)
+{
+ newhope_reconciliation_t * rec;
+ uint16_t n, q;
+ int i;
+
+ /* Define some often-used constants */
+ n = this->params->n;
+ q = this->params->q;
+
+ /* are we the responder? */
+ if (this->s == NULL)
+ {
+ uint32_t *a = NULL, *b = NULL, *e1 = NULL, *e2 = NULL, *v = NULL, t;
+ uint8_t *rbits = NULL;
+ uint8_t noise_seed_buf[seed_len];
+ chunk_t noise_seed = { noise_seed_buf, seed_len };
+ chunk_t a_seed;
+ newhope_noise_t *noise = NULL;
+ rng_t *rng = NULL;
+ bool success = FALSE;
+
+ if (value.len != poly_len + seed_len)
+ {
+ DBG1(DBG_LIB, "received %N KE payload of incorrect size",
+ diffie_hellman_group_names, NH_128_BIT);
+ return FALSE;
+ }
+ a_seed = chunk_create(value.ptr + poly_len, seed_len);
+
+ a = derive_a_poly(this, a_seed);
+ if (a == NULL)
+ {
+ return FALSE;
+ }
+
+ b = unpack_poly(this, value.ptr);
+ if (b == NULL)
+ {
+ goto end;
+ }
+
+ /* debug output of polynomials a and b */
+ DBG3(DBG_LIB, " i a[i] b[i]");
+ for (i = 0; i < n; i++)
+ {
+ DBG3(DBG_LIB, "%4d %5u %5u", i, a[i], b[i]);
+ }
+
+ /* generate random seed for the derivation of noise polynomials */
+ rng = lib->crypto->create_rng(lib->crypto, RNG_STRONG);
+ if (!rng)
+ {
+ DBG1(DBG_LIB, "could not instatiate random source");
+ goto end;
+ }
+ if (!rng->get_bytes(rng, seed_len, noise_seed.ptr))
+ {
+ DBG1(DBG_LIB, "could not generate seed for noise polynomials");
+ goto end;
+ }
+
+ /* create noise polynomial generator */
+ noise = newhope_noise_create(noise_seed);
+ if (!noise)
+ {
+ goto end;
+ }
+
+ /* create noise polynomial s' from seed with nonce = 0x00 */
+ this->s = noise->get_binomial_words(noise, 0x00, n, q);
+ if (this->s == NULL)
+ {
+ goto end;
+ }
+
+ /* create noise polynomial e' from seed with nonce = 0x01 */
+ e1 = noise->get_binomial_words(noise, 0x01, n, q);
+ if (e1 == NULL)
+ {
+ goto end;
+ }
+
+ /* create noise polynomial e'' from seed with nonce = 0x02 */
+ e2 = noise->get_binomial_words(noise, 0x02, n, q);
+ if (e2 == NULL)
+ {
+ goto end;
+ }
+
+ /* compute u = a * NTT(s') + NTT(e') */
+ this->u = multiply_add_poly(this, a, e1);
+
+ /* compute v = NTT_inv( b * NTT(s') ) */
+ v = multiply_ntt_inv_poly(this, b);
+
+ /* compute v = v + e'' */
+ for (i = 0; i < n; i++)
+ {
+ t = v[i] + e2[i];
+ v[i] = (t < q) ? t : t - q;
+ }
+ memwipe(e2, n * sizeof(uint32_t));
+
+ /* create uniform noise bytes from seed with nonce = 0x02 */
+ rbits = noise->get_uniform_bytes(noise, 0x03, n/(4*8));
+
+ rec = newhope_reconciliation_create(n, q);
+ this->r = rec->help_reconcile(rec, v, rbits);
+ free(rbits);
+ this->shared_secret = rec->reconcile(rec, v, this->r);
+ rec->destroy(rec);
+
+ DBG4(DBG_LIB, "key: %B", &this->shared_secret);
+ success = TRUE;
+
+ end:
+ DESTROY_IF(rng);
+ DESTROY_IF(noise);
+ free(a);
+ free(b);
+ free(e1);
+ free(e2);
+ free(v);
+
+ return success;
+ }
+ else
+ {
+ uint32_t *v;
+
+ if (value.len != poly_len + rec_len)
+ {
+ DBG1(DBG_LIB, "received %N KE payload of incorrect size",
+ diffie_hellman_group_names, NH_128_BIT);
+ return FALSE;
+ }
+
+ this->u = unpack_poly(this, value.ptr);
+ if (this->u == NULL)
+ {
+ return FALSE;
+ }
+
+ this->r = unpack_rec(this, value.ptr + poly_len);
+ if (this->r == NULL)
+ {
+ return FALSE;
+ }
+
+ DBG3(DBG_LIB, " i u[i] r[i]");
+ for (i = 0; i < n; i++)
+ {
+ DBG3(DBG_LIB, "%4d %5u %5u", i, this->u[i], this->r[i]);
+ }
+
+ /* compute v' = NTT_inv( u * NTT(s) ) */
+ v = multiply_ntt_inv_poly(this, this->u);
+
+ rec = newhope_reconciliation_create(n, q);
+ this->shared_secret = rec->reconcile(rec, v, this->r);
+ free(v);
+ rec->destroy(rec);
+
+ DBG4(DBG_LIB, "key: %B", &this->shared_secret);
+
+ return TRUE;
+ }
+}
+
+METHOD(diffie_hellman_t, get_dh_group, diffie_hellman_group_t,
+ private_newhope_ke_t *this)
+{
+ return NH_128_BIT;
+}
+
+METHOD(diffie_hellman_t, destroy, void,
+ private_newhope_ke_t *this)
+{
+ chunk_clear(&this->shared_secret);
+ memwipe(this->s, this->params->n * sizeof(uint32_t));
+ free(this->s);
+ free(this->u);
+ free(this->r);
+ free(this);
+}
+
+/*
+ * Described in header.
+ */
+newhope_ke_t *newhope_ke_create(diffie_hellman_group_t group, chunk_t g, chunk_t p)
+{
+ private_newhope_ke_t *this;
+
+ INIT(this,
+ .public = {
+ .dh = {
+ .get_shared_secret = _get_shared_secret,
+ .set_other_public_value = _set_other_public_value,
+ .get_my_public_value = _get_my_public_value,
+ .get_dh_group = _get_dh_group,
+ .destroy = _destroy,
+ },
+ },
+ .params = &ntt_fft_12289_1024,
+
+ );
+
+ return &this->public;
+}
diff --git a/src/libstrongswan/plugins/newhope/newhope_ke.h b/src/libstrongswan/plugins/newhope/newhope_ke.h
new file mode 100644
index 000000000..677d04f90
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/newhope_ke.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+/**
+ * @defgroup newhope_ke newhope_ke
+ * @{ @ingroup newhope_p
+ */
+
+#ifndef NEWHOPE_KE_H_
+#define NEWHOPE_KE_H_
+
+typedef struct newhope_ke_t newhope_ke_t;
+
+#include <library.h>
+
+/**
+ * Implementation of a key exchange algorithm using the New Hope algorithm
+ */
+struct newhope_ke_t {
+
+ /**
+ * Implements diffie_hellman_t interface.
+ */
+ diffie_hellman_t dh;
+};
+
+/**
+ * Creates a new newhope_ke_t object.
+ *
+ * @param group New Hope DH group number
+ * @param g not used
+ * @param p not used
+ * @return newhope_ke_t object, NULL if not supported
+ */
+newhope_ke_t *newhope_ke_create(diffie_hellman_group_t group, chunk_t g, chunk_t p);
+
+#endif /** NEWHOPE_KE_H_ @}*/
+
diff --git a/src/libstrongswan/plugins/newhope/newhope_noise.c b/src/libstrongswan/plugins/newhope/newhope_noise.c
new file mode 100644
index 000000000..5ba9f94bd
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/newhope_noise.c
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * Based on public domain code by Erdem Alkim, Léo Ducas, Thomas Pöppelmann,
+ * and Peter Schwabe.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+#include "newhope_noise.h"
+
+typedef struct private_newhope_noise_t private_newhope_noise_t;
+
+static const int seed_len = 32; /* 256 bits */
+static const int nonce_len = 12; /* 96 bits */
+
+/**
+ * Private data of an newhope_noise_t object.
+ */
+struct private_newhope_noise_t {
+
+ /**
+ * Public newhope_noise_t interface.
+ */
+ newhope_noise_t public;
+
+ /**
+ * 256 bit seed and 96 bit nonce (44 bytes)
+ */
+ chunk_t seed;
+
+ /**
+ * ChaCha20 stream
+ */
+ xof_t *xof;
+
+};
+
+METHOD(newhope_noise_t, get_uniform_bytes, uint8_t*,
+ private_newhope_noise_t *this, uint8_t nonce, uint16_t n)
+{
+ uint8_t *bytes;
+
+ this->seed.ptr[seed_len] = nonce;
+ if (!this->xof->set_seed(this->xof, this->seed))
+ {
+ DBG1(DBG_LIB, "could not set seed of CHACHA20 XOF");
+ return NULL;
+ }
+
+ /* allocate dynamic memory for the noise polynomial */
+ bytes = (uint8_t*)malloc(n);
+
+ if (!this->xof->get_bytes(this->xof, n, bytes))
+ {
+ DBG1(DBG_LIB, "could not get bytes from SHAKE128 XOF");
+ free(bytes);
+ return NULL;
+ }
+
+ return bytes;
+}
+
+METHOD(newhope_noise_t, get_binomial_words, uint32_t*,
+ private_newhope_noise_t *this, uint8_t nonce, uint16_t n, uint16_t q)
+{
+ uint32_t *np, a, b, d, t;
+ uint8_t x[4];
+ int i = 0, j;
+
+ this->seed.ptr[seed_len] = nonce;
+ if (!this->xof->set_seed(this->xof, this->seed))
+ {
+ DBG1(DBG_LIB, "could not set seed of CHACHA20 XOF");
+ return NULL;
+ }
+
+ /* allocate dynamic memory for the noise polynomial */
+ np = (uint32_t*)malloc(n * sizeof(uint32_t));
+
+ for (i = 0; i < n; i++)
+ {
+ if (!this->xof->get_bytes(this->xof, sizeof(x), x))
+ {
+ DBG1(DBG_LIB, "could not get bytes from SHAKE128 XOF");
+ free(np);
+ return NULL;
+ }
+
+ /* Treat x as a 32 bit unsigned little endian integer */
+ t = uletoh32(x);
+
+ /* Compute Psi_16 distribution */
+ d = 0;
+ for (j = 0; j < 8; j++)
+ {
+ d += (t >> j) & 0x01010101;
+ }
+ a = ((d >> 8) & 0xff) + (d & 0xff);
+ b = ((d >> 16) & 0xff) + (d >> 24);
+ np[i] = (a >= b) ? a - b : a + q - b;
+ }
+
+ return np;
+}
+
+METHOD(newhope_noise_t, destroy, void,
+ private_newhope_noise_t *this)
+{
+ this->xof->destroy(this->xof);
+ chunk_free(&this->seed);
+ free(this);
+}
+
+/*
+ * Described in header.
+ */
+newhope_noise_t *newhope_noise_create(chunk_t seed)
+{
+ private_newhope_noise_t *this;
+ xof_t *xof;
+
+ if (seed.len != seed_len)
+ {
+ DBG1(DBG_LIB, "seed for ChaCha20 stream must be 256 bits");
+ return NULL;
+ }
+
+ xof = lib->crypto->create_xof(lib->crypto, XOF_CHACHA20);
+ if (!xof)
+ {
+ DBG1(DBG_LIB, "could not instantiate ChaCha20 stream");
+ return NULL;
+ }
+
+ INIT(this,
+ .public = {
+ .get_uniform_bytes = _get_uniform_bytes,
+ .get_binomial_words = _get_binomial_words,
+ .destroy = _destroy,
+ },
+ .xof = xof,
+ .seed = chunk_alloc(seed_len + nonce_len),
+ );
+
+ /* initialize seed for ChaCha 20 stream */
+ memcpy(this->seed.ptr, seed.ptr, seed_len);
+ memset(this->seed.ptr + seed_len, 0x00, nonce_len);
+
+ return &this->public;
+}
diff --git a/src/libstrongswan/plugins/newhope/newhope_noise.h b/src/libstrongswan/plugins/newhope/newhope_noise.h
new file mode 100644
index 000000000..d7819d3ad
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/newhope_noise.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+/**
+ * @defgroup newhope_noise newhope_noise
+ * @{ @ingroup newhope_p
+ */
+
+#ifndef NEWHOPE_NOISE_H_
+#define NEWHOPE_NOISE_H_
+
+typedef struct newhope_noise_t newhope_noise_t;
+
+#include <library.h>
+
+/**
+ * Generate pseudo random noise using a ChaCha20 stream
+ * initialized with a 256 bit seed and an 8 bit nonce
+ */
+struct newhope_noise_t {
+
+ /**
+ * Return n pseudo random bytes with a uniform distribution
+ *
+ * @param nonce Nonce determining the pseudo random stream
+ * @param n Number of pseudo random bytes to be returned
+ * @return Return array with n peudo random bytes
+ */
+ uint8_t* (*get_uniform_bytes)(newhope_noise_t *this, uint8_t nonce,
+ uint16_t n);
+
+ /**
+ * Return n pseudo random 32-bit words with a Psi16 binomial distribution
+ *
+ * @param nonce Nonce determining the pseudo random stream
+ * @param n Number of pseudo random Psi16 words to be returned
+ * @param q Prime number q determining the ring
+ * @return Return array with n pseudo random 32 bit words
+ */
+ uint32_t* (*get_binomial_words)(newhope_noise_t *this, uint8_t nonce,
+ uint16_t n, uint16_t q);
+
+ /**
+ * Destroy a newhope_noise_t object
+ */
+ void (*destroy)(newhope_noise_t *this);
+};
+
+/**
+ * Creates a new newhope_noise_t object.
+ *
+ * @param seed 256 bit seed (32 byte chunk)
+ * @return newhope_noise_t object, NULL if not supported
+ */
+newhope_noise_t *newhope_noise_create(chunk_t seed);
+
+#endif /** NEWHOPE_NOISE_H_ @}*/
+
diff --git a/src/libstrongswan/plugins/newhope/newhope_plugin.c b/src/libstrongswan/plugins/newhope/newhope_plugin.c
new file mode 100644
index 000000000..444e61a1d
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/newhope_plugin.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+#include "newhope_plugin.h"
+#include "newhope_ke.h"
+
+#include <library.h>
+
+typedef struct private_newhope_plugin_t private_newhope_plugin_t;
+
+/**
+ * private data of newhope_plugin
+ */
+struct private_newhope_plugin_t {
+
+ /**
+ * public functions
+ */
+ newhope_plugin_t public;
+};
+
+METHOD(plugin_t, get_name, char*,
+ private_newhope_plugin_t *this)
+{
+ return "newhope";
+}
+
+METHOD(plugin_t, get_features, int,
+ private_newhope_plugin_t *this, plugin_feature_t *features[])
+{
+ static plugin_feature_t f[] = {
+ PLUGIN_REGISTER(DH, newhope_ke_create),
+ PLUGIN_PROVIDE(DH, NH_128_BIT),
+ PLUGIN_DEPENDS(XOF, XOF_SHAKE_128),
+ PLUGIN_DEPENDS(XOF, XOF_CHACHA20),
+ };
+ *features = f;
+
+ return countof(f);
+}
+
+METHOD(plugin_t, destroy, void,
+ private_newhope_plugin_t *this)
+{
+ free(this);
+}
+
+/*
+ * see header file
+ */
+plugin_t *newhope_plugin_create()
+{
+ private_newhope_plugin_t *this;
+
+ INIT(this,
+ .public = {
+ .plugin = {
+ .get_name = _get_name,
+ .get_features = _get_features,
+ .destroy = _destroy,
+ },
+ },
+ );
+
+ return &this->public.plugin;
+}
diff --git a/src/libstrongswan/plugins/newhope/newhope_plugin.h b/src/libstrongswan/plugins/newhope/newhope_plugin.h
new file mode 100644
index 000000000..b04792f10
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/newhope_plugin.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+/**
+ * @defgroup newhope_p newhope
+ * @ingroup plugins
+ *
+ * @defgroup newhope_plugin newhope_plugin
+ * @{ @ingroup newhope_p
+ */
+
+#ifndef NEWHOPE_PLUGIN_H_
+#define NEWHOPE_PLUGIN_H_
+
+#include <plugins/plugin.h>
+
+typedef struct newhope_plugin_t newhope_plugin_t;
+
+/**
+ * Plugin implementing New Hope-based key exchange
+ */
+struct newhope_plugin_t {
+
+ /**
+ * implements plugin interface
+ */
+ plugin_t plugin;
+};
+
+#endif /** NEWHOPE_PLUGIN_H_ @}*/
diff --git a/src/libstrongswan/plugins/newhope/newhope_reconciliation.c b/src/libstrongswan/plugins/newhope/newhope_reconciliation.c
new file mode 100644
index 000000000..4aed60e30
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/newhope_reconciliation.c
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * Based on public domain code by Erdem Alkim, Léo Ducas, Thomas Pöppelmann,
+ * and Peter Schwabe.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ *
+ */
+
+#include "newhope_reconciliation.h"
+
+typedef struct private_newhope_reconciliation_t private_newhope_reconciliation_t;
+
+/**
+ * Private data of an newhope_reconciliation_t object.
+ */
+struct private_newhope_reconciliation_t {
+
+ /**
+ * Public newhope_reconciliation_t interface.
+ */
+ newhope_reconciliation_t public;
+
+ /**
+ * Array sizes
+ */
+ int n, n4;
+
+ /**
+ * Multiples of modulus q
+ */
+ int32_t q, q2, q4, q8, q16;
+};
+
+
+static inline int32_t rec_abs(int32_t v)
+{
+ int32_t mask = v >> 31;
+
+ return (v ^ mask) - mask;
+}
+
+/**
+ * Auxiliary function used by help_reconcile() method
+ */
+static int32_t rec_f(private_newhope_reconciliation_t *this,
+ int32_t v, uint8_t r, int32_t *v0, int32_t *v1)
+{
+ int32_t x, xit, t, b;
+
+ x = 8 * v + 2 * r;
+
+ /* compute t = x/q */
+ b = x * 2730;
+ t = b >> 25;
+ b = x - t * this->q;
+ b = this->q - 1 - b;
+ b >>= 31;
+ t -= b;
+
+ r = t & 0x01;
+ xit = (t >> 1);
+ *v0 = xit + r ; /* v0 = round(x/(2q)) */
+
+ t -= 1;
+ r = t & 0x01;
+ *v1 = ( t>> 1) + r;
+
+ return rec_abs(x - (*v0) * this->q2);
+}
+
+/**
+ * Auxiliary function used by reconcile() method
+ */
+static int32_t rec_g(private_newhope_reconciliation_t *this, int32_t x)
+{
+ int32_t t, r, b;
+
+ /* t = x/(4*q) */
+ b = x * 2730;
+ t = b >> 27;
+ b = x - t * this->q4;
+ b = this->q4 - 1 - b;
+ b >>= 31;
+ t -= b;
+
+ r = t & 0x01;
+ t = (t >> 1) + r; /* t = round(x/(8q)) */
+ t *= this->q8;
+
+ return abs(t - x);
+}
+
+METHOD(newhope_reconciliation_t, help_reconcile, uint8_t*,
+ private_newhope_reconciliation_t *this, uint32_t *v, uint8_t *rbits)
+{
+ int32_t v0[4], v1[4], v_tmp[4], k;
+ int i, i0, i1, i2, i3, j;
+ uint8_t *r, rbit;
+
+ /* allocate output vector */
+ r = (uint8_t*)malloc(this->n);
+
+ for (i = 0; i < this->n4/8; i++)
+ {
+ for (j = 0; j < 8; j++)
+ {
+ i0 = 8*i + j;
+ i1 = i0 + this->n4;
+ i2 = i1 + this->n4;
+ i3 = i2 + this->n4;
+
+ /* iterate through all 256 random bits */
+ rbit = (rbits[i] >> j) & 0x01;
+
+ k = rec_f(this, v[i0], rbit, &v0[0], &v1[0]);
+ k += rec_f(this, v[i1], rbit, &v0[1], &v1[1]);
+ k += rec_f(this, v[i2], rbit, &v0[2], &v1[2]);
+ k += rec_f(this, v[i3], rbit, &v0[3], &v1[3]);
+
+ k = (this->q2 - 1 - k) >> 31;
+
+ v_tmp[0] = ((~k) & v0[0]) ^ (k & v1[0]);
+ v_tmp[1] = ((~k) & v0[1]) ^ (k & v1[1]);
+ v_tmp[2] = ((~k) & v0[2]) ^ (k & v1[2]);
+ v_tmp[3] = ((~k) & v0[3]) ^ (k & v1[3]);
+
+ r[i0] = (v_tmp[0] - v_tmp[3]) & 0x03;
+ r[i1] = (v_tmp[1] - v_tmp[3]) & 0x03;
+ r[i2] = (v_tmp[2] - v_tmp[3]) & 0x03;
+ r[i3] = (v_tmp[3] - k + v_tmp[3]) & 0x03;
+ }
+ }
+
+ return r;
+}
+
+METHOD(newhope_reconciliation_t, reconcile, chunk_t,
+ private_newhope_reconciliation_t *this, uint32_t *v, uint8_t *r)
+{
+ size_t key_len;
+ uint8_t *key;
+ int32_t tmp[4], t;
+ int i, i0, i1, i2, i3, j;
+
+ key_len = this->n4 / 8;
+ key = (uint8_t*)malloc(key_len);
+ memset(key, 0x00, key_len);
+
+ for (i = 0; i < key_len; i++)
+ {
+ for (j = 0; j < 8; j++)
+ {
+ i0 = 8*i + j;
+ i1 = i0 + this->n4;
+ i2 = i1 + this->n4;
+ i3 = i2 + this->n4;
+
+ tmp[0] = this->q16 + 8 * (int32_t)v[i0] -
+ this->q * (2*r[i0] + r[i3]);
+ tmp[1] = this->q16 + 8 * (int32_t)v[i1] -
+ this->q * (2*r[i1] + r[i3]);
+ tmp[2] = this->q16 + 8 * (int32_t)v[i2] -
+ this->q * (2*r[i2] + r[i3]);
+ tmp[3] = this->q16 + 8 * (int32_t)v[i3] -
+ this->q * ( r[i3]);
+
+ t = rec_g(this, tmp[0]) + rec_g(this, tmp[1]) +
+ rec_g(this, tmp[2]) + rec_g(this, tmp[3]) - this->q8;
+
+ key[i] |= ((t >> 31) & 0x01) << j;
+ }
+ }
+
+ return chunk_create(key, key_len);
+}
+
+METHOD(newhope_reconciliation_t, destroy, void,
+ private_newhope_reconciliation_t *this)
+{
+ free(this);
+}
+
+/*
+ * Described in header.
+ */
+newhope_reconciliation_t *newhope_reconciliation_create(int n, int32_t q)
+{
+ private_newhope_reconciliation_t *this;
+
+ INIT(this,
+ .public = {
+ .help_reconcile = _help_reconcile,
+ .reconcile = _reconcile,
+ .destroy = _destroy,
+ },
+ .n = n,
+ .n4 = n / 4,
+ .q = q,
+ .q2 = 2 * q,
+ .q4 = 4 * q,
+ .q8 = 8 * q,
+ .q16 = 16 * q,
+ );
+
+ return &this->public;
+}
diff --git a/src/libstrongswan/plugins/newhope/newhope_reconciliation.h b/src/libstrongswan/plugins/newhope/newhope_reconciliation.h
new file mode 100644
index 000000000..7cbf0d208
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/newhope_reconciliation.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+/**
+ * @defgroup newhope_reconciliation newhope_reconciliation
+ * @{ @ingroup newhope_p
+ */
+
+#ifndef NEWHOPE_RECONCILIATION_H_
+#define NEWHOPE_RECONCILIATION_H_
+
+typedef struct newhope_reconciliation_t newhope_reconciliation_t;
+
+#include <library.h>
+
+/**
+ * Class assisting the error reconciliation
+ * resulting in a key exchange error rate < 2^(-60)
+ */
+struct newhope_reconciliation_t {
+
+ /**
+ * Generate reconciliation polynomial
+ *
+ * @param v polynomial v
+ * @param rbits pseudo random bit array
+ * @return return array with reconciliation polynomial
+ */
+ uint8_t* (*help_reconcile)(newhope_reconciliation_t *this,
+ uint32_t *v, uint8_t *rbits);
+
+ /**
+ * Use reconciliation polynomial r to derive shared secret
+ *
+ * @param v polynomial v or v'
+ * @param r reconciliation polynomial r
+ * @return Return shared secret
+ */
+ chunk_t (*reconcile)(newhope_reconciliation_t *this,
+ uint32_t *v, uint8_t *r);
+
+ /**
+ * Destroy a newhope_reconciliation_t object
+ */
+ void (*destroy)(newhope_reconciliation_t *this);
+};
+
+/**
+ * Creates a new newhope_reconciliation_t object.
+ *
+ * @param n array size
+ * @param q prime modulus
+ * @return newhope_reconciliation_t object
+ */
+newhope_reconciliation_t *newhope_reconciliation_create(int n, int32_t q);
+
+#endif /** NEWHOPE_RECONCILIATION_H_ @}*/
+
diff --git a/src/libstrongswan/plugins/newhope/tests/Makefile.am b/src/libstrongswan/plugins/newhope/tests/Makefile.am
new file mode 100644
index 000000000..3992e26d1
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/tests/Makefile.am
@@ -0,0 +1,25 @@
+TESTS = newhope_tests
+
+check_PROGRAMS = $(TESTS)
+
+newhope_tests_SOURCES = \
+ suites/test_newhope_ke.c \
+ suites/test_newhope_noise.c \
+ suites/test_newhope_reconciliation.c \
+ newhope_tests.h newhope_tests.c
+
+newhope_tests_CFLAGS = \
+ -I$(top_srcdir)/src/libstrongswan \
+ -I$(top_srcdir)/src/libstrongswan/tests \
+ -I$(top_srcdir)/src/libstrongswan/math/libnttfft \
+ -I$(top_srcdir)/src/libstrongswan/plugins/newhope \
+ -DPLUGINDIR=\""$(abs_top_builddir)/src/libstrongswan/plugins\"" \
+ -DPLUGINS=\""${s_plugins}\"" \
+ @COVERAGE_CFLAGS@
+
+newhope_tests_LDFLAGS = @COVERAGE_LDFLAGS@
+newhope_tests_LDADD = \
+ $(top_builddir)/src/libstrongswan/libstrongswan.la \
+ $(top_builddir)/src/libstrongswan/tests/libtest.la \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la \
+ ../libnewhope.la
diff --git a/src/libstrongswan/plugins/newhope/tests/Makefile.in b/src/libstrongswan/plugins/newhope/tests/Makefile.in
new file mode 100644
index 000000000..07ded5d9d
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/tests/Makefile.in
@@ -0,0 +1,929 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+TESTS = newhope_tests$(EXEEXT)
+check_PROGRAMS = $(am__EXEEXT_1)
+subdir = src/libstrongswan/plugins/newhope/tests
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/config/libtool.m4 \
+ $(top_srcdir)/m4/config/ltoptions.m4 \
+ $(top_srcdir)/m4/config/ltsugar.m4 \
+ $(top_srcdir)/m4/config/ltversion.m4 \
+ $(top_srcdir)/m4/config/lt~obsolete.m4 \
+ $(top_srcdir)/m4/macros/split-package-version.m4 \
+ $(top_srcdir)/m4/macros/with.m4 \
+ $(top_srcdir)/m4/macros/enable-disable.m4 \
+ $(top_srcdir)/m4/macros/add-plugin.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__EXEEXT_1 = newhope_tests$(EXEEXT)
+am__dirstamp = $(am__leading_dot)dirstamp
+am_newhope_tests_OBJECTS = \
+ suites/newhope_tests-test_newhope_ke.$(OBJEXT) \
+ suites/newhope_tests-test_newhope_noise.$(OBJEXT) \
+ suites/newhope_tests-test_newhope_reconciliation.$(OBJEXT) \
+ newhope_tests-newhope_tests.$(OBJEXT)
+newhope_tests_OBJECTS = $(am_newhope_tests_OBJECTS)
+newhope_tests_DEPENDENCIES = \
+ $(top_builddir)/src/libstrongswan/libstrongswan.la \
+ $(top_builddir)/src/libstrongswan/tests/libtest.la \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la \
+ ../libnewhope.la
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+newhope_tests_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(newhope_tests_CFLAGS) \
+ $(CFLAGS) $(newhope_tests_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(newhope_tests_SOURCES)
+DIST_SOURCES = $(newhope_tests_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+ATOMICLIB = @ATOMICLIB@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BFDLIB = @BFDLIB@
+BTLIB = @BTLIB@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COVERAGE_CFLAGS = @COVERAGE_CFLAGS@
+COVERAGE_LDFLAGS = @COVERAGE_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLIB = @DLLIB@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+EASY_INSTALL = @EASY_INSTALL@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GEM = @GEM@
+GENHTML = @GENHTML@
+GPERF = @GPERF@
+GPRBUILD = @GPRBUILD@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LCOV = @LCOV@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MYSQLCFLAG = @MYSQLCFLAG@
+MYSQLCONFIG = @MYSQLCONFIG@
+MYSQLLIB = @MYSQLLIB@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_LIB = @OPENSSL_LIB@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PACKAGE_VERSION_BUILD = @PACKAGE_VERSION_BUILD@
+PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@
+PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@
+PACKAGE_VERSION_REVIEW = @PACKAGE_VERSION_REVIEW@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PLUGIN_CFLAGS = @PLUGIN_CFLAGS@
+PTHREADLIB = @PTHREADLIB@
+PYTHON = @PYTHON@
+PYTHONEGGINSTALLDIR = @PYTHONEGGINSTALLDIR@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PACKAGE_VERSION = @PYTHON_PACKAGE_VERSION@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+PY_TEST = @PY_TEST@
+RANLIB = @RANLIB@
+RTLIB = @RTLIB@
+RUBY = @RUBY@
+RUBYGEMDIR = @RUBYGEMDIR@
+RUBYINCLUDE = @RUBYINCLUDE@
+RUBYLIB = @RUBYLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOCKLIB = @SOCKLIB@
+STRIP = @STRIP@
+UNWINDLIB = @UNWINDLIB@
+VERSION = @VERSION@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+aikgen_plugins = @aikgen_plugins@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+attest_plugins = @attest_plugins@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+c_plugins = @c_plugins@
+charon_natt_port = @charon_natt_port@
+charon_plugins = @charon_plugins@
+charon_udp_port = @charon_udp_port@
+clearsilver_LIBS = @clearsilver_LIBS@
+cmd_plugins = @cmd_plugins@
+datadir = @datadir@
+datarootdir = @datarootdir@
+dev_headers = @dev_headers@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+fips_mode = @fips_mode@
+gtk_CFLAGS = @gtk_CFLAGS@
+gtk_LIBS = @gtk_LIBS@
+h_plugins = @h_plugins@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+imcvdir = @imcvdir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+ipsec_script = @ipsec_script@
+ipsec_script_upper = @ipsec_script_upper@
+ipsecdir = @ipsecdir@
+ipsecgroup = @ipsecgroup@
+ipseclibdir = @ipseclibdir@
+ipsecuser = @ipsecuser@
+json_CFLAGS = @json_CFLAGS@
+json_LIBS = @json_LIBS@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libiptc_CFLAGS = @libiptc_CFLAGS@
+libiptc_LIBS = @libiptc_LIBS@
+linux_headers = @linux_headers@
+localedir = @localedir@
+localstatedir = @localstatedir@
+manager_plugins = @manager_plugins@
+mandir = @mandir@
+medsrv_plugins = @medsrv_plugins@
+mkdir_p = @mkdir_p@
+nm_CFLAGS = @nm_CFLAGS@
+nm_LIBS = @nm_LIBS@
+nm_ca_dir = @nm_ca_dir@
+nm_plugins = @nm_plugins@
+oldincludedir = @oldincludedir@
+pcsclite_CFLAGS = @pcsclite_CFLAGS@
+pcsclite_LIBS = @pcsclite_LIBS@
+pdfdir = @pdfdir@
+piddir = @piddir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+pki_plugins = @pki_plugins@
+plugindir = @plugindir@
+pool_plugins = @pool_plugins@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+random_device = @random_device@
+resolv_conf = @resolv_conf@
+routing_table = @routing_table@
+routing_table_prio = @routing_table_prio@
+runstatedir = @runstatedir@
+s_plugins = @s_plugins@
+sbindir = @sbindir@
+scepclient_plugins = @scepclient_plugins@
+scripts_plugins = @scripts_plugins@
+sharedstatedir = @sharedstatedir@
+soup_CFLAGS = @soup_CFLAGS@
+soup_LIBS = @soup_LIBS@
+srcdir = @srcdir@
+starter_plugins = @starter_plugins@
+strongswan_conf = @strongswan_conf@
+strongswan_options = @strongswan_options@
+swanctldir = @swanctldir@
+sysconfdir = @sysconfdir@
+systemd_CFLAGS = @systemd_CFLAGS@
+systemd_LIBS = @systemd_LIBS@
+systemd_daemon_CFLAGS = @systemd_daemon_CFLAGS@
+systemd_daemon_LIBS = @systemd_daemon_LIBS@
+systemd_journal_CFLAGS = @systemd_journal_CFLAGS@
+systemd_journal_LIBS = @systemd_journal_LIBS@
+systemdsystemunitdir = @systemdsystemunitdir@
+t_plugins = @t_plugins@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
+urandom_device = @urandom_device@
+xml_CFLAGS = @xml_CFLAGS@
+xml_LIBS = @xml_LIBS@
+newhope_tests_SOURCES = \
+ suites/test_newhope_ke.c \
+ suites/test_newhope_noise.c \
+ suites/test_newhope_reconciliation.c \
+ newhope_tests.h newhope_tests.c
+
+newhope_tests_CFLAGS = \
+ -I$(top_srcdir)/src/libstrongswan \
+ -I$(top_srcdir)/src/libstrongswan/tests \
+ -I$(top_srcdir)/src/libstrongswan/math/libnttfft \
+ -I$(top_srcdir)/src/libstrongswan/plugins/newhope \
+ -DPLUGINDIR=\""$(abs_top_builddir)/src/libstrongswan/plugins\"" \
+ -DPLUGINS=\""${s_plugins}\"" \
+ @COVERAGE_CFLAGS@
+
+newhope_tests_LDFLAGS = @COVERAGE_LDFLAGS@
+newhope_tests_LDADD = \
+ $(top_builddir)/src/libstrongswan/libstrongswan.la \
+ $(top_builddir)/src/libstrongswan/tests/libtest.la \
+ $(top_builddir)/src/libstrongswan/math/libnttfft/libnttfft.la \
+ ../libnewhope.la
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libstrongswan/plugins/newhope/tests/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/libstrongswan/plugins/newhope/tests/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+suites/$(am__dirstamp):
+ @$(MKDIR_P) suites
+ @: > suites/$(am__dirstamp)
+suites/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) suites/$(DEPDIR)
+ @: > suites/$(DEPDIR)/$(am__dirstamp)
+suites/newhope_tests-test_newhope_ke.$(OBJEXT): \
+ suites/$(am__dirstamp) suites/$(DEPDIR)/$(am__dirstamp)
+suites/newhope_tests-test_newhope_noise.$(OBJEXT): \
+ suites/$(am__dirstamp) suites/$(DEPDIR)/$(am__dirstamp)
+suites/newhope_tests-test_newhope_reconciliation.$(OBJEXT): \
+ suites/$(am__dirstamp) suites/$(DEPDIR)/$(am__dirstamp)
+
+newhope_tests$(EXEEXT): $(newhope_tests_OBJECTS) $(newhope_tests_DEPENDENCIES) $(EXTRA_newhope_tests_DEPENDENCIES)
+ @rm -f newhope_tests$(EXEEXT)
+ $(AM_V_CCLD)$(newhope_tests_LINK) $(newhope_tests_OBJECTS) $(newhope_tests_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+ -rm -f suites/*.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newhope_tests-newhope_tests.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@suites/$(DEPDIR)/newhope_tests-test_newhope_ke.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@suites/$(DEPDIR)/newhope_tests-test_newhope_noise.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@suites/$(DEPDIR)/newhope_tests-test_newhope_reconciliation.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+suites/newhope_tests-test_newhope_ke.o: suites/test_newhope_ke.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -MT suites/newhope_tests-test_newhope_ke.o -MD -MP -MF suites/$(DEPDIR)/newhope_tests-test_newhope_ke.Tpo -c -o suites/newhope_tests-test_newhope_ke.o `test -f 'suites/test_newhope_ke.c' || echo '$(srcdir)/'`suites/test_newhope_ke.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) suites/$(DEPDIR)/newhope_tests-test_newhope_ke.Tpo suites/$(DEPDIR)/newhope_tests-test_newhope_ke.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='suites/test_newhope_ke.c' object='suites/newhope_tests-test_newhope_ke.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -c -o suites/newhope_tests-test_newhope_ke.o `test -f 'suites/test_newhope_ke.c' || echo '$(srcdir)/'`suites/test_newhope_ke.c
+
+suites/newhope_tests-test_newhope_ke.obj: suites/test_newhope_ke.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -MT suites/newhope_tests-test_newhope_ke.obj -MD -MP -MF suites/$(DEPDIR)/newhope_tests-test_newhope_ke.Tpo -c -o suites/newhope_tests-test_newhope_ke.obj `if test -f 'suites/test_newhope_ke.c'; then $(CYGPATH_W) 'suites/test_newhope_ke.c'; else $(CYGPATH_W) '$(srcdir)/suites/test_newhope_ke.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) suites/$(DEPDIR)/newhope_tests-test_newhope_ke.Tpo suites/$(DEPDIR)/newhope_tests-test_newhope_ke.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='suites/test_newhope_ke.c' object='suites/newhope_tests-test_newhope_ke.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -c -o suites/newhope_tests-test_newhope_ke.obj `if test -f 'suites/test_newhope_ke.c'; then $(CYGPATH_W) 'suites/test_newhope_ke.c'; else $(CYGPATH_W) '$(srcdir)/suites/test_newhope_ke.c'; fi`
+
+suites/newhope_tests-test_newhope_noise.o: suites/test_newhope_noise.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -MT suites/newhope_tests-test_newhope_noise.o -MD -MP -MF suites/$(DEPDIR)/newhope_tests-test_newhope_noise.Tpo -c -o suites/newhope_tests-test_newhope_noise.o `test -f 'suites/test_newhope_noise.c' || echo '$(srcdir)/'`suites/test_newhope_noise.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) suites/$(DEPDIR)/newhope_tests-test_newhope_noise.Tpo suites/$(DEPDIR)/newhope_tests-test_newhope_noise.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='suites/test_newhope_noise.c' object='suites/newhope_tests-test_newhope_noise.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -c -o suites/newhope_tests-test_newhope_noise.o `test -f 'suites/test_newhope_noise.c' || echo '$(srcdir)/'`suites/test_newhope_noise.c
+
+suites/newhope_tests-test_newhope_noise.obj: suites/test_newhope_noise.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -MT suites/newhope_tests-test_newhope_noise.obj -MD -MP -MF suites/$(DEPDIR)/newhope_tests-test_newhope_noise.Tpo -c -o suites/newhope_tests-test_newhope_noise.obj `if test -f 'suites/test_newhope_noise.c'; then $(CYGPATH_W) 'suites/test_newhope_noise.c'; else $(CYGPATH_W) '$(srcdir)/suites/test_newhope_noise.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) suites/$(DEPDIR)/newhope_tests-test_newhope_noise.Tpo suites/$(DEPDIR)/newhope_tests-test_newhope_noise.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='suites/test_newhope_noise.c' object='suites/newhope_tests-test_newhope_noise.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -c -o suites/newhope_tests-test_newhope_noise.obj `if test -f 'suites/test_newhope_noise.c'; then $(CYGPATH_W) 'suites/test_newhope_noise.c'; else $(CYGPATH_W) '$(srcdir)/suites/test_newhope_noise.c'; fi`
+
+suites/newhope_tests-test_newhope_reconciliation.o: suites/test_newhope_reconciliation.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -MT suites/newhope_tests-test_newhope_reconciliation.o -MD -MP -MF suites/$(DEPDIR)/newhope_tests-test_newhope_reconciliation.Tpo -c -o suites/newhope_tests-test_newhope_reconciliation.o `test -f 'suites/test_newhope_reconciliation.c' || echo '$(srcdir)/'`suites/test_newhope_reconciliation.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) suites/$(DEPDIR)/newhope_tests-test_newhope_reconciliation.Tpo suites/$(DEPDIR)/newhope_tests-test_newhope_reconciliation.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='suites/test_newhope_reconciliation.c' object='suites/newhope_tests-test_newhope_reconciliation.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -c -o suites/newhope_tests-test_newhope_reconciliation.o `test -f 'suites/test_newhope_reconciliation.c' || echo '$(srcdir)/'`suites/test_newhope_reconciliation.c
+
+suites/newhope_tests-test_newhope_reconciliation.obj: suites/test_newhope_reconciliation.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -MT suites/newhope_tests-test_newhope_reconciliation.obj -MD -MP -MF suites/$(DEPDIR)/newhope_tests-test_newhope_reconciliation.Tpo -c -o suites/newhope_tests-test_newhope_reconciliation.obj `if test -f 'suites/test_newhope_reconciliation.c'; then $(CYGPATH_W) 'suites/test_newhope_reconciliation.c'; else $(CYGPATH_W) '$(srcdir)/suites/test_newhope_reconciliation.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) suites/$(DEPDIR)/newhope_tests-test_newhope_reconciliation.Tpo suites/$(DEPDIR)/newhope_tests-test_newhope_reconciliation.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='suites/test_newhope_reconciliation.c' object='suites/newhope_tests-test_newhope_reconciliation.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -c -o suites/newhope_tests-test_newhope_reconciliation.obj `if test -f 'suites/test_newhope_reconciliation.c'; then $(CYGPATH_W) 'suites/test_newhope_reconciliation.c'; else $(CYGPATH_W) '$(srcdir)/suites/test_newhope_reconciliation.c'; fi`
+
+newhope_tests-newhope_tests.o: newhope_tests.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -MT newhope_tests-newhope_tests.o -MD -MP -MF $(DEPDIR)/newhope_tests-newhope_tests.Tpo -c -o newhope_tests-newhope_tests.o `test -f 'newhope_tests.c' || echo '$(srcdir)/'`newhope_tests.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/newhope_tests-newhope_tests.Tpo $(DEPDIR)/newhope_tests-newhope_tests.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='newhope_tests.c' object='newhope_tests-newhope_tests.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -c -o newhope_tests-newhope_tests.o `test -f 'newhope_tests.c' || echo '$(srcdir)/'`newhope_tests.c
+
+newhope_tests-newhope_tests.obj: newhope_tests.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -MT newhope_tests-newhope_tests.obj -MD -MP -MF $(DEPDIR)/newhope_tests-newhope_tests.Tpo -c -o newhope_tests-newhope_tests.obj `if test -f 'newhope_tests.c'; then $(CYGPATH_W) 'newhope_tests.c'; else $(CYGPATH_W) '$(srcdir)/newhope_tests.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/newhope_tests-newhope_tests.Tpo $(DEPDIR)/newhope_tests-newhope_tests.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='newhope_tests.c' object='newhope_tests-newhope_tests.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newhope_tests_CFLAGS) $(CFLAGS) -c -o newhope_tests-newhope_tests.obj `if test -f 'newhope_tests.c'; then $(CYGPATH_W) 'newhope_tests.c'; else $(CYGPATH_W) '$(srcdir)/newhope_tests.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ $(am__tty_colors); \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=XPASS; \
+ ;; \
+ *) \
+ col=$$grn; res=PASS; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xfail=`expr $$xfail + 1`; \
+ col=$$lgn; res=XFAIL; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=FAIL; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ col=$$blu; res=SKIP; \
+ fi; \
+ echo "$${col}$$res$${std}: $$tst"; \
+ done; \
+ if test "$$all" -eq 1; then \
+ tests="test"; \
+ All=""; \
+ else \
+ tests="tests"; \
+ All="All "; \
+ fi; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="$$All$$all $$tests passed"; \
+ else \
+ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all $$tests failed"; \
+ else \
+ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ if test "$$skip" -eq 1; then \
+ skipped="($$skip test was not run)"; \
+ else \
+ skipped="($$skip tests were not run)"; \
+ fi; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ if test "$$failed" -eq 0; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ fi; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f suites/$(DEPDIR)/$(am__dirstamp)
+ -rm -f suites/$(am__dirstamp)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR) suites/$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR) suites/$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
+ ctags ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/libstrongswan/plugins/newhope/tests/newhope_tests.c b/src/libstrongswan/plugins/newhope/tests/newhope_tests.c
new file mode 100644
index 000000000..1cc9a2d91
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/tests/newhope_tests.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2014 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+#include <test_runner.h>
+
+#include <library.h>
+
+/* declare test suite constructors */
+#define TEST_SUITE(x) test_suite_t* x();
+#include "newhope_tests.h"
+#undef TEST_SUITE
+
+static test_configuration_t tests[] = {
+#define TEST_SUITE(x) \
+ { .suite = x, },
+#include "newhope_tests.h"
+ { .suite = NULL, }
+};
+
+static bool test_runner_init(bool init)
+{
+ if (init)
+ {
+ char *plugins, *plugindir;
+
+ plugins = lib->settings->get_str(lib->settings,
+ "tests.load", PLUGINS);
+ plugindir = lib->settings->get_str(lib->settings,
+ "tests.plugindir", PLUGINDIR);
+ plugin_loader_add_plugindirs(plugindir, plugins);
+ if (!lib->plugins->load(lib->plugins, plugins))
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ lib->processor->set_threads(lib->processor, 0);
+ lib->processor->cancel(lib->processor);
+ lib->plugins->unload(lib->plugins);
+ }
+ return TRUE;
+}
+
+int main(int argc, char *argv[])
+{
+ return test_runner_run("newhope", tests, test_runner_init);
+}
diff --git a/src/libstrongswan/plugins/newhope/tests/newhope_tests.h b/src/libstrongswan/plugins/newhope/tests/newhope_tests.h
new file mode 100644
index 000000000..3f81434e6
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/tests/newhope_tests.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+TEST_SUITE(newhope_ke_suite_create)
+TEST_SUITE(newhope_noise_suite_create)
+TEST_SUITE(newhope_reconciliation_suite_create)
diff --git a/src/libstrongswan/plugins/newhope/tests/suites/test_newhope_ke.c b/src/libstrongswan/plugins/newhope/tests/suites/test_newhope_ke.c
new file mode 100644
index 000000000..33b744fe1
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/tests/suites/test_newhope_ke.c
@@ -0,0 +1,193 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+#include "test_suite.h"
+
+#include <newhope_ke.h>
+
+#include <library.h>
+
+#include <time.h>
+
+const int count = 1000;
+
+START_TEST(test_newhope_ke_good)
+{
+ chunk_t i_msg, r_msg, i_shared_secret, r_shared_secret;
+ diffie_hellman_t *i_nh, *r_nh;
+ struct timespec start, stop;
+ int i;
+
+ clock_gettime(CLOCK_THREAD_CPUTIME_ID, &start);
+
+ for (i = 0; i < count; i++)
+ {
+ i_nh = lib->crypto->create_dh(lib->crypto, NH_128_BIT);
+ ck_assert(i_nh != NULL);
+ ck_assert(i_nh->get_dh_group(i_nh) == NH_128_BIT);
+
+ ck_assert(i_nh->get_my_public_value(i_nh, &i_msg));
+ ck_assert(i_msg.len = 1824);
+
+ r_nh = lib->crypto->create_dh(lib->crypto, NH_128_BIT);
+ ck_assert(r_nh != NULL);
+
+ ck_assert(r_nh->set_other_public_value(r_nh, i_msg));
+ ck_assert(r_nh->get_my_public_value(r_nh, &r_msg));
+ ck_assert(r_msg.len == 2048);
+
+ ck_assert(r_nh->get_shared_secret(r_nh, &r_shared_secret));
+ ck_assert(r_shared_secret.len == 32);
+
+ ck_assert(i_nh->set_other_public_value(i_nh, r_msg));
+ ck_assert(i_nh->get_shared_secret(i_nh, &i_shared_secret));
+ ck_assert(i_shared_secret.len == 32);
+ ck_assert(chunk_equals(i_shared_secret, r_shared_secret));
+
+ /* cleanup */
+ chunk_clear(&i_shared_secret);
+ chunk_clear(&r_shared_secret);
+ chunk_free(&i_msg);
+ chunk_free(&r_msg);
+ i_nh->destroy(i_nh);
+ r_nh->destroy(r_nh);
+ }
+
+ clock_gettime(CLOCK_THREAD_CPUTIME_ID, &stop);
+
+ DBG0(DBG_LIB, "%d Newhope DH loops in %d ms\n", count,
+ (stop.tv_nsec - start.tv_nsec) / 1000000 +
+ (stop.tv_sec - start.tv_sec) * 1000);
+}
+END_TEST
+
+START_TEST(test_newhope_ke_wrong)
+{
+ chunk_t i_msg, r_msg, i_shared_secret, r_shared_secret;
+ diffie_hellman_t *i_nh, *r_nh;
+
+ i_nh = lib->crypto->create_dh(lib->crypto, NH_128_BIT);
+ ck_assert(i_nh != NULL);
+ ck_assert(i_nh->get_my_public_value(i_nh, &i_msg));
+
+ r_nh = lib->crypto->create_dh(lib->crypto, NH_128_BIT);
+ ck_assert(r_nh != NULL);
+ ck_assert(r_nh->set_other_public_value(r_nh, i_msg));
+ ck_assert(r_nh->get_my_public_value(r_nh, &r_msg));
+
+ /* destroy 1st instance of i_nh */
+ i_nh->destroy(i_nh);
+ chunk_free(&i_msg);
+
+ /* create 2nd instance of i_nh */
+ i_nh = lib->crypto->create_dh(lib->crypto, NH_128_BIT);
+ ck_assert(i_nh != NULL);
+ ck_assert(i_nh->get_my_public_value(i_nh, &i_msg));
+ ck_assert(i_nh->set_other_public_value(i_nh, r_msg));
+
+ ck_assert(r_nh->get_shared_secret(r_nh, &r_shared_secret));
+ ck_assert(i_nh->get_shared_secret(i_nh, &i_shared_secret));
+ ck_assert(!chunk_equals(i_shared_secret, r_shared_secret));
+
+ /* cleanup */
+ chunk_clear(&i_shared_secret);
+ chunk_clear(&r_shared_secret);
+ chunk_free(&i_msg);
+ chunk_free(&r_msg);
+ i_nh->destroy(i_nh);
+ r_nh->destroy(r_nh);
+}
+END_TEST
+
+START_TEST(test_newhope_ke_fail_i)
+{
+ diffie_hellman_t *i_nh;
+ char buf_ff[2048];
+ int i;
+
+ chunk_t i_msg;
+
+ chunk_t r_msg[] = {
+ chunk_empty,
+ chunk_from_chars(0x00),
+ chunk_create(buf_ff, 2047),
+ chunk_create(buf_ff, 2048),
+ };
+
+ memset(buf_ff, 0xff, sizeof(buf_ff));
+
+ for (i = 0; i < countof(r_msg); i++)
+ {
+ i_nh = lib->crypto->create_dh(lib->crypto, NH_128_BIT);
+ ck_assert(i_nh != NULL);
+ ck_assert(i_nh->get_my_public_value(i_nh, &i_msg));
+ ck_assert(!i_nh->set_other_public_value(i_nh, r_msg[i]));
+ chunk_free(&i_msg);
+ i_nh->destroy(i_nh);
+ }
+}
+END_TEST
+
+START_TEST(test_newhope_ke_fail_r)
+{
+ diffie_hellman_t *r_nh;
+ char buf_ff[1824];
+ int i;
+
+ chunk_t i_msg[] = {
+ chunk_empty,
+ chunk_from_chars(0x00),
+ chunk_create(buf_ff, 1823),
+ chunk_create(buf_ff, 1824),
+ };
+
+ memset(buf_ff, 0xff, sizeof(buf_ff));
+
+ for (i = 0; i < countof(i_msg); i++)
+ {
+ r_nh = lib->crypto->create_dh(lib->crypto, NH_128_BIT);
+ ck_assert(r_nh != NULL);
+ ck_assert(!r_nh->set_other_public_value(r_nh, i_msg[i]));
+ r_nh->destroy(r_nh);
+ }
+}
+END_TEST
+
+Suite *newhope_ke_suite_create()
+{
+ Suite *s;
+ TCase *tc;
+
+ s = suite_create("newhope_ke");
+
+ tc = tcase_create("ke_good");
+ test_case_set_timeout(tc, 30);
+ tcase_add_test(tc, test_newhope_ke_good);
+ suite_add_tcase(s, tc);
+
+ tc = tcase_create("ke_wrong");
+ tcase_add_test(tc, test_newhope_ke_wrong);
+ suite_add_tcase(s, tc);
+
+ tc = tcase_create("ke_fail_i");
+ tcase_add_test(tc, test_newhope_ke_fail_i);
+ suite_add_tcase(s, tc);
+
+ tc = tcase_create("ke_fail_r");
+ tcase_add_test(tc, test_newhope_ke_fail_r);
+ suite_add_tcase(s, tc);
+
+ return s;
+}
diff --git a/src/libstrongswan/plugins/newhope/tests/suites/test_newhope_noise.c b/src/libstrongswan/plugins/newhope/tests/suites/test_newhope_noise.c
new file mode 100644
index 000000000..96dd16787
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/tests/suites/test_newhope_noise.c
@@ -0,0 +1,676 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+#include "test_suite.h"
+
+#include <newhope_noise.h>
+
+#include <library.h>
+
+static const uint16_t n = 1024;
+static const uint16_t q = 12289;
+
+static const size_t seed_len = 32;
+
+typedef struct {
+ uint8_t key;
+ uint8_t nonce;
+ uint8_t uniform[64];
+ uint32_t poly[1024];
+} noise_t;
+
+static noise_t noises[] = {
+ { 0x00, 0x00, /* polynomial s */
+ { 0x9f, 0x07, 0xe7, 0xbe, 0x55, 0x51, 0x38, 0x7a, 0x98, 0xba,
+ 0x97, 0x7c, 0x73, 0x2d, 0x08, 0x0d, 0xcb, 0x0f, 0x29, 0xa0,
+ 0x48, 0xe3, 0x65, 0x69, 0x12, 0xc6, 0x53, 0x3e, 0x32, 0xee,
+ 0x7a, 0xed, 0x29, 0xb7, 0x21, 0x76, 0x9c, 0xe6, 0x4e, 0x43,
+ 0xd5, 0x71, 0x33, 0xb0, 0x74, 0xd8, 0x39, 0xd5, 0x31, 0xed,
+ 0x1f, 0x28, 0x51, 0x0a, 0xfb, 0x45, 0xac, 0xe1, 0x0a, 0x1f,
+ 0x4b, 0x79, 0x4d, 0x6f },
+ { 12286, 12288, 12287, 5, 4, 12288, 12286, 12287, 2, 2,
+ 2, 12288, 2, 12284, 1, 12288, 12288, 12288, 6, 12288,
+ 0, 4, 1, 12285, 12286, 2, 12284, 12287, 1, 5,
+ 5, 12286, 12288, 2, 12286, 0, 3, 1, 0, 2,
+ 0, 0, 4, 12283, 12284, 4, 0, 12288, 3, 12288,
+ 0, 4, 1, 12288, 12286, 0, 3, 1, 12286, 12287,
+ 12285, 3, 2, 3, 12286, 0, 6, 6, 12288, 12284,
+ 0, 12282, 1, 0, 4, 1, 0, 3, 2, 2,
+ 3, 3, 2, 12288, 3, 1, 12287, 12285, 0, 12288,
+ 0, 0, 12288, 12287, 12284, 12286, 0, 12288, 4, 4,
+ 12288, 5, 12286, 2, 12288, 5, 1, 12283, 1, 12288,
+ 1, 12288, 12287, 12285, 2, 2, 12285, 12284, 0, 12285,
+ 12287, 0, 1, 0, 2, 12288, 12288, 12287, 0, 4,
+ 12288, 12285, 12288, 0, 2, 1, 12287, 3, 1, 3,
+ 5, 12286, 1, 0, 12286, 0, 4, 0, 12288, 1,
+ 12288, 4, 5, 12283, 12288, 1, 3, 12283, 12286, 5,
+ 1, 12286, 12287, 12286, 0, 12287, 12285, 1, 0, 0,
+ 1, 3, 0, 0, 0, 12284, 12286, 2, 4, 12288,
+ 6, 1, 2, 12288, 1, 12287, 12286, 12284, 12287, 1,
+ 3, 12284, 0, 0, 6, 12286, 7, 5, 2, 3,
+ 12285, 12287, 12285, 2, 3, 12283, 2, 12284, 12288, 3,
+ 12288, 1, 4, 12287, 2, 12288, 12288, 1, 12286, 12284,
+ 2, 1, 5, 12286, 0, 12288, 0, 0, 0, 12287,
+ 1, 0, 3, 0, 0, 6, 2, 12283, 1, 3,
+ 3, 12284, 3, 1, 12286, 2, 12288, 0, 6, 1,
+ 1, 12285, 12287, 12288, 4, 2, 12288, 3, 12286, 12288,
+ 12287, 3, 3, 2, 7, 4, 12287, 12286, 12287, 2,
+ 2, 12287, 1, 12288, 1, 12287, 12283, 12287, 12288, 1,
+ 12283, 0, 12286, 12288, 4, 12287, 12286, 12286, 2, 2,
+ 12287, 5, 12288, 4, 0, 12287, 1, 3, 12286, 2,
+ 1, 1, 12288, 12287, 5, 12288, 0, 0, 1, 0,
+ 12286, 6, 2, 1, 2, 5, 12286, 6, 12286, 12288,
+ 0, 12286, 3, 12283, 12288, 12284, 0, 7, 2, 6,
+ 1, 12288, 12285, 12284, 1, 0, 0, 2, 12288, 12288,
+ 12288, 3, 3, 1, 3, 12286, 4, 3, 12284, 4,
+ 1, 12287, 12287, 12285, 0, 12287, 12287, 12287, 12286, 12288,
+ 1, 12287, 1, 0, 12288, 2, 0, 4, 0, 12287,
+ 12285, 12285, 5, 3, 12282, 0, 12287, 5, 12287, 1,
+ 12283, 12288, 12288, 3, 1, 1, 3, 12288, 12283, 5,
+ 12288, 12288, 5, 5, 1, 12286, 12286, 12288, 1, 2,
+ 1, 3, 12287, 12288, 12284, 12287, 1, 12287, 0, 12286,
+ 12285, 1, 12287, 12282, 12286, 12287, 0, 12285, 4, 2,
+ 1, 12282, 0, 1, 12288, 12285, 12284, 12286, 12286, 12287,
+ 12288, 1, 12288, 4, 12287, 4, 12287, 12287, 0, 1,
+ 12287, 3, 1, 12286, 12286, 4, 6, 12288, 1, 12285,
+ 12286, 12287, 0, 12287, 12287, 1, 12286, 5, 0, 2,
+ 12283, 12284, 1, 12286, 0, 12287, 12286, 12288, 1, 4,
+ 4, 12283, 2, 6, 1, 12288, 12286, 2, 7, 2,
+ 1, 12288, 5, 12284, 12288, 12288, 1, 7, 3, 12283,
+ 1, 12286, 2, 12288, 12287, 1, 12286, 1, 12286, 12288,
+ 12287, 3, 2, 2, 0, 12284, 12287, 1, 1, 12284,
+ 12286, 1, 2, 1, 0, 12285, 1, 0, 1, 2,
+ 2, 4, 12288, 1, 12288, 5, 0, 12287, 12288, 2,
+ 0, 12288, 12287, 0, 12288, 12288, 0, 0, 12285, 4,
+ 2, 12288, 0, 2, 0, 12288, 1, 3, 12287, 12288,
+ 12288, 12288, 12286, 0, 12285, 12286, 12287, 3, 0, 12286,
+ 2, 1, 12285, 2, 12288, 0, 5, 0, 1, 12288,
+ 12288, 4, 3, 3, 12286, 2, 12288, 4, 12288, 6,
+ 2, 12286, 4, 12287, 2, 12287, 0, 12284, 12288, 0,
+ 12286, 12288, 3, 4, 12286, 12288, 1, 3, 12286, 3,
+ 4, 1, 1, 6, 3, 1, 1, 0, 12288, 4,
+ 0, 12288, 0, 0, 0, 12288, 2, 4, 2, 12287,
+ 0, 0, 3, 2, 3, 4, 0, 3, 2, 12288,
+ 2, 4, 6, 12286, 12284, 12287, 1, 0, 0, 4,
+ 1, 3, 12282, 1, 2, 2, 0, 3, 12282, 2,
+ 12287, 2, 12288, 4, 12288, 3, 3, 12283, 12288, 12288,
+ 12286, 12287, 5, 4, 3, 3, 12288, 12284, 2, 2,
+ 0, 12288, 1, 3, 3, 4, 12284, 12288, 0, 1,
+ 12284, 0, 12286, 12287, 0, 0, 12287, 0, 1, 6,
+ 12288, 1, 12284, 12287, 12282, 12288, 4, 12287, 1, 12286,
+ 1, 12286, 12286, 1, 4, 0, 12288, 1, 12288, 1,
+ 12285, 3, 1, 0, 1, 0, 12288, 12287, 2, 2,
+ 0, 12288, 3, 12284, 2, 12288, 12288, 12288, 12287, 3,
+ 3, 0, 12286, 12286, 1, 2, 12286, 12287, 0, 1,
+ 12288, 12287, 12287, 12288, 12288, 1, 9, 1, 12288, 12287,
+ 2, 1, 1, 0, 12287, 12287, 2, 2, 12288, 12285,
+ 1, 12287, 4, 0, 2, 1, 1, 3, 12284, 12286,
+ 1, 2, 12288, 12287, 4, 1, 12285, 0, 1, 2,
+ 12288, 1, 3, 0, 12286, 0, 12288, 12286, 12287, 12286,
+ 1, 12284, 1, 2, 2, 12288, 0, 12288, 1, 12284,
+ 2, 3, 12287, 1, 12285, 12288, 0, 1, 12284, 2,
+ 12288, 12286, 12286, 3, 12288, 12282, 3, 12287, 12288, 12287,
+ 4, 12287, 1, 2, 9, 12283, 12286, 12286, 0, 4,
+ 12288, 12288, 4, 0, 1, 1, 2, 12284, 1, 1,
+ 0, 12288, 1, 0, 12287, 1, 1, 5, 2, 1,
+ 12288, 3, 12287, 5, 4, 1, 4, 12287, 12285, 3,
+ 12286, 1, 3, 0, 12287, 0, 12286, 12287, 12287, 12287,
+ 3, 2, 12286, 12284, 2, 12288, 1, 1, 12288, 3,
+ 1, 3, 12284, 3, 12282, 12288, 3, 0, 2, 12288,
+ 0, 5, 0, 2, 0, 12281, 12285, 4, 3, 4,
+ 2, 12284, 0, 0, 2, 2, 12287, 12284, 2, 12286,
+ 1, 12288, 1, 12286, 12286, 12287, 4, 0, 6, 3,
+ 0, 3, 12288, 12288, 12288, 12287, 3, 1, 1, 1,
+ 2, 12287, 12284, 3, 12286, 12280, 3, 12284, 12287, 12288,
+ 5, 12288, 12284, 2, 12285, 4, 3, 12286, 6, 2,
+ 1, 12287, 0, 1, 2, 12286, 1, 0, 12287, 0,
+ 1, 1, 12286, 2, 12285, 0, 1, 12288, 0, 1,
+ 12288, 1, 12288, 12287, 12287, 12285, 12282, 12288, 2, 12288,
+ 2, 12284, 1, 12284, 12287, 12286, 12288, 0, 12288, 1,
+ 12283, 12286, 5, 3, 0, 12286, 12286, 3, 1, 0,
+ 1, 12288, 12288, 4, 1, 12286, 12287, 12285, 2, 0,
+ 2, 12287, 1, 12285, 12288, 12286, 12288, 2, 2, 12285,
+ 3, 12286, 12285, 12287 }
+ },
+ { 0x00, 0x01, /* polynomial e */
+ { 0x46, 0xf0, 0xf6, 0xef, 0xee, 0x15, 0xc8, 0xf1, 0xb1, 0x98,
+ 0xcb, 0x49, 0xd9, 0x2b, 0x99, 0x08, 0x67, 0x90, 0x51, 0x59,
+ 0x44, 0x0c, 0xc7, 0x23, 0x91, 0x6d, 0xc0, 0x01, 0x28, 0x26,
+ 0x98, 0x10, 0x39, 0xce, 0x17, 0x66, 0xaa, 0x25, 0x42, 0xb0,
+ 0x5d, 0xb3, 0xbd, 0x80, 0x9a, 0xb1, 0x42, 0x48, 0x9d, 0x5d,
+ 0xbf, 0xe1, 0x27, 0x3e, 0x73, 0x99, 0x63, 0x7b, 0x4b, 0x32,
+ 0x13, 0x76, 0x8a, 0xaa },
+ { 12283, 1, 12288, 4, 0, 12285, 5, 1, 1, 2,
+ 3, 4, 12288, 0, 3, 1, 1, 0, 12286, 6,
+ 1, 0, 1, 0, 4, 2, 12288, 3, 0, 5,
+ 1, 5, 2, 12285, 4, 12288, 3, 2, 12288, 2,
+ 12288, 12285, 12287, 6, 12282, 1, 12286, 7, 12287, 4,
+ 2, 2, 12288, 12285, 0, 2, 0, 12288, 1, 12287,
+ 12287, 2, 1, 2, 1, 12285, 12288, 12286, 1, 2,
+ 12287, 12288, 12288, 1, 0, 12287, 0, 4, 2, 6,
+ 12287, 12285, 12283, 12285, 5, 12283, 12286, 1, 12283, 2,
+ 3, 12286, 12285, 2, 5, 12286, 3, 0, 3, 12286,
+ 5, 12285, 12287, 12288, 1, 5, 3, 5, 1, 1,
+ 1, 12288, 5, 0, 12288, 3, 2, 12288, 12285, 12288,
+ 5, 6, 0, 2, 1, 12287, 12288, 12287, 3, 12284,
+ 2, 0, 3, 0, 0, 12288, 0, 2, 2, 2,
+ 0, 1, 2, 2, 0, 0, 12287, 12285, 0, 4,
+ 1, 12283, 3, 5, 12288, 12286, 12287, 6, 2, 0,
+ 0, 12287, 2, 2, 12288, 0, 2, 12288, 12287, 12288,
+ 12288, 1, 12288, 1, 12288, 2, 4, 2, 1, 1,
+ 0, 12287, 3, 2, 6, 2, 1, 12288, 12285, 6,
+ 0, 1, 12284, 12287, 12287, 12286, 5, 4, 0, 5,
+ 12287, 12286, 12288, 12286, 0, 3, 1, 12287, 12287, 12288,
+ 12288, 12286, 1, 0, 3, 12287, 3, 1, 12283, 1,
+ 12288, 5, 1, 4, 12286, 12287, 2, 0, 0, 0,
+ 12281, 12286, 0, 8, 5, 0, 4, 0, 12287, 5,
+ 1, 3, 2, 12286, 12286, 12288, 12285, 12285, 12287, 0,
+ 12284, 12287, 1, 0, 2, 1, 12286, 12288, 2, 12285,
+ 0, 0, 0, 1, 0, 6, 1, 12288, 12287, 12287,
+ 0, 3, 12288, 12288, 12287, 0, 12287, 1, 3, 0,
+ 0, 12286, 12286, 4, 4, 12287, 1, 3, 4, 12287,
+ 12284, 2, 12288, 12286, 12283, 12285, 1, 3, 1, 12288,
+ 0, 3, 3, 12284, 12285, 5, 3, 12288, 3, 4,
+ 3, 1, 12288, 0, 12288, 1, 0, 0, 3, 0,
+ 3, 2, 12287, 12288, 0, 12288, 0, 2, 12285, 4,
+ 0, 12287, 12287, 1, 1, 1, 12287, 12285, 4, 12282,
+ 3, 1, 1, 12288, 2, 4, 12285, 12286, 3, 1,
+ 0, 12287, 12283, 12285, 2, 5, 1, 1, 12288, 12288,
+ 0, 8, 3, 12287, 12285, 12287, 12286, 12284, 1, 12286,
+ 1, 12288, 2, 3, 12288, 12288, 2, 12288, 12284, 12285,
+ 0, 3, 12288, 12288, 2, 3, 7, 12287, 3, 3,
+ 3, 12284, 0, 0, 1, 12283, 5, 0, 1, 12288,
+ 3, 12286, 12287, 12286, 0, 0, 12287, 12283, 4, 12283,
+ 0, 0, 3, 12285, 5, 12286, 12282, 12288, 1, 12287,
+ 12288, 1, 5, 2, 12287, 2, 12288, 7, 12288, 3,
+ 5, 1, 0, 12287, 1, 12287, 3, 2, 4, 2,
+ 12287, 12286, 12288, 2, 5, 1, 12286, 4, 0, 2,
+ 6, 12286, 2, 12286, 3, 12288, 5, 12285, 0, 2,
+ 12287, 5, 12286, 12284, 7, 12285, 12286, 12284, 12287, 1,
+ 12288, 12284, 12286, 2, 4, 2, 2, 12283, 12286, 2,
+ 2, 12283, 1, 12286, 1, 0, 12284, 3, 0, 4,
+ 1, 0, 4, 12288, 0, 12287, 12287, 12287, 12286, 12284,
+ 12288, 3, 1, 12285, 0, 3, 8, 4, 2, 12288,
+ 3, 12287, 12287, 2, 3, 12288, 12286, 2, 12286, 12288,
+ 0, 1, 12287, 12285, 0, 12285, 12288, 12287, 1, 12287,
+ 0, 12284, 0, 1, 1, 12285, 0, 0, 0, 12287,
+ 12287, 3, 0, 4, 12288, 1, 12288, 12285, 12283, 0,
+ 12286, 12286, 12285, 12285, 12287, 1, 0, 2, 3, 1,
+ 2, 12286, 12288, 3, 12286, 12288, 12288, 6, 2, 2,
+ 0, 12288, 2, 5, 12288, 0, 12284, 12282, 12286, 1,
+ 12288, 12288, 12286, 12288, 3, 12286, 2, 0, 12283, 0,
+ 4, 2, 12288, 0, 12286, 0, 4, 3, 12286, 12287,
+ 4, 12288, 3, 2, 12283, 1, 1, 1, 3, 12286,
+ 4, 0, 12288, 12285, 12287, 0, 0, 12286, 4, 0,
+ 12286, 2, 12288, 12288, 12285, 12283, 5, 3, 12286, 12288,
+ 4, 1, 12283, 0, 12288, 0, 12287, 12287, 0, 3,
+ 12287, 12287, 2, 2, 3, 0, 1, 4, 12288, 3,
+ 3, 0, 12284, 12285, 4, 12288, 1, 12287, 0, 1,
+ 12283, 1, 12284, 12287, 12286, 12285, 0, 0, 3, 12285,
+ 3, 1, 12288, 12287, 12284, 12282, 5, 3, 3, 2,
+ 12285, 4, 12288, 0, 3, 12288, 4, 0, 12283, 12288,
+ 2, 12285, 12288, 12282, 0, 2, 12285, 3, 1, 12284,
+ 1, 5, 7, 12286, 5, 12285, 1, 2, 0, 4,
+ 12283, 12287, 12286, 2, 12280, 12287, 12288, 2, 12285, 12286,
+ 2, 1, 2, 1, 2, 2, 3, 3, 0, 0,
+ 4, 2, 12288, 12286, 4, 0, 1, 12288, 2, 12287,
+ 12288, 12288, 1, 3, 12283, 12288, 1, 12287, 1, 1,
+ 3, 12288, 12288, 1, 2, 1, 1, 12283, 7, 12286,
+ 12288, 1, 12288, 12287, 12284, 7, 2, 12285, 12286, 0,
+ 0, 0, 2, 4, 12288, 0, 12284, 12285, 12286, 2,
+ 12284, 2, 4, 6, 3, 12287, 12288, 12285, 1, 2,
+ 12286, 0, 0, 12287, 12288, 0, 12286, 2, 1, 1,
+ 1, 3, 1, 12285, 4, 0, 12287, 12288, 12287, 0,
+ 12288, 12287, 12288, 12287, 12288, 12288, 0, 12287, 12284, 0,
+ 12288, 12285, 3, 2, 4, 2, 12284, 3, 1, 3,
+ 4, 12288, 12285, 12284, 12287, 1, 4, 0, 2, 12288,
+ 4, 12288, 12287, 3, 1, 0, 0, 12284, 12287, 2,
+ 4, 12287, 2, 12288, 0, 2, 2, 3, 12287, 12286,
+ 8, 12286, 12285, 0, 12285, 2, 3, 5, 12287, 12288,
+ 6, 12288, 12284, 0, 0, 3, 1, 2, 12284, 2,
+ 1, 3, 2, 0, 0, 12288, 12287, 12288, 1, 12288,
+ 4, 3, 12284, 1, 3, 12288, 12283, 12288, 1, 1,
+ 2, 1, 1, 3, 1, 12288, 0, 12288, 2, 0,
+ 0, 12284, 12283, 3, 12288, 0, 2, 12287, 0, 0,
+ 12286, 12286, 0, 0, 2, 4, 12288, 1, 2, 3,
+ 2, 12286, 12286, 1, 2, 4, 12288, 12288, 12284, 12287,
+ 6, 2, 12288, 12286, 0, 0, 3, 12286, 12288, 12287,
+ 12286, 12287, 3, 1, 12286, 0, 4, 3, 12286, 5,
+ 2, 1, 12287, 12286, 4, 12287, 0, 5, 12288, 0,
+ 12288, 2, 2, 1, 1, 0, 0, 12288, 12288, 12288,
+ 0, 0, 12288, 12287, 5, 1, 12288, 1, 10, 1,
+ 0, 0, 2, 2, 2, 0, 12288, 4, 2, 12283,
+ 3, 1, 1, 12285, 2, 12285, 5, 7, 5, 12288,
+ 0, 12287, 5, 1, 12288, 12286, 12287, 0, 0, 0,
+ 12287, 1, 3, 12288 }
+ },
+ { 0x01, 0x00, /* polynomial s' */
+ { 0x3a, 0xeb, 0x52, 0x24, 0xec, 0xf8, 0x49, 0x92, 0x9b, 0x9d,
+ 0x82, 0x8d, 0xb1, 0xce, 0xd4, 0xdd, 0x83, 0x20, 0x25, 0xe8,
+ 0x01, 0x8b, 0x81, 0x60, 0xb8, 0x22, 0x84, 0xf3, 0xc9, 0x49,
+ 0xaa, 0x5a, 0x8e, 0xca, 0x00, 0xbb, 0xb4, 0xa7, 0x3b, 0xda,
+ 0xd1, 0x92, 0xb5, 0xc4, 0x2f, 0x73, 0xf2, 0xfd, 0x4e, 0x27,
+ 0x36, 0x44, 0xc8, 0xb3, 0x61, 0x25, 0xa6, 0x4a, 0xdd, 0xeb,
+ 0x00, 0x6c, 0x13, 0xa0 },
+ { 5, 4, 4, 12288, 12286, 1, 12287, 12288, 2, 12288,
+ 12288, 12287, 2, 2, 12284, 12288, 12288, 3, 2, 3,
+ 12287, 2, 2, 0, 0, 2, 5, 12285, 5, 12287,
+ 2, 12282, 12286, 2, 1, 2, 1, 1, 12288, 12285,
+ 12287, 12286, 2, 0, 0, 12285, 0, 0, 12287, 12286,
+ 12285, 12286, 2, 12288, 12288, 0, 1, 2, 12286, 2,
+ 1, 0, 0, 2, 1, 12288, 1, 12287, 1, 0,
+ 0, 2, 12285, 2, 2, 12288, 12286, 3, 12287, 0,
+ 1, 1, 0, 2, 12287, 2, 1, 2, 3, 0,
+ 0, 1, 12288, 12288, 2, 12287, 12286, 12286, 6, 12288,
+ 0, 0, 4, 0, 12286, 0, 4, 12288, 12288, 5,
+ 12287, 12288, 12285, 2, 12285, 12288, 1, 0, 2, 12288,
+ 12286, 1, 3, 12285, 2, 2, 1, 1, 12288, 12288,
+ 12287, 1, 12288, 3, 0, 12285, 4, 12285, 12287, 2,
+ 2, 12287, 12287, 12286, 12288, 12284, 2, 12286, 4, 1,
+ 0, 12286, 12284, 3, 12286, 3, 12286, 3, 4, 1,
+ 12288, 12282, 2, 2, 12284, 0, 12286, 12283, 3, 0,
+ 4, 2, 4, 2, 12285, 10, 12288, 8, 3, 2,
+ 2, 0, 1, 0, 0, 12286, 2, 12284, 4, 1,
+ 12287, 12287, 1, 1, 12286, 1, 0, 12285, 12288, 12286,
+ 12287, 2, 1, 12284, 12288, 12285, 12285, 3, 0, 1,
+ 4, 4, 1, 0, 2, 1, 12288, 1, 12287, 0,
+ 12286, 4, 2, 3, 3, 12285, 12288, 12288, 5, 2,
+ 0, 4, 3, 12287, 12287, 5, 2, 3, 12284, 0,
+ 8, 1, 1, 0, 5, 12288, 12288, 12288, 12286, 6,
+ 3, 12288, 12286, 12287, 4, 12288, 2, 12288, 12284, 12287,
+ 4, 12288, 0, 0, 3, 0, 4, 4, 12287, 0,
+ 3, 0, 12285, 12287, 12288, 12288, 0, 0, 12287, 12288,
+ 12286, 0, 0, 12285, 12288, 4, 12287, 1, 2, 12288,
+ 12285, 5, 4, 12283, 2, 0, 12288, 2, 0, 0,
+ 12286, 12284, 3, 3, 3, 12287, 1, 1, 0, 1,
+ 3, 12288, 4, 4, 0, 2, 0, 1, 12286, 12284,
+ 2, 2, 12287, 3, 2, 12288, 3, 12286, 2, 12286,
+ 12288, 4, 3, 12288, 2, 12288, 2, 1, 12288, 12288,
+ 7, 12288, 12288, 0, 12288, 1, 12284, 12288, 12288, 12287,
+ 12287, 1, 12285, 12287, 12287, 1, 0, 2, 12286, 3,
+ 12288, 12288, 12287, 3, 5, 0, 0, 12287, 2, 12287,
+ 12288, 8, 12287, 1, 2, 12288, 12284, 3, 0, 12287,
+ 12284, 3, 0, 2, 1, 3, 4, 12287, 12286, 12288,
+ 12286, 0, 0, 12287, 12285, 0, 12286, 2, 1, 12287,
+ 12288, 5, 12287, 12287, 12286, 2, 12283, 0, 0, 12286,
+ 2, 12284, 5, 0, 1, 12287, 0, 3, 1, 12285,
+ 12288, 0, 3, 12287, 2, 12286, 0, 1, 12288, 1,
+ 12284, 12281, 12284, 12288, 12285, 2, 5, 4, 12286, 0,
+ 12287, 12288, 12286, 12285, 3, 12282, 1, 12287, 2, 0,
+ 6, 12288, 4, 12286, 3, 12288, 12286, 12284, 3, 1,
+ 6, 3, 2, 1, 2, 1, 1, 12288, 12287, 1,
+ 3, 3, 1, 0, 0, 12288, 3, 12284, 12285, 12284,
+ 1, 3, 12286, 0, 1, 12285, 12287, 1, 12285, 2,
+ 0, 1, 12287, 1, 4, 3, 1, 12287, 0, 5,
+ 1, 12288, 2, 1, 1, 4, 3, 12286, 3, 3,
+ 2, 12287, 3, 12286, 0, 12288, 12285, 2, 3, 12286,
+ 0, 12287, 5, 4, 1, 1, 12287, 12288, 2, 0,
+ 0, 0, 2, 0, 12286, 4, 12288, 12288, 12285, 12286,
+ 2, 12288, 12288, 0, 12288, 12286, 12284, 12287, 1, 5,
+ 0, 12285, 12287, 2, 4, 3, 12285, 12287, 12288, 0,
+ 12288, 12287, 12286, 2, 12288, 12286, 12284, 1, 2, 12287,
+ 4, 1, 4, 4, 12284, 2, 0, 12288, 3, 1,
+ 0, 4, 1, 6, 0, 12286, 12288, 12287, 12287, 0,
+ 12284, 12285, 2, 12286, 1, 0, 3, 12288, 1, 2,
+ 12284, 12286, 12285, 12283, 12285, 0, 12285, 2, 0, 2,
+ 1, 3, 1, 12286, 12288, 1, 4, 0, 0, 12287,
+ 12287, 12286, 0, 1, 12286, 0, 2, 12288, 2, 12287,
+ 0, 0, 12286, 12287, 4, 6, 12286, 0, 12288, 0,
+ 0, 12287, 2, 3, 4, 1, 3, 12286, 4, 0,
+ 12288, 12286, 12287, 12287, 12288, 4, 12285, 1, 12286, 12286,
+ 2, 12288, 0, 0, 1, 5, 12285, 1, 12281, 3,
+ 12281, 2, 3, 0, 12284, 12288, 5, 0, 0, 12288,
+ 0, 0, 12288, 12286, 3, 12287, 0, 2, 12288, 0,
+ 3, 12288, 12286, 0, 12286, 12287, 12284, 0, 12286, 1,
+ 12287, 12282, 12287, 12288, 0, 5, 12288, 2, 1, 12288,
+ 1, 12285, 5, 2, 12286, 12285, 12287, 0, 2, 12288,
+ 1, 12288, 1, 12286, 0, 2, 12287, 12287, 6, 12286,
+ 12288, 0, 12286, 4, 6, 12287, 12287, 2, 2, 12285,
+ 1, 12288, 12285, 12286, 5, 12288, 1, 2, 1, 7,
+ 12286, 5, 12288, 12287, 12286, 12284, 1, 2, 12287, 4,
+ 1, 1, 0, 1, 2, 12285, 2, 12288, 12284, 1,
+ 1, 12287, 12286, 12285, 12287, 1, 12287, 3, 1, 12286,
+ 0, 12286, 3, 3, 12288, 2, 12288, 5, 12288, 1,
+ 2, 0, 12287, 1, 12287, 7, 2, 3, 0, 12287,
+ 2, 12284, 12284, 12281, 12286, 12285, 12287, 12287, 0, 12288,
+ 3, 4, 3, 2, 3, 1, 12288, 12286, 0, 12288,
+ 12286, 1, 12286, 6, 12287, 1, 6, 5, 3, 1,
+ 12286, 2, 1, 3, 1, 12286, 12285, 3, 2, 0,
+ 0, 12284, 1, 1, 3, 3, 1, 1, 12288, 0,
+ 12284, 1, 12288, 0, 0, 12287, 0, 4, 12285, 0,
+ 4, 12283, 1, 1, 0, 12285, 0, 12286, 0, 0,
+ 1, 0, 12286, 0, 12288, 3, 4, 0, 2, 1,
+ 12287, 2, 12288, 1, 0, 12288, 0, 12288, 6, 12288,
+ 12287, 12286, 3, 12284, 0, 12288, 12284, 12286, 12287, 12288,
+ 12288, 12288, 4, 0, 2, 6, 12286, 1, 4, 12288,
+ 2, 1, 0, 5, 2, 1, 12285, 0, 0, 12285,
+ 4, 12286, 5, 1, 3, 2, 12287, 2, 0, 2,
+ 7, 12283, 12288, 12288, 3, 0, 3, 12288, 3, 12286,
+ 12288, 12287, 12288, 3, 0, 2, 4, 1, 12284, 2,
+ 12288, 12286, 12287, 1, 1, 12288, 0, 12288, 12283, 6,
+ 2, 1, 12288, 3, 12287, 12288, 1, 1, 12285, 0,
+ 12286, 12287, 12288, 1, 2, 12287, 0, 4, 0, 12286,
+ 2, 1, 12288, 12285, 12287, 0, 2, 12287, 6, 2,
+ 0, 12287, 12288, 2, 12288, 12284, 12288, 12285, 4, 1,
+ 12288, 12284, 12287, 4, 12284, 1, 3, 12284, 12282, 0,
+ 12286, 12287, 2, 12286, 3, 4, 2, 12288, 3, 3,
+ 1, 3, 12287, 12283 }
+ },
+ { 0x01, 0x01, /* polynomial e' */
+ { 0x58, 0xd8, 0x6a, 0xcd, 0xe2, 0x79, 0x61, 0x98, 0xfd, 0xea,
+ 0xcf, 0x2a, 0xc0, 0xfd, 0xf0, 0x72, 0x86, 0x32, 0xdc, 0xe9,
+ 0xc6, 0x45, 0x81, 0x80, 0x67, 0x06, 0x72, 0x28, 0xa6, 0xfe,
+ 0x41, 0x2b, 0x78, 0x88, 0x58, 0x6d, 0x58, 0x47, 0x3e, 0xb7,
+ 0x46, 0x60, 0xd8, 0x2f, 0xa0, 0x83, 0xe4, 0xbc, 0x81, 0xdd,
+ 0xc6, 0x29, 0x8b, 0xee, 0xf9, 0xec, 0x90, 0x39, 0x9d, 0x46,
+ 0xbf, 0x2d, 0x7c, 0xdf },
+ { 12287, 3, 3, 1, 12285, 4, 1, 5, 12287, 12285,
+ 12285, 12285, 1, 12288, 12287, 12288, 2, 3, 12283, 12288,
+ 12285, 0, 0, 12286, 12287, 12288, 12288, 12288, 12288, 1,
+ 12288, 2, 2, 5, 5, 0, 12287, 12286, 3, 3,
+ 2, 2, 1, 0, 2, 12287, 12285, 3, 1, 3,
+ 5, 2, 12287, 12287, 2, 0, 4, 2, 0, 0,
+ 1, 5, 12288, 6, 4, 12287, 1, 0, 12283, 0,
+ 1, 12286, 2, 0, 2, 1, 12284, 12282, 0, 6,
+ 1, 2, 5, 12288, 6, 12288, 12284, 2, 1, 2,
+ 12288, 12283, 12288, 3, 12288, 12288, 2, 12286, 12283, 1,
+ 12285, 0, 0, 12286, 12288, 12286, 12288, 12286, 4, 0,
+ 1, 12285, 3, 1, 2, 12285, 12287, 12284, 12287, 12285,
+ 12286, 1, 12288, 3, 5, 5, 3, 12285, 12286, 12288,
+ 0, 1, 12287, 12284, 2, 4, 12288, 12287, 0, 12288,
+ 12288, 12285, 12288, 12284, 3, 0, 2, 0, 2, 0,
+ 1, 1, 1, 12287, 1, 12284, 12285, 0, 12284, 1,
+ 12284, 2, 12288, 5, 4, 1, 1, 12284, 1, 3,
+ 2, 6, 3, 2, 3, 12284, 0, 0, 4, 2,
+ 6, 2, 2, 2, 6, 12288, 0, 1, 12286, 1,
+ 5, 1, 12283, 2, 0, 12284, 1, 12286, 4, 1,
+ 2, 4, 6, 12288, 12288, 12284, 1, 0, 3, 12286,
+ 1, 0, 3, 12288, 12287, 2, 2, 0, 12285, 12286,
+ 0, 12288, 4, 2, 12282, 12287, 1, 12288, 12287, 12286,
+ 12284, 1, 4, 2, 7, 12288, 12283, 12288, 5, 12288,
+ 12288, 12287, 3, 2, 12287, 5, 12287, 12286, 12288, 12287,
+ 0, 12282, 12288, 12288, 0, 3, 12287, 2, 12287, 12284,
+ 6, 12285, 2, 3, 3, 12284, 2, 4, 12286, 5,
+ 0, 2, 12287, 3, 0, 12284, 12286, 0, 2, 12286,
+ 12287, 3, 1, 4, 1, 12286, 12288, 1, 2, 0,
+ 12285, 12287, 2, 0, 0, 0, 3, 12286, 12287, 2,
+ 0, 0, 0, 12286, 4, 1, 12287, 0, 0, 2,
+ 5, 0, 12284, 1, 1, 12288, 2, 12286, 12288, 2,
+ 2, 12282, 1, 12286, 4, 12286, 3, 12287, 12287, 12286,
+ 5, 5, 0, 12288, 3, 12285, 1, 12287, 7, 12286,
+ 2, 12287, 1, 12285, 2, 12287, 12288, 0, 4, 12281,
+ 0, 12286, 3, 1, 12285, 2, 2, 12285, 5, 0,
+ 12285, 2, 12288, 1, 3, 12287, 1, 12288, 1, 5,
+ 12287, 1, 0, 3, 2, 12286, 12286, 12288, 3, 0,
+ 12287, 12288, 0, 12286, 12285, 0, 12286, 12288, 3, 12287,
+ 12288, 2, 6, 0, 2, 12285, 1, 1, 7, 7,
+ 12284, 12284, 5, 0, 12288, 12288, 4, 3, 1, 2,
+ 12287, 0, 12288, 12284, 2, 5, 1, 2, 0, 12288,
+ 1, 12284, 2, 3, 0, 12287, 12285, 2, 12288, 12288,
+ 7, 1, 12287, 1, 12286, 2, 3, 4, 12288, 12288,
+ 12286, 12286, 3, 12288, 1, 12286, 12286, 0, 12283, 12288,
+ 2, 0, 7, 2, 12287, 0, 0, 12286, 4, 1,
+ 12288, 12288, 1, 2, 12287, 12282, 3, 5, 0, 12288,
+ 12288, 12286, 12286, 12286, 4, 2, 0, 1, 12284, 3,
+ 12283, 5, 12287, 2, 2, 12288, 1, 12284, 1, 0,
+ 1, 3, 12288, 2, 12287, 1, 12286, 12288, 0, 12287,
+ 12288, 2, 2, 12286, 0, 12287, 12288, 12284, 0, 2,
+ 2, 2, 1, 3, 12285, 12285, 1, 12285, 2, 6,
+ 2, 0, 12288, 0, 0, 3, 2, 12287, 1, 12286,
+ 0, 12287, 0, 1, 12285, 12287, 6, 12288, 2, 0,
+ 12286, 2, 4, 12288, 2, 5, 12285, 12286, 0, 12284,
+ 12288, 3, 3, 3, 12287, 4, 2, 0, 12283, 2,
+ 12287, 0, 1, 12287, 2, 12288, 12287, 3, 2, 7,
+ 7, 1, 12287, 12288, 2, 6, 1, 3, 2, 0,
+ 2, 2, 3, 12288, 3, 4, 2, 0, 5, 12285,
+ 3, 12285, 3, 12285, 1, 1, 12287, 12285, 2, 12285,
+ 5, 0, 7, 2, 12284, 0, 12285, 7, 1, 12288,
+ 12288, 0, 12288, 12287, 5, 0, 2, 0, 2, 12286,
+ 1, 12286, 0, 12286, 12285, 4, 12286, 2, 12288, 12287,
+ 12287, 1, 12286, 12287, 12287, 12286, 12287, 12288, 6, 5,
+ 2, 5, 12283, 12286, 12286, 12288, 1, 0, 3, 12286,
+ 5, 0, 12287, 12288, 12288, 12287, 12286, 2, 1, 0,
+ 1, 2, 3, 1, 12286, 2, 1, 6, 12288, 1,
+ 12286, 1, 12288, 0, 1, 0, 12283, 0, 2, 12288,
+ 3, 1, 12287, 12288, 4, 0, 3, 12286, 0, 1,
+ 12283, 4, 1, 4, 12287, 5, 0, 12287, 12288, 3,
+ 3, 12282, 1, 4, 2, 3, 0, 2, 6, 12282,
+ 12285, 12288, 12287, 12288, 2, 12285, 1, 0, 12287, 12288,
+ 12286, 0, 0, 4, 12288, 12287, 1, 0, 2, 5,
+ 2, 12287, 1, 7, 12284, 0, 12287, 12286, 2, 1,
+ 12287, 0, 1, 12284, 12287, 12287, 12285, 12285, 3, 12282,
+ 12286, 1, 1, 12288, 12282, 12287, 1, 1, 2, 2,
+ 3, 1, 12287, 5, 12282, 0, 0, 12287, 1, 3,
+ 12288, 3, 12285, 12286, 2, 0, 12288, 12288, 5, 12285,
+ 4, 12288, 12287, 0, 1, 4, 1, 2, 12288, 0,
+ 2, 1, 12288, 4, 6, 12288, 1, 12287, 4, 1,
+ 12285, 12288, 3, 0, 12288, 12285, 2, 0, 12286, 2,
+ 1, 12288, 1, 12288, 12284, 3, 0, 2, 2, 12288,
+ 12287, 12286, 4, 12288, 2, 0, 0, 3, 4, 0,
+ 12288, 12282, 6, 2, 12283, 12287, 2, 6, 1, 2,
+ 12288, 2, 12283, 3, 12287, 3, 4, 0, 0, 12285,
+ 0, 12288, 12287, 12284, 12286, 3, 1, 12286, 2, 0,
+ 12287, 12286, 12286, 12288, 5, 2, 12288, 12286, 0, 12287,
+ 0, 3, 2, 12287, 12286, 0, 1, 12287, 2, 0,
+ 12286, 5, 12285, 12288, 12288, 12288, 12286, 4, 1, 12285,
+ 12284, 12288, 12286, 1, 1, 12287, 2, 12286, 3, 2,
+ 12283, 12283, 4, 2, 12283, 5, 0, 1, 0, 5,
+ 12287, 1, 1, 0, 3, 10, 12287, 3, 12288, 12288,
+ 12287, 2, 2, 0, 4, 12288, 12283, 12288, 1, 12287,
+ 3, 0, 0, 1, 12288, 12284, 0, 12286, 12287, 0,
+ 12287, 2, 1, 7, 12288, 12287, 0, 4, 12287, 12286,
+ 3, 4, 12287, 12288, 12285, 12287, 12288, 12285, 12286, 7,
+ 1, 1, 12288, 3, 12287, 3, 1, 4, 2, 5,
+ 12282, 3, 0, 12286, 12288, 0, 12285, 0, 2, 3,
+ 0, 12286, 3, 2, 12285, 0, 0, 12287, 1, 0,
+ 0, 6, 2, 12287, 12284, 7, 5, 0, 1, 6,
+ 2, 4, 1, 12286, 12288, 2, 12287, 3, 4, 12283,
+ 0, 12288, 2, 2, 12286, 0, 2, 2, 12288, 12285,
+ 12287, 12285, 12288, 0 }
+ },
+ { 0x01, 0x02, /* polynomial e'' */
+ { 0x20, 0x37, 0x77, 0x8a, 0x9c, 0x19, 0xde, 0xf0, 0x65, 0x9e,
+ 0x0f, 0xa5, 0xfc, 0x0e, 0x78, 0xfe, 0x55, 0x89, 0xc9, 0x88,
+ 0x41, 0xa2, 0x5a, 0x1e, 0xa4, 0x66, 0xcd, 0x3a, 0x29, 0x42,
+ 0xd1, 0x25, 0xf2, 0x84, 0xd7, 0xee, 0xd5, 0x53, 0x86, 0x5b,
+ 0xa3, 0x93, 0x4e, 0xee, 0xc7, 0x5b, 0xe5, 0x52, 0x68, 0x19,
+ 0xdf, 0x63, 0xfb, 0x91, 0x3d, 0xe9, 0x5d, 0xd6, 0xeb, 0x81,
+ 0x3d, 0xac, 0xf1, 0xad },
+ { 12286, 12286, 1, 12287, 1, 12286, 12287, 12287, 12284, 1,
+ 12287, 2, 12284, 0, 2, 12288, 0, 1, 0, 12285,
+ 12288, 4, 2, 12287, 12282, 12288, 12285, 12288, 2, 12288,
+ 6, 7, 12286, 12286, 1, 4, 12287, 12287, 3, 1,
+ 3, 3, 2, 12285, 0, 1, 12288, 1, 1, 12287,
+ 0, 0, 1, 0, 12287, 12283, 12283, 12288, 12287, 0,
+ 0, 2, 12286, 3, 3, 0, 12286, 12282, 3, 6,
+ 3, 3, 12285, 1, 1, 12288, 1, 0, 12288, 0,
+ 12287, 4, 1, 0, 12285, 12288, 1, 1, 1, 3,
+ 12286, 0, 12288, 0, 12287, 12287, 3, 5, 1, 12287,
+ 12287, 0, 0, 0, 12283, 0, 0, 12288, 0, 12287,
+ 12286, 12284, 12286, 0, 12286, 3, 5, 12287, 0, 12287,
+ 1, 3, 2, 6, 1, 12287, 1, 1, 12285, 4,
+ 12282, 12288, 12288, 3, 2, 12287, 3, 3, 12288, 12286,
+ 2, 5, 12288, 12287, 12288, 3, 0, 12283, 3, 3,
+ 1, 0, 12288, 2, 2, 12287, 12286, 4, 12287, 12288,
+ 0, 0, 12286, 1, 4, 4, 12286, 12287, 4, 12288,
+ 2, 1, 1, 12288, 12287, 3, 12287, 12286, 12285, 12288,
+ 4, 1, 0, 12287, 3, 12286, 12287, 4, 0, 12287,
+ 12286, 12287, 3, 1, 1, 12285, 12287, 0, 12285, 2,
+ 5, 2, 12285, 3, 2, 12285, 12287, 2, 0, 12288,
+ 2, 5, 2, 12283, 1, 1, 0, 12286, 12288, 3,
+ 1, 12286, 12283, 0, 1, 2, 2, 1, 12287, 12287,
+ 4, 4, 1, 0, 0, 12288, 12287, 12284, 12284, 7,
+ 0, 12288, 5, 4, 12288, 12288, 1, 0, 1, 1,
+ 2, 12288, 12288, 5, 1, 0, 12287, 3, 3, 0,
+ 1, 12288, 12288, 3, 12285, 12288, 3, 5, 4, 1,
+ 12285, 12285, 12288, 12285, 12288, 12285, 4, 1, 3, 12285,
+ 4, 0, 12288, 12286, 5, 12287, 12285, 12288, 4, 12288,
+ 0, 12287, 12286, 0, 12286, 12283, 0, 12287, 12284, 1,
+ 12288, 12288, 3, 12286, 1, 2, 12286, 3, 1, 12285,
+ 12286, 12285, 0, 12285, 12288, 0, 2, 12283, 0, 1,
+ 2, 1, 2, 3, 3, 12285, 0, 0, 0, 12288,
+ 12283, 4, 12286, 2, 1, 3, 3, 12284, 2, 4,
+ 3, 12286, 12282, 12286, 0, 12286, 12287, 3, 12288, 12288,
+ 2, 12287, 12286, 3, 0, 12286, 1, 1, 0, 12287,
+ 2, 0, 0, 1, 12286, 1, 0, 12283, 0, 12288,
+ 2, 5, 12288, 12287, 2, 1, 12288, 2, 2, 5,
+ 2, 12286, 12286, 2, 12284, 12287, 0, 12284, 0, 12284,
+ 12286, 12286, 12288, 12287, 12287, 2, 1, 12287, 12287, 1,
+ 5, 0, 0, 12288, 2, 12285, 6, 2, 12288, 12288,
+ 12286, 2, 12285, 0, 0, 0, 12288, 3, 12286, 1,
+ 1, 0, 3, 0, 12286, 12288, 12287, 3, 2, 12287,
+ 12288, 1, 12288, 12282, 2, 0, 12288, 12286, 12285, 12281,
+ 4, 1, 7, 12283, 12287, 12288, 1, 6, 0, 12288,
+ 5, 1, 1, 12286, 12286, 0, 12287, 12285, 12287, 1,
+ 12288, 12286, 12286, 12288, 2, 12287, 12287, 12288, 12286, 12288,
+ 12282, 12284, 12286, 0, 12285, 12285, 3, 12288, 12287, 12288,
+ 2, 0, 2, 0, 12288, 12286, 3, 12288, 12286, 12287,
+ 1, 1, 1, 0, 5, 5, 12285, 12288, 3, 12286,
+ 1, 2, 12285, 1, 4, 12288, 1, 4, 1, 3,
+ 4, 12286, 0, 7, 2, 12288, 2, 12287, 0, 2,
+ 12283, 12286, 0, 12288, 12286, 4, 1, 12284, 7, 12285,
+ 0, 12284, 12287, 0, 0, 3, 4, 12284, 0, 1,
+ 0, 1, 12285, 1, 12286, 12284, 12287, 0, 7, 1,
+ 4, 12282, 12288, 0, 2, 12285, 12288, 12287, 12287, 12283,
+ 0, 1, 3, 12285, 12286, 3, 12288, 12288, 12284, 12286,
+ 12288, 1, 0, 2, 12287, 0, 12286, 4, 12288, 0,
+ 12284, 0, 0, 2, 12286, 0, 0, 12286, 12287, 1,
+ 12288, 0, 12284, 1, 12288, 12288, 1, 1, 12282, 12284,
+ 12288, 12285, 12285, 12288, 1, 12286, 2, 0, 0, 12284,
+ 2, 12288, 0, 0, 12285, 0, 3, 0, 0, 12285,
+ 12286, 5, 3, 12287, 5, 2, 12287, 0, 1, 12286,
+ 12287, 1, 12286, 1, 12288, 0, 0, 12282, 5, 12282,
+ 12287, 12288, 12287, 1, 0, 3, 4, 6, 1, 1,
+ 12287, 12284, 12286, 12287, 12286, 2, 1, 12288, 3, 0,
+ 3, 0, 12286, 1, 0, 12288, 1, 12284, 4, 0,
+ 4, 12288, 1, 4, 1, 12286, 4, 0, 2, 1,
+ 1, 4, 12287, 2, 1, 12288, 4, 3, 2, 12287,
+ 0, 1, 12287, 1, 12285, 12286, 2, 2, 0, 12286,
+ 12287, 0, 12288, 12285, 5, 12288, 0, 0, 12288, 3,
+ 12288, 0, 4, 0, 12288, 12286, 12287, 0, 0, 2,
+ 12283, 0, 12281, 1, 1, 3, 4, 2, 12284, 5,
+ 12288, 2, 3, 4, 12287, 3, 12288, 12287, 12288, 2,
+ 12286, 2, 0, 12286, 12286, 5, 12288, 2, 12288, 7,
+ 12286, 12286, 4, 12288, 12288, 12288, 5, 12287, 7, 12286,
+ 12282, 2, 12284, 0, 12288, 0, 2, 12283, 2, 5,
+ 4, 1, 12288, 12283, 5, 12288, 12288, 0, 0, 0,
+ 6, 1, 12286, 6, 4, 12287, 2, 12288, 12287, 12286,
+ 4, 5, 0, 1, 2, 1, 4, 12286, 1, 2,
+ 1, 1, 0, 12288, 12282, 1, 1, 3, 12284, 12288,
+ 0, 12287, 1, 12286, 12288, 6, 1, 5, 12287, 12285,
+ 2, 12288, 12288, 12284, 0, 12287, 2, 3, 5, 1,
+ 12286, 1, 12287, 0, 12284, 1, 5, 12283, 1, 1,
+ 12287, 12283, 12288, 0, 12287, 3, 0, 12288, 12286, 12287,
+ 8, 0, 0, 12288, 1, 3, 2, 3, 12287, 9,
+ 2, 3, 4, 12288, 3, 0, 12288, 12283, 0, 0,
+ 2, 4, 12287, 2, 12287, 12286, 12287, 2, 12287, 2,
+ 3, 1, 3, 1, 0, 1, 1, 5, 3, 12285,
+ 1, 12281, 12287, 12286, 1, 4, 12287, 12286, 12285, 4,
+ 2, 0, 12288, 12288, 12286, 12287, 12288, 1, 3, 4,
+ 0, 1, 12285, 4, 3, 12284, 1, 12288, 12285, 12288,
+ 0, 12281, 12288, 12285, 12285, 1, 12284, 12286, 12287, 0,
+ 0, 12287, 1, 12282, 4, 4, 12288, 1, 4, 12286,
+ 5, 4, 1, 5, 3, 1, 0, 6, 12288, 0,
+ 12288, 2, 12286, 12287, 6, 0, 12288, 0, 12287, 1,
+ 4, 0, 12282, 4, 1, 12286, 1, 12282, 3, 12285,
+ 12283, 12286, 12288, 4, 12284, 12286, 12286, 0, 12286, 0,
+ 0, 1, 12286, 1, 1, 4, 12284, 0, 3, 2,
+ 12288, 1, 2, 12287, 2, 1, 12288, 0, 1, 2,
+ 12286, 0, 6, 12285, 0, 1, 4, 0, 0, 3,
+ 2, 12287, 12285, 7, 1, 3, 1, 0, 12286, 12288,
+ 0, 12287, 1, 12286 }
+ }
+};
+
+START_TEST(test_newhope_noise_uniform)
+{
+ newhope_noise_t *noise;
+ uint8_t seed_buf[seed_len], *uniform;
+ chunk_t seed = { seed_buf, seed_len };
+
+ memset(seed_buf, 0x00, seed_len - 1);
+ seed_buf[seed_len - 1] = noises[_i].key;
+
+ noise = newhope_noise_create(seed);
+ ck_assert(noise != NULL);
+ uniform = noise->get_uniform_bytes(noise, noises[_i].nonce, 64);
+ ck_assert(uniform != NULL);
+ ck_assert(memeq(uniform, noises[_i].uniform, 64));
+ free(uniform);
+ noise->destroy(noise);
+}
+END_TEST
+
+START_TEST(test_newhope_noise_poly)
+{
+ newhope_noise_t *noise;
+ uint8_t seed_buf[seed_len];
+ uint32_t *poly;
+ int i;
+ chunk_t seed = { seed_buf, seed_len };
+
+ memset(seed_buf, 0x00, seed_len - 1);
+ seed_buf[seed_len - 1] = noises[_i].key;
+
+ noise = newhope_noise_create(seed);
+ ck_assert(noise != NULL);
+ poly = noise->get_binomial_words(noise, noises[_i].nonce, n, q);
+ ck_assert(poly != NULL);
+ for (i = 0; i < n; i++)
+ {
+ ck_assert(poly[i] == noises[_i].poly[i]);
+ }
+ free(poly);
+ noise->destroy(noise);
+}
+END_TEST
+
+static size_t seed_lengths[] = { 0, 1, 31, 33 };
+
+START_TEST(test_newhope_noise_fail)
+{
+ newhope_noise_t *noise;
+ chunk_t seed;
+
+ seed = chunk_alloc(seed_lengths[_i]);
+ memset(seed.ptr, 0x00, seed.len);
+
+ noise = newhope_noise_create(seed);
+ ck_assert(noise == NULL);
+ chunk_free(&seed);
+}
+END_TEST
+
+Suite *newhope_noise_suite_create()
+{
+ Suite *s;
+ TCase *tc;
+
+ s = suite_create("newhope_noise");
+
+ tc = tcase_create("noise_uniform");
+ tcase_add_loop_test(tc, test_newhope_noise_uniform, 0, countof(noises));
+ suite_add_tcase(s, tc);
+
+ tc = tcase_create("noise_poly");
+ tcase_add_loop_test(tc, test_newhope_noise_poly, 0, countof(noises));
+ suite_add_tcase(s, tc);
+
+ tc = tcase_create("noise_fail");
+ tcase_add_loop_test(tc, test_newhope_noise_fail, 0, countof(seed_lengths));
+ suite_add_tcase(s, tc);
+
+ return s;
+}
diff --git a/src/libstrongswan/plugins/newhope/tests/suites/test_newhope_reconciliation.c b/src/libstrongswan/plugins/newhope/tests/suites/test_newhope_reconciliation.c
new file mode 100644
index 000000000..4432e34d6
--- /dev/null
+++ b/src/libstrongswan/plugins/newhope/tests/suites/test_newhope_reconciliation.c
@@ -0,0 +1,344 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+#include "test_suite.h"
+
+#include <newhope_reconciliation.h>
+
+#include <library.h>
+
+static const uint16_t n = 1024;
+static const uint16_t q = 12289;
+
+static uint32_t r_v[] = {
+ 7832, 2714, 1942, 12135, 6869, 11272, 11601, 1783, 9639, 1465,
+ 4603, 8158, 1418, 6162, 3907, 6653, 1091, 3026, 4540, 4797,
+ 2751, 29, 768, 5580, 1304, 5262, 1644, 11294, 12257, 10466,
+ 170, 8458, 7185, 6850, 8790, 11277, 10980, 5507, 10693, 9766,
+ 7230, 3980, 796, 11125, 8042, 9022, 10207, 7577, 5041, 192,
+ 10308, 7905, 8520, 3814, 3372, 11772, 11290, 418, 2744, 4782,
+ 3072, 10921, 10721, 6100, 1021, 7943, 7426, 2142, 6618, 757,
+ 5033, 9336, 9332, 3410, 6613, 11776, 1525, 9567, 5371, 1290,
+ 3685, 11054, 11228, 10703, 70, 11215, 8992, 2855, 2962, 10104,
+ 10083, 8146, 7599, 3428, 4316, 10056, 1245, 9776, 7867, 1381,
+ 6540, 11273, 6626, 3708, 5348, 4521, 3760, 1771, 12037, 2681,
+ 3044, 10226, 5133, 5013, 7851, 7187, 1965, 6776, 223, 3003,
+ 4800, 10128, 9592, 8917, 10664, 7076, 2081, 5621, 2694, 8245,
+ 10979, 929, 10593, 10429, 6890, 6222, 5891, 6633, 12124, 1508,
+ 508, 9650, 2480, 10302, 3958, 4519, 5309, 8675, 6963, 5281,
+ 8265, 4851, 7173, 2537, 1176, 259, 6422, 6782, 1429, 7231,
+ 4948, 8137, 11341, 12090, 5395, 8087, 3098, 6724, 7462, 9973,
+ 149, 7331, 562, 9753, 1227, 768, 7520, 12107, 6199, 6503,
+ 9876, 306, 3876, 1903, 6306, 10288, 10184, 9401, 68, 5246,
+ 630, 10136, 133, 12082, 648, 8537, 3896, 4482, 12011, 5407,
+ 5305, 4301, 6551, 714, 5902, 11915, 3121, 5428, 5441, 5140,
+ 10139, 2091, 875, 9478, 11576, 8663, 10514, 1018, 8780, 6445,
+ 2501, 4204, 1276, 7474, 10594, 3808, 4367, 11469, 4875, 1899,
+ 9136, 1507, 6235, 6367, 3851, 7341, 9925, 4629, 9588, 3150,
+ 4739, 6109, 4850, 9944, 11565, 4995, 8383, 9623, 6248, 3020,
+ 1730, 3368, 3431, 8617, 6478, 7182, 8720, 1927, 6493, 9285,
+ 9779, 2800, 3730, 1754, 3772, 3124, 7569, 10008, 9240, 2493,
+ 4402, 5851, 2050, 8630, 5054, 8421, 1536, 7671, 5467, 9075,
+ 5881, 4355, 4554, 11354, 4048, 10335, 11033, 4252, 2558, 4363,
+ 10448, 327, 1675, 4755, 8227, 7705, 398, 10398, 9913, 4129,
+ 6571, 10743, 280, 6634, 796, 7264, 3916, 11349, 1415, 1187,
+ 692, 9980, 1647, 4267, 1001, 12229, 6040, 268, 1308, 531,
+ 3141, 7209, 1941, 4684, 10261, 1415, 8381, 4919, 11450, 1494,
+ 8237, 11023, 3380, 4448, 10101, 9232, 11040, 7799, 4958, 741,
+ 2234, 10436, 11442, 5073, 2908, 2355, 31, 7222, 5457, 3746,
+ 8920, 122, 8960, 5708, 1750, 11161, 4847, 3199, 7954, 2151,
+ 9419, 11678, 8997, 12016, 9690, 9605, 10718, 3735, 1617, 9574,
+ 10384, 11604, 9311, 687, 7145, 11891, 6529, 5052, 1342, 8735,
+ 7644, 6062, 6338, 8563, 2502, 5284, 220, 5224, 3771, 11067,
+ 11609, 2972, 3799, 2566, 7488, 6369, 7704, 6095, 3598, 12112,
+ 8545, 2026, 746, 3206, 2814, 8740, 1491, 5950, 8413, 4043,
+ 12036, 6082, 4131, 1941, 6942, 9396, 11267, 8912, 7344, 10371,
+ 9205, 9520, 12038, 4345, 8024, 10999, 8408, 4673, 6682, 8893,
+ 8668, 10099, 7658, 11896, 4276, 2042, 10707, 9793, 3152, 11961,
+ 3269, 5512, 5736, 5938, 9457, 10439, 10777, 6656, 3174, 9043,
+ 6046, 2519, 11912, 5244, 6214, 2071, 11317, 5285, 891, 6184,
+ 3819, 1563, 1474, 654, 5147, 2380, 10760, 4816, 3378, 1414,
+ 7784, 10067, 1809, 6320, 4789, 9359, 2747, 9424, 9074, 9473,
+ 3300, 6244, 104, 7612, 1105, 4276, 573, 1988, 923, 12047,
+ 7948, 4860, 3949, 4971, 6956, 2831, 2034, 289, 10946, 6970,
+ 3191, 5122, 2175, 1300, 6198, 256, 6433, 11646, 9119, 9723,
+ 1046, 5967, 1124, 6449, 2817, 692, 4649, 3089, 5050, 11261,
+ 2220, 3052, 12012, 10110, 1394, 2877, 10089, 11696, 4462, 5504,
+ 66, 2500, 5384, 7461, 5712, 8649, 9536, 7670, 2385, 3469,
+ 782, 2876, 7772, 6118, 142, 5396, 10951, 10556, 3450, 10602,
+ 1604, 7909, 3323, 39, 10258, 2262, 7113, 11313, 10203, 10846,
+ 9275, 4316, 965, 6006, 4458, 7926, 3171, 1797, 4659, 5336,
+ 5543, 250, 9230, 10720, 11970, 4511, 4311, 11763, 1283, 4044,
+ 2643, 3744, 4490, 5984, 8868, 8760, 11738, 6037, 9164, 7601,
+ 7544, 11117, 7322, 2081, 4034, 10791, 11491, 7027, 1615, 5338,
+ 8528, 3424, 2126, 927, 1650, 6068, 3812, 10958, 7574, 11032,
+ 6954, 6132, 2598, 9458, 11346, 1974, 3273, 1040, 10331, 8587,
+ 11017, 6864, 8246, 5328, 11330, 6779, 8761, 4342, 4595, 8610,
+ 161, 4622, 6411, 10708, 7896, 11431, 12097, 9500, 3376, 9561,
+ 10730, 2248, 3069, 1434, 8838, 566, 6397, 5881, 4956, 4203,
+ 8362, 6047, 3484, 4784, 9901, 8989, 862, 8817, 12186, 9876,
+ 9748, 1905, 5696, 9028, 5721, 2940, 10235, 2326, 2134, 6167,
+ 1019, 10851, 1253, 5588, 9149, 6532, 3959, 11598, 4068, 3299,
+ 8264, 9787, 7089, 2829, 6755, 6156, 455, 5900, 2839, 5921,
+ 2140, 7428, 2688, 11175, 9247, 6727, 11711, 1762, 6244, 3336,
+ 2308, 9922, 7883, 7007, 10890, 7013, 8452, 2743, 1482, 6927,
+ 7846, 6128, 5114, 4868, 7487, 4584, 6785, 460, 6747, 8894,
+ 9855, 12242, 3365, 1450, 6614, 3974, 5200, 3247, 2779, 8695,
+ 828, 10940, 2304, 376, 3027, 3898, 10351, 1879, 10262, 2512,
+ 5487, 4280, 10297, 8480, 9481, 7905, 197, 8361, 4927, 705,
+ 9671, 6722, 2589, 8772, 1078, 333, 8696, 6267, 7420, 4471,
+ 8994, 5038, 5318, 1846, 2574, 8779, 10724, 825, 7399, 7073,
+ 4422, 8385, 5171, 8849, 11344, 10735, 8483, 2241, 11738, 6581,
+ 10699, 2777, 6531, 4678, 7608, 10871, 3501, 9239, 7252, 11828,
+ 7873, 9606, 4526, 5958, 8505, 11233, 9638, 2421, 5652, 3095,
+ 9049, 11347, 6274, 1405, 11114, 11208, 5703, 10774, 3011, 11633,
+ 5741, 9601, 5507, 4527, 3501, 5707, 8698, 178, 12091, 325,
+ 6056, 635, 3772, 12169, 10509, 6528, 3573, 3675, 3389, 3161,
+ 1148, 2687, 3509, 6639, 10452, 11804, 5355, 1085, 9580, 7106,
+ 1396, 8279, 4881, 3402, 7803, 8801, 6142, 7623, 4386, 9291,
+ 1502, 500, 11809, 6655, 2674, 10061, 1650, 5422, 8936, 10011,
+ 1193, 9619, 1435, 8285, 4038, 9984, 9732, 4477, 1251, 7106,
+ 7817, 10062, 3378, 5608, 2395, 2563, 1957, 3768, 4160, 7267,
+ 11631, 2171, 4771, 6927, 4330, 10482, 6204, 11022, 7895, 1924,
+ 3648, 1991, 6628, 10136, 2916, 5416, 7827, 1479, 2312, 9991,
+ 7915, 5431, 10911, 10979, 4527, 436, 10521, 5725, 2201, 10198,
+ 662, 1691, 8867, 10008, 9359, 5291, 567, 5725, 10329, 4772,
+ 2813, 7323, 5646, 1861, 9922, 1831, 9356, 1219, 4107, 9999,
+ 4569, 9092, 833, 1602, 4258, 1443, 1484, 4036, 5415, 3767,
+ 9992, 412, 9343, 2251, 10513, 9067, 1494, 11893, 744, 1978,
+ 11259, 3614, 7459, 5254, 4232, 5148, 4119, 11550, 6425, 4933,
+ 4292, 10521, 9657, 9632, 4613, 7738, 5561, 8806, 3501, 3731,
+ 11329, 2693, 11581, 6393, 10176, 10773, 1790, 1809, 9186, 12085,
+ 5418, 7223, 1077, 1527, 10917, 4236, 7668, 11754, 6655, 7696,
+ 1809, 11512, 3618, 5857, 7512, 1044, 7970, 6825, 4897, 2870,
+ 126, 8619, 10445, 3883, 4238, 4051, 399, 1580, 9893, 11046,
+ 2955, 6520, 5435, 1891, 1254, 12135, 4122, 10512, 11960, 6196,
+ 3443, 10118, 1689, 10877
+};
+
+static uint32_t i_v[] = {
+ 8355, 2010, 1416, 12110, 6361, 11296, 11668, 1446, 9822, 947,
+ 5422, 8211, 1824, 6158, 3458, 6435, 685, 2707, 4804, 4929,
+ 3204, 12158, 674, 5703, 1125, 5085, 1358, 10956, 12216, 11164,
+ 12112, 8359, 7018, 7038, 9099, 11789, 10574, 5991, 10736, 9335,
+ 7898, 4429, 587, 11156, 7912, 9063, 9673, 6792, 5530, 648,
+ 10203, 7284, 7935, 4177, 3514, 11488, 10998, 12254, 2913, 4827,
+ 2446, 10965, 10718, 5569, 1023, 8150, 7440, 1928, 6384, 802,
+ 4726, 9738, 10374, 3842, 6761, 11788, 1133, 9413, 5818, 1099,
+ 3710, 11315, 11667, 10285, 12431, 11195, 9193, 2842, 2267, 9902,
+ 10076, 7409, 6751, 3748, 4487, 9961, 1547, 10060, 7443, 1276,
+ 6827, 10798, 6323, 4038, 5508, 4006, 3300, 1774, 255, 2688,
+ 3238, 10275, 4911, 5648, 7842, 7506, 1769, 6425, 195, 3176,
+ 4455, 10337, 9451, 8912, 10445, 7646, 2837, 5109, 3033, 8668,
+ 10295, 744, 10869, 10204, 6825, 6326, 6299, 7208, 11886, 1246,
+ 704, 9626, 2538, 10932, 3903, 4545, 5111, 9006, 6698, 5008,
+ 8464, 4679, 7230, 2223, 707, 705, 6592, 6207, 1114, 7645,
+ 5374, 7595, 11064, 746, 5585, 8248, 2921, 7004, 6595, 9985,
+ 506, 7147, 793, 9605, 596, 962, 8223, 11771, 6438, 6663,
+ 9519, 12013, 4302, 2216, 6633, 10351, 10096, 9645, 347, 4601,
+ 596, 10448, 12051, 12376, 1544, 8939, 5114, 4052, 11408, 5947,
+ 5368, 4270, 6747, 423, 6283, 11211, 2574, 5974, 5533, 5143,
+ 9757, 2155, 729, 9776, 11989, 8808, 11057, 1519, 9187, 5996,
+ 2966, 3865, 1409, 8023, 10648, 4397, 5082, 10832, 4769, 2068,
+ 9226, 1790, 5911, 6534, 3780, 7312, 9388, 5014, 9054, 3445,
+ 4659, 6203, 5234, 9490, 11060, 4214, 8978, 9789, 6201, 3088,
+ 1988, 3057, 3762, 8725, 7322, 7583, 8233, 1394, 6534, 9221,
+ 9736, 2738, 3837, 2595, 4012, 3674, 7505, 10231, 8080, 2402,
+ 3977, 5928, 1942, 8421, 5507, 8422, 1238, 6909, 5800, 9613,
+ 6083, 4382, 4669, 11670, 4032, 10762, 11623, 4387, 3728, 4656,
+ 9701, 722, 1255, 4495, 8158, 7762, 792, 10307, 9813, 3904,
+ 6081, 11003, 12045, 6718, 1089, 7327, 4381, 11188, 943, 1740,
+ 563, 10251, 756, 5027, 848, 325, 6547, 12288, 1222, 12189,
+ 3641, 7314, 2049, 5254, 10043, 1068, 7906, 4741, 11639, 1981,
+ 7660, 10911, 2746, 4536, 10068, 9700, 11057, 8114, 5556, 253,
+ 2292, 10686, 11848, 5306, 3092, 2570, 12167, 7101, 5245, 3463,
+ 8627, 12513, 9010, 5356, 1633, 10462, 4545, 3614, 7245, 1887,
+ 9738, 11902, 8716, 12035, 9958, 9421, 11063, 3759, 883, 9754,
+ 10730, 11706, 9132, 540, 6726, 11382, 7038, 4407, 1225, 8606,
+ 7689, 5894, 6553, 7908, 2454, 4939, 613, 5811, 3580, 11792,
+ 11364, 3153, 3698, 2604, 7470, 6053, 7699, 6018, 4289, 11497,
+ 8580, 2249, 718, 2444, 2972, 8812, 1710, 6317, 8718, 4194,
+ 12288, 5837, 3698, 2216, 7402, 9045, 11194, 8500, 7238, 10686,
+ 9409, 9867, 12264, 3859, 7673, 11659, 8496, 4618, 6465, 8811,
+ 9114, 10740, 7738, 11850, 4142, 2493, 11136, 9623, 3071, 11701,
+ 2925, 5043, 6151, 6221, 9642, 10846, 11145, 6315, 3741, 9123,
+ 5131, 2585, 11337, 4786, 5844, 1485, 11505, 5205, 797, 5955,
+ 3717, 1756, 1551, 1122, 5057, 2585, 10857, 5129, 3557, 1254,
+ 7750, 9688, 2462, 6415, 4345, 9460, 2957, 8793, 9210, 9242,
+ 3487, 6506, 11888, 7563, 1078, 4486, 406, 2261, 867, 11965,
+ 7979, 4533, 3654, 4747, 6636, 3166, 2114, 380, 9715, 7132,
+ 2982, 5024, 1817, 1231, 6210, 12377, 6280, 10882, 9937, 9587,
+ 633, 5668, 899, 6176, 2431, 956, 5022, 3094, 4658, 11168,
+ 2989, 2654, 11990, 10494, 1691, 3017, 10044, 11882, 4020, 5342,
+ 11911, 2426, 5748, 7592, 6340, 9214, 9357, 7169, 2109, 3210,
+ 415, 3024, 7791, 5684, 246, 5134, 11335, 10092, 3133, 10427,
+ 1502, 7739, 3272, 169, 9521, 2550, 7327, 11309, 10815, 10146,
+ 9157, 4579, 1022, 6447, 4233, 8488, 2958, 1715, 4215, 4965,
+ 5728, 551, 8942, 10845, 11881, 4472, 4331, 304, 1183, 3798,
+ 1968, 3993, 4889, 6145, 8841, 8816, 11283, 6578, 9212, 8161,
+ 7003, 11574, 7764, 1678, 4138, 10444, 11880, 7101, 1390, 4743,
+ 8320, 3026, 2338, 1203, 1562, 6502, 3103, 10770, 7608, 11097,
+ 6745, 6037, 2926, 9489, 10782, 1853, 3482, 524, 11063, 8299,
+ 11092, 6838, 7779, 4598, 11245, 7274, 8908, 3886, 4440, 8651,
+ 11949, 5344, 6954, 11015, 8333, 11347, 12677, 8716, 3514, 9892,
+ 10366, 2029, 2875, 1540, 9013, 250, 6393, 5618, 4565, 3687,
+ 8340, 6420, 3632, 5032, 9408, 9738, 961, 8653, 12315, 10459,
+ 9883, 2074, 5357, 9341, 4850, 2514, 9746, 2605, 2394, 5928,
+ 808, 10443, 1589, 5673, 9176, 6593, 3404, 12254, 4230, 3630,
+ 7958, 10065, 7471, 2432, 6626, 6517, 382, 6131, 2888, 5440,
+ 1571, 7341, 2841, 11202, 9462, 7180, 11206, 1433, 6183, 3882,
+ 2105, 9906, 8076, 7074, 10572, 7262, 8456, 2979, 1095, 6891,
+ 8025, 5914, 5380, 4300, 7363, 4989, 6788, 1043, 6836, 8710,
+ 10099, 12310, 3997, 2102, 7002, 4041, 4948, 2601, 2958, 8665,
+ 984, 10820, 1940, 541, 3377, 3533, 9357, 2049, 10721, 2732,
+ 5355, 4280, 10281, 8056, 9557, 7749, 611, 8255, 4854, 708,
+ 9199, 7033, 2582, 8343, 820, 944, 8651, 5547, 7052, 4723,
+ 8972, 5594, 5314, 1938, 2539, 8789, 10341, 12368, 7475, 6903,
+ 4436, 8346, 5391, 8336, 10864, 10397, 8517, 2078, 12127, 6612,
+ 10511, 2970, 6576, 5166, 7744, 10934, 3186, 9515, 6831, 12085,
+ 7284, 9791, 4755, 6341, 8713, 11526, 9392, 2122, 5743, 2776,
+ 9581, 11396, 7006, 1465, 11235, 10997, 5776, 10401, 2929, 11732,
+ 5847, 9512, 6068, 3934, 3730, 5813, 9195, 410, 11698, 896,
+ 6321, 1310, 3478, 11649, 10201, 6850, 3612, 3451, 3569, 3266,
+ 747, 3151, 3352, 6497, 10445, 11501, 5306, 1026, 9712, 7294,
+ 813, 8005, 5090, 2905, 7903, 8358, 6290, 7756, 3955, 9471,
+ 1858, 699, 11847, 7292, 2165, 10556, 1038, 5289, 8693, 9698,
+ 1702, 10228, 1412, 8681, 3330, 10042, 8888, 4257, 1201, 7422,
+ 7956, 10019, 3011, 5956, 2188, 2407, 1986, 3847, 4345, 7427,
+ 12091, 1763, 3885, 6731, 4172, 10828, 6129, 10972, 7878, 2189,
+ 3988, 2125, 6536, 10663, 3100, 5129, 7656, 1053, 2303, 10149,
+ 8087, 5666, 11151, 10962, 4905, 779, 10113, 5451, 1509, 9590,
+ 735, 1626, 8419, 10607, 9293, 5778, 907, 5527, 10408, 5454,
+ 2266, 7131, 6332, 2055, 10105, 1188, 9842, 2059, 4417, 10026,
+ 4339, 9779, 680, 1731, 4958, 1589, 1866, 3797, 5058, 3735,
+ 9899, 543, 9330, 2436, 10757, 9010, 1270, 12232, 1122, 2222,
+ 10945, 3733, 7454, 5251, 4185, 5118, 4331, 12022, 5900, 4767,
+ 4393, 10252, 9957, 9653, 4674, 7705, 5694, 9123, 3882, 3137,
+ 11627, 2712, 11985, 6346, 9990, 10760, 1869, 1778, 8899, 12168,
+ 5207, 7250, 1088, 1131, 11567, 4337, 8286, 11660, 7152, 8010,
+ 2286, 11335, 2984, 5740, 7114, 806, 7579, 7119, 5122, 2917,
+ 541, 7913, 10555, 3684, 4720, 3954, 517, 1526, 9712, 10854,
+ 1921, 6897, 4704, 2141, 1602, 11880, 4548, 10569, 11521, 6408,
+ 3609, 9752, 1960, 10934
+};
+
+static uint8_t rbits[] = {
+ 0x3f, 0xff, 0xaf, 0x0f, 0x6b, 0xb2, 0xb8, 0x46, 0x53, 0x44,
+ 0x95, 0x98, 0x0a, 0x85, 0x0c, 0xfc, 0xc4, 0x86, 0xcc, 0x69,
+ 0xc6, 0xd9, 0xfa, 0xee, 0x19, 0xa6, 0x34, 0x0f, 0x35, 0xc4,
+ 0xdc, 0x08
+};
+
+static uint8_t r_ref[] = {
+ 0, 3, 3, 1, 1, 1, 0, 1, 0, 3, 2, 0, 1, 1, 3, 0, 2, 1, 0, 3,
+ 2, 1, 2, 3, 3, 0, 2, 0, 1, 3, 3, 2, 3, 3, 0, 3, 0, 2, 2, 0,
+ 1, 1, 2, 0, 1, 1, 2, 1, 3, 0, 0, 3, 1, 1, 0, 0, 0, 2, 0, 1,
+ 0, 2, 3, 1, 3, 0, 3, 1, 0, 0, 2, 1, 3, 3, 1, 3, 2, 1, 0, 2,
+ 0, 0, 3, 3, 0, 1, 2, 2, 0, 1, 0, 3, 2, 2, 1, 1, 3, 0, 3, 3,
+ 2, 2, 0, 2, 1, 0, 0, 0, 3, 0, 3, 1, 2, 1, 1, 0, 3, 3, 2, 1,
+ 3, 3, 2, 2, 1, 3, 0, 0, 2, 2, 3, 1, 1, 2, 2, 2, 0, 2, 0, 2,
+ 0, 0, 1, 2, 2, 2, 3, 1, 2, 0, 3, 0, 1, 3, 2, 3, 3, 1, 1, 2,
+ 0, 0, 2, 1, 2, 2, 0, 2, 2, 2, 2, 1, 1, 3, 1, 3, 3, 1, 2, 2,
+ 3, 0, 1, 0, 0, 2, 2, 1, 3, 2, 2, 2, 3, 1, 1, 0, 0, 3, 2, 3,
+ 0, 0, 3, 3, 2, 2, 2, 2, 1, 1, 0, 1, 2, 1, 3, 2, 0, 3, 0, 2,
+ 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 1, 0, 2, 3, 2, 1, 2, 0, 3, 0,
+ 2, 2, 1, 1, 2, 1, 2, 0, 1, 2, 1, 3, 0, 0, 2, 3, 0, 3, 1, 0,
+ 2, 2, 2, 1, 2, 0, 3, 1, 0, 0, 3, 0, 2, 3, 1, 0, 2, 3, 3, 0,
+ 0, 0, 3, 0, 2, 3, 2, 0, 2, 2, 1, 0, 1, 2, 1, 3, 3, 3, 1, 2,
+ 1, 2, 3, 1, 1, 2, 2, 0, 3, 0, 3, 3, 1, 3, 3, 3, 1, 3, 0, 3,
+ 0, 0, 1, 2, 1, 0, 3, 0, 0, 2, 1, 3, 3, 3, 1, 1, 2, 3, 1, 0,
+ 1, 1, 3, 3, 0, 3, 1, 3, 1, 2, 2, 2, 1, 3, 1, 2, 1, 3, 0, 1,
+ 2, 2, 2, 3, 3, 2, 2, 3, 1, 2, 2, 1, 2, 1, 0, 0, 0, 1, 3, 2,
+ 0, 3, 1, 1, 2, 1, 3, 2, 3, 2, 0, 1, 0, 1, 3, 0, 2, 3, 1, 3,
+ 0, 1, 1, 3, 1, 1, 1, 0, 2, 3, 2, 1, 2, 0, 3, 3, 2, 0, 1, 0,
+ 3, 3, 3, 1, 2, 2, 1, 0, 3, 3, 0, 2, 3, 1, 1, 1, 3, 3, 1, 3,
+ 3, 0, 1, 0, 2, 0, 1, 1, 0, 0, 3, 2, 2, 3, 0, 2, 2, 0, 1, 1,
+ 1, 3, 1, 1, 1, 0, 1, 2, 3, 2, 2, 3, 1, 1, 3, 3, 3, 1, 2, 0,
+ 0, 0, 2, 2, 2, 3, 2, 0, 0, 1, 3, 0, 0, 0, 2, 0, 1, 0, 3, 0,
+ 3, 1, 0, 1, 1, 1, 2, 2, 2, 0, 0, 2, 2, 0, 3, 1, 0, 2, 2, 0,
+ 2, 0, 0, 1, 1, 0, 1, 2, 3, 2, 3, 2, 3, 3, 3, 0, 2, 1, 2, 2,
+ 1, 0, 1, 1, 1, 2, 1, 3, 2, 0, 3, 3, 0, 0, 1, 1, 1, 2, 2, 2,
+ 0, 1, 1, 2, 0, 2, 0, 1, 2, 0, 1, 3, 2, 2, 3, 0, 0, 1, 1, 2,
+ 3, 1, 2, 0, 3, 0, 2, 1, 0, 0, 0, 1, 1, 1, 1, 3, 0, 0, 0, 3,
+ 2, 3, 2, 1, 0, 3, 1, 1, 1, 1, 3, 0, 0, 1, 1, 1, 0, 3, 2, 2,
+ 3, 1, 1, 3, 0, 1, 1, 3, 0, 3, 2, 2, 0, 3, 1, 3, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 3, 2, 2, 0, 1, 3, 0, 1, 3, 3, 2, 1, 3, 1, 1,
+ 3, 3, 2, 1, 1, 3, 1, 0, 2, 1, 1, 3, 3, 3, 1, 3, 1, 3, 0, 1,
+ 2, 2, 0, 3, 3, 2, 1, 1, 1, 3, 0, 2, 0, 3, 3, 1, 2, 3, 1, 3,
+ 0, 0, 0, 1, 3, 3, 0, 2, 3, 0, 1, 3, 0, 0, 3, 0, 2, 2, 3, 3,
+ 3, 3, 2, 1, 0, 3, 1, 1, 1, 2, 2, 0, 3, 2, 0, 2, 2, 3, 1, 0,
+ 3, 3, 1, 2, 3, 0, 1, 1, 0, 3, 3, 1, 1, 3, 0, 2, 1, 2, 2, 2,
+ 2, 3, 2, 3, 0, 0, 3, 1, 1, 0, 3, 2, 3, 2, 3, 3, 2, 2, 3, 1,
+ 3, 2, 1, 0, 1, 0, 2, 2, 1, 3, 1, 2, 3, 3, 1, 3, 2, 1, 3, 2,
+ 2, 3, 1, 1, 3, 3, 3, 3, 2, 0, 0, 3, 3, 3, 2, 3, 2, 0, 3, 0,
+ 3, 1, 2, 0, 3, 0, 2, 2, 2, 3, 1, 2, 2, 1, 3, 3, 0, 1, 3, 0,
+ 0, 1, 3, 2, 1, 1, 0, 1, 3, 3, 1, 1, 0, 1, 2, 2, 2, 0, 2, 3,
+ 1, 2, 1, 1, 3, 2, 3, 3, 1, 0, 1, 3, 2, 3, 2, 2, 1, 2, 3, 1,
+ 3, 2, 3, 1, 3, 3, 0, 3, 1, 1, 3, 2, 1, 2, 2, 0, 1, 1, 2, 3,
+ 1, 3, 0, 0, 3, 0, 3, 0, 1, 2, 0, 2, 2, 3, 2, 0, 0, 0, 3, 0,
+ 2, 0, 0, 2, 2, 2, 3, 1, 3, 2, 3, 2, 0, 1, 2, 1, 1, 3, 0, 3,
+ 2, 0, 2, 2, 3, 2, 1, 0, 1, 1, 0, 2, 0, 3, 2, 0, 2, 3, 1, 3,
+ 2, 2, 2, 2, 3, 1, 0, 2, 3, 3, 3, 2, 0, 0, 3, 3, 1, 2, 2, 3,
+ 0, 1, 1, 1, 3, 2, 1, 0, 0, 1, 2, 3, 3, 0, 1, 1, 1, 1, 0, 1,
+ 0, 2, 3, 3, 3, 3, 0, 2, 3, 0, 1, 0, 0, 1, 1, 3, 2, 2, 0, 0,
+ 2, 2, 1, 3
+};
+
+static chunk_t shared_secret = chunk_from_chars(
+ 0x14, 0x22, 0x06, 0xe3, 0x48, 0xf3, 0xfa, 0xfc, 0x21, 0x0d,
+ 0x5d, 0x51, 0x19, 0x7f, 0x16, 0x4e, 0xe6, 0xd3, 0x10, 0xa9,
+ 0xf5, 0xab, 0xfc, 0x96, 0x11, 0x1b, 0xc3, 0x4a, 0x89, 0xf9,
+ 0x66, 0x55
+);
+
+START_TEST(test_newhope_rec_good)
+{
+ newhope_reconciliation_t *rec;
+ chunk_t i_shared_secret, r_shared_secret;
+ uint8_t *r;
+
+ rec = newhope_reconciliation_create(n, q);
+ ck_assert(rec != NULL);
+
+ r = rec->help_reconcile(rec, r_v, rbits);
+ ck_assert(memeq(r, r_ref, n));
+
+ r_shared_secret = rec->reconcile(rec, r_v, r);
+ ck_assert(chunk_equals(r_shared_secret, shared_secret));
+
+ i_shared_secret = rec->reconcile(rec, i_v, r);
+ ck_assert(chunk_equals(i_shared_secret, shared_secret));
+
+ /* cleanup */
+ rec->destroy(rec);
+ chunk_free(&i_shared_secret);
+ chunk_free(&r_shared_secret);
+ free(r);
+}
+END_TEST
+
+Suite *newhope_reconciliation_suite_create()
+{
+ Suite *s;
+ TCase *tc;
+
+ s = suite_create("newhope_reconciliation");
+
+ tc = tcase_create("rec_good");
+ tcase_add_test(tc, test_newhope_rec_good);
+ suite_add_tcase(s, tc);
+
+ return s;
+}
diff --git a/src/libstrongswan/plugins/nonce/Makefile.in b/src/libstrongswan/plugins/nonce/Makefile.in
index 58a27509b..a19b2c4c0 100644
--- a/src/libstrongswan/plugins/nonce/Makefile.in
+++ b/src/libstrongswan/plugins/nonce/Makefile.in
@@ -351,7 +351,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -385,8 +384,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -440,6 +437,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/ntru/Makefile.in b/src/libstrongswan/plugins/ntru/Makefile.in
index fd123a118..5cbba3920 100644
--- a/src/libstrongswan/plugins/ntru/Makefile.in
+++ b/src/libstrongswan/plugins/ntru/Makefile.in
@@ -352,7 +352,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -386,8 +385,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -441,6 +438,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/ntru/ntru_ke.c b/src/libstrongswan/plugins/ntru/ntru_ke.c
index efc660bed..17309b149 100644
--- a/src/libstrongswan/plugins/ntru/ntru_ke.c
+++ b/src/libstrongswan/plugins/ntru/ntru_ke.c
@@ -25,22 +25,22 @@
typedef struct private_ntru_ke_t private_ntru_ke_t;
/* Best bandwidth and speed, no X9.98 compatibility */
-static ntru_param_set_id_t param_sets_optimum[] = {
+static const ntru_param_set_id_t param_sets_optimum[] = {
NTRU_EES401EP2, NTRU_EES439EP1, NTRU_EES593EP1, NTRU_EES743EP1
};
/* X9.98/IEEE 1363.1 parameter sets for best speed */
-static ntru_param_set_id_t param_sets_x9_98_speed[] = {
+static const ntru_param_set_id_t param_sets_x9_98_speed[] = {
NTRU_EES659EP1, NTRU_EES761EP1, NTRU_EES1087EP1, NTRU_EES1499EP1
};
/* X9.98/IEEE 1363.1 parameter sets for best bandwidth (smallest size) */
-static ntru_param_set_id_t param_sets_x9_98_bandwidth[] = {
+static const ntru_param_set_id_t param_sets_x9_98_bandwidth[] = {
NTRU_EES401EP1, NTRU_EES449EP1, NTRU_EES677EP1, NTRU_EES1087EP2
};
/* X9.98/IEEE 1363.1 parameter sets balancing speed and bandwidth */
-static ntru_param_set_id_t param_sets_x9_98_balance[] = {
+static const ntru_param_set_id_t param_sets_x9_98_balance[] = {
NTRU_EES541EP1, NTRU_EES613EP1, NTRU_EES887EP1, NTRU_EES1171EP1
};
@@ -61,7 +61,7 @@ struct private_ntru_ke_t {
/**
* NTRU Parameter Set
*/
- ntru_param_set_t *param_set;
+ const ntru_param_set_t *param_set;
/**
* Cryptographical strength in bits of the NTRU Parameter Set
@@ -243,7 +243,8 @@ METHOD(diffie_hellman_t, destroy, void,
ntru_ke_t *ntru_ke_create(diffie_hellman_group_t group, chunk_t g, chunk_t p)
{
private_ntru_ke_t *this;
- ntru_param_set_id_t *param_sets, param_set_id;
+ const ntru_param_set_id_t *param_sets;
+ ntru_param_set_id_t param_set_id;
rng_t *entropy;
ntru_drbg_t *drbg;
char *parameter_set;
diff --git a/src/libstrongswan/plugins/ntru/ntru_param_set.c b/src/libstrongswan/plugins/ntru/ntru_param_set.c
index 4af1e3091..3b2716e28 100644
--- a/src/libstrongswan/plugins/ntru/ntru_param_set.c
+++ b/src/libstrongswan/plugins/ntru/ntru_param_set.c
@@ -41,7 +41,7 @@ ENUM(ntru_param_set_id_names, NTRU_EES401EP1, NTRU_EES743EP1,
/**
* NTRU encryption parameter set definitions
*/
-static ntru_param_set_t ntru_param_sets[] = {
+static const ntru_param_set_t ntru_param_sets[] = {
/* X9.98/IEEE 1363.1 parameter sets for best bandwidth (smallest size) */
{
@@ -340,7 +340,7 @@ static ntru_param_set_t ntru_param_sets[] = {
/**
* See header.
*/
-ntru_param_set_t* ntru_param_set_get_by_id(ntru_param_set_id_t id)
+const ntru_param_set_t* ntru_param_set_get_by_id(ntru_param_set_id_t id)
{
int i;
@@ -358,7 +358,7 @@ ntru_param_set_t* ntru_param_set_get_by_id(ntru_param_set_id_t id)
/**
* See header.
*/
-ntru_param_set_t* ntru_param_set_get_by_oid(uint8_t const *oid)
+const ntru_param_set_t* ntru_param_set_get_by_oid(uint8_t const *oid)
{
int i;
diff --git a/src/libstrongswan/plugins/ntru/ntru_param_set.h b/src/libstrongswan/plugins/ntru/ntru_param_set.h
index df4e55333..3ec0f833f 100644
--- a/src/libstrongswan/plugins/ntru/ntru_param_set.h
+++ b/src/libstrongswan/plugins/ntru/ntru_param_set.h
@@ -80,23 +80,81 @@ extern enum_name_t *ntru_param_set_id_names;
* NTRU encryption parameter set definitions
*/
struct ntru_param_set_t {
- ntru_param_set_id_t id; /* NTRU parameter set ID */
- uint8_t oid[NTRU_OID_LEN]; /* pointer to OID */
- uint8_t der_id; /* parameter-set DER id */
- uint8_t N_bits; /* no. of bits in N (i.e. in an index */
- uint16_t N; /* ring dimension */
- uint16_t sec_strength_len; /* no. of octets of security strength */
- uint16_t q; /* big modulus */
- uint8_t q_bits; /* no. of bits in q (i.e. in a coefficient */
- bool is_product_form; /* if product form used */
- uint32_t dF_r; /* no. of +1 or -1 coefficients in ring elements
- F, r */
- uint16_t dg; /* no. - 1 of +1 coefficients or
- no. of -1 coefficients in ring element g */
- uint16_t m_len_max; /* max no. of plaintext octets */
- uint16_t min_msg_rep_wt; /* min. message representative weight */
- uint8_t c_bits; /* no. bits in candidate for deriving an index */
- uint8_t m_len_len; /* no. of octets to hold mLenOctets */
+
+ /**
+ * NTRU parameter set ID
+ */
+ const ntru_param_set_id_t id;
+
+ /**
+ * pointer to OID
+ */
+ const uint8_t oid[NTRU_OID_LEN];
+
+ /**
+ * parameter-set DER id
+ */
+ const uint8_t der_id;
+
+ /**
+ * no. of bits in N (i.e. in an index
+ */
+ const uint8_t N_bits;
+
+ /**
+ * ring dimension
+ */
+ const uint16_t N;
+
+ /**
+ * no. of octets of security strength
+ */
+ const uint16_t sec_strength_len;
+
+ /**
+ * big modulus
+ */
+ const uint16_t q;
+
+ /**
+ * no. of bits in q (i.e. in a coefficient)
+ */
+ const uint8_t q_bits;
+
+ /**
+ * if product form used
+ */
+ const bool is_product_form;
+
+ /**
+ * no. of +1 or -1 coefficients in ring elements F, r
+ */
+ const uint32_t dF_r;
+
+ /**
+ * no. - 1 of +1 coefficients or no. of -1 coefficients in ring element g
+ */
+ const uint16_t dg;
+
+ /**
+ * max no. of plaintext octets
+ */
+ const uint16_t m_len_max;
+
+ /**
+ * min. message representative weight
+ */
+ const uint16_t min_msg_rep_wt;
+
+ /**
+ * no. bits in candidate for deriving an index
+ */
+ const uint8_t c_bits;
+
+ /**
+ * no. of octets to hold mLenOctets
+ */
+ const uint8_t m_len_len;
};
/**
@@ -105,7 +163,7 @@ struct ntru_param_set_t {
* @param id NTRU parameter set ID
* @return NTRU parameter set
*/
-ntru_param_set_t* ntru_param_set_get_by_id(ntru_param_set_id_t id);
+const ntru_param_set_t* ntru_param_set_get_by_id(ntru_param_set_id_t id);
/**
* Get NTRU encryption parameter set by NTRU parameter set OID
@@ -113,6 +171,6 @@ ntru_param_set_t* ntru_param_set_get_by_id(ntru_param_set_id_t id);
* @param oid NTRU parameter set OID
* @return NTRU parameter set
*/
-ntru_param_set_t* ntru_param_set_get_by_oid(uint8_t const *oid);
+const ntru_param_set_t* ntru_param_set_get_by_oid(uint8_t const *oid);
#endif /** NTRU_PARAM_SET_H_ @}*/
diff --git a/src/libstrongswan/plugins/ntru/ntru_plugin.c b/src/libstrongswan/plugins/ntru/ntru_plugin.c
index 66be7c75b..dc6bd3167 100644
--- a/src/libstrongswan/plugins/ntru/ntru_plugin.c
+++ b/src/libstrongswan/plugins/ntru/ntru_plugin.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Andreas Steffen
+ * Copyright (C) 2013-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -43,13 +43,21 @@ METHOD(plugin_t, get_features, int,
static plugin_feature_t f[] = {
PLUGIN_REGISTER(DH, ntru_ke_create),
PLUGIN_PROVIDE(DH, NTRU_112_BIT),
+ PLUGIN_DEPENDS(RNG, RNG_TRUE),
+ PLUGIN_DEPENDS(SIGNER, AUTH_HMAC_SHA2_256_256),
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA1),
PLUGIN_PROVIDE(DH, NTRU_128_BIT),
+ PLUGIN_DEPENDS(RNG, RNG_TRUE),
+ PLUGIN_DEPENDS(SIGNER, AUTH_HMAC_SHA2_256_256),
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA1),
PLUGIN_PROVIDE(DH, NTRU_192_BIT),
+ PLUGIN_DEPENDS(RNG, RNG_TRUE),
+ PLUGIN_DEPENDS(SIGNER, AUTH_HMAC_SHA2_256_256),
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA256),
PLUGIN_PROVIDE(DH, NTRU_256_BIT),
PLUGIN_DEPENDS(RNG, RNG_TRUE),
PLUGIN_DEPENDS(SIGNER, AUTH_HMAC_SHA2_256_256),
- PLUGIN_DEPENDS(HASHER, HASH_SHA256),
- PLUGIN_SDEPEND(HASHER, HASH_SHA1)
+ PLUGIN_DEPENDS(XOF, XOF_MGF1_SHA256),
};
*features = f;
diff --git a/src/libstrongswan/plugins/ntru/ntru_poly.c b/src/libstrongswan/plugins/ntru/ntru_poly.c
index cb11601cd..b2fca2f7f 100644
--- a/src/libstrongswan/plugins/ntru/ntru_poly.c
+++ b/src/libstrongswan/plugins/ntru/ntru_poly.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Andreas Steffen
+ * Copyright (C) 2014-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* Copyright (C) 2009-2013 Security Innovation
@@ -17,7 +17,7 @@
#include "ntru_poly.h"
-#include <crypto/mgf1/mgf1_bitspender.h>
+#include <crypto/xofs/xof_bitspender.h>
#include <utils/debug.h>
#include <utils/test.h>
@@ -290,8 +290,9 @@ static private_ntru_poly_t* ntru_poly_create(uint16_t N, uint16_t q,
/*
* Described in header.
*/
-ntru_poly_t *ntru_poly_create_from_seed(hash_algorithm_t alg, chunk_t seed,
- uint8_t c_bits, uint16_t N, uint16_t q,
+ntru_poly_t *ntru_poly_create_from_seed(ext_out_function_t mgf1_type,
+ chunk_t seed, uint8_t c_bits,
+ uint16_t N, uint16_t q,
uint32_t indices_len_p,
uint32_t indices_len_m,
bool is_product_form)
@@ -300,9 +301,9 @@ ntru_poly_t *ntru_poly_create_from_seed(hash_algorithm_t alg, chunk_t seed,
int n, num_indices, index_i = 0;
uint32_t index, limit;
uint8_t *used;
- mgf1_bitspender_t *bitspender;
+ xof_bitspender_t *bitspender;
- bitspender = mgf1_bitspender_create(alg, seed, TRUE);
+ bitspender = xof_bitspender_create(mgf1_type, seed, TRUE);
if (!bitspender)
{
return NULL;
diff --git a/src/libstrongswan/plugins/ntru/ntru_poly.h b/src/libstrongswan/plugins/ntru/ntru_poly.h
index 87c77103c..765b72bdd 100644
--- a/src/libstrongswan/plugins/ntru/ntru_poly.h
+++ b/src/libstrongswan/plugins/ntru/ntru_poly.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Andreas Steffen
+ * Copyright (C) 2014-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
typedef struct ntru_poly_t ntru_poly_t;
#include <library.h>
+#include <crypto/xofs/xof.h>
/**
* Implements a trinary polynomial storing the indices of non-zero coefficients
@@ -63,9 +64,9 @@ struct ntru_poly_t {
};
/**
- * Create a trits polynomial from a seed using MGF1 with a base hash function
+ * Create a trits polynomial from a seed using MGF1
*
- * @param alg hash algorithm to be used by MGF1
+ * @param alg MGF1 algorithm used(XOF_MGF1_SHA1 or XOF_MGF_SHA256)
* @param seed seed used by MGF1 to generate trits from
* @param N ring dimension, number of polynomial coefficients
* @param q large modulus
@@ -74,7 +75,7 @@ struct ntru_poly_t {
* @param indices_len_m number of indices for -1 coefficients
* @param is_product_form generate multiple polynomials
*/
-ntru_poly_t *ntru_poly_create_from_seed(hash_algorithm_t alg, chunk_t seed,
+ntru_poly_t *ntru_poly_create_from_seed(ext_out_function_t alg, chunk_t seed,
uint8_t c_bits, uint16_t N, uint16_t q,
uint32_t indices_len_p,
uint32_t indices_len_m,
diff --git a/src/libstrongswan/plugins/ntru/ntru_private_key.c b/src/libstrongswan/plugins/ntru/ntru_private_key.c
index fa87fe9c3..844c8baf3 100644
--- a/src/libstrongswan/plugins/ntru/ntru_private_key.c
+++ b/src/libstrongswan/plugins/ntru/ntru_private_key.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Andreas Steffen
+ * Copyright (C) 2014-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* Copyright (C) 2009-2013 Security Innovation
@@ -38,7 +38,7 @@ struct private_ntru_private_key_t {
/**
* NTRU Parameter Set
*/
- ntru_param_set_t *params;
+ const ntru_param_set_t *params;
/**
* Polynomial F which is the private key
@@ -178,7 +178,7 @@ bool ntru_check_min_weight(uint16_t N, uint8_t *t, uint16_t min_wt)
METHOD(ntru_private_key_t, decrypt, bool,
private_ntru_private_key_t *this, chunk_t ciphertext, chunk_t *plaintext)
{
- hash_algorithm_t hash_algid;
+ ext_out_function_t alg;
size_t t_len, seed1_len, seed2_len;
uint16_t *t1, *t2, *t = NULL;
uint16_t mod_q_mask, q_mod_p, cmprime_len, cm_len = 0, num_zeros;
@@ -206,9 +206,9 @@ METHOD(ntru_private_key_t, decrypt, bool,
Mtrin = (uint8_t *)t1;
M = Mtrin + this->params->N;
- /* set hash algorithm based on security strength */
- hash_algid = (this->params->sec_strength_len <= 20) ? HASH_SHA1 :
- HASH_SHA256;
+ /* set MGF1 algorithm type based on security strength */
+ alg = (this->params->sec_strength_len <= 20) ? XOF_MGF1_SHA1 :
+ XOF_MGF1_SHA256;
/* set constants */
mod_q_mask = this->params->q - 1;
@@ -307,7 +307,7 @@ METHOD(ntru_private_key_t, decrypt, bool,
ntru_coeffs_mod4_2_octets(this->params->N, t2, seed.ptr);
/* form mask */
- mask = ntru_trits_create(this->params->N, hash_algid, seed);
+ mask = ntru_trits_create(this->params->N, alg, seed);
if (!mask)
{
DBG1(DBG_LIB, "mask creation failed");
@@ -390,9 +390,8 @@ METHOD(ntru_private_key_t, decrypt, bool,
/* generate cr */
DBG2(DBG_LIB, "generate polynomial r");
- r_poly = ntru_poly_create_from_seed(hash_algid, seed,
- this->params->c_bits, this->params->N,
- this->params->q, this->params->dF_r,
+ r_poly = ntru_poly_create_from_seed(alg, seed, this->params->c_bits,
+ this->params->N, this->params->q, this->params->dF_r,
this->params->dF_r, this->params->is_product_form);
if (!r_poly)
{
@@ -642,13 +641,13 @@ static bool ring_inv(uint16_t *a, uint16_t N, uint16_t q, uint16_t *t,
* Described in header.
*/
ntru_private_key_t *ntru_private_key_create(ntru_drbg_t *drbg,
- ntru_param_set_t *params)
+ const ntru_param_set_t *params)
{
private_ntru_private_key_t *this;
size_t t_len;
uint16_t *t1, *t2, *t = NULL;
uint16_t mod_q_mask;
- hash_algorithm_t hash_algid;
+ ext_out_function_t alg;
ntru_poly_t *g_poly;
chunk_t seed;
int i;
@@ -667,14 +666,8 @@ ntru_private_key_t *ntru_private_key_create(ntru_drbg_t *drbg,
);
/* set hash algorithm and seed length based on security strength */
- if (params->sec_strength_len <= 20)
- {
- hash_algid = HASH_SHA1;
- }
- else
- {
- hash_algid = HASH_SHA256;
- }
+ alg = (params->sec_strength_len <= 20) ? XOF_MGF1_SHA1 :
+ XOF_MGF1_SHA256;
seed =chunk_alloc(params->sec_strength_len + 8);
/* get random seed for generating trinary F as a list of indices */
@@ -685,7 +678,7 @@ ntru_private_key_t *ntru_private_key_create(ntru_drbg_t *drbg,
}
DBG2(DBG_LIB, "generate polynomial F");
- this->privkey = ntru_poly_create_from_seed(hash_algid, seed, params->c_bits,
+ this->privkey = ntru_poly_create_from_seed(alg, seed, params->c_bits,
params->N, params->q,
params->dF_r, params->dF_r,
params->is_product_form);
@@ -729,7 +722,7 @@ ntru_private_key_t *ntru_private_key_create(ntru_drbg_t *drbg,
}
DBG2(DBG_LIB, "generate polynomial g");
- g_poly = ntru_poly_create_from_seed(hash_algid, seed, params->c_bits,
+ g_poly = ntru_poly_create_from_seed(alg, seed, params->c_bits,
params->N, params->q, params->dg + 1,
params->dg, FALSE);
if (!g_poly)
@@ -775,7 +768,7 @@ ntru_private_key_t *ntru_private_key_create_from_data(ntru_drbg_t *drbg,
size_t privkey_packed_trits_len, privkey_packed_indices_len;
uint8_t *privkey_packed, tag;
uint16_t *indices, dF;
- ntru_param_set_t *params;
+ const ntru_param_set_t *params;
header_len = 2 + NTRU_OID_LEN;
diff --git a/src/libstrongswan/plugins/ntru/ntru_private_key.h b/src/libstrongswan/plugins/ntru/ntru_private_key.h
index c6f08440f..ced806d7a 100644
--- a/src/libstrongswan/plugins/ntru/ntru_private_key.h
+++ b/src/libstrongswan/plugins/ntru/ntru_private_key.h
@@ -77,7 +77,8 @@ struct ntru_private_key_t {
* @param drbg Digital Random Bit Generator used for key generation
* @param params NTRU encryption parameter set to be used
*/
-ntru_private_key_t *ntru_private_key_create(ntru_drbg_t *drbg, ntru_param_set_t *params);
+ntru_private_key_t *ntru_private_key_create(ntru_drbg_t *drbg,
+ const ntru_param_set_t *params);
/**
* Creates an NTRU encryption private key from encoding
diff --git a/src/libstrongswan/plugins/ntru/ntru_public_key.c b/src/libstrongswan/plugins/ntru/ntru_public_key.c
index a2ff1b2b0..36d9abf0a 100644
--- a/src/libstrongswan/plugins/ntru/ntru_public_key.c
+++ b/src/libstrongswan/plugins/ntru/ntru_public_key.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Andreas Steffen
+ * Copyright (C) 2014-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* Copyright (C) 2009-2013 Security Innovation
@@ -37,7 +37,7 @@ struct private_ntru_public_key_t {
/**
* NTRU Parameter Set
*/
- ntru_param_set_t *params;
+ const ntru_param_set_t *params;
/**
* Polynomial h which is the public key
@@ -102,7 +102,7 @@ extern bool ntru_check_min_weight(uint16_t N, uint8_t *t, uint16_t min_wt);
METHOD(ntru_public_key_t, encrypt, bool,
private_ntru_public_key_t *this, chunk_t plaintext, chunk_t *ciphertext)
{
- hash_algorithm_t hash_algid;
+ ext_out_function_t alg;
size_t t_len, seed1_len, seed2_len;
uint16_t *t1, *t = NULL;
uint8_t b[MAX_SEC_STRENGTH_LEN];
@@ -139,8 +139,8 @@ METHOD(ntru_public_key_t, encrypt, bool,
M = Mtrin + this->params->N;
/* set hash algorithm based on security strength */
- hash_algid = (this->params->sec_strength_len <= 20) ? HASH_SHA1 :
- HASH_SHA256;
+ alg = (this->params->sec_strength_len <= 20) ? XOF_MGF1_SHA1 :
+ XOF_MGF1_SHA256;
/* set constants */
mod_q_mask = this->params->q - 1;
@@ -173,7 +173,7 @@ METHOD(ntru_public_key_t, encrypt, bool,
seed.len = seed2_len;
DBG2(DBG_LIB, "generate polynomial r");
- r_poly = ntru_poly_create_from_seed(hash_algid, seed, this->params->c_bits,
+ r_poly = ntru_poly_create_from_seed(alg, seed, this->params->c_bits,
this->params->N, this->params->q,
this->params->dF_r, this->params->dF_r,
this->params->is_product_form);
@@ -191,7 +191,7 @@ METHOD(ntru_public_key_t, encrypt, bool,
seed.len = seed1_len;
/* form mask */
- mask = ntru_trits_create(this->params->N, hash_algid, seed);
+ mask = ntru_trits_create(this->params->N, alg, seed);
if (!mask)
{
DBG1(DBG_LIB, "mask creation failed");
@@ -320,7 +320,7 @@ METHOD(ntru_public_key_t, destroy, void,
* Described in header.
*/
ntru_public_key_t *ntru_public_key_create(ntru_drbg_t *drbg,
- ntru_param_set_t *params,
+ const ntru_param_set_t *params,
uint16_t *pubkey)
{
private_ntru_public_key_t *this;
@@ -357,7 +357,7 @@ ntru_public_key_t *ntru_public_key_create_from_data(ntru_drbg_t *drbg,
{
private_ntru_public_key_t *this;
size_t header_len, pubkey_packed_len;
- ntru_param_set_t *params;
+ const ntru_param_set_t *params;
header_len = 2 + NTRU_OID_LEN;
diff --git a/src/libstrongswan/plugins/ntru/ntru_public_key.h b/src/libstrongswan/plugins/ntru/ntru_public_key.h
index baa8eabcd..4f098f28c 100644
--- a/src/libstrongswan/plugins/ntru/ntru_public_key.h
+++ b/src/libstrongswan/plugins/ntru/ntru_public_key.h
@@ -71,7 +71,7 @@ struct ntru_public_key_t {
* @param pubkey Coefficients of public key polynomial h
*/
ntru_public_key_t *ntru_public_key_create(ntru_drbg_t *drbg,
- ntru_param_set_t *params,
+ const ntru_param_set_t *params,
uint16_t *pubkey);
/**
diff --git a/src/libstrongswan/plugins/ntru/ntru_trits.c b/src/libstrongswan/plugins/ntru/ntru_trits.c
index 57b3532ef..0bbbcc178 100644
--- a/src/libstrongswan/plugins/ntru/ntru_trits.c
+++ b/src/libstrongswan/plugins/ntru/ntru_trits.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2014 Andreas Steffen
+ * Copyright (C) 2013-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -16,7 +16,7 @@
#include "ntru_trits.h"
#include "ntru_convert.h"
-#include <crypto/mgf1/mgf1_bitspender.h>
+#include <crypto/xofs/xof_bitspender.h>
#include <utils/debug.h>
#include <utils/test.h>
@@ -67,14 +67,15 @@ METHOD(ntru_trits_t, destroy, void,
/*
* Described in header.
*/
-ntru_trits_t *ntru_trits_create(size_t len, hash_algorithm_t alg, chunk_t seed)
+ntru_trits_t *ntru_trits_create(size_t len, ext_out_function_t alg,
+ chunk_t seed)
{
private_ntru_trits_t *this;
uint8_t octet, buf[5], *trits;
size_t trits_needed;
- mgf1_bitspender_t *bitspender;
+ xof_bitspender_t *bitspender;
- bitspender = mgf1_bitspender_create(alg, seed, TRUE);
+ bitspender = xof_bitspender_create(alg, seed, TRUE);
if (!bitspender)
{
return NULL;
diff --git a/src/libstrongswan/plugins/ntru/ntru_trits.h b/src/libstrongswan/plugins/ntru/ntru_trits.h
index 524c51bac..e489aae7a 100644
--- a/src/libstrongswan/plugins/ntru/ntru_trits.h
+++ b/src/libstrongswan/plugins/ntru/ntru_trits.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Andreas Steffen
+ * Copyright (C) 2013-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
typedef struct ntru_trits_t ntru_trits_t;
#include <library.h>
+#include <crypto/xofs/xof.h>
/**
* Implements an array of trinary elements (trits)
@@ -52,10 +53,11 @@ struct ntru_trits_t {
* Create a trits array from a seed using MGF1 with a base hash function
*
* @param size size of the trits array
- * @param alg hash algorithm to be used by MGF1
+ * @param alg MGF1 algorithm used (XOF_MGF1_SHA1 or XOF_MGF_SHA256)
* @param seed seed used by MGF1 to generate trits from
*/
-ntru_trits_t *ntru_trits_create(size_t size, hash_algorithm_t alg, chunk_t seed);
+ntru_trits_t *ntru_trits_create(size_t size, ext_out_function_t alg,
+ chunk_t seed);
#endif /** NTRU_TRITS_H_ @}*/
diff --git a/src/libstrongswan/plugins/openssl/Makefile.in b/src/libstrongswan/plugins/openssl/Makefile.in
index f453f43b5..dd8a17ed7 100644
--- a/src/libstrongswan/plugins/openssl/Makefile.in
+++ b/src/libstrongswan/plugins/openssl/Makefile.in
@@ -360,7 +360,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -394,8 +393,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -449,6 +446,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/openssl/openssl_ec_private_key.c b/src/libstrongswan/plugins/openssl/openssl_ec_private_key.c
index 24fe623eb..22bbf6dc7 100644
--- a/src/libstrongswan/plugins/openssl/openssl_ec_private_key.c
+++ b/src/libstrongswan/plugins/openssl/openssl_ec_private_key.c
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2008-2012 Tobias Brunner
+ * Copyright (C) 2008-2016 Tobias Brunner
* Copyright (C) 2009 Martin Willi
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -304,7 +304,26 @@ static private_openssl_ec_private_key_t *create_empty(void)
return this;
}
-/**
+/*
+ * See header.
+ */
+private_key_t *openssl_ec_private_key_create(EVP_PKEY *key)
+{
+ private_openssl_ec_private_key_t *this;
+ EC_KEY *ec;
+
+ ec = EVP_PKEY_get1_EC_KEY(key);
+ EVP_PKEY_free(key);
+ if (!ec)
+ {
+ return NULL;
+ }
+ this = create_empty();
+ this->ec = ec;
+ return &this->public.key;
+}
+
+/*
* See header.
*/
openssl_ec_private_key_t *openssl_ec_private_key_gen(key_type_t type,
diff --git a/src/libstrongswan/plugins/openssl/openssl_ec_private_key.h b/src/libstrongswan/plugins/openssl/openssl_ec_private_key.h
index f56c95aa1..84314f671 100644
--- a/src/libstrongswan/plugins/openssl/openssl_ec_private_key.h
+++ b/src/libstrongswan/plugins/openssl/openssl_ec_private_key.h
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2008 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * Copyright (C) 2008-2016 Tobias Brunner
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -21,6 +21,8 @@
#ifndef OPENSSL_EC_PRIVATE_KEY_H_
#define OPENSSL_EC_PRIVATE_KEY_H_
+#include <openssl/evp.h>
+
#include <credentials/builder.h>
#include <credentials/keys/private_key.h>
@@ -61,4 +63,12 @@ openssl_ec_private_key_t *openssl_ec_private_key_gen(key_type_t type,
openssl_ec_private_key_t *openssl_ec_private_key_load(key_type_t type,
va_list args);
+/**
+ * Wrap an EVP_PKEY object of type EVP_PKEY_EC
+ *
+ * @param key EVP_PKEY_EC key object (adopted)
+ * @return loaded key, NULL on failure
+ */
+private_key_t *openssl_ec_private_key_create(EVP_PKEY *key);
+
#endif /** OPENSSL_EC_PRIVATE_KEY_H_ @}*/
diff --git a/src/libstrongswan/plugins/openssl/openssl_gcm.c b/src/libstrongswan/plugins/openssl/openssl_gcm.c
index 6bbe4af95..5ef885b16 100644
--- a/src/libstrongswan/plugins/openssl/openssl_gcm.c
+++ b/src/libstrongswan/plugins/openssl/openssl_gcm.c
@@ -255,13 +255,13 @@ aead_t *openssl_gcm_create(encryption_algorithm_t algo,
key_size = 16;
/* FALL */
case 16:
- this->cipher = EVP_get_cipherbyname("aes-128-gcm");
+ this->cipher = EVP_aes_128_gcm();
break;
case 24:
- this->cipher = EVP_get_cipherbyname("aes-192-gcm");
+ this->cipher = EVP_aes_192_gcm();
break;
case 32:
- this->cipher = EVP_get_cipherbyname("aes-256-gcm");
+ this->cipher = EVP_aes_256_gcm();
break;
default:
free(this);
diff --git a/src/libstrongswan/plugins/openssl/openssl_pkcs12.c b/src/libstrongswan/plugins/openssl/openssl_pkcs12.c
index 705e96c69..bbd400cac 100644
--- a/src/libstrongswan/plugins/openssl/openssl_pkcs12.c
+++ b/src/libstrongswan/plugins/openssl/openssl_pkcs12.c
@@ -23,10 +23,6 @@
#include <library.h>
#include <credentials/sets/mem_cred.h>
-#ifdef OPENSSL_IS_BORINGSSL
-#define EVP_PKEY_base_id(p) EVP_PKEY_type(p->type)
-#endif
-
typedef struct private_pkcs12_t private_pkcs12_t;
/**
diff --git a/src/libstrongswan/plugins/openssl/openssl_plugin.c b/src/libstrongswan/plugins/openssl/openssl_plugin.c
index 3e3b986df..ab73d718f 100644
--- a/src/libstrongswan/plugins/openssl/openssl_plugin.c
+++ b/src/libstrongswan/plugins/openssl/openssl_plugin.c
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2008-2013 Tobias Brunner
+ * Copyright (C) 2008-2016 Tobias Brunner
* Copyright (C) 2008 Martin Willi
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -269,6 +269,53 @@ static bool seed_rng()
return TRUE;
}
+/**
+ * Generic key loader
+ */
+static private_key_t *openssl_private_key_load(key_type_t type, va_list args)
+{
+ chunk_t blob = chunk_empty;
+ EVP_PKEY *key;
+
+ while (TRUE)
+ {
+ switch (va_arg(args, builder_part_t))
+ {
+ case BUILD_BLOB_ASN1_DER:
+ blob = va_arg(args, chunk_t);
+ continue;
+ case BUILD_END:
+ break;
+ default:
+ return NULL;
+ }
+ break;
+ }
+
+ if (blob.ptr)
+ {
+ key = d2i_AutoPrivateKey(NULL, (const u_char**)&blob.ptr, blob.len);
+ if (key)
+ {
+ switch (EVP_PKEY_base_id(key))
+ {
+#ifndef OPENSSL_NO_RSA
+ case EVP_PKEY_RSA:
+ return openssl_rsa_private_key_create(key);
+#endif
+#ifndef OPENSSL_NO_ECDSA
+ case EVP_PKEY_EC:
+ return openssl_ec_private_key_create(key);
+#endif
+ default:
+ EVP_PKEY_free(key);
+ break;
+ }
+ }
+ }
+ return NULL;
+}
+
METHOD(plugin_t, get_name, char*,
private_openssl_plugin_t *this)
{
@@ -438,16 +485,16 @@ METHOD(plugin_t, get_features, int,
PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA1),
#endif
#ifndef OPENSSL_NO_SHA256
- PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA224),
- PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA256),
- PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA224),
- PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA256),
+ PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA2_224),
+ PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA2_256),
+ PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA2_224),
+ PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA2_256),
#endif
#ifndef OPENSSL_NO_SHA512
- PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA384),
- PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA512),
- PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA384),
- PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA512),
+ PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA2_384),
+ PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_SHA2_512),
+ PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA2_384),
+ PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_RSA_EMSA_PKCS1_SHA2_512),
#endif
#ifndef OPENSSL_NO_MD5
PLUGIN_PROVIDE(PRIVKEY_SIGN, SIGN_RSA_EMSA_PKCS1_MD5),
@@ -504,6 +551,9 @@ METHOD(plugin_t, get_features, int,
PLUGIN_PROVIDE(PUBKEY_VERIFY, SIGN_ECDSA_521),
#endif
#endif /* OPENSSL_NO_ECDSA */
+ /* generic key loader */
+ PLUGIN_REGISTER(PRIVKEY, openssl_private_key_load, TRUE),
+ PLUGIN_PROVIDE(PRIVKEY, KEY_ANY),
PLUGIN_REGISTER(RNG, openssl_rng_create),
PLUGIN_PROVIDE(RNG, RNG_STRONG),
PLUGIN_PROVIDE(RNG, RNG_WEAK),
diff --git a/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c b/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c
index 485e0bbc7..54ecf2542 100644
--- a/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c
+++ b/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c
@@ -1,7 +1,7 @@
/*
+ * Copyright (C) 2008-2016 Tobias Brunner
* Copyright (C) 2009 Martin Willi
- * Copyright (C) 2008 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -158,16 +158,16 @@ METHOD(private_key_t, sign, bool,
{
case SIGN_RSA_EMSA_PKCS1_NULL:
return build_emsa_pkcs1_signature(this, NID_undef, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA1:
- return build_emsa_pkcs1_signature(this, NID_sha1, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA224:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_224:
return build_emsa_pkcs1_signature(this, NID_sha224, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA256:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_256:
return build_emsa_pkcs1_signature(this, NID_sha256, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA384:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_384:
return build_emsa_pkcs1_signature(this, NID_sha384, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA512:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_512:
return build_emsa_pkcs1_signature(this, NID_sha512, data, signature);
+ case SIGN_RSA_EMSA_PKCS1_SHA1:
+ return build_emsa_pkcs1_signature(this, NID_sha1, data, signature);
case SIGN_RSA_EMSA_PKCS1_MD5:
return build_emsa_pkcs1_signature(this, NID_md5, data, signature);
default:
@@ -327,7 +327,7 @@ static private_openssl_rsa_private_key_t *create_empty()
return this;
}
-/**
+/*
* See header.
*/
openssl_rsa_private_key_t *openssl_rsa_private_key_gen(key_type_t type,
@@ -383,7 +383,26 @@ error:
return NULL;
}
-/**
+/*
+ * See header
+ */
+private_key_t *openssl_rsa_private_key_create(EVP_PKEY *key)
+{
+ private_openssl_rsa_private_key_t *this;
+ RSA *rsa;
+
+ rsa = EVP_PKEY_get1_RSA(key);
+ EVP_PKEY_free(key);
+ if (!rsa)
+ {
+ return NULL;
+ }
+ this = create_empty();
+ this->rsa = rsa;
+ return &this->public.key;
+}
+
+/*
* See header
*/
openssl_rsa_private_key_t *openssl_rsa_private_key_load(key_type_t type,
@@ -528,7 +547,7 @@ static bool login(ENGINE *engine, chunk_t keyid)
}
#endif /* OPENSSL_NO_ENGINE */
-/**
+/*
* See header.
*/
openssl_rsa_private_key_t *openssl_rsa_private_key_connect(key_type_t type,
diff --git a/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.h b/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.h
index 60889d651..34ce4c776 100644
--- a/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.h
+++ b/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.h
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2008 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * Copyright (C) 2008-2016 Tobias Brunner
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -21,6 +21,8 @@
#ifndef OPENSSL_RSA_PRIVATE_KEY_H_
#define OPENSSL_RSA_PRIVATE_KEY_H_
+#include <openssl/evp.h>
+
#include <credentials/builder.h>
#include <credentials/keys/private_key.h>
@@ -62,6 +64,14 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_load(key_type_t type,
va_list args);
/**
+ * Wrap an EVP_PKEY object of type EVP_PKEY_RSA
+ *
+ * @param key EVP_PKEY_RSA key object (adopted)
+ * @return loaded key, NULL on failure
+ */
+private_key_t *openssl_rsa_private_key_create(EVP_PKEY *key);
+
+/**
* Connect to a RSA private key on a smartcard.
*
* Accepts the BUILD_SMARTCARD_KEYID and the BUILD_SMARTCARD_PIN
diff --git a/src/libstrongswan/plugins/openssl/openssl_rsa_public_key.c b/src/libstrongswan/plugins/openssl/openssl_rsa_public_key.c
index d66d5016e..d3a644f72 100644
--- a/src/libstrongswan/plugins/openssl/openssl_rsa_public_key.c
+++ b/src/libstrongswan/plugins/openssl/openssl_rsa_public_key.c
@@ -143,16 +143,16 @@ METHOD(public_key_t, verify, bool,
{
case SIGN_RSA_EMSA_PKCS1_NULL:
return verify_emsa_pkcs1_signature(this, NID_undef, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA1:
- return verify_emsa_pkcs1_signature(this, NID_sha1, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA224:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_224:
return verify_emsa_pkcs1_signature(this, NID_sha224, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA256:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_256:
return verify_emsa_pkcs1_signature(this, NID_sha256, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA384:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_384:
return verify_emsa_pkcs1_signature(this, NID_sha384, data, signature);
- case SIGN_RSA_EMSA_PKCS1_SHA512:
+ case SIGN_RSA_EMSA_PKCS1_SHA2_512:
return verify_emsa_pkcs1_signature(this, NID_sha512, data, signature);
+ case SIGN_RSA_EMSA_PKCS1_SHA1:
+ return verify_emsa_pkcs1_signature(this, NID_sha1, data, signature);
case SIGN_RSA_EMSA_PKCS1_MD5:
return verify_emsa_pkcs1_signature(this, NID_md5, data, signature);
default:
diff --git a/src/libstrongswan/plugins/openssl/openssl_util.h b/src/libstrongswan/plugins/openssl/openssl_util.h
index f4186e8c4..7c5c367f7 100644
--- a/src/libstrongswan/plugins/openssl/openssl_util.h
+++ b/src/libstrongswan/plugins/openssl/openssl_util.h
@@ -136,6 +136,13 @@ int openssl_asn1_known_oid(ASN1_OBJECT *obj);
time_t openssl_asn1_to_time(ASN1_TIME *time);
/**
+ * Compatibility macros
+ */
+#ifdef OPENSSL_IS_BORINGSSL
+#define EVP_PKEY_base_id(p) EVP_PKEY_type(p->type)
+#endif
+
+/**
* Macros to define fallback getters/setters to access keys (BIGNUM*) for types
* that were made opaque with OpenSSL 1.1.0.
*/
diff --git a/src/libstrongswan/plugins/padlock/Makefile.in b/src/libstrongswan/plugins/padlock/Makefile.in
index e1cf497c8..abca5f79b 100644
--- a/src/libstrongswan/plugins/padlock/Makefile.in
+++ b/src/libstrongswan/plugins/padlock/Makefile.in
@@ -353,7 +353,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -387,8 +386,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -442,6 +439,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/padlock/padlock_sha1_hasher.c b/src/libstrongswan/plugins/padlock/padlock_sha1_hasher.c
index 107ade09b..30040da39 100644
--- a/src/libstrongswan/plugins/padlock/padlock_sha1_hasher.c
+++ b/src/libstrongswan/plugins/padlock/padlock_sha1_hasher.c
@@ -16,7 +16,6 @@
#include <string.h>
#include <arpa/inet.h>
-#include <byteswap.h>
#include "padlock_sha1_hasher.h"
@@ -66,11 +65,11 @@ static void sha1(chunk_t data, uint32_t *digest)
padlock_sha1(data.len, data.ptr, (u_char*)hash);
- digest[0] = bswap_32(hash[0]);
- digest[1] = bswap_32(hash[1]);
- digest[2] = bswap_32(hash[2]);
- digest[3] = bswap_32(hash[3]);
- digest[4] = bswap_32(hash[4]);
+ digest[0] = __builtin_bswap32(hash[0]);
+ digest[1] = __builtin_bswap32(hash[1]);
+ digest[2] = __builtin_bswap32(hash[2]);
+ digest[3] = __builtin_bswap32(hash[3]);
+ digest[4] = __builtin_bswap32(hash[4]);
}
/**
diff --git a/src/libstrongswan/plugins/pem/Makefile.in b/src/libstrongswan/plugins/pem/Makefile.in
index 3e6b8d0bb..8cafb9e32 100644
--- a/src/libstrongswan/plugins/pem/Makefile.in
+++ b/src/libstrongswan/plugins/pem/Makefile.in
@@ -351,7 +351,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -385,8 +384,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -440,6 +437,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/pgp/Makefile.in b/src/libstrongswan/plugins/pgp/Makefile.in
index e9c85e57f..0bddf9ccf 100644
--- a/src/libstrongswan/plugins/pgp/Makefile.in
+++ b/src/libstrongswan/plugins/pgp/Makefile.in
@@ -351,7 +351,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -385,8 +384,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -440,6 +437,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/pkcs1/Makefile.in b/src/libstrongswan/plugins/pkcs1/Makefile.in
index a61eb1ab2..708f5a68c 100644
--- a/src/libstrongswan/plugins/pkcs1/Makefile.in
+++ b/src/libstrongswan/plugins/pkcs1/Makefile.in
@@ -352,7 +352,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -386,8 +385,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -441,6 +438,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/pkcs1/pkcs1_builder.c b/src/libstrongswan/plugins/pkcs1/pkcs1_builder.c
index 767b3acf2..766832d39 100644
--- a/src/libstrongswan/plugins/pkcs1/pkcs1_builder.c
+++ b/src/libstrongswan/plugins/pkcs1/pkcs1_builder.c
@@ -1,8 +1,8 @@
/*
+ * Copyright (C) 2008-2016 Tobias Brunner
* Copyright (C) 2008-2009 Martin Willi
- * Copyright (C) 2008 Tobias Brunner
* Copyright (C) 2000-2008 Andreas Steffen
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -204,7 +204,6 @@ static private_key_t *parse_rsa_private_key(chunk_t blob)
case PRIV_KEY_VERSION:
if (object.len > 0 && *object.ptr != 0)
{
- DBG1(DBG_ASN, "PKCS#1 private key format is not version 1");
goto end;
}
break;
@@ -249,6 +248,63 @@ end:
}
/**
+ * Check if the ASN.1 structure looks like an EC private key according to
+ * RFC 5915.
+ *
+ * ECPrivateKey :=: SEQUENCE {
+ * version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1),
+ * privateKey OCTET STRING,
+ * parameters [0] ECParameters {{ NamedCurve }} OPTIONAL,
+ * publicKey [1] BIT STRING OPTIONAL
+ * }
+ *
+ * While the parameters and publicKey fields are OPTIONAL, RFC 5915 says that
+ * paramaters MUST be included and publicKey SHOULD be.
+ */
+static bool is_ec_private_key(chunk_t blob)
+{
+ chunk_t data;
+ return asn1_unwrap(&blob, &blob) == ASN1_SEQUENCE &&
+ asn1_unwrap(&blob, &data) == ASN1_INTEGER &&
+ asn1_parse_integer_uint64(data) == 1 &&
+ asn1_unwrap(&blob, &data) == ASN1_OCTET_STRING &&
+ asn1_unwrap(&blob, &data) == ASN1_CONTEXT_C_0 &&
+ asn1_unwrap(&blob, &data) == ASN1_CONTEXT_C_1;
+}
+
+/**
+ * Check if the ASN.1 structure looks like a BLISS private key.
+ */
+static bool is_bliss_private_key(chunk_t blob)
+{
+ chunk_t data;
+ return asn1_unwrap(&blob, &blob) == ASN1_SEQUENCE &&
+ asn1_unwrap(&blob, &data) == ASN1_OID &&
+ asn1_unwrap(&blob, &data) == ASN1_BIT_STRING &&
+ asn1_unwrap(&blob, &data) == ASN1_BIT_STRING &&
+ asn1_unwrap(&blob, &data) == ASN1_BIT_STRING;
+}
+
+/**
+ * Load a private key from an ASN.1 encoded blob trying to detect the type
+ * automatically.
+ */
+static private_key_t *parse_private_key(chunk_t blob)
+{
+ if (is_ec_private_key(blob))
+ {
+ return lib->creds->create(lib->creds, CRED_PRIVATE_KEY, KEY_ECDSA,
+ BUILD_BLOB_ASN1_DER, blob, BUILD_END);
+ }
+ else if (is_bliss_private_key(blob))
+ {
+ return lib->creds->create(lib->creds, CRED_PRIVATE_KEY, KEY_ECDSA,
+ BUILD_BLOB_ASN1_DER, blob, BUILD_END);
+ }
+ return parse_rsa_private_key(blob);
+}
+
+/**
* See header.
*/
public_key_t *pkcs1_public_key_load(key_type_t type, va_list args)
@@ -301,6 +357,14 @@ private_key_t *pkcs1_private_key_load(key_type_t type, va_list args)
}
break;
}
- return parse_rsa_private_key(blob);
+ switch (type)
+ {
+ case KEY_ANY:
+ return parse_private_key(blob);
+ case KEY_RSA:
+ return parse_rsa_private_key(blob);
+ default:
+ return NULL;
+ }
}
diff --git a/src/libstrongswan/plugins/pkcs1/pkcs1_plugin.c b/src/libstrongswan/plugins/pkcs1/pkcs1_plugin.c
index eb0903d47..ec1bdf565 100644
--- a/src/libstrongswan/plugins/pkcs1/pkcs1_plugin.c
+++ b/src/libstrongswan/plugins/pkcs1/pkcs1_plugin.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2009 Martin Willi
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -43,6 +43,10 @@ METHOD(plugin_t, get_features, int,
{
static plugin_feature_t f[] = {
PLUGIN_REGISTER(PRIVKEY, pkcs1_private_key_load, FALSE),
+ PLUGIN_PROVIDE(PRIVKEY, KEY_ANY),
+ PLUGIN_SDEPEND(PRIVKEY, KEY_RSA),
+ PLUGIN_SDEPEND(PRIVKEY, KEY_ECDSA),
+ PLUGIN_REGISTER(PRIVKEY, pkcs1_private_key_load, FALSE),
PLUGIN_PROVIDE(PRIVKEY, KEY_RSA),
PLUGIN_REGISTER(PUBKEY, pkcs1_public_key_load, FALSE),
PLUGIN_PROVIDE(PUBKEY, KEY_ANY),
diff --git a/src/libstrongswan/plugins/pkcs11/Makefile.in b/src/libstrongswan/plugins/pkcs11/Makefile.in
index 61919e3dd..6c10c0812 100644
--- a/src/libstrongswan/plugins/pkcs11/Makefile.in
+++ b/src/libstrongswan/plugins/pkcs11/Makefile.in
@@ -355,7 +355,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -389,8 +388,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -444,6 +441,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c b/src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c
index aec4550ce..1d1016911 100644
--- a/src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c
+++ b/src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2015 Tobias Brunner
+ * Copyright (C) 2011-2016 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* Copyright (C) 2010 Martin Willi
@@ -15,6 +15,27 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
+/*
+ * Copyright (C) 2016 EDF S.A.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
#include "pkcs11_private_key.h"
@@ -112,13 +133,13 @@ CK_MECHANISM_PTR pkcs11_signature_scheme_to_mech(signature_scheme_t scheme,
} mappings[] = {
{SIGN_RSA_EMSA_PKCS1_NULL, {CKM_RSA_PKCS, NULL, 0},
KEY_RSA, 0, HASH_UNKNOWN},
- {SIGN_RSA_EMSA_PKCS1_SHA1, {CKM_SHA1_RSA_PKCS, NULL, 0},
+ {SIGN_RSA_EMSA_PKCS1_SHA2_256, {CKM_SHA256_RSA_PKCS, NULL, 0},
KEY_RSA, 0, HASH_UNKNOWN},
- {SIGN_RSA_EMSA_PKCS1_SHA256, {CKM_SHA256_RSA_PKCS, NULL, 0},
+ {SIGN_RSA_EMSA_PKCS1_SHA2_384, {CKM_SHA384_RSA_PKCS, NULL, 0},
KEY_RSA, 0, HASH_UNKNOWN},
- {SIGN_RSA_EMSA_PKCS1_SHA384, {CKM_SHA384_RSA_PKCS, NULL, 0},
+ {SIGN_RSA_EMSA_PKCS1_SHA2_512, {CKM_SHA512_RSA_PKCS, NULL, 0},
KEY_RSA, 0, HASH_UNKNOWN},
- {SIGN_RSA_EMSA_PKCS1_SHA512, {CKM_SHA512_RSA_PKCS, NULL, 0},
+ {SIGN_RSA_EMSA_PKCS1_SHA1, {CKM_SHA1_RSA_PKCS, NULL, 0},
KEY_RSA, 0, HASH_UNKNOWN},
{SIGN_RSA_EMSA_PKCS1_MD5, {CKM_MD5_RSA_PKCS, NULL, 0},
KEY_RSA, 0, HASH_UNKNOWN},
@@ -496,6 +517,120 @@ static pkcs11_library_t* find_lib_by_keyid(chunk_t keyid, int *slot,
}
/**
+ * Find the PKCS#11 lib and CKA_ID of the certificate object of a given
+ * subjectKeyIdentifier and optional slot
+ */
+static pkcs11_library_t* find_lib_and_keyid_by_skid(chunk_t keyid_chunk,
+ chunk_t *ckaid, int *slot)
+{
+ CK_OBJECT_CLASS class = CKO_CERTIFICATE;
+ CK_CERTIFICATE_TYPE type = CKC_X_509;
+ CK_ATTRIBUTE tmpl[] = {
+ {CKA_CLASS, &class, sizeof(class)},
+ {CKA_CERTIFICATE_TYPE, &type, sizeof(type)},
+ };
+ CK_ATTRIBUTE attr[] = {
+ {CKA_VALUE, NULL, 0},
+ {CKA_ID, NULL, 0},
+ };
+ CK_OBJECT_HANDLE object;
+ CK_SESSION_HANDLE session;
+ CK_RV rv;
+ pkcs11_manager_t *manager;
+ enumerator_t *enumerator, *certs;
+ identification_t *keyid;
+ pkcs11_library_t *p11, *found = NULL;
+ CK_SLOT_ID current;
+ linked_list_t *raw;
+ certificate_t *cert;
+ struct {
+ chunk_t value;
+ chunk_t ckaid;
+ } *entry;
+
+ manager = lib->get(lib, "pkcs11-manager");
+ if (!manager)
+ {
+ return NULL;
+ }
+
+ keyid = identification_create_from_encoding(ID_KEY_ID, keyid_chunk);
+ /* store result in a temporary list, avoid recursive operation */
+ raw = linked_list_create();
+
+ enumerator = manager->create_token_enumerator(manager);
+ while (enumerator->enumerate(enumerator, &p11, &current))
+ {
+ if (*slot != -1 && *slot != current)
+ {
+ continue;
+ }
+ rv = p11->f->C_OpenSession(current, CKF_SERIAL_SESSION, NULL, NULL,
+ &session);
+ if (rv != CKR_OK)
+ {
+ DBG1(DBG_CFG, "opening PKCS#11 session failed: %N",
+ ck_rv_names, rv);
+ continue;
+ }
+ certs = p11->create_object_enumerator(p11, session, tmpl, countof(tmpl),
+ attr, countof(attr));
+ while (certs->enumerate(certs, &object))
+ {
+ INIT(entry,
+ .value = chunk_clone(
+ chunk_create(attr[0].pValue, attr[0].ulValueLen)),
+ .ckaid = chunk_clone(
+ chunk_create(attr[1].pValue, attr[1].ulValueLen)),
+ );
+ raw->insert_last(raw, entry);
+ }
+ certs->destroy(certs);
+
+ while (raw->remove_first(raw, (void**)&entry) == SUCCESS)
+ {
+ if (!found)
+ {
+ cert = lib->creds->create(lib->creds, CRED_CERTIFICATE,
+ CERT_X509, BUILD_BLOB_ASN1_DER,
+ entry->value, BUILD_END);
+ if (cert)
+ {
+ if (cert->has_subject(cert, keyid))
+ {
+ DBG1(DBG_CFG, "found cert with keyid '%#B' on PKCS#11 "
+ "token '%s':%d", &keyid_chunk, p11->get_name(p11),
+ current);
+ found = p11;
+ *ckaid = chunk_clone(entry->ckaid);
+ *slot = current;
+ }
+ cert->destroy(cert);
+ }
+ else
+ {
+ DBG1(DBG_CFG, "parsing cert with CKA_ID '%#B' on PKCS#11 "
+ "token '%s':%d failed", &entry->ckaid,
+ p11->get_name(p11), current);
+ }
+ }
+ chunk_free(&entry->value);
+ chunk_free(&entry->ckaid);
+ free(entry);
+ }
+ p11->f->C_CloseSession(session);
+ if (found)
+ {
+ break;
+ }
+ }
+ enumerator->destroy(enumerator);
+ keyid->destroy(keyid);
+ raw->destroy(raw);
+ return found;
+}
+
+/**
* Find the key on the token
*/
static bool find_key(private_pkcs11_private_key_t *this, chunk_t keyid)
@@ -645,7 +780,7 @@ pkcs11_private_key_t *pkcs11_private_key_connect(key_type_t type, va_list args)
{
private_pkcs11_private_key_t *this;
char *module = NULL;
- chunk_t keyid = chunk_empty;
+ chunk_t keyid = chunk_empty, ckaid = chunk_empty;
int slot = -1;
CK_RV rv;
@@ -713,6 +848,10 @@ pkcs11_private_key_t *pkcs11_private_key_connect(key_type_t type, va_list args)
}
if (!this->lib)
{
+ this->lib = find_lib_and_keyid_by_skid(keyid, &ckaid, &slot);
+ }
+ if (!this->lib)
+ {
DBG1(DBG_CFG, "no PKCS#11 module found having a keyid %#B", &keyid);
free(this);
return NULL;
@@ -738,8 +877,17 @@ pkcs11_private_key_t *pkcs11_private_key_connect(key_type_t type, va_list args)
return NULL;
}
+ if (ckaid.ptr)
+ {
+ DBG1(DBG_CFG, "using CKA_ID '%#B' for key with keyid '%#B'",
+ &ckaid, &keyid);
+ keyid = ckaid;
+ }
+
if (!find_key(this, keyid))
{
+ DBG1(DBG_CFG, "did not find the key with %s '%#B'",
+ ckaid.ptr ? "CKA_ID" : "keyid", &keyid);
destroy(this);
return NULL;
}
@@ -751,11 +899,11 @@ pkcs11_private_key_t *pkcs11_private_key_connect(key_type_t type, va_list args)
if (!this->pubkey)
{
DBG1(DBG_CFG, "no public key or certificate found for private key "
- "on '%s':%d", module, slot);
+ "(%s '%#B') on '%s':%d", ckaid.ptr ? "CKA_ID" : "keyid",
+ &keyid, module, slot);
destroy(this);
return NULL;
}
}
-
return &this->public;
}
diff --git a/src/libstrongswan/plugins/pkcs12/Makefile.in b/src/libstrongswan/plugins/pkcs12/Makefile.in
index 02b7d2902..7e81b05bc 100644
--- a/src/libstrongswan/plugins/pkcs12/Makefile.in
+++ b/src/libstrongswan/plugins/pkcs12/Makefile.in
@@ -352,7 +352,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -386,8 +385,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -441,6 +438,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/pkcs7/Makefile.in b/src/libstrongswan/plugins/pkcs7/Makefile.in
index 5a758aa14..cbd1996f4 100644
--- a/src/libstrongswan/plugins/pkcs7/Makefile.in
+++ b/src/libstrongswan/plugins/pkcs7/Makefile.in
@@ -354,7 +354,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -388,8 +387,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -443,6 +440,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/pkcs8/Makefile.in b/src/libstrongswan/plugins/pkcs8/Makefile.in
index 92f751a61..3d27d61f1 100644
--- a/src/libstrongswan/plugins/pkcs8/Makefile.in
+++ b/src/libstrongswan/plugins/pkcs8/Makefile.in
@@ -351,7 +351,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -385,8 +384,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -440,6 +437,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/plugin_feature.c b/src/libstrongswan/plugins/plugin_feature.c
index 4c92c412c..39d86c82a 100644
--- a/src/libstrongswan/plugins/plugin_feature.c
+++ b/src/libstrongswan/plugins/plugin_feature.c
@@ -30,6 +30,7 @@ ENUM(plugin_feature_names, FEATURE_NONE, FEATURE_CUSTOM,
"SIGNER",
"HASHER",
"PRF",
+ "XOF",
"DH",
"RNG",
"NONCE_GEN",
@@ -87,6 +88,9 @@ uint32_t plugin_feature_hash(plugin_feature_t *feature)
case FEATURE_PRF:
data = chunk_from_thing(feature->arg.prf);
break;
+ case FEATURE_XOF:
+ data = chunk_from_thing(feature->arg.xof);
+ break;
case FEATURE_DH:
data = chunk_from_thing(feature->arg.dh_group);
break;
@@ -160,6 +164,8 @@ bool plugin_feature_matches(plugin_feature_t *a, plugin_feature_t *b)
return a->arg.hasher == b->arg.hasher;
case FEATURE_PRF:
return a->arg.prf == b->arg.prf;
+ case FEATURE_XOF:
+ return a->arg.xof == b->arg.xof;
case FEATURE_DH:
return a->arg.dh_group == b->arg.dh_group;
case FEATURE_RNG:
@@ -218,6 +224,7 @@ bool plugin_feature_equals(plugin_feature_t *a, plugin_feature_t *b)
case FEATURE_SIGNER:
case FEATURE_HASHER:
case FEATURE_PRF:
+ case FEATURE_XOF:
case FEATURE_DH:
case FEATURE_NONCE_GEN:
case FEATURE_RESOLVER:
@@ -305,6 +312,13 @@ char* plugin_feature_get_string(plugin_feature_t *feature)
return str;
}
break;
+ case FEATURE_XOF:
+ if (asprintf(&str, "%N:%N", plugin_feature_names, feature->type,
+ ext_out_function_names, feature->arg.xof) > 0)
+ {
+ return str;
+ }
+ break;
case FEATURE_DH:
if (asprintf(&str, "%N:%N", plugin_feature_names, feature->type,
diffie_hellman_group_names, feature->arg.dh_group) > 0)
@@ -465,6 +479,10 @@ bool plugin_feature_load(plugin_t *plugin, plugin_feature_t *feature,
lib->crypto->add_prf(lib->crypto, feature->arg.prf,
name, reg->arg.reg.f);
break;
+ case FEATURE_XOF:
+ lib->crypto->add_xof(lib->crypto, feature->arg.xof,
+ name, reg->arg.reg.f);
+ break;
case FEATURE_DH:
lib->crypto->add_dh(lib->crypto, feature->arg.dh_group,
name, reg->arg.reg.f);
@@ -552,6 +570,9 @@ bool plugin_feature_unload(plugin_t *plugin, plugin_feature_t *feature,
case FEATURE_PRF:
lib->crypto->remove_prf(lib->crypto, reg->arg.reg.f);
break;
+ case FEATURE_XOF:
+ lib->crypto->remove_xof(lib->crypto, reg->arg.reg.f);
+ break;
case FEATURE_DH:
lib->crypto->remove_dh(lib->crypto, reg->arg.reg.f);
break;
diff --git a/src/libstrongswan/plugins/plugin_feature.h b/src/libstrongswan/plugins/plugin_feature.h
index ee7808a94..8cc6277eb 100644
--- a/src/libstrongswan/plugins/plugin_feature.h
+++ b/src/libstrongswan/plugins/plugin_feature.h
@@ -110,6 +110,8 @@ struct plugin_feature_t {
FEATURE_HASHER,
/** prf_t */
FEATURE_PRF,
+ /** xof_t */
+ FEATURE_XOF,
/** diffie_hellman_t */
FEATURE_DH,
/** rng_t */
@@ -171,6 +173,8 @@ struct plugin_feature_t {
integrity_algorithm_t signer;
/** FEATURE_PRF */
pseudo_random_function_t prf;
+ /** FEATURE_XOFF */
+ ext_out_function_t xof;
/** FEATURE_HASHER */
hash_algorithm_t hasher;
/** FEATURE_DH */
@@ -278,6 +282,7 @@ struct plugin_feature_t {
#define _PLUGIN_FEATURE_SIGNER(kind, alg) __PLUGIN_FEATURE(kind, SIGNER, .signer = alg)
#define _PLUGIN_FEATURE_HASHER(kind, alg) __PLUGIN_FEATURE(kind, HASHER, .hasher = alg)
#define _PLUGIN_FEATURE_PRF(kind, alg) __PLUGIN_FEATURE(kind, PRF, .prf = alg)
+#define _PLUGIN_FEATURE_XOF(kind, alg) __PLUGIN_FEATURE(kind, XOF, .xof = alg)
#define _PLUGIN_FEATURE_DH(kind, group) __PLUGIN_FEATURE(kind, DH, .dh_group = group)
#define _PLUGIN_FEATURE_RNG(kind, quality) __PLUGIN_FEATURE(kind, RNG, .rng_quality = quality)
#define _PLUGIN_FEATURE_NONCE_GEN(kind, ...) __PLUGIN_FEATURE(kind, NONCE_GEN, .custom = NULL)
@@ -310,6 +315,7 @@ struct plugin_feature_t {
#define _PLUGIN_FEATURE_REGISTER_SIGNER(type, f) __PLUGIN_FEATURE_REGISTER(type, f)
#define _PLUGIN_FEATURE_REGISTER_HASHER(type, f) __PLUGIN_FEATURE_REGISTER(type, f)
#define _PLUGIN_FEATURE_REGISTER_PRF(type, f) __PLUGIN_FEATURE_REGISTER(type, f)
+#define _PLUGIN_FEATURE_REGISTER_XOF(type, f) __PLUGIN_FEATURE_REGISTER(type, f)
#define _PLUGIN_FEATURE_REGISTER_DH(type, f) __PLUGIN_FEATURE_REGISTER(type, f)
#define _PLUGIN_FEATURE_REGISTER_RNG(type, f) __PLUGIN_FEATURE_REGISTER(type, f)
#define _PLUGIN_FEATURE_REGISTER_NONCE_GEN(type, f) __PLUGIN_FEATURE_REGISTER(type, f)
diff --git a/src/libstrongswan/plugins/pubkey/Makefile.in b/src/libstrongswan/plugins/pubkey/Makefile.in
index c5decc3a4..40fd6264d 100644
--- a/src/libstrongswan/plugins/pubkey/Makefile.in
+++ b/src/libstrongswan/plugins/pubkey/Makefile.in
@@ -352,7 +352,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -386,8 +385,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -441,6 +438,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/random/Makefile.in b/src/libstrongswan/plugins/random/Makefile.in
index b78e62732..edd8edaf3 100644
--- a/src/libstrongswan/plugins/random/Makefile.in
+++ b/src/libstrongswan/plugins/random/Makefile.in
@@ -352,7 +352,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -386,8 +385,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -441,6 +438,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/rc2/Makefile.in b/src/libstrongswan/plugins/rc2/Makefile.in
index 51f6a17a7..0fd1ad902 100644
--- a/src/libstrongswan/plugins/rc2/Makefile.in
+++ b/src/libstrongswan/plugins/rc2/Makefile.in
@@ -350,7 +350,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -384,8 +383,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -439,6 +436,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/rdrand/Makefile.in b/src/libstrongswan/plugins/rdrand/Makefile.in
index ff853b691..88bc0af77 100644
--- a/src/libstrongswan/plugins/rdrand/Makefile.in
+++ b/src/libstrongswan/plugins/rdrand/Makefile.in
@@ -352,7 +352,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -386,8 +385,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -441,6 +438,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/revocation/Makefile.in b/src/libstrongswan/plugins/revocation/Makefile.in
index e6ce51936..4ec73eff5 100644
--- a/src/libstrongswan/plugins/revocation/Makefile.in
+++ b/src/libstrongswan/plugins/revocation/Makefile.in
@@ -353,7 +353,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -387,8 +386,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -442,6 +439,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/revocation/revocation_validator.c b/src/libstrongswan/plugins/revocation/revocation_validator.c
index fdcb9902b..f2e3cdd83 100644
--- a/src/libstrongswan/plugins/revocation/revocation_validator.c
+++ b/src/libstrongswan/plugins/revocation/revocation_validator.c
@@ -404,6 +404,26 @@ static bool verify_crl(certificate_t *crl)
}
/**
+ * Report the given CRL's validity and cache it if valid and requested
+ */
+static bool is_crl_valid(certificate_t *crl, bool cache)
+{
+ time_t valid_until;
+
+ if (crl->get_validity(crl, NULL, NULL, &valid_until))
+ {
+ DBG1(DBG_CFG, " crl is valid: until %T", &valid_until, FALSE);
+ if (cache)
+ {
+ lib->credmgr->cache_cert(lib->credmgr, crl);
+ }
+ return TRUE;
+ }
+ DBG1(DBG_CFG, " crl is stale: since %T", &valid_until, FALSE);
+ return FALSE;
+}
+
+/**
* Get the better of two CRLs, and check for usable CRL info
*/
static certificate_t *get_better_crl(certificate_t *cand, certificate_t *best,
@@ -411,7 +431,7 @@ static certificate_t *get_better_crl(certificate_t *cand, certificate_t *best,
bool cache, crl_t *base)
{
enumerator_t *enumerator;
- time_t revocation, valid_until;
+ time_t revocation;
crl_reason_t reason;
chunk_t serial;
crl_t *crl = (crl_t*)cand;
@@ -447,8 +467,6 @@ static certificate_t *get_better_crl(certificate_t *cand, certificate_t *best,
{
if (chunk_equals(serial, subject->get_serial(subject)))
{
- DBG1(DBG_CFG, "certificate was revoked on %T, reason: %N",
- &revocation, TRUE, crl_reason_names, reason);
if (reason != CRL_REASON_CERTIFICATE_HOLD)
{
*valid = VALIDATION_REVOKED;
@@ -458,6 +476,9 @@ static certificate_t *get_better_crl(certificate_t *cand, certificate_t *best,
/* if the cert is on hold, a newer CRL might not contain it */
*valid = VALIDATION_ON_HOLD;
}
+ is_crl_valid(cand, cache);
+ DBG1(DBG_CFG, "certificate was revoked on %T, reason: %N",
+ &revocation, TRUE, crl_reason_names, reason);
enumerator->destroy(enumerator);
DESTROY_IF(best);
return cand;
@@ -470,18 +491,12 @@ static certificate_t *get_better_crl(certificate_t *cand, certificate_t *best,
{
DESTROY_IF(best);
best = cand;
- if (best->get_validity(best, NULL, NULL, &valid_until))
+ if (is_crl_valid(best, cache))
{
- DBG1(DBG_CFG, " crl is valid: until %T", &valid_until, FALSE);
*valid = VALIDATION_GOOD;
- if (cache)
- { /* we cache non-stale crls only, as a stale crls are refetched */
- lib->credmgr->cache_cert(lib->credmgr, best);
- }
}
else
{
- DBG1(DBG_CFG, " crl is stale: since %T", &valid_until, FALSE);
*valid = VALIDATION_STALE;
}
}
diff --git a/src/libstrongswan/plugins/sha1/Makefile.in b/src/libstrongswan/plugins/sha1/Makefile.in
index 14d3430a6..1933aa0c0 100644
--- a/src/libstrongswan/plugins/sha1/Makefile.in
+++ b/src/libstrongswan/plugins/sha1/Makefile.in
@@ -351,7 +351,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -385,8 +384,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -440,6 +437,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/sha2/Makefile.in b/src/libstrongswan/plugins/sha2/Makefile.in
index de341503b..3fbb08157 100644
--- a/src/libstrongswan/plugins/sha2/Makefile.in
+++ b/src/libstrongswan/plugins/sha2/Makefile.in
@@ -350,7 +350,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -384,8 +383,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -439,6 +436,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/sha3/Makefile.am b/src/libstrongswan/plugins/sha3/Makefile.am
index 7ccf58ce6..a776b1de0 100644
--- a/src/libstrongswan/plugins/sha3/Makefile.am
+++ b/src/libstrongswan/plugins/sha3/Makefile.am
@@ -11,6 +11,9 @@ plugin_LTLIBRARIES = libstrongswan-sha3.la
endif
libstrongswan_sha3_la_SOURCES = \
- sha3_plugin.h sha3_plugin.c sha3_hasher.c sha3_hasher.h
+ sha3_plugin.h sha3_plugin.c \
+ sha3_hasher.c sha3_hasher.h \
+ sha3_shake.h sha3_shake.c \
+ sha3_keccak.h sha3_keccak.c
libstrongswan_sha3_la_LDFLAGS = -module -avoid-version
diff --git a/src/libstrongswan/plugins/sha3/Makefile.in b/src/libstrongswan/plugins/sha3/Makefile.in
index 0d29fcb4b..9e237a933 100644
--- a/src/libstrongswan/plugins/sha3/Makefile.in
+++ b/src/libstrongswan/plugins/sha3/Makefile.in
@@ -137,7 +137,8 @@ am__uninstall_files_from_dir = { \
am__installdirs = "$(DESTDIR)$(plugindir)"
LTLIBRARIES = $(noinst_LTLIBRARIES) $(plugin_LTLIBRARIES)
libstrongswan_sha3_la_LIBADD =
-am_libstrongswan_sha3_la_OBJECTS = sha3_plugin.lo sha3_hasher.lo
+am_libstrongswan_sha3_la_OBJECTS = sha3_plugin.lo sha3_hasher.lo \
+ sha3_shake.lo sha3_keccak.lo
libstrongswan_sha3_la_OBJECTS = $(am_libstrongswan_sha3_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -350,7 +351,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -384,8 +384,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -439,6 +437,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
@@ -451,7 +451,10 @@ AM_CFLAGS = \
@MONOLITHIC_TRUE@noinst_LTLIBRARIES = libstrongswan-sha3.la
@MONOLITHIC_FALSE@plugin_LTLIBRARIES = libstrongswan-sha3.la
libstrongswan_sha3_la_SOURCES = \
- sha3_plugin.h sha3_plugin.c sha3_hasher.c sha3_hasher.h
+ sha3_plugin.h sha3_plugin.c \
+ sha3_hasher.c sha3_hasher.h \
+ sha3_shake.h sha3_shake.c \
+ sha3_keccak.h sha3_keccak.c
libstrongswan_sha3_la_LDFLAGS = -module -avoid-version
all: all-am
@@ -544,7 +547,9 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha3_hasher.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha3_keccak.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha3_plugin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha3_shake.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
diff --git a/src/libstrongswan/plugins/sha3/sha3_hasher.c b/src/libstrongswan/plugins/sha3/sha3_hasher.c
index b34a02594..0fbcbb8dc 100644
--- a/src/libstrongswan/plugins/sha3/sha3_hasher.c
+++ b/src/libstrongswan/plugins/sha3/sha3_hasher.c
@@ -1,53 +1,25 @@
/*
- * Copyright (C) 2015 Andreas Steffen
+ * Copyright (C) 2015-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
- * Based on the implementation by the Keccak, Keyak and Ketje Teams, namely,
- * Guido Bertoni, Joan Daemen, Michaël Peeters, Gilles Van Assche and
- * Ronny Van Keer, hereby denoted as "the implementer".
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
- * To the extent possible under law, the implementer has waived all copyright
- * and related or neighboring rights to the source code in this file.
- * http://creativecommons.org/publicdomain/zero/1.0/
+ * This program 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.
*/
#include <string.h>
#include "sha3_hasher.h"
+#include "sha3_keccak.h"
typedef struct private_sha3_hasher_t private_sha3_hasher_t;
-#define KECCAK_STATE_SIZE 200 /* bytes */
-#define KECCAK_MAX_RATE 144 /* bytes */
-#define DELIMITED_SUFFIX 0x06
-
-static const uint64_t round_constants[] = {
- 0x0000000000000001ULL,
- 0x0000000000008082ULL,
- 0x800000000000808aULL,
- 0x8000000080008000ULL,
- 0x000000000000808bULL,
- 0x0000000080000001ULL,
- 0x8000000080008081ULL,
- 0x8000000000008009ULL,
- 0x000000000000008aULL,
- 0x0000000000000088ULL,
- 0x0000000080008009ULL,
- 0x000000008000000aULL,
- 0x000000008000808bULL,
- 0x800000000000008bULL,
- 0x8000000000008089ULL,
- 0x8000000000008003ULL,
- 0x8000000000008002ULL,
- 0x8000000000000080ULL,
- 0x000000000000800aULL,
- 0x800000008000000aULL,
- 0x8000000080008081ULL,
- 0x8000000000008080ULL,
- 0x0000000080000001ULL,
- 0x8000000080008008ULL
-};
-
/**
* Private data structure with hashing context for SHA-3
*/
@@ -64,309 +36,16 @@ struct private_sha3_hasher_t {
hash_algorithm_t algorithm;
/**
- * Internal state of 1600 bits as defined by FIPS-202
- */
- uint8_t state[KECCAK_STATE_SIZE];
-
- /**
- * Rate in bytes
+ * SHA-3 Keccak state
*/
- u_int rate;
-
- /**
- * Rate input buffer
- */
- uint8_t rate_buffer[KECCAK_MAX_RATE];
-
- /**
- * Index pointing to the current position in the rate buffer
- */
- u_int rate_index;
+ sha3_keccak_t *keccak;
};
-#if BYTE_ORDER != LITTLE_ENDIAN
-/**
- * Function to load a 64-bit value using the little-endian (LE) convention.
- * On a LE platform, this could be greatly simplified using a cast.
- */
-static uint64_t load64(const uint8_t *x)
-{
- int i;
- uint64_t u = 0;
-
- for (i = 7; i >= 0; --i)
- {
- u <<= 8;
- u |= x[i];
- }
- return u;
-}
-
-/**
- * Function to store a 64-bit value using the little-endian (LE) convention.
- * On a LE platform, this could be greatly simplified using a cast.
- */
-static void store64(uint8_t *x, uint64_t u)
-{
- u_int i;
-
- for (i = 0; i < 8; ++i)
- {
- x[i] = u;
- u >>= 8;
- }
-}
-
-/**
- * Function to XOR into a 64-bit value using the little-endian (LE) convention.
- * On a LE platform, this could be greatly simplified using a cast.
- */
-static void xor64(uint8_t *x, uint64_t u)
-{
- u_int i;
-
- for (i = 0; i < 8; ++i)
- {
- x[i] ^= u;
- u >>= 8;
- }
-}
-#endif
-
-/**
- * Some macros used by the Keccak-f[1600] permutation.
- */
-#define ROL64(a, offset) ((((uint64_t)a) << offset) ^ (((uint64_t)a) >> (64-offset)))
-
-#if BYTE_ORDER == LITTLE_ENDIAN
- #define readLane(i) (((uint64_t*)state)[i])
- #define writeLane(i, lane) (((uint64_t*)state)[i]) = (lane)
- #define XORLane(i, lane) (((uint64_t*)state)[i]) ^= (lane)
-#elif BYTE_ORDER == BIG_ENDIAN
- #define readLane(i) load64((uint8_t*)state+sizeof(uint64_t)*i))
- #define writeLane(i, lane) store64((uint8_t*)state+sizeof(uint64_t)*i, lane)
- #define XORLane(i, lane) xor64((uint8_t*)state+sizeof(uint64_t)*i, lane)
-#endif
-
-/**
- * Function that computes the Keccak-f[1600] permutation on the given state.
- */
-static void keccak_f1600_state_permute(void *state)
-{
- int round;
-
- for (round = 0; round < 24; round++)
- {
- { /* θ step (see [Keccak Reference, Section 2.3.2]) */
-
- uint64_t C[5], D;
-
- /* Compute the parity of the columns */
- C[0] = readLane(0) ^ readLane( 5) ^ readLane(10)
- ^ readLane(15) ^ readLane(20);
- C[1] = readLane(1) ^ readLane( 6) ^ readLane(11)
- ^ readLane(16) ^ readLane(21);
- C[2] = readLane(2) ^ readLane( 7) ^ readLane(12)
- ^ readLane(17) ^ readLane(22);
- C[3] = readLane(3) ^ readLane( 8) ^ readLane(13)
- ^ readLane(18) ^ readLane(23);
- C[4] = readLane(4) ^ readLane( 9) ^ readLane(14)
- ^ readLane(19) ^ readLane(24);
-
- /* Compute and add the θ effect to the whole column */
- D = C[4] ^ ROL64(C[1], 1);
- XORLane( 0, D);
- XORLane( 5, D);
- XORLane(10, D);
- XORLane(15, D);
- XORLane(20, D);
-
- D = C[0] ^ ROL64(C[2], 1);
- XORLane( 1, D);
- XORLane( 6, D);
- XORLane(11, D);
- XORLane(16, D);
- XORLane(21, D);
-
- D = C[1] ^ ROL64(C[3], 1);
- XORLane( 2, D);
- XORLane( 7, D);
- XORLane(12, D);
- XORLane(17, D);
- XORLane(22, D);
-
- D = C[2] ^ ROL64(C[4], 1);
- XORLane( 3, D);
- XORLane( 8, D);
- XORLane(13, D);
- XORLane(18, D);
- XORLane(23, D);
-
- D = C[3] ^ ROL64(C[0], 1);
- XORLane( 4, D);
- XORLane( 9, D);
- XORLane(14, D);
- XORLane(19, D);
- XORLane(24, D);
- }
-
- { /* ρ and π steps (see [Keccak Reference, Sections 2.3.3 and 2.3.4]) */
-
- uint64_t t1, t2;
-
- t1 = readLane( 1);
-
- t2 = readLane(10);
- writeLane(10, ROL64(t1, 1));
-
- t1 = readLane( 7);
- writeLane( 7, ROL64(t2, 3));
-
- t2 = readLane(11);
- writeLane(11, ROL64(t1, 6));
-
- t1 = readLane(17);
- writeLane(17, ROL64(t2, 10));
-
- t2 = readLane(18);
- writeLane(18, ROL64(t1, 15));
-
- t1 = readLane( 3);
- writeLane( 3, ROL64(t2, 21));
-
- t2 = readLane( 5);
- writeLane( 5, ROL64(t1, 28));
-
- t1 = readLane(16);
- writeLane(16, ROL64(t2, 36));
-
- t2 = readLane( 8);
- writeLane( 8, ROL64(t1, 45));
-
- t1 = readLane(21);
- writeLane(21, ROL64(t2, 55));
-
- t2 = readLane(24);
- writeLane(24, ROL64(t1, 2));
-
- t1 = readLane( 4);
- writeLane( 4, ROL64(t2, 14));
-
- t2 = readLane(15);
- writeLane(15, ROL64(t1, 27));
-
- t1 = readLane(23);
- writeLane(23, ROL64(t2, 41));
-
- t2 = readLane(19);
- writeLane(19, ROL64(t1, 56));
-
- t1 = readLane(13);
- writeLane(13, ROL64(t2, 8));
-
- t2 = readLane(12);
- writeLane(12, ROL64(t1, 25));
-
- t1 = readLane( 2);
- writeLane( 2, ROL64(t2, 43));
-
- t2 = readLane(20);
- writeLane(20, ROL64(t1, 62));
-
- t1 = readLane(14);
- writeLane(14, ROL64(t2, 18));
-
- t2 = readLane(22);
- writeLane(22, ROL64(t1, 39));
-
- t1 = readLane( 9);
- writeLane( 9, ROL64(t2, 61));
-
- t2 = readLane( 6);
- writeLane( 6, ROL64(t1, 20));
-
- writeLane( 1, ROL64(t2, 44));
- }
-
- { /* χ step (see [Keccak Reference, Section 2.3.1]) */
-
- uint64_t t[5];
-
- t[0] = readLane(0);
- t[1] = readLane(1);
- t[2] = readLane(2);
- t[3] = readLane(3);
- t[4] = readLane(4);
-
- writeLane(0, t[0] ^ ((~t[1]) & t[2]));
- writeLane(1, t[1] ^ ((~t[2]) & t[3]));
- writeLane(2, t[2] ^ ((~t[3]) & t[4]));
- writeLane(3, t[3] ^ ((~t[4]) & t[0]));
- writeLane(4, t[4] ^ ((~t[0]) & t[1]));
-
- t[0] = readLane(5);
- t[1] = readLane(6);
- t[2] = readLane(7);
- t[3] = readLane(8);
- t[4] = readLane(9);
-
- writeLane(5, t[0] ^ ((~t[1]) & t[2]));
- writeLane(6, t[1] ^ ((~t[2]) & t[3]));
- writeLane(7, t[2] ^ ((~t[3]) & t[4]));
- writeLane(8, t[3] ^ ((~t[4]) & t[0]));
- writeLane(9, t[4] ^ ((~t[0]) & t[1]));
-
- t[0] = readLane(10);
- t[1] = readLane(11);
- t[2] = readLane(12);
- t[3] = readLane(13);
- t[4] = readLane(14);
-
- writeLane(10, t[0] ^ ((~t[1]) & t[2]));
- writeLane(11, t[1] ^ ((~t[2]) & t[3]));
- writeLane(12, t[2] ^ ((~t[3]) & t[4]));
- writeLane(13, t[3] ^ ((~t[4]) & t[0]));
- writeLane(14, t[4] ^ ((~t[0]) & t[1]));
-
- t[0] = readLane(15);
- t[1] = readLane(16);
- t[2] = readLane(17);
- t[3] = readLane(18);
- t[4] = readLane(19);
-
- writeLane(15, t[0] ^ ((~t[1]) & t[2]));
- writeLane(16, t[1] ^ ((~t[2]) & t[3]));
- writeLane(17, t[2] ^ ((~t[3]) & t[4]));
- writeLane(18, t[3] ^ ((~t[4]) & t[0]));
- writeLane(19, t[4] ^ ((~t[0]) & t[1]));
-
- t[0] = readLane(20);
- t[1] = readLane(21);
- t[2] = readLane(22);
- t[3] = readLane(23);
- t[4] = readLane(24);
-
- writeLane(20, t[0] ^ ((~t[1]) & t[2]));
- writeLane(21, t[1] ^ ((~t[2]) & t[3]));
- writeLane(22, t[2] ^ ((~t[3]) & t[4]));
- writeLane(23, t[3] ^ ((~t[4]) & t[0]));
- writeLane(24, t[4] ^ ((~t[0]) & t[1]));
- }
-
- { /* ι step (see [Keccak Reference, Section 2.3.5]) */
-
- XORLane(0, round_constants[round]);
- }
- }
-}
-
METHOD(hasher_t, reset, bool,
private_sha3_hasher_t *this)
{
- memset(this->state, 0x00, KECCAK_STATE_SIZE);
- this->rate_index = 0;
-
+ this->keccak->reset(this->keccak);
return TRUE;
}
@@ -388,79 +67,17 @@ METHOD(hasher_t, get_hash_size, size_t,
}
}
-static void sha3_absorb(private_sha3_hasher_t *this, chunk_t data)
-{
- uint64_t *buffer_lanes, *state_lanes;
- size_t len, rate_lanes;
- int i;
-
- buffer_lanes = (uint64_t*)this->rate_buffer;
- state_lanes = (uint64_t*)this->state;
- rate_lanes = this->rate / sizeof(uint64_t);
-
- while (data.len)
- {
- len = min(data.len, this->rate - this->rate_index);
- memcpy(this->rate_buffer + this->rate_index, data.ptr, len);
- this->rate_index += len;
- data.ptr += len;
- data.len -= len;
-
- if (this->rate_index == this->rate)
- {
- for (i = 0; i < rate_lanes; i++)
- {
- state_lanes[i] ^= buffer_lanes[i];
- }
- this->rate_index = 0;
-
- keccak_f1600_state_permute(this->state);
- }
- }
-}
-
-static void sha3_final(private_sha3_hasher_t *this)
-{
- uint64_t *buffer_lanes, *state_lanes;
- size_t rate_lanes, remainder;
- int i;
-
- /* Add the delimitedSuffix as the first bit of padding */
- this->rate_buffer[this->rate_index++] = DELIMITED_SUFFIX;
-
- buffer_lanes = (uint64_t*)this->rate_buffer;
- state_lanes = (uint64_t*)this->state;
- rate_lanes = this->rate_index / sizeof(uint64_t);
-
- remainder = this->rate_index - rate_lanes * sizeof(uint64_t);
- if (remainder)
- {
- memset(this->rate_buffer + this->rate_index, 0x00,
- sizeof(uint64_t) - remainder);
- rate_lanes++;
- }
- for (i = 0; i < rate_lanes; i++)
- {
- state_lanes[i] ^= buffer_lanes[i];
- }
-
- /* Add the second bit of padding */
- this->state[this->rate - 1] ^= 0x80;
-
- /* Switch to the squeezing phase */
- keccak_f1600_state_permute(this->state);
-}
METHOD(hasher_t, get_hash, bool,
private_sha3_hasher_t *this, chunk_t chunk, uint8_t *buffer)
{
- sha3_absorb(this, chunk);
+ this->keccak->absorb(this->keccak, chunk);
if (buffer != NULL)
{
- sha3_final(this);
- memcpy(buffer, this->state, get_hash_size(this));
- reset(this);
+ this->keccak->finalize(this->keccak);
+ this->keccak->squeeze(this->keccak, get_hash_size(this), buffer);
+ this->keccak->reset(this->keccak);
}
return TRUE;
}
@@ -470,22 +87,24 @@ METHOD(hasher_t, allocate_hash, bool,
{
chunk_t allocated_hash;
- sha3_absorb(this, chunk);
+ this->keccak->absorb(this->keccak, chunk);
if (hash != NULL)
{
- sha3_final(this);
+ this->keccak->finalize(this->keccak);
allocated_hash = chunk_alloc(get_hash_size(this));
- memcpy(allocated_hash.ptr, this->state, allocated_hash.len);
- reset(this);
+ this->keccak->squeeze(this->keccak, allocated_hash.len,
+ allocated_hash.ptr);
+ this->keccak->reset(this->keccak);
*hash = allocated_hash;
}
return TRUE;
}
METHOD(hasher_t, destroy, void,
- sha3_hasher_t *this)
+ private_sha3_hasher_t *this)
{
+ this->keccak->destroy(this->keccak);
free(this);
}
@@ -510,18 +129,22 @@ sha3_hasher_t *sha3_hasher_create(hash_algorithm_t algorithm)
INIT(this,
.public = {
.hasher_interface = {
- .reset = _reset,
- .get_hash_size = _get_hash_size,
- .get_hash = _get_hash,
- .allocate_hash = _allocate_hash,
- .destroy = _destroy,
+ .reset = _reset,
+ .get_hash_size = _get_hash_size,
+ .get_hash = _get_hash,
+ .allocate_hash = _allocate_hash,
+ .destroy = _destroy,
},
},
.algorithm = algorithm,
);
- this->rate = KECCAK_STATE_SIZE - 2*get_hash_size(this);
- reset(this);
+ this->keccak = sha3_keccak_create(2*get_hash_size(this), 0x06);
+ if (!this->keccak)
+ {
+ free(this);
+ return NULL;
+ }
return &this->public;
}
diff --git a/src/libstrongswan/plugins/sha3/sha3_keccak.c b/src/libstrongswan/plugins/sha3/sha3_keccak.c
new file mode 100644
index 000000000..1be1db160
--- /dev/null
+++ b/src/libstrongswan/plugins/sha3/sha3_keccak.c
@@ -0,0 +1,498 @@
+/*
+ * Copyright (C) 2015-2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * Based on the implementation by the Keccak, Keyak and Ketje Teams, namely,
+ * Guido Bertoni, Joan Daemen, Michaël Peeters, Gilles Van Assche and
+ * Ronny Van Keer, hereby denoted as "the implementer".
+ *
+ * To the extent possible under law, the implementer has waived all copyright
+ * and related or neighboring rights to the source code in this file.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+#include <string.h>
+
+#include "sha3_keccak.h"
+
+typedef struct private_sha3_keccak_t private_sha3_keccak_t;
+
+#define KECCAK_STATE_SIZE 200 /* bytes */
+#define KECCAK_MAX_RATE 168 /* bytes */
+
+static const uint64_t round_constants[] = {
+ 0x0000000000000001ULL,
+ 0x0000000000008082ULL,
+ 0x800000000000808aULL,
+ 0x8000000080008000ULL,
+ 0x000000000000808bULL,
+ 0x0000000080000001ULL,
+ 0x8000000080008081ULL,
+ 0x8000000000008009ULL,
+ 0x000000000000008aULL,
+ 0x0000000000000088ULL,
+ 0x0000000080008009ULL,
+ 0x000000008000000aULL,
+ 0x000000008000808bULL,
+ 0x800000000000008bULL,
+ 0x8000000000008089ULL,
+ 0x8000000000008003ULL,
+ 0x8000000000008002ULL,
+ 0x8000000000000080ULL,
+ 0x000000000000800aULL,
+ 0x800000008000000aULL,
+ 0x8000000080008081ULL,
+ 0x8000000000008080ULL,
+ 0x0000000080000001ULL,
+ 0x8000000080008008ULL
+};
+
+/**
+ * Private data structure with hashing context for SHA-3
+ */
+struct private_sha3_keccak_t {
+
+ /**
+ * Public interface for this hasher.
+ */
+ sha3_keccak_t public;
+
+ /**
+ * Internal state of 1600 bits as defined by FIPS-202
+ */
+ uint8_t state[KECCAK_STATE_SIZE];
+
+ /**
+ * Rate in bytes
+ */
+ u_int rate;
+
+ /**
+ * Rate input buffer
+ */
+ uint8_t rate_buffer[KECCAK_MAX_RATE];
+
+ /**
+ * Index pointing to the current position in the rate buffer
+ */
+ u_int rate_index;
+
+ /**
+ * Suffix delimiting the input message
+ */
+ uint8_t delimited_suffix;
+
+};
+
+#if BYTE_ORDER != LITTLE_ENDIAN
+/**
+ * Function to load a 64-bit value using the little-endian (LE) convention.
+ * On a LE platform, this could be greatly simplified using a cast.
+ */
+static uint64_t load64(const uint8_t *x)
+{
+ int i;
+ uint64_t u = 0;
+
+ for (i = 7; i >= 0; --i)
+ {
+ u <<= 8;
+ u |= x[i];
+ }
+ return u;
+}
+
+/**
+ * Function to store a 64-bit value using the little-endian (LE) convention.
+ * On a LE platform, this could be greatly simplified using a cast.
+ */
+static void store64(uint8_t *x, uint64_t u)
+{
+ u_int i;
+
+ for (i = 0; i < 8; ++i)
+ {
+ x[i] = u;
+ u >>= 8;
+ }
+}
+
+/**
+ * Function to XOR into a 64-bit value using the little-endian (LE) convention.
+ * On a LE platform, this could be greatly simplified using a cast.
+ */
+static void xor64(uint8_t *x, uint64_t u)
+{
+ u_int i;
+
+ for (i = 0; i < 8; ++i)
+ {
+ x[i] ^= u;
+ u >>= 8;
+ }
+}
+#endif
+
+/**
+ * Some macros used by the Keccak-f[1600] permutation.
+ */
+#define ROL64(a, offset) ((((uint64_t)a) << offset) ^ (((uint64_t)a) >> (64-offset)))
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+ #define readLane(i) (((uint64_t*)state)[i])
+ #define writeLane(i, lane) (((uint64_t*)state)[i]) = (lane)
+ #define XORLane(i, lane) (((uint64_t*)state)[i]) ^= (lane)
+#elif BYTE_ORDER == BIG_ENDIAN
+ #define readLane(i) load64((uint8_t*)state+sizeof(uint64_t)*i))
+ #define writeLane(i, lane) store64((uint8_t*)state+sizeof(uint64_t)*i, lane)
+ #define XORLane(i, lane) xor64((uint8_t*)state+sizeof(uint64_t)*i, lane)
+#endif
+
+/**
+ * Function that computes the Keccak-f[1600] permutation on the given state.
+ */
+static void keccak_f1600_state_permute(void *state)
+{
+ int round;
+
+ for (round = 0; round < 24; round++)
+ {
+ { /* θ step (see [Keccak Reference, Section 2.3.2]) */
+
+ uint64_t C[5], D;
+
+ /* Compute the parity of the columns */
+ C[0] = readLane(0) ^ readLane( 5) ^ readLane(10)
+ ^ readLane(15) ^ readLane(20);
+ C[1] = readLane(1) ^ readLane( 6) ^ readLane(11)
+ ^ readLane(16) ^ readLane(21);
+ C[2] = readLane(2) ^ readLane( 7) ^ readLane(12)
+ ^ readLane(17) ^ readLane(22);
+ C[3] = readLane(3) ^ readLane( 8) ^ readLane(13)
+ ^ readLane(18) ^ readLane(23);
+ C[4] = readLane(4) ^ readLane( 9) ^ readLane(14)
+ ^ readLane(19) ^ readLane(24);
+
+ /* Compute and add the θ effect to the whole column */
+ D = C[4] ^ ROL64(C[1], 1);
+ XORLane( 0, D);
+ XORLane( 5, D);
+ XORLane(10, D);
+ XORLane(15, D);
+ XORLane(20, D);
+
+ D = C[0] ^ ROL64(C[2], 1);
+ XORLane( 1, D);
+ XORLane( 6, D);
+ XORLane(11, D);
+ XORLane(16, D);
+ XORLane(21, D);
+
+ D = C[1] ^ ROL64(C[3], 1);
+ XORLane( 2, D);
+ XORLane( 7, D);
+ XORLane(12, D);
+ XORLane(17, D);
+ XORLane(22, D);
+
+ D = C[2] ^ ROL64(C[4], 1);
+ XORLane( 3, D);
+ XORLane( 8, D);
+ XORLane(13, D);
+ XORLane(18, D);
+ XORLane(23, D);
+
+ D = C[3] ^ ROL64(C[0], 1);
+ XORLane( 4, D);
+ XORLane( 9, D);
+ XORLane(14, D);
+ XORLane(19, D);
+ XORLane(24, D);
+ }
+
+ { /* ρ and π steps (see [Keccak Reference, Sections 2.3.3 and 2.3.4]) */
+
+ uint64_t t1, t2;
+
+ t1 = readLane( 1);
+
+ t2 = readLane(10);
+ writeLane(10, ROL64(t1, 1));
+
+ t1 = readLane( 7);
+ writeLane( 7, ROL64(t2, 3));
+
+ t2 = readLane(11);
+ writeLane(11, ROL64(t1, 6));
+
+ t1 = readLane(17);
+ writeLane(17, ROL64(t2, 10));
+
+ t2 = readLane(18);
+ writeLane(18, ROL64(t1, 15));
+
+ t1 = readLane( 3);
+ writeLane( 3, ROL64(t2, 21));
+
+ t2 = readLane( 5);
+ writeLane( 5, ROL64(t1, 28));
+
+ t1 = readLane(16);
+ writeLane(16, ROL64(t2, 36));
+
+ t2 = readLane( 8);
+ writeLane( 8, ROL64(t1, 45));
+
+ t1 = readLane(21);
+ writeLane(21, ROL64(t2, 55));
+
+ t2 = readLane(24);
+ writeLane(24, ROL64(t1, 2));
+
+ t1 = readLane( 4);
+ writeLane( 4, ROL64(t2, 14));
+
+ t2 = readLane(15);
+ writeLane(15, ROL64(t1, 27));
+
+ t1 = readLane(23);
+ writeLane(23, ROL64(t2, 41));
+
+ t2 = readLane(19);
+ writeLane(19, ROL64(t1, 56));
+
+ t1 = readLane(13);
+ writeLane(13, ROL64(t2, 8));
+
+ t2 = readLane(12);
+ writeLane(12, ROL64(t1, 25));
+
+ t1 = readLane( 2);
+ writeLane( 2, ROL64(t2, 43));
+
+ t2 = readLane(20);
+ writeLane(20, ROL64(t1, 62));
+
+ t1 = readLane(14);
+ writeLane(14, ROL64(t2, 18));
+
+ t2 = readLane(22);
+ writeLane(22, ROL64(t1, 39));
+
+ t1 = readLane( 9);
+ writeLane( 9, ROL64(t2, 61));
+
+ t2 = readLane( 6);
+ writeLane( 6, ROL64(t1, 20));
+
+ writeLane( 1, ROL64(t2, 44));
+ }
+
+ { /* χ step (see [Keccak Reference, Section 2.3.1]) */
+
+ uint64_t t[5];
+
+ t[0] = readLane(0);
+ t[1] = readLane(1);
+ t[2] = readLane(2);
+ t[3] = readLane(3);
+ t[4] = readLane(4);
+
+ writeLane(0, t[0] ^ ((~t[1]) & t[2]));
+ writeLane(1, t[1] ^ ((~t[2]) & t[3]));
+ writeLane(2, t[2] ^ ((~t[3]) & t[4]));
+ writeLane(3, t[3] ^ ((~t[4]) & t[0]));
+ writeLane(4, t[4] ^ ((~t[0]) & t[1]));
+
+ t[0] = readLane(5);
+ t[1] = readLane(6);
+ t[2] = readLane(7);
+ t[3] = readLane(8);
+ t[4] = readLane(9);
+
+ writeLane(5, t[0] ^ ((~t[1]) & t[2]));
+ writeLane(6, t[1] ^ ((~t[2]) & t[3]));
+ writeLane(7, t[2] ^ ((~t[3]) & t[4]));
+ writeLane(8, t[3] ^ ((~t[4]) & t[0]));
+ writeLane(9, t[4] ^ ((~t[0]) & t[1]));
+
+ t[0] = readLane(10);
+ t[1] = readLane(11);
+ t[2] = readLane(12);
+ t[3] = readLane(13);
+ t[4] = readLane(14);
+
+ writeLane(10, t[0] ^ ((~t[1]) & t[2]));
+ writeLane(11, t[1] ^ ((~t[2]) & t[3]));
+ writeLane(12, t[2] ^ ((~t[3]) & t[4]));
+ writeLane(13, t[3] ^ ((~t[4]) & t[0]));
+ writeLane(14, t[4] ^ ((~t[0]) & t[1]));
+
+ t[0] = readLane(15);
+ t[1] = readLane(16);
+ t[2] = readLane(17);
+ t[3] = readLane(18);
+ t[4] = readLane(19);
+
+ writeLane(15, t[0] ^ ((~t[1]) & t[2]));
+ writeLane(16, t[1] ^ ((~t[2]) & t[3]));
+ writeLane(17, t[2] ^ ((~t[3]) & t[4]));
+ writeLane(18, t[3] ^ ((~t[4]) & t[0]));
+ writeLane(19, t[4] ^ ((~t[0]) & t[1]));
+
+ t[0] = readLane(20);
+ t[1] = readLane(21);
+ t[2] = readLane(22);
+ t[3] = readLane(23);
+ t[4] = readLane(24);
+
+ writeLane(20, t[0] ^ ((~t[1]) & t[2]));
+ writeLane(21, t[1] ^ ((~t[2]) & t[3]));
+ writeLane(22, t[2] ^ ((~t[3]) & t[4]));
+ writeLane(23, t[3] ^ ((~t[4]) & t[0]));
+ writeLane(24, t[4] ^ ((~t[0]) & t[1]));
+ }
+
+ { /* ι step (see [Keccak Reference, Section 2.3.5]) */
+
+ XORLane(0, round_constants[round]);
+ }
+ }
+}
+
+METHOD(sha3_keccak_t, get_rate, u_int,
+ private_sha3_keccak_t *this)
+{
+ return this->rate;
+}
+
+METHOD(sha3_keccak_t, reset, void,
+ private_sha3_keccak_t *this)
+{
+ memset(this->state, 0x00, KECCAK_STATE_SIZE);
+ this->rate_index = 0;
+}
+
+
+METHOD(sha3_keccak_t, absorb, void,
+ private_sha3_keccak_t *this, chunk_t data)
+{
+ uint64_t *buffer_lanes, *state_lanes;
+ size_t len, rate_lanes;
+ int i;
+
+ buffer_lanes = (uint64_t*)this->rate_buffer;
+ state_lanes = (uint64_t*)this->state;
+ rate_lanes = this->rate / sizeof(uint64_t);
+
+ while (data.len)
+ {
+ len = min(data.len, this->rate - this->rate_index);
+ memcpy(this->rate_buffer + this->rate_index, data.ptr, len);
+ this->rate_index += len;
+ data.ptr += len;
+ data.len -= len;
+
+ if (this->rate_index == this->rate)
+ {
+ for (i = 0; i < rate_lanes; i++)
+ {
+ state_lanes[i] ^= buffer_lanes[i];
+ }
+ this->rate_index = 0;
+
+ keccak_f1600_state_permute(this->state);
+ }
+ }
+}
+
+METHOD(sha3_keccak_t, finalize, void,
+ private_sha3_keccak_t *this)
+{
+ uint64_t *buffer_lanes, *state_lanes;
+ size_t rate_lanes, remainder;
+ int i;
+
+ /* Add the delimitedSuffix as the first bit of padding */
+ this->rate_buffer[this->rate_index++] = this->delimited_suffix;
+
+ buffer_lanes = (uint64_t*)this->rate_buffer;
+ state_lanes = (uint64_t*)this->state;
+ rate_lanes = this->rate_index / sizeof(uint64_t);
+
+ remainder = this->rate_index - rate_lanes * sizeof(uint64_t);
+ if (remainder)
+ {
+ memset(this->rate_buffer + this->rate_index, 0x00,
+ sizeof(uint64_t) - remainder);
+ rate_lanes++;
+ }
+ for (i = 0; i < rate_lanes; i++)
+ {
+ state_lanes[i] ^= buffer_lanes[i];
+ }
+
+ /* Add the second bit of padding */
+ this->state[this->rate - 1] ^= 0x80;
+
+ /* Switch to the squeezing phase */
+ keccak_f1600_state_permute(this->state);
+ this->rate_index = 0;
+}
+
+METHOD(sha3_keccak_t, squeeze, void,
+ private_sha3_keccak_t *this, size_t out_len, uint8_t *out)
+{
+ size_t index = 0, len;
+
+ while (index < out_len)
+ {
+ if (this->rate_index == this->rate)
+ {
+ keccak_f1600_state_permute(this->state);
+ this->rate_index = 0;
+ }
+ len = min(out_len - index, this->rate - this->rate_index);
+ memcpy(out, &this->state[this->rate_index], len);
+ out += len;
+ index += len;
+ this->rate_index += len;
+ }
+}
+
+METHOD(sha3_keccak_t, destroy, void,
+ private_sha3_keccak_t *this)
+{
+ free(this);
+}
+
+/*
+ * Described in header.
+ */
+sha3_keccak_t *sha3_keccak_create(u_int capacity, uint8_t delimited_suffix)
+{
+ private_sha3_keccak_t *this;
+ int rate;
+
+ rate = KECCAK_STATE_SIZE - capacity;
+
+ if (rate <= 0 || rate > KECCAK_MAX_RATE)
+ {
+ return NULL;
+ }
+
+ INIT(this,
+ .public = {
+ .get_rate = _get_rate,
+ .reset = _reset,
+ .absorb = _absorb,
+ .finalize = _finalize,
+ .squeeze = _squeeze,
+ .destroy = _destroy,
+ },
+ .rate = rate,
+ .delimited_suffix = delimited_suffix,
+ );
+
+ return &this->public;
+}
diff --git a/src/libstrongswan/plugins/sha3/sha3_keccak.h b/src/libstrongswan/plugins/sha3/sha3_keccak.h
new file mode 100644
index 000000000..eeea9d7fd
--- /dev/null
+++ b/src/libstrongswan/plugins/sha3/sha3_keccak.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+n */
+
+/**
+ * @defgroup sha3_keccak sha3_keccak
+ * @{ @ingroup sha3_p
+ */
+
+#ifndef SHA3_KECCAK_H_
+#define SHA3_KECCAK_H_
+
+typedef struct sha3_keccak_t sha3_keccak_t;
+
+#include <crypto/hashers/hasher.h>
+
+/**
+ * Implements the Keccak-f[1600] sponge function as defined by FIPS-202.
+ */
+struct sha3_keccak_t {
+
+ /**
+ * Get the available rate in bytes
+ *
+ * @return rate in bytes
+ */
+ u_int (*get_rate)(sha3_keccak_t *this);
+
+ /**
+ * Resets the internal Keccak state
+ */
+ void (*reset)(sha3_keccak_t *this);
+
+ /**
+ * Absorbs data into the Keccak state
+ *
+ * @param data data to be absorbed
+ */
+ void (*absorb)(sha3_keccak_t *this, chunk_t data);
+
+ /**
+ * Finalize the absorption phase and switch to the squeeze phase
+ */
+ void (*finalize)(sha3_keccak_t *this);
+
+ /**
+ * Squeeze the Keccak state to get output data
+ * Can be called multiple times
+ *
+ * @param out_len number of output bytes requested
+ * @param out output buffer, must comprise at least out_len bytes
+ */
+ void (*squeeze)(sha3_keccak_t *this, size_t out_len, uint8_t *out);
+
+ /**
+ * Destroy the sha3_keccak_t object
+ */
+ void (*destroy)(sha3_keccak_t *this);
+
+};
+
+/**
+ * Creates a new sha3_keccak_t.
+ *
+ * @param capacity required capacity to achieve a given security level
+ * @param delimited_suffix bits delimiting the input message
+ * @return sha3_keccak_t object, NULL if capacity too big
+ */
+sha3_keccak_t *sha3_keccak_create(u_int capacity, uint8_t delimited_suffix);
+
+#endif /** SHA3_KECCAK_H_ @}*/
diff --git a/src/libstrongswan/plugins/sha3/sha3_plugin.c b/src/libstrongswan/plugins/sha3/sha3_plugin.c
index 28068f38e..8268e67c3 100644
--- a/src/libstrongswan/plugins/sha3/sha3_plugin.c
+++ b/src/libstrongswan/plugins/sha3/sha3_plugin.c
@@ -14,9 +14,10 @@
*/
#include "sha3_plugin.h"
+#include "sha3_hasher.h"
+#include "sha3_shake.h"
#include <library.h>
-#include "sha3_hasher.h"
typedef struct private_sha3_plugin_t private_sha3_plugin_t;
@@ -46,6 +47,9 @@ METHOD(plugin_t, get_features, int,
PLUGIN_PROVIDE(HASHER, HASH_SHA3_256),
PLUGIN_PROVIDE(HASHER, HASH_SHA3_384),
PLUGIN_PROVIDE(HASHER, HASH_SHA3_512),
+ PLUGIN_REGISTER(XOF, sha3_shake_create),
+ PLUGIN_PROVIDE(XOF, XOF_SHAKE_128),
+ PLUGIN_PROVIDE(XOF, XOF_SHAKE_256),
};
*features = f;
return countof(f);
diff --git a/src/libstrongswan/plugins/sha3/sha3_shake.c b/src/libstrongswan/plugins/sha3/sha3_shake.c
new file mode 100644
index 000000000..0f1af39f5
--- /dev/null
+++ b/src/libstrongswan/plugins/sha3/sha3_shake.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+#include "sha3_shake.h"
+#include "sha3_keccak.h"
+
+typedef struct private_sha3_shake_t private_sha3_shake_t;
+
+
+/**
+ * Private data structure with hashing context for SHA-3
+ */
+struct private_sha3_shake_t {
+
+ /**
+ * Public interface for this hasher.
+ */
+ sha3_shake_t public;
+
+ /**
+ * XOF algorithm to be used (XOF_SHAKE_128 or XOF_SHAKE_256)
+ */
+ ext_out_function_t algorithm;
+
+ /**
+ * SHA-3 Keccak state
+ */
+ sha3_keccak_t *keccak;
+
+ /**
+ * Capacity in bytes of the SHA-3 Keccak state
+ */
+ u_int capacity;
+
+};
+
+METHOD(xof_t, get_type, ext_out_function_t,
+ private_sha3_shake_t *this)
+{
+ return this->algorithm;
+}
+
+METHOD(xof_t, get_bytes, bool,
+ private_sha3_shake_t *this, size_t out_len, uint8_t *buffer)
+{
+ this->keccak->squeeze(this->keccak, out_len, buffer);
+ return TRUE;
+}
+
+METHOD(xof_t, allocate_bytes, bool,
+ private_sha3_shake_t *this, size_t out_len, chunk_t *chunk)
+{
+ *chunk = chunk_alloc(out_len);
+ this->keccak->squeeze(this->keccak, out_len, chunk->ptr);
+ return TRUE;
+}
+
+METHOD(xof_t, get_block_size, size_t,
+ private_sha3_shake_t *this)
+{
+ return this->keccak->get_rate(this->keccak);
+}
+
+METHOD(xof_t, get_seed_size, size_t,
+ private_sha3_shake_t *this)
+{
+ return this->capacity;
+}
+
+METHOD(xof_t, set_seed, bool,
+ private_sha3_shake_t *this, chunk_t seed)
+{
+ this->keccak->reset(this->keccak);
+ this->keccak->absorb(this->keccak, seed);
+ this->keccak->finalize(this->keccak);
+ return TRUE;
+}
+
+
+METHOD(xof_t, destroy, void,
+ private_sha3_shake_t *this)
+{
+ this->keccak->destroy(this->keccak);
+ free(this);
+}
+
+/*
+ * Described in header.
+ */
+sha3_shake_t* sha3_shake_create(ext_out_function_t algorithm)
+{
+ private_sha3_shake_t *this;
+ u_int capacity = 0;
+
+ switch (algorithm)
+ {
+ case XOF_SHAKE_128:
+ capacity = 32;
+ break;
+ case XOF_SHAKE_256:
+ capacity = 64;
+ break;
+ default:
+ return NULL;
+ }
+
+ INIT(this,
+ .public = {
+ .xof_interface = {
+ .get_type = _get_type,
+ .get_bytes = _get_bytes,
+ .allocate_bytes = _allocate_bytes,
+ .get_block_size = _get_block_size,
+ .get_seed_size = _get_seed_size,
+ .set_seed = _set_seed,
+ .destroy = _destroy,
+ },
+ },
+ .algorithm = algorithm,
+ .capacity = capacity,
+ );
+
+ this->keccak = sha3_keccak_create(capacity, 0x1f);
+ if (!this->keccak)
+ {
+ free(this);
+ return NULL;
+ }
+
+ return &this->public;
+}
diff --git a/src/libstrongswan/plugins/sha3/sha3_shake.h b/src/libstrongswan/plugins/sha3/sha3_shake.h
new file mode 100644
index 000000000..a8643edd7
--- /dev/null
+++ b/src/libstrongswan/plugins/sha3/sha3_shake.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program 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.
+ */
+
+/**
+ * @defgroup sha3_shake sha3_shake
+ * @{ @ingroup sha3_p
+ */
+
+#ifndef SHA3_SHAKE_H_
+#define SHA3_SHAKE_H_
+
+typedef struct sha3_shake_t sha3_shake_t;
+
+#include <crypto/xofs/xof.h>
+
+/**
+ * Implementation of xof_t interface using the SHA-3 XOF algorithm family
+ * SHAKE128 and SHAKE256 as defined by FIPS-202.
+ */
+struct sha3_shake_t {
+
+ /**
+ * Generic xof_t interface for this Extended Output Function (XOF).
+ */
+ xof_t xof_interface;
+};
+
+/**
+ * Creates a new sha3_shake_t.
+ *
+ * @param algorithm XOF_SHAKE_128 or XOF_SHAKE_256
+ * @return sha3_shake_t object, NULL if not supported
+ */
+sha3_shake_t* sha3_shake_create(ext_out_function_t algorithm);
+
+#endif /** SHA3_SHAKE_H_ @}*/
diff --git a/src/libstrongswan/plugins/soup/Makefile.in b/src/libstrongswan/plugins/soup/Makefile.in
index 6563f8335..97ab30763 100644
--- a/src/libstrongswan/plugins/soup/Makefile.in
+++ b/src/libstrongswan/plugins/soup/Makefile.in
@@ -351,7 +351,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -385,8 +384,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -440,6 +437,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/sqlite/Makefile.in b/src/libstrongswan/plugins/sqlite/Makefile.in
index 268730e14..4551ff766 100644
--- a/src/libstrongswan/plugins/sqlite/Makefile.in
+++ b/src/libstrongswan/plugins/sqlite/Makefile.in
@@ -353,7 +353,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -387,8 +386,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -442,6 +439,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/sshkey/Makefile.in b/src/libstrongswan/plugins/sshkey/Makefile.in
index d50b29565..47e2234c4 100644
--- a/src/libstrongswan/plugins/sshkey/Makefile.in
+++ b/src/libstrongswan/plugins/sshkey/Makefile.in
@@ -353,7 +353,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -387,8 +386,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -442,6 +439,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/test_vectors/Makefile.am b/src/libstrongswan/plugins/test_vectors/Makefile.am
index ab540e78e..c29b6fd1e 100644
--- a/src/libstrongswan/plugins/test_vectors/Makefile.am
+++ b/src/libstrongswan/plugins/test_vectors/Makefile.am
@@ -20,6 +20,7 @@ libstrongswan_test_vectors_la_SOURCES = \
test_vectors/aes_ccm.c \
test_vectors/aes_gcm.c \
test_vectors/chacha20poly1305.c \
+ test_vectors/chacha20_xof.c \
test_vectors/blowfish.c \
test_vectors/camellia_cbc.c \
test_vectors/camellia_ctr.c \
@@ -41,6 +42,7 @@ libstrongswan_test_vectors_la_SOURCES = \
test_vectors/sha2.c \
test_vectors/sha2_hmac.c \
test_vectors/sha3.c \
+ test_vectors/sha3_shake.c \
test_vectors/fips_prf.c \
test_vectors/modp.c \
test_vectors/modpsub.c \
diff --git a/src/libstrongswan/plugins/test_vectors/Makefile.in b/src/libstrongswan/plugins/test_vectors/Makefile.in
index 6721909f0..56ae8dcab 100644
--- a/src/libstrongswan/plugins/test_vectors/Makefile.in
+++ b/src/libstrongswan/plugins/test_vectors/Makefile.in
@@ -143,18 +143,19 @@ am_libstrongswan_test_vectors_la_OBJECTS = test_vectors_plugin.lo \
test_vectors/aes_ctr.lo test_vectors/aes_xcbc.lo \
test_vectors/aes_cmac.lo test_vectors/aes_ccm.lo \
test_vectors/aes_gcm.lo test_vectors/chacha20poly1305.lo \
- test_vectors/blowfish.lo test_vectors/camellia_cbc.lo \
- test_vectors/camellia_ctr.lo test_vectors/camellia_xcbc.lo \
- test_vectors/cast.lo test_vectors/des.lo test_vectors/idea.lo \
- test_vectors/null.lo test_vectors/rc2.lo test_vectors/rc5.lo \
+ test_vectors/chacha20_xof.lo test_vectors/blowfish.lo \
+ test_vectors/camellia_cbc.lo test_vectors/camellia_ctr.lo \
+ test_vectors/camellia_xcbc.lo test_vectors/cast.lo \
+ test_vectors/des.lo test_vectors/idea.lo test_vectors/null.lo \
+ test_vectors/rc2.lo test_vectors/rc5.lo \
test_vectors/serpent_cbc.lo test_vectors/twofish_cbc.lo \
test_vectors/md2.lo test_vectors/md4.lo test_vectors/md5.lo \
test_vectors/md5_hmac.lo test_vectors/sha1.lo \
test_vectors/sha1_hmac.lo test_vectors/sha2.lo \
test_vectors/sha2_hmac.lo test_vectors/sha3.lo \
- test_vectors/fips_prf.lo test_vectors/modp.lo \
- test_vectors/modpsub.lo test_vectors/ecp.lo \
- test_vectors/ecpbp.lo test_vectors/rng.lo
+ test_vectors/sha3_shake.lo test_vectors/fips_prf.lo \
+ test_vectors/modp.lo test_vectors/modpsub.lo \
+ test_vectors/ecp.lo test_vectors/ecpbp.lo test_vectors/rng.lo
libstrongswan_test_vectors_la_OBJECTS = \
$(am_libstrongswan_test_vectors_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
@@ -369,7 +370,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -403,8 +403,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -458,6 +456,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
@@ -479,6 +479,7 @@ libstrongswan_test_vectors_la_SOURCES = \
test_vectors/aes_ccm.c \
test_vectors/aes_gcm.c \
test_vectors/chacha20poly1305.c \
+ test_vectors/chacha20_xof.c \
test_vectors/blowfish.c \
test_vectors/camellia_cbc.c \
test_vectors/camellia_ctr.c \
@@ -500,6 +501,7 @@ libstrongswan_test_vectors_la_SOURCES = \
test_vectors/sha2.c \
test_vectors/sha2_hmac.c \
test_vectors/sha3.c \
+ test_vectors/sha3_shake.c \
test_vectors/fips_prf.c \
test_vectors/modp.c \
test_vectors/modpsub.c \
@@ -609,6 +611,8 @@ test_vectors/aes_gcm.lo: test_vectors/$(am__dirstamp) \
test_vectors/$(DEPDIR)/$(am__dirstamp)
test_vectors/chacha20poly1305.lo: test_vectors/$(am__dirstamp) \
test_vectors/$(DEPDIR)/$(am__dirstamp)
+test_vectors/chacha20_xof.lo: test_vectors/$(am__dirstamp) \
+ test_vectors/$(DEPDIR)/$(am__dirstamp)
test_vectors/blowfish.lo: test_vectors/$(am__dirstamp) \
test_vectors/$(DEPDIR)/$(am__dirstamp)
test_vectors/camellia_cbc.lo: test_vectors/$(am__dirstamp) \
@@ -651,6 +655,8 @@ test_vectors/sha2_hmac.lo: test_vectors/$(am__dirstamp) \
test_vectors/$(DEPDIR)/$(am__dirstamp)
test_vectors/sha3.lo: test_vectors/$(am__dirstamp) \
test_vectors/$(DEPDIR)/$(am__dirstamp)
+test_vectors/sha3_shake.lo: test_vectors/$(am__dirstamp) \
+ test_vectors/$(DEPDIR)/$(am__dirstamp)
test_vectors/fips_prf.lo: test_vectors/$(am__dirstamp) \
test_vectors/$(DEPDIR)/$(am__dirstamp)
test_vectors/modp.lo: test_vectors/$(am__dirstamp) \
@@ -688,6 +694,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@test_vectors/$(DEPDIR)/camellia_ctr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@test_vectors/$(DEPDIR)/camellia_xcbc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@test_vectors/$(DEPDIR)/cast.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@test_vectors/$(DEPDIR)/chacha20_xof.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@test_vectors/$(DEPDIR)/chacha20poly1305.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@test_vectors/$(DEPDIR)/des.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@test_vectors/$(DEPDIR)/ecp.Plo@am__quote@
@@ -710,6 +717,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@test_vectors/$(DEPDIR)/sha2.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@test_vectors/$(DEPDIR)/sha2_hmac.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@test_vectors/$(DEPDIR)/sha3.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@test_vectors/$(DEPDIR)/sha3_shake.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@test_vectors/$(DEPDIR)/twofish_cbc.Plo@am__quote@
.c.o:
diff --git a/src/libstrongswan/plugins/test_vectors/test_vectors.h b/src/libstrongswan/plugins/test_vectors/test_vectors.h
index 3ff211da8..43633e3ff 100644
--- a/src/libstrongswan/plugins/test_vectors/test_vectors.h
+++ b/src/libstrongswan/plugins/test_vectors/test_vectors.h
@@ -258,6 +258,21 @@ TEST_VECTOR_PRF(sha512_hmac_p5)
TEST_VECTOR_PRF(sha512_hmac_p6)
TEST_VECTOR_PRF(fips_prf_1)
+TEST_VECTOR_XOF(shake_128_0)
+TEST_VECTOR_XOF(shake_128_32)
+TEST_VECTOR_XOF(shake_128_167)
+TEST_VECTOR_XOF(shake_128_168)
+TEST_VECTOR_XOF(shake_128_255)
+TEST_VECTOR_XOF(shake_256_0)
+TEST_VECTOR_XOF(shake_256_64)
+TEST_VECTOR_XOF(shake_256_135)
+TEST_VECTOR_XOF(shake_256_136)
+TEST_VECTOR_XOF(shake_256_255)
+TEST_VECTOR_XOF(chacha20_xof_1)
+TEST_VECTOR_XOF(chacha20_xof_2)
+TEST_VECTOR_XOF(chacha20_xof_3)
+TEST_VECTOR_XOF(chacha20_xof_4)
+
TEST_VECTOR_RNG(rng_monobit_1)
TEST_VECTOR_RNG(rng_monobit_2)
TEST_VECTOR_RNG(rng_monobit_3)
diff --git a/src/libstrongswan/plugins/test_vectors/test_vectors/chacha20_xof.c b/src/libstrongswan/plugins/test_vectors/test_vectors/chacha20_xof.c
new file mode 100644
index 000000000..2c602c6a3
--- /dev/null
+++ b/src/libstrongswan/plugins/test_vectors/test_vectors/chacha20_xof.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the Licenseor (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be usefulbut
+ * 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.
+ */
+
+#include <crypto/crypto_tester.h>
+
+/**
+ * ChaCha20 Stream Test Vector from RFC 7539, Section 2.3.2
+ */
+xof_test_vector_t chacha20_xof_1 = {
+ .alg = XOF_CHACHA20, .len = 44,
+ .seed = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+ "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+ "\x00\x00\x00\x09\x00\x00\x00\x4a\x00\x00\x00\x00",
+ .out_len = 64,
+ .out = "\x10\xf1\xe7\xe4\xd1\x3b\x59\x15\x50\x0f\xdd\x1f\xa3\x20\x71\xc4"
+ "\xc7\xd1\xf4\xc7\x33\xc0\x68\x03\x04\x22\xaa\x9a\xc3\xd4\x6c\x4e"
+ "\xd2\x82\x64\x46\x07\x9f\xaa\x09\x14\xc2\xd7\x05\xd9\x8b\x02\xa2"
+ "\xb5\x12\x9c\xd1\xde\x16\x4e\xb9\xcb\xd0\x83\xe8\xa2\x50\x3c\x4e"
+};
+
+/**
+ * ChaCha20 Stream Test Vector from RFC 7539, Section 2.4.2
+ */
+xof_test_vector_t chacha20_xof_2 = {
+ .alg = XOF_CHACHA20, .len = 44,
+ .seed = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+ "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+ "\x00\x00\x00\x00\x00\x00\x00\x4a\x00\x00\x00\x00",
+ .out_len = 114,
+ .out = "\x22\x4f\x51\xf3\x40\x1b\xd9\xe1\x2f\xde\x27\x6f\xb8\x63\x1d\xed"
+ "\x8c\x13\x1f\x82\x3d\x2c\x06\xe2\x7e\x4f\xca\xec\x9e\xf3\xcf\x78"
+ "\x8a\x3b\x0a\xa3\x72\x60\x0a\x92\xb5\x79\x74\xcd\xed\x2b\x93\x34"
+ "\x79\x4c\xba\x40\xc6\x3e\x34\xcd\xea\x21\x2c\x4c\xf0\x7d\x41\xb7"
+ "\x69\xa6\x74\x9f\x3f\x63\x0f\x41\x22\xca\xfe\x28\xec\x4d\xc4\x7e"
+ "\x26\xd4\x34\x6d\x70\xb9\x8c\x73\xf3\xe9\xc5\x3a\xc4\x0c\x59\x45"
+ "\x39\x8b\x6e\xda\x1a\x83\x2c\x89\xc1\x67\xea\xcd\x90\x1d\x7e\x2b"
+ "\xf3\x63"
+};
+
+/**
+ * ChaCha20 Stream Test Vector #2 from RFC 7539, Section A1.
+ */
+xof_test_vector_t chacha20_xof_3 = {
+ .alg = XOF_CHACHA20, .len = 44,
+ .seed = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
+ .out_len = 64,
+ .out = "\x9f\x07\xe7\xbe\x55\x51\x38\x7a\x98\xba\x97\x7c\x73\x2d\x08\x0d"
+ "\xcb\x0f\x29\xa0\x48\xe3\x65\x69\x12\xc6\x53\x3e\x32\xee\x7a\xed"
+ "\x29\xb7\x21\x76\x9c\xe6\x4e\x43\xd5\x71\x33\xb0\x74\xd8\x39\xd5"
+ "\x31\xed\x1f\x28\x51\x0a\xfb\x45\xac\xe1\x0a\x1f\x4b\x79\x4d\x6f"
+};
+
+/**
+ * ChaCha20 Stream Test Vector #3 from RFC 7539, Section A1.
+ */
+xof_test_vector_t chacha20_xof_4 = {
+ .alg = XOF_CHACHA20, .len = 44,
+ .seed = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
+ .out_len = 64,
+ .out = "\x3a\xeb\x52\x24\xec\xf8\x49\x92\x9b\x9d\x82\x8d\xb1\xce\xd4\xdd"
+ "\x83\x20\x25\xe8\x01\x8b\x81\x60\xb8\x22\x84\xf3\xc9\x49\xaa\x5a"
+ "\x8e\xca\x00\xbb\xb4\xa7\x3b\xda\xd1\x92\xb5\xc4\x2f\x73\xf2\xfd"
+ "\x4e\x27\x36\x44\xc8\xb3\x61\x25\xa6\x4a\xdd\xeb\x00\x6c\x13\xa0"
+};
+
diff --git a/src/libstrongswan/plugins/test_vectors/test_vectors/sha3.c b/src/libstrongswan/plugins/test_vectors/test_vectors/sha3.c
index e659f66f4..d8212f8df 100644
--- a/src/libstrongswan/plugins/test_vectors/test_vectors/sha3.c
+++ b/src/libstrongswan/plugins/test_vectors/test_vectors/sha3.c
@@ -23,7 +23,6 @@ hasher_test_vector_t sha3_224_0 = {
.data = "",
.hash = "\x6B\x4E\x03\x42\x36\x67\xDB\xB7\x3B\x6E\x15\x45\x4F\x0E\xB1\xAB"
"\xD4\x59\x7F\x9A\x1B\x07\x8E\x3F\x5B\x5A\x6B\xC7"
-
};
hasher_test_vector_t sha3_224_1 = {
diff --git a/src/libstrongswan/plugins/test_vectors/test_vectors/sha3_shake.c b/src/libstrongswan/plugins/test_vectors/test_vectors/sha3_shake.c
new file mode 100644
index 000000000..0150d0a80
--- /dev/null
+++ b/src/libstrongswan/plugins/test_vectors/test_vectors/sha3_shake.c
@@ -0,0 +1,472 @@
+/*
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the Licenseor (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be usefulbut
+ * 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.
+ */
+
+#include <crypto/crypto_tester.h>
+
+/**
+ * SHAKE-128 vectors from "https://github.com/gvanas/KeccakCodePackage/"
+ */
+xof_test_vector_t shake_128_0 = {
+ .alg = XOF_SHAKE_128, .len = 0,
+ .seed = "",
+ .out_len = 512,
+ .out = "\x7F\x9C\x2B\xA4\xE8\x8F\x82\x7D\x61\x60\x45\x50\x76\x05\x85\x3E"
+ "\xD7\x3B\x80\x93\xF6\xEF\xBC\x88\xEB\x1A\x6E\xAC\xFA\x66\xEF\x26"
+ "\x3C\xB1\xEE\xA9\x88\x00\x4B\x93\x10\x3C\xFB\x0A\xEE\xFD\x2A\x68"
+ "\x6E\x01\xFA\x4A\x58\xE8\xA3\x63\x9C\xA8\xA1\xE3\xF9\xAE\x57\xE2"
+ "\x35\xB8\xCC\x87\x3C\x23\xDC\x62\xB8\xD2\x60\x16\x9A\xFA\x2F\x75"
+ "\xAB\x91\x6A\x58\xD9\x74\x91\x88\x35\xD2\x5E\x6A\x43\x50\x85\xB2"
+ "\xBA\xDF\xD6\xDF\xAA\xC3\x59\xA5\xEF\xBB\x7B\xCC\x4B\x59\xD5\x38"
+ "\xDF\x9A\x04\x30\x2E\x10\xC8\xBC\x1C\xBF\x1A\x0B\x3A\x51\x20\xEA"
+ "\x17\xCD\xA7\xCF\xAD\x76\x5F\x56\x23\x47\x4D\x36\x8C\xCC\xA8\xAF"
+ "\x00\x07\xCD\x9F\x5E\x4C\x84\x9F\x16\x7A\x58\x0B\x14\xAA\xBD\xEF"
+ "\xAE\xE7\xEE\xF4\x7C\xB0\xFC\xA9\x76\x7B\xE1\xFD\xA6\x94\x19\xDF"
+ "\xB9\x27\xE9\xDF\x07\x34\x8B\x19\x66\x91\xAB\xAE\xB5\x80\xB3\x2D"
+ "\xEF\x58\x53\x8B\x8D\x23\xF8\x77\x32\xEA\x63\xB0\x2B\x4F\xA0\xF4"
+ "\x87\x33\x60\xE2\x84\x19\x28\xCD\x60\xDD\x4C\xEE\x8C\xC0\xD4\xC9"
+ "\x22\xA9\x61\x88\xD0\x32\x67\x5C\x8A\xC8\x50\x93\x3C\x7A\xFF\x15"
+ "\x33\xB9\x4C\x83\x4A\xDB\xB6\x9C\x61\x15\xBA\xD4\x69\x2D\x86\x19"
+ "\xF9\x0B\x0C\xDF\x8A\x7B\x9C\x26\x40\x29\xAC\x18\x5B\x70\xB8\x3F"
+ "\x28\x01\xF2\xF4\xB3\xF7\x0C\x59\x3E\xA3\xAE\xEB\x61\x3A\x7F\x1B"
+ "\x1D\xE3\x3F\xD7\x50\x81\xF5\x92\x30\x5F\x2E\x45\x26\xED\xC0\x96"
+ "\x31\xB1\x09\x58\xF4\x64\xD8\x89\xF3\x1B\xA0\x10\x25\x0F\xDA\x7F"
+ "\x13\x68\xEC\x29\x67\xFC\x84\xEF\x2A\xE9\xAF\xF2\x68\xE0\xB1\x70"
+ "\x0A\xFF\xC6\x82\x0B\x52\x3A\x3D\x91\x71\x35\xF2\xDF\xF2\xEE\x06"
+ "\xBF\xE7\x2B\x31\x24\x72\x1D\x4A\x26\xC0\x4E\x53\xA7\x5E\x30\xE7"
+ "\x3A\x7A\x9C\x4A\x95\xD9\x1C\x55\xD4\x95\xE9\xF5\x1D\xD0\xB5\xE9"
+ "\xD8\x3C\x6D\x5E\x8C\xE8\x03\xAA\x62\xB8\xD6\x54\xDB\x53\xD0\x9B"
+ "\x8D\xCF\xF2\x73\xCD\xFE\xB5\x73\xFA\xD8\xBC\xD4\x55\x78\xBE\xC2"
+ "\xE7\x70\xD0\x1E\xFD\xE8\x6E\x72\x1A\x3F\x7C\x6C\xCE\x27\x5D\xAB"
+ "\xE6\xE2\x14\x3F\x1A\xF1\x8D\xA7\xEF\xDD\xC4\xC7\xB7\x0B\x5E\x34"
+ "\x5D\xB9\x3C\xC9\x36\xBE\xA3\x23\x49\x1C\xCB\x38\xA3\x88\xF5\x46"
+ "\xA9\xFF\x00\xDD\x4E\x13\x00\xB9\xB2\x15\x3D\x20\x41\xD2\x05\xB4"
+ "\x43\xE4\x1B\x45\xA6\x53\xF2\xA5\xC4\x49\x2C\x1A\xDD\x54\x45\x12"
+ "\xDD\xA2\x52\x98\x33\x46\x2B\x71\xA4\x1A\x45\xBE\x97\x29\x0B\x6F"
+};
+
+xof_test_vector_t shake_128_32 = {
+ .alg = XOF_SHAKE_128, .len = 32,
+ .seed = "\x9F\x2F\xCC\x7C\x90\xDE\x09\x0D\x6B\x87\xCD\x7E\x97\x18\xC1\xEA"
+ "\x6C\xB2\x11\x18\xFC\x2D\x5D\xE9\xF9\x7E\x5D\xB6\xAC\x1E\x9C\x10",
+ .out_len = 512,
+ .out = "\xFC\xDE\xAD\x82\xF3\x9C\xDF\xCE\xF9\x9C\x1B\xAB\xB6\x74\xA9\xA8"
+ "\xE2\x4A\xC5\x94\x64\x6C\x31\xD0\x20\xA4\xCD\x2B\xC2\x55\x4A\xFD"
+ "\x78\xC4\xE4\x13\xF7\x80\x4F\xA1\x70\x8B\x9F\x40\x00\xFD\x86\x0E"
+ "\x30\x70\xF2\xE1\xBA\x9E\xEE\x38\x05\x35\x2A\xAD\x65\x5B\x4B\x0A"
+ "\x72\x8F\x2D\x5F\xCC\x43\x24\x38\x25\xBC\x0D\xCE\x33\xCA\x71\x66"
+ "\x26\xDC\x76\xE9\x20\xD7\x25\x75\xE2\x6D\xDD\x71\x10\xD0\xF9\x91"
+ "\xA9\x12\x00\xB5\x13\xAE\xE2\x3A\xC9\xBC\x70\x43\xA1\x52\xAC\xE0"
+ "\xCD\x0B\x49\x18\x1D\x2B\xB6\xBD\x36\xE9\x3C\x0B\x62\x7A\xCA\x9C"
+ "\x6A\xB6\xC8\x5E\xD7\x0C\xE7\x62\x42\x9C\x8F\x26\x27\x08\x10\x32"
+ "\x84\xC0\xA7\x92\x13\x8F\x10\xE8\x56\x8E\xFB\x23\x99\xB3\x8A\x31"
+ "\x05\x5C\x11\x88\xBA\x59\x34\x4E\x6A\x2B\x73\xD5\xC0\x4A\xA5\x24"
+ "\x05\x66\x49\x84\x4D\x1D\xAD\xCD\x07\xD3\x5D\xF5\xD8\x51\xEB\xAF"
+ "\xFC\xA5\x70\x3B\x80\x15\x3E\xA6\x27\xB1\xBA\xDF\xB2\x88\x5F\x70"
+ "\xF7\x86\xD3\x4F\x56\x50\xFE\x73\xE3\x69\x0A\x8A\x96\x61\x00\x59"
+ "\x25\x3D\xD3\xAB\xB5\xFA\x7C\x54\xCF\x6E\x77\x69\x5D\x24\xA6\x59"
+ "\x40\x77\xEE\x4D\x36\x73\xF9\xFC\x56\xC6\x2F\xC7\xF7\x10\xCF\x87"
+ "\x20\x14\xC0\xA7\xDE\x8B\x1C\xA6\xAE\x8C\xEF\xAA\xDE\xAF\x5F\x4D"
+ "\x05\x5F\xF7\x65\xAD\x41\x87\x13\xF2\xDD\x08\xEA\xFB\x5E\x16\xEE"
+ "\xD9\xFE\x34\x4E\xE8\xD4\x38\x8F\xDC\x22\x35\x1F\x63\x83\x40\x17"
+ "\xB5\x39\xE3\xFF\x14\x3F\x39\x4B\x5B\x74\xD0\x6F\x65\xE9\x6A\x7A"
+ "\x3D\x02\x8F\xD1\x4F\x6C\x70\x01\xEB\x7A\xD2\xDC\xFC\xF4\xB2\x44"
+ "\x7A\xA1\x73\xA2\xAE\x8E\xDB\x58\x1B\x5B\xBD\x89\xE8\xA4\x68\xFE"
+ "\x0A\x38\x50\x75\x30\xB9\x79\x5D\xA3\xBC\xEC\x6D\xDE\xBC\xE9\xEB"
+ "\x31\x32\xEF\x18\xC9\xC2\xA8\xB9\x36\xA4\x31\xC8\xB1\x21\xFA\x99"
+ "\x6F\xF9\xBA\x5C\xE5\x22\x98\x6B\x67\x8A\x5E\xC9\x9A\x10\x3A\x91"
+ "\xCF\x33\x19\x6E\x08\xC8\x2D\xC6\x5E\x68\xAE\xD2\x38\xA9\x31\x6A"
+ "\x73\xE7\x1C\xF5\xA6\x7C\xE4\x40\xB9\x3B\xDB\x84\x5B\x3A\x60\x53"
+ "\x9E\xCC\xDC\xE4\x1B\xC7\x23\xEC\x9A\x14\xEE\x4E\x08\x2F\x60\xC0"
+ "\xBE\x3D\x5E\x50\xDF\xC8\xBE\x1E\x86\xA9\x7E\xCE\xE9\xD8\x8E\x2B"
+ "\xB2\xA3\xAF\xF4\x7F\xBD\x6D\x66\x75\xD8\x1E\xFE\x07\x08\x92\x6B"
+ "\x81\xAB\x31\x4A\x52\x4F\xC7\x45\x09\x01\x62\xD2\xAC\x72\x3C\x43"
+ "\x26\xE0\xF9\xE1\x6F\xBD\xBA\x2B\x1E\x99\x14\xBB\xEE\xDF\xF9\x6B"
+};
+
+xof_test_vector_t shake_128_167 = {
+ .alg = XOF_SHAKE_128, .len = 167,
+ .seed = "\x0D\x8D\x09\xAE\xD1\x9F\x10\x13\x96\x9C\xE5\xE7\xEB\x92\xF8\x3A"
+ "\x20\x9A\xE7\x6B\xE3\x1C\x75\x48\x44\xEA\x91\x16\xCE\xB3\x9A\x22"
+ "\xEB\xB6\x00\x30\x17\xBB\xCF\x26\x55\x5F\xA6\x62\x41\x85\x18\x7D"
+ "\xB8\xF0\xCB\x35\x64\xB8\xB1\xC0\x6B\xF6\x85\xD4\x7F\x32\x86\xED"
+ "\xA2\x0B\x83\x35\x8F\x59\x9D\x20\x44\xBB\xF0\x58\x3F\xAB\x8D\x78"
+ "\xF8\x54\xFE\x0A\x59\x61\x83\x23\x0C\x5E\xF8\xE5\x44\x26\x75\x0E"
+ "\xAF\x2C\xC4\xE2\x9D\x3B\xDD\x03\x7E\x73\x4D\x86\x3C\x2B\xD9\x78"
+ "\x9B\x4C\x24\x30\x96\x13\x8F\x76\x72\xC2\x32\x31\x4E\xFF\xDF\xC6"
+ "\x51\x34\x27\xE2\xDA\x76\x91\x6B\x52\x48\x93\x3B\xE3\x12\xEB\x5D"
+ "\xDE\x4C\xF7\x08\x04\xFB\x25\x8A\xC5\xFB\x82\xD5\x8D\x08\x17\x7A"
+ "\xC6\xF4\x75\x60\x17\xFF\xF5",
+ .out_len = 512,
+ .out = "\xC7\x3D\x8F\xAA\xB5\xD0\xB4\xD6\x60\xBD\x50\x82\xE4\x4C\x3C\xAC"
+ "\x97\xE6\x16\x48\xBE\x0A\x04\xB1\x16\x72\x4E\x6F\x6B\x65\x76\x84"
+ "\x67\x4B\x4B\x0E\x90\xD0\xAE\x96\xC0\x85\x3E\xBD\x83\x7B\xD8\x24"
+ "\x9A\xDB\xD3\xB6\x0A\x1A\xD1\xFC\xF8\xA6\xAB\x8E\x2F\x5A\xA7\xFF"
+ "\x19\x7A\x3D\x7D\xBE\xDE\xFB\x43\x3B\x61\x35\x36\xAE\xC4\xD6\x55"
+ "\xB7\xBC\xD7\x78\x52\x6B\xE6\x67\x84\x7A\xCD\x2E\x05\x64\xD9\x6C"
+ "\xE5\x14\x0C\x91\x35\x7F\xAD\xE0\x00\xEF\xCB\x40\x45\x7E\x1B\x6C"
+ "\xED\x41\xFA\x10\x2E\x36\xE7\x99\x79\x2D\xB0\x3E\x9A\x40\xC7\x99"
+ "\xBC\xA9\x12\x62\x94\x8E\x17\x60\x50\x65\xFB\xF6\x38\xFB\x40\xA1"
+ "\x57\xB4\x5C\xF7\x91\x1A\x75\x3D\x0D\x20\x5D\xF8\x47\x16\xA5\x71"
+ "\x12\xBE\xAB\x44\xF6\x20\x1F\xF7\x5A\xAD\xE0\xBA\xFB\xA5\x04\x74"
+ "\x5C\xFE\x23\xE4\xE6\x0E\x67\xE3\x99\x36\x22\xAE\xD7\x3A\x1D\xD6"
+ "\xA4\x65\xBD\x45\x3D\xD3\xC5\xBA\x7D\x2C\xDF\x3F\x1D\x39\x37\x6A"
+ "\x67\xC2\x3E\x55\x5F\x5A\xCF\x25\xBC\xE1\xE5\x5F\x30\x72\x52\xB9"
+ "\xAA\xC2\xC0\xA3\x9C\x88\x5C\x7E\x44\xF2\x04\xCB\x82\x1C\x0D\x37"
+ "\xA2\x2D\xE3\xA7\x1F\x3A\x19\x09\xB1\x1B\x71\x81\xC4\x2B\xE9\xB7"
+ "\x8A\xA0\xD0\xA1\x54\x44\xF3\x30\x00\x75\x54\xBC\xFC\xC0\xD8\xFD"
+ "\x87\xD6\x43\x1F\xB9\x3C\x7C\xC3\x87\x67\xA5\x5D\x30\xD3\x54\x55"
+ "\x60\xBD\x38\x0D\xB8\xC4\xC0\xED\xA9\x39\x9F\x68\xF8\x54\x64\x42"
+ "\x66\xC1\xB7\x95\x8B\x27\x0E\x75\xB7\x91\x34\xAA\x01\xE7\xDC\xF1"
+ "\xE6\xFD\xB6\xD9\xAE\x5D\x02\xCC\xE8\xCE\x8E\x48\x04\x75\xE9\x61"
+ "\x7C\xC4\x2A\x91\xC0\x8D\x9A\xF6\xE5\x10\x1B\x8A\xC5\x83\x4A\xDB"
+ "\x2C\x66\x98\x7F\x42\xA5\x80\xBB\x50\x3A\x4B\x34\xA9\xF1\x5A\xDC"
+ "\xD0\xE2\x3D\x0D\x40\x29\x47\x97\x64\x83\x1D\x06\xB5\xCA\xF3\xF1"
+ "\x4B\x91\x44\x9F\x15\xA2\x91\xF4\xAC\x25\x0B\x27\x0B\x6C\xB3\xC3"
+ "\x04\x72\x5C\x99\xE3\x26\x45\xE1\xFC\x02\xA0\xCD\xDD\x9E\x71\x79"
+ "\x11\xF2\x34\x2D\x94\x82\xF8\xE0\x97\x99\x85\xA0\x17\x0D\x72\x5D"
+ "\xAB\x4E\xA6\x6D\x44\xF6\x26\xBA\x47\x59\x25\xFA\x39\xFC\x9D\xEE"
+ "\x92\x9C\x06\xD0\x09\x41\x6C\x0A\xDC\x1D\x98\x7C\xD6\x25\xA2\x0A"
+ "\xCB\xA4\xCC\x87\xF7\x2F\x61\x08\x67\xC3\xA7\xA9\x28\xA3\xA0\x37"
+ "\x96\x76\xE8\xFE\x25\x71\x07\xAB\x2F\x5C\x03\x0B\xD2\x48\x0E\x3D"
+ "\x18\x63\x56\x2E\x1F\xD0\x79\x02\x80\x33\x3E\xD9\xD5\xDD\x5A\x5C"
+};
+
+xof_test_vector_t shake_128_168 = {
+ .alg = XOF_SHAKE_128, .len = 168,
+ .seed = "\xC3\x23\x6B\x73\xDE\xB7\x66\x2B\xF3\xF3\xDA\xA5\x8F\x13\x7B\x35"
+ "\x8B\xA6\x10\x56\x0E\xF7\x45\x57\x85\xA9\xBE\xFD\xB0\x35\xA0\x66"
+ "\xE9\x07\x04\xF9\x29\xBD\x96\x89\xCE\xF0\xCE\x3B\xDA\x5A\xCF\x44"
+ "\x80\xBC\xEB\x8D\x09\xD1\x0B\x09\x8A\xD8\x50\x0D\x9B\x60\x71\xDF"
+ "\xC3\xA1\x4A\xF6\xC7\x75\x11\xD8\x1E\x3A\xA8\x84\x49\x86\xC3\xBE"
+ "\xA6\xF4\x69\xF9\xE0\x21\x94\xC9\x28\x68\xCD\x5F\x51\x64\x62\x56"
+ "\x79\x8F\xF0\x42\x49\x54\xC1\x43\x4B\xDF\xED\x9F\xAC\xB3\x90\xB0"
+ "\x7D\x34\x2E\x99\x29\x36\xE0\xF8\x8B\xFD\x0E\x88\x4A\x0D\xDB\x67"
+ "\x9D\x05\x47\xCC\xDE\xC6\x38\x42\x85\xA4\x54\x29\xD1\x15\xAC\x7D"
+ "\x23\x5A\x71\x72\x42\x02\x1D\x1D\xC3\x56\x41\xF5\xF0\xA4\x8E\x84"
+ "\x45\xDB\xA5\x8E\x6C\xB2\xC8\xEA",
+ .out_len = 512,
+ .out = "\x4A\x05\xF2\xEF\x1A\xAD\x5F\xF4\x30\x64\x29\xEC\x0F\x19\x04\x40"
+ "\x77\xFB\x64\xBF\xE1\xDC\xC5\x0F\x74\xC3\xF0\x45\xE9\xA9\xC3\xDE"
+ "\x4A\x3B\x59\x63\xAE\xF7\x71\xB0\x49\x11\x1B\x7B\x46\x40\xE2\x0B"
+ "\x1B\xA8\x4E\xD7\xAF\xEE\x32\x55\x71\xAC\xF3\x47\xE3\x11\xF3\x3C"
+ "\x1D\x42\x1F\x21\xD6\x63\x06\x5C\x4D\xAD\xDB\xD1\x78\x5C\x5D\xAC"
+ "\x0D\x55\x4C\xED\xB1\xA4\x5A\x32\xE2\x81\x45\xE9\x8F\x49\xDE\xE2"
+ "\x85\xB3\x3D\xE1\x4C\x33\x6D\x10\x95\x0E\xCC\x30\x96\x6B\x79\xE8"
+ "\x61\x3F\xFE\xBB\x70\x2F\xCC\x00\xA1\xC4\x25\x0D\xD3\x85\xAB\xB5"
+ "\x37\xA2\x84\xE9\x10\x8D\x16\xB6\xF0\x8F\x4E\x10\x3F\x2C\x5E\x9E"
+ "\x5C\x87\x9C\xB5\x09\x55\x34\x15\x1E\x3C\x9A\x31\x6D\x06\xDC\xE5"
+ "\x3B\x7F\x01\xB4\x24\xD3\x75\xB5\x64\xFE\x68\x39\xD1\xD1\xF0\x0A"
+ "\x2E\x62\x60\x40\x60\xA9\x74\x8B\xCD\xC8\x14\x37\x37\x95\x9F\xAB"
+ "\xBC\xAE\x18\x51\x21\x3E\x6D\xC2\x8B\xEF\xDA\x48\x14\x9D\xE6\xAA"
+ "\xF4\xA6\x0D\x46\x15\xBE\xD6\x7D\x11\x79\x6F\x61\x73\xC3\xDC\xF1"
+ "\x39\x03\x7B\x31\xEE\xC9\xA8\x40\x4D\xF0\x75\x97\xBC\x26\x6D\x3C"
+ "\x7D\x9E\xB9\xA7\xCA\xBF\x74\x9F\xB4\x4E\x40\xD7\x46\xD0\xE9\xDF"
+ "\xB5\xC8\xBB\xEB\x25\xE3\xF1\x61\x2D\x03\xD3\xEB\x0C\x15\x4D\xE4"
+ "\xB2\x70\x8C\x4F\x8A\x89\x76\x2E\x17\x1F\x74\x45\x18\xAE\xC1\x34"
+ "\xA0\x2E\xEA\xF4\x9D\xB2\xE2\xC6\xC9\x91\x47\x11\x28\x8D\x6B\x0C"
+ "\xE8\x77\x86\x1D\x9B\x10\xAC\xFC\xC1\x96\x43\x73\x82\x87\xDA\x00"
+ "\x52\x82\xF3\xFC\x82\xF9\xF5\x0A\xA6\x81\xF2\xF5\x5F\xE1\x80\x9C"
+ "\x9E\x23\xA3\xA5\x9E\x51\xC2\xE8\x94\xF7\x18\x37\x2F\x9F\xA1\x56"
+ "\x4B\x47\xAB\x3F\x43\xF0\x74\x7A\x17\x83\x9E\x93\x33\x69\xB6\x77"
+ "\x80\x53\xE1\x76\x4F\x52\xC5\xF3\x19\xE3\x3C\x8B\x25\x67\x8F\x72"
+ "\x33\x2E\x33\xCC\xA9\x7C\x68\xF1\x9E\x05\x8E\x70\xC3\x14\x10\xDF"
+ "\x4D\xE7\xE0\x81\x69\xD6\x09\x6B\x7B\x4E\xA4\x82\x71\xEB\x68\x4F"
+ "\xEE\x9F\xC8\xB5\x61\xC3\xFE\xE2\xDC\xE8\x3D\x09\x2B\x14\x2B\xEC"
+ "\x14\x78\xD2\x6B\x48\xC3\xC6\xE5\x97\xA7\xB2\xE4\x40\x27\xE1\xEC"
+ "\xA2\x31\x78\xD3\xAF\xCC\x67\xBB\x53\x0A\x52\x9C\x7E\x13\x36\xE1"
+ "\xAD\xAE\x74\xEF\x0B\xE9\xCD\x61\xE9\x1C\x6A\xEA\x57\xF7\xCC\xB2"
+ "\x3B\x64\xB2\xF8\x48\x61\xCE\x15\x92\x09\xFE\xF7\xA8\x97\xA1\x6A"
+ "\x87\x1A\xA9\x9E\x63\xA5\x12\x6D\xF2\xB0\x33\x87\xE4\x2C\x3D\x18"
+};
+
+xof_test_vector_t shake_128_255 = {
+ .alg = XOF_SHAKE_128, .len = 255,
+ .seed = "\x3A\x3A\x81\x9C\x48\xEF\xDE\x2A\xD9\x14\xFB\xF0\x0E\x18\xAB\x6B"
+ "\xC4\xF1\x45\x13\xAB\x27\xD0\xC1\x78\xA1\x88\xB6\x14\x31\xE7\xF5"
+ "\x62\x3C\xB6\x6B\x23\x34\x67\x75\xD3\x86\xB5\x0E\x98\x2C\x49\x3A"
+ "\xDB\xBF\xC5\x4B\x9A\x3C\xD3\x83\x38\x23\x36\xA1\xA0\xB2\x15\x0A"
+ "\x15\x35\x8F\x33\x6D\x03\xAE\x18\xF6\x66\xC7\x57\x3D\x55\xC4\xFD"
+ "\x18\x1C\x29\xE6\xCC\xFD\xE6\x3E\xA3\x5F\x0A\xDF\x58\x85\xCF\xC0"
+ "\xA3\xD8\x4A\x2B\x2E\x4D\xD2\x44\x96\xDB\x78\x9E\x66\x31\x70\xCE"
+ "\xF7\x47\x98\xAA\x1B\xBC\xD4\x57\x4E\xA0\xBB\xA4\x04\x89\xD7\x64"
+ "\xB2\xF8\x3A\xAD\xC6\x6B\x14\x8B\x4A\x0C\xD9\x52\x46\xC1\x27\xD5"
+ "\x87\x1C\x4F\x11\x41\x86\x90\xA5\xDD\xF0\x12\x46\xA0\xC8\x0A\x43"
+ "\xC7\x00\x88\xB6\x18\x36\x39\xDC\xFD\xA4\x12\x5B\xD1\x13\xA8\xF4"
+ "\x9E\xE2\x3E\xD3\x06\xFA\xAC\x57\x6C\x3F\xB0\xC1\xE2\x56\x67\x1D"
+ "\x81\x7F\xC2\x53\x4A\x52\xF5\xB4\x39\xF7\x2E\x42\x4D\xE3\x76\xF4"
+ "\xC5\x65\xCC\xA8\x23\x07\xDD\x9E\xF7\x6D\xA5\xB7\xC4\xEB\x7E\x08"
+ "\x51\x72\xE3\x28\x80\x7C\x02\xD0\x11\xFF\xBF\x33\x78\x53\x78\xD7"
+ "\x9D\xC2\x66\xF6\xA5\xBE\x6B\xB0\xE4\xA9\x2E\xCE\xEB\xAE\xB1",
+ .out_len = 512,
+ .out = "\x14\x23\x6E\x75\xB9\x78\x4D\xF4\xF5\x79\x35\xF9\x45\x35\x6C\xBE"
+ "\x38\x3F\xE5\x13\xED\x30\x28\x6F\x91\x06\x07\x59\xBC\xB0\xEF\x4B"
+ "\xAA\xC8\x58\xEC\xAE\x7C\x6E\x7E\xDD\x49\x8F\x01\xA0\x82\xB6\x3F"
+ "\xA5\x7D\x22\x54\x02\x31\xE2\xE2\x5C\x83\xEF\xB3\xB3\xF2\x95\x3A"
+ "\x5F\x67\x45\x02\xAB\x63\x52\x26\x44\x6B\x84\x93\x76\x43\xDC\xD5"
+ "\x78\x9E\xE7\x3F\x1D\x73\x4B\xC8\xFE\x5F\x7F\x08\x83\xAB\x10\x96"
+ "\x1B\x9A\x31\xFF\x60\xDE\xE1\x61\x59\xBC\x69\x82\xEF\xB0\x85\x45"
+ "\x98\x4B\xF7\x1F\xED\x1C\x4C\xD8\x1C\x09\x14\xB4\xC1\x9F\xCF\xEE"
+ "\xF5\x4A\xF4\xBB\xE3\x72\xF1\x8C\xFC\xD3\xA1\x86\x57\xF5\xB9\x45"
+ "\x0F\x99\xA7\x8F\x0F\xA2\xC3\xCD\xCA\x74\x61\xC4\xED\x75\x69\x53"
+ "\x68\x83\xB6\x6C\xD8\x7E\x9C\x20\x09\x62\x90\x2E\xAA\x16\xA5\x4D"
+ "\xB6\xA0\xA5\xCC\x26\xD8\x89\x03\x8C\x07\x60\x81\x0B\x5B\xB4\xF3"
+ "\x3F\x1E\x5D\x63\x9B\x6F\x9B\xC7\xCA\x62\xBA\x6F\x8C\x9F\x8D\xE7"
+ "\x70\x26\x0A\xFE\x47\xF4\xE0\xF8\x2F\x10\x21\x98\xEB\xA2\x7F\x54"
+ "\x32\x52\xAC\x8D\xDD\x83\xE1\xB8\xDB\x0A\x91\xAC\x65\x63\x3F\xD1"
+ "\x2A\x55\x0E\xBE\x96\xF9\x3A\xA6\x70\x4E\xD5\x90\x5C\x23\x4F\xA6"
+ "\xD9\x20\x39\x10\xCB\xD0\x2D\xE1\x66\xC4\xC3\x34\x8F\xB8\x1E\xF7"
+ "\xB8\x4A\xE1\x45\x5F\xE3\x18\xB5\xFD\x17\x08\x83\xF4\x9B\xA2\xF2"
+ "\x42\x89\xC4\x79\xA2\xC7\x53\x14\x06\xBA\x98\x9B\xEA\xEF\x3A\x79"
+ "\xF6\x59\x02\x86\x42\xE9\xB0\x33\xF7\xDE\xB9\xEC\xEC\x3A\x7A\x9F"
+ "\x1D\xBD\x24\x51\xFC\xB4\x7C\x81\xE2\x1E\x91\xD2\x0B\x92\x4C\x6B"
+ "\xD0\x4C\x1F\x0B\x27\x10\xD2\xE5\x70\xCD\x24\xBA\xD5\xB5\xDE\x4E"
+ "\x49\xAA\x80\xB6\xAD\xD5\x50\x7B\x4D\x2E\x51\x03\x70\xC7\xAF\xA8"
+ "\x14\xD7\xE1\xA7\xE2\x78\xE5\x3D\x7C\xCF\x49\xA0\xA8\x66\xCA\x3A"
+ "\x7B\x5B\xB7\x1E\xF3\x42\x5E\x46\x0F\xEE\xB2\x91\x49\xF2\x17\x06"
+ "\x66\x13\x69\x5F\x85\x50\x6A\x09\x46\xCF\x68\x97\x9F\x04\xAE\x07"
+ "\x3A\xF8\x02\x89\x76\xBF\x0C\x5B\xDC\x22\x12\xE8\xC3\x64\x58\x3D"
+ "\xE9\xFB\xD0\x3B\x34\xDD\xEE\x5E\xC4\xCF\xA8\xED\x8C\xE5\x92\x97"
+ "\x1D\x01\x08\xFA\xF7\x6C\x89\x40\xE2\x5E\x6C\x5F\x86\x55\x84\xC3"
+ "\x4A\x23\x3C\x14\xF0\x05\x32\x67\x3F\xDB\xE3\x88\xCC\x7E\x98\xA5"
+ "\xB8\x67\xB1\xC5\x91\x30\x7A\x90\x15\x11\x2B\x56\x7F\xF6\xB4\xF3"
+ "\x18\x11\x41\x11\xFC\x95\xE5\xBD\x7C\x9C\x60\xB7\x4C\x1F\x87\x25"
+};
+
+/**
+ * SHAKE-256 vectors from "https://github.com/gvanas/KeccakCodePackage/"
+ */
+xof_test_vector_t shake_256_0 = {
+ .alg = XOF_SHAKE_256, .len = 0,
+ .seed = "",
+ .out_len = 512,
+ .out = "\x46\xB9\xDD\x2B\x0B\xA8\x8D\x13\x23\x3B\x3F\xEB\x74\x3E\xEB\x24"
+ "\x3F\xCD\x52\xEA\x62\xB8\x1B\x82\xB5\x0C\x27\x64\x6E\xD5\x76\x2F"
+ "\xD7\x5D\xC4\xDD\xD8\xC0\xF2\x00\xCB\x05\x01\x9D\x67\xB5\x92\xF6"
+ "\xFC\x82\x1C\x49\x47\x9A\xB4\x86\x40\x29\x2E\xAC\xB3\xB7\xC4\xBE"
+ "\x14\x1E\x96\x61\x6F\xB1\x39\x57\x69\x2C\xC7\xED\xD0\xB4\x5A\xE3"
+ "\xDC\x07\x22\x3C\x8E\x92\x93\x7B\xEF\x84\xBC\x0E\xAB\x86\x28\x53"
+ "\x34\x9E\xC7\x55\x46\xF5\x8F\xB7\xC2\x77\x5C\x38\x46\x2C\x50\x10"
+ "\xD8\x46\xC1\x85\xC1\x51\x11\xE5\x95\x52\x2A\x6B\xCD\x16\xCF\x86"
+ "\xF3\xD1\x22\x10\x9E\x3B\x1F\xDD\x94\x3B\x6A\xEC\x46\x8A\x2D\x62"
+ "\x1A\x7C\x06\xC6\xA9\x57\xC6\x2B\x54\xDA\xFC\x3B\xE8\x75\x67\xD6"
+ "\x77\x23\x13\x95\xF6\x14\x72\x93\xB6\x8C\xEA\xB7\xA9\xE0\xC5\x8D"
+ "\x86\x4E\x8E\xFD\xE4\xE1\xB9\xA4\x6C\xBE\x85\x47\x13\x67\x2F\x5C"
+ "\xAA\xAE\x31\x4E\xD9\x08\x3D\xAB\x4B\x09\x9F\x8E\x30\x0F\x01\xB8"
+ "\x65\x0F\x1F\x4B\x1D\x8F\xCF\x3F\x3C\xB5\x3F\xB8\xE9\xEB\x2E\xA2"
+ "\x03\xBD\xC9\x70\xF5\x0A\xE5\x54\x28\xA9\x1F\x7F\x53\xAC\x26\x6B"
+ "\x28\x41\x9C\x37\x78\xA1\x5F\xD2\x48\xD3\x39\xED\xE7\x85\xFB\x7F"
+ "\x5A\x1A\xAA\x96\xD3\x13\xEA\xCC\x89\x09\x36\xC1\x73\xCD\xCD\x0F"
+ "\xAB\x88\x2C\x45\x75\x5F\xEB\x3A\xED\x96\xD4\x77\xFF\x96\x39\x0B"
+ "\xF9\xA6\x6D\x13\x68\xB2\x08\xE2\x1F\x7C\x10\xD0\x4A\x3D\xBD\x4E"
+ "\x36\x06\x33\xE5\xDB\x4B\x60\x26\x01\xC1\x4C\xEA\x73\x7D\xB3\xDC"
+ "\xF7\x22\x63\x2C\xC7\x78\x51\xCB\xDD\xE2\xAA\xF0\xA3\x3A\x07\xB3"
+ "\x73\x44\x5D\xF4\x90\xCC\x8F\xC1\xE4\x16\x0F\xF1\x18\x37\x8F\x11"
+ "\xF0\x47\x7D\xE0\x55\xA8\x1A\x9E\xDA\x57\xA4\xA2\xCF\xB0\xC8\x39"
+ "\x29\xD3\x10\x91\x2F\x72\x9E\xC6\xCF\xA3\x6C\x6A\xC6\xA7\x58\x37"
+ "\x14\x30\x45\xD7\x91\xCC\x85\xEF\xF5\xB2\x19\x32\xF2\x38\x61\xBC"
+ "\xF2\x3A\x52\xB5\xDA\x67\xEA\xF7\xBA\xAE\x0F\x5F\xB1\x36\x9D\xB7"
+ "\x8F\x3A\xC4\x5F\x8C\x4A\xC5\x67\x1D\x85\x73\x5C\xDD\xDB\x09\xD2"
+ "\xB1\xE3\x4A\x1F\xC0\x66\xFF\x4A\x16\x2C\xB2\x63\xD6\x54\x12\x74"
+ "\xAE\x2F\xCC\x86\x5F\x61\x8A\xBE\x27\xC1\x24\xCD\x8B\x07\x4C\xCD"
+ "\x51\x63\x01\xB9\x18\x75\x82\x4D\x09\x95\x8F\x34\x1E\xF2\x74\xBD"
+ "\xAB\x0B\xAE\x31\x63\x39\x89\x43\x04\xE3\x58\x77\xB0\xC2\x8A\x9B"
+ "\x1F\xD1\x66\xC7\x96\xB9\xCC\x25\x8A\x06\x4A\x8F\x57\xE2\x7F\x2A"
+};
+
+xof_test_vector_t shake_256_64 = {
+ .alg = XOF_SHAKE_256, .len = 64,
+ .seed = "\xE9\x26\xAE\x8B\x0A\xF6\xE5\x31\x76\xDB\xFF\xCC\x2A\x6B\x88\xC6"
+ "\xBD\x76\x5F\x93\x9D\x3D\x17\x8A\x9B\xDE\x9E\xF3\xAA\x13\x1C\x61"
+ "\xE3\x1C\x1E\x42\xCD\xFA\xF4\xB4\xDC\xDE\x57\x9A\x37\xE1\x50\xEF"
+ "\xBE\xF5\x55\x5B\x4C\x1C\xB4\x04\x39\xD8\x35\xA7\x24\xE2\xFA\xE7",
+ .out_len = 512,
+ .out = "\x77\xB7\x49\x6E\xD0\x8C\x39\x33\xBD\x75\x98\x3C\x0C\x04\x94\xBD"
+ "\xD8\x26\x24\x93\xA4\xB5\x5D\xDC\xCC\x64\x16\x7E\x67\xEA\xC0\xF6"
+ "\xE6\x30\x7A\xCC\x15\xC3\x3F\x39\x63\x74\x4E\x26\xCA\x6C\x50\x4D"
+ "\x39\x3B\x3E\xE8\x16\x5E\x4D\x49\xEB\x3B\x6E\x64\x92\x07\x65\x30"
+ "\x48\xF8\xB8\x22\xFF\x88\x4D\xC7\x49\x37\x44\x3B\x1C\x4A\x88\x8C"
+ "\x7A\x76\x8C\x63\xD5\xB5\xD2\x9E\x74\x46\x87\x39\x23\xB9\xD7\xA5"
+ "\x6F\xA5\xD9\xE9\x07\x60\xAB\x86\xD5\x71\x8E\x34\x64\x82\x1B\x79"
+ "\xEB\x46\xD1\x69\x14\x1F\xF1\x61\x20\xBF\xB6\x50\xC7\x6D\x4B\x3E"
+ "\x5B\x3F\x6C\xE6\x1F\xEB\xDB\xE0\x9A\xED\x7F\x4C\x91\x06\x6D\x90"
+ "\x3A\xF6\xE5\x65\x31\xE8\xFF\x71\x54\x95\x08\xB6\xE4\x20\xCA\xC6"
+ "\xBE\xDF\xE0\xCB\xEA\xE6\xBC\x22\x84\x76\xBC\x8C\x00\xEA\xE4\x3D"
+ "\x40\xC8\x2C\xBD\xF6\xB4\x60\xC3\x76\xD7\xC1\x16\x48\xEB\x28\x15"
+ "\xB6\x50\x6A\xBD\x43\x39\xB2\x5D\x58\xD4\x5C\xDD\x0A\x0B\x9E\x35"
+ "\xA8\x8E\x25\x1F\xDC\x34\xD4\x81\x0D\x65\x9D\x17\x9F\x59\xEB\xD0"
+ "\x37\x17\xFD\x31\xA6\x39\x4C\xE1\x2C\xD5\x56\x90\x66\xE1\x38\x88"
+ "\x5C\xB2\xBD\xEB\xBA\x06\x36\x75\x57\xCE\x84\x9E\xB8\x69\xF3\xCA"
+ "\xC3\x88\x00\xD5\x1C\x22\xB6\x66\xAE\x27\x01\xE5\x80\x79\x63\x94"
+ "\xDF\xA0\x2F\x49\x10\xBF\x5F\x86\xAA\xB5\x39\x51\x23\x33\x64\xEA"
+ "\x20\xCD\xA3\x5A\xFB\xAB\x44\x5B\xE7\xF6\x86\x64\x38\x56\xF8\x25"
+ "\x39\x4B\xE7\xB4\xB6\xD2\xC9\x18\xD0\x15\x1F\x46\xFB\x9A\xEE\x8A"
+ "\x7B\xA2\xD7\x06\xE4\x8C\xB0\xBC\x42\x9B\x06\x42\x62\xC1\xA0\xEB"
+ "\x35\x24\xFF\x14\x63\x2F\x51\x84\x57\x5C\x15\xF6\xF4\xA3\x44\x6E"
+ "\x93\xCB\x4E\x86\xB6\xA9\x31\xBA\x26\x84\x09\xCE\x30\xB4\x59\x5F"
+ "\xD2\x05\x9A\x27\x18\x3B\x3B\xA8\xD0\xAC\xE8\xE4\x82\x86\x6D\x5C"
+ "\x7D\x5B\x03\xDB\x8D\xBD\x24\xB9\x9D\x59\xEB\x6E\xEF\xFD\x20\x9E"
+ "\x12\x45\x35\xD1\x54\xB9\x8F\x99\x91\xD8\x4F\xE1\xAA\x76\x3C\x51"
+ "\x33\xD4\x1E\xCC\x23\x39\x30\x95\x7D\xCE\xB7\x89\x6A\xF7\x0F\x73"
+ "\x5A\x2F\x5C\x1E\x79\x48\x0A\xFD\x50\x94\x3B\xC5\x01\x4B\xCF\x0A"
+ "\x73\x54\xAA\x7F\x71\x31\x63\xB5\x5A\x1E\x41\xBD\xD0\x5F\xBB\xA9"
+ "\xC1\xDB\x2C\x69\x04\x3E\xD9\xEE\xA4\xFA\x45\xC9\x90\xCC\xB4\xA8"
+ "\xDC\x41\xAF\xAB\x18\x16\x40\x18\xE5\x4C\x47\xAC\x5B\xD6\x98\x0F"
+ "\xD7\x96\xAC\xF0\xDD\xB4\x2C\x70\x42\xA4\x87\x7E\x8B\xE3\xDE\x29"
+};
+
+xof_test_vector_t shake_256_135 = {
+ .alg = XOF_SHAKE_256, .len = 135,
+ .seed = "\xB7\x71\xD5\xCE\xF5\xD1\xA4\x1A\x93\xD1\x56\x43\xD7\x18\x1D\x2A"
+ "\x2E\xF0\xA8\xE8\x4D\x91\x81\x2F\x20\xED\x21\xF1\x47\xBE\xF7\x32"
+ "\xBF\x3A\x60\xEF\x40\x67\xC3\x73\x4B\x85\xBC\x8C\xD4\x71\x78\x0F"
+ "\x10\xDC\x9E\x82\x91\xB5\x83\x39\xA6\x77\xB9\x60\x21\x8F\x71\xE7"
+ "\x93\xF2\x79\x7A\xEA\x34\x94\x06\x51\x28\x29\x06\x5D\x37\xBB\x55"
+ "\xEA\x79\x6F\xA4\xF5\x6F\xD8\x89\x6B\x49\xB2\xCD\x19\xB4\x32\x15"
+ "\xAD\x96\x7C\x71\x2B\x24\xE5\x03\x2D\x06\x52\x32\xE0\x2C\x12\x74"
+ "\x09\xD2\xED\x41\x46\xB9\xD7\x5D\x76\x3D\x52\xDB\x98\xD9\x49\xD3"
+ "\xB0\xFE\xD6\xA8\x05\x2F\xBB",
+ .out_len = 512,
+ .out = "\x6C\x60\x95\x5D\xCB\x8A\x66\x3B\x6D\xC7\xF5\xEF\x7E\x06\x9C\xA8"
+ "\xFE\x3D\xA9\x9A\x66\xDF\x65\x96\x92\x5D\x55\x7F\xED\x91\xF4\x70"
+ "\x91\x40\x7D\x6F\xDE\x32\x02\x3B\x57\xE2\xEE\x4C\x6A\xC9\x7B\x07"
+ "\x76\x24\xFA\xC2\x5F\x6E\x13\xF4\x19\x16\x96\xB4\x0A\x4D\xF7\x5F"
+ "\x61\xCD\x55\x21\xD9\x82\xC6\xD0\x9D\x83\x42\xC1\x7A\x36\x6E\xC6"
+ "\x34\x6E\x35\x28\xB2\x6C\xFF\x91\x5B\xE9\x44\x2B\x9E\xBC\xC3\x0F"
+ "\xF2\xF6\xAD\xD0\xE8\x2B\xA9\x04\xC7\x37\x00\xCC\x99\xAC\xFF\x48"
+ "\x0C\xAF\x04\x87\xCE\xE5\x4C\xBA\x37\x53\xB6\xA5\xDD\x6F\x0D\xFE"
+ "\x65\x71\xF0\x11\x5E\x87\x37\xB0\x71\x03\x10\x23\xB6\xBB\x0D\x79"
+ "\x86\x4C\x3F\x33\x16\x2E\x78\x26\x9C\xEE\x23\xFC\xE4\x7B\x91\xB4"
+ "\xFD\xF9\x1F\x98\x46\x4A\x1D\x21\xE7\x99\xD1\x7F\x76\xC1\xBB\x80"
+ "\x7D\xEE\x66\x7B\x0B\x27\x30\x54\xBE\x29\x82\x99\xBD\x12\xB7\xA8"
+ "\x0F\xB3\x54\xCE\x3E\x6D\x1A\xCF\x98\x44\x38\x79\xA5\x54\xEC\xA6"
+ "\xB9\x6D\xF0\x61\xD0\x4A\x11\x7C\x98\xAE\xEC\x1C\xDE\x1A\xFA\x9C"
+ "\xEF\x62\xDD\x68\x6D\xA9\x1B\xB2\xB1\xF1\x23\x79\xBB\xDC\x9F\xA3"
+ "\x2A\x6B\x69\x98\xB7\x7E\x8E\xB0\xB5\x05\x07\x86\x2A\xFA\x77\x99"
+ "\xD0\x18\xE2\x72\x09\x1F\x51\xCA\xDD\x81\xAD\xB5\x87\xEF\x67\xBA"
+ "\x67\x61\x8C\x45\xD1\xF3\xD5\x59\xDB\xD2\x99\xAB\xC2\x6E\xC7\x12"
+ "\xDA\x8F\xA3\x4B\xA3\x3B\xFF\x40\x0D\x1F\x0F\x8B\x63\x45\xCF\x57"
+ "\x26\x9B\x85\x85\x78\xC0\x07\x2A\x91\xA6\x3E\xF8\x5F\x9D\x37\x89"
+ "\x00\xCD\x1A\x55\xD2\xBD\x46\x30\xDB\x82\x9E\xB4\x84\xD8\x9C\xE7"
+ "\xA4\x14\xAC\xA1\x73\xC5\x25\x34\xAD\x5F\x93\x55\xE8\x0E\x39\x5E"
+ "\x79\x15\x6D\x75\x1A\x93\x0F\x7F\x8B\x5D\x9F\x4D\x5A\x2C\x9A\x75"
+ "\x37\x23\x08\x3C\x5E\x8E\xC6\xCB\x24\xD8\xEF\x93\xC8\xFE\xF2\xD1"
+ "\xBE\x4E\xCA\x22\x2C\x6E\x6C\x2A\xCF\xD6\x84\x89\x3C\xEA\x65\xCB"
+ "\xF5\xB0\x96\xB3\xD8\x66\x00\x71\x36\x12\x6A\x33\xEF\x49\x6B\xF2"
+ "\x31\x0F\x29\x3B\xFA\x4C\x93\xAB\x82\x68\x21\xE2\xB9\x32\x59\xC4"
+ "\x64\xE0\xAE\xB0\x6D\x6D\xF8\xFF\xA3\x0B\x1C\x1E\x7E\x38\x4C\x7E"
+ "\x42\x7A\x2B\xA3\xD9\x9F\xF8\xA6\x66\x38\x0C\x5C\x1B\x67\x8F\x74"
+ "\x2C\x57\xB0\xC3\xB0\x88\x49\xFD\x65\x30\x0D\xF1\x34\x99\xDD\x89"
+ "\x4E\xFC\x33\x11\x6E\x7D\x07\x74\x06\x43\x31\xFD\xD4\x07\x48\x74"
+ "\x17\xD1\x3B\xBA\x42\x85\x29\x9A\xF6\x50\xD3\x06\x5D\x95\x11\x31"
+};
+
+xof_test_vector_t shake_256_136 = {
+ .alg = XOF_SHAKE_256, .len = 136,
+ .seed = "\xB3\x2D\x95\xB0\xB9\xAA\xD2\xA8\x81\x6D\xE6\xD0\x6D\x1F\x86\x00"
+ "\x85\x05\xBD\x8C\x14\x12\x4F\x6E\x9A\x16\x3B\x5A\x2A\xDE\x55\xF8"
+ "\x35\xD0\xEC\x38\x80\xEF\x50\x70\x0D\x3B\x25\xE4\x2C\xC0\xAF\x05"
+ "\x0C\xCD\x1B\xE5\xE5\x55\xB2\x30\x87\xE0\x4D\x7B\xF9\x81\x36\x22"
+ "\x78\x0C\x73\x13\xA1\x95\x4F\x87\x40\xB6\xEE\x2D\x3F\x71\xF7\x68"
+ "\xDD\x41\x7F\x52\x04\x82\xBD\x3A\x08\xD4\xF2\x22\xB4\xEE\x9D\xBD"
+ "\x01\x54\x47\xB3\x35\x07\xDD\x50\xF3\xAB\x42\x47\xC5\xDE\x9A\x8A"
+ "\xBD\x62\xA8\xDE\xCE\xA0\x1E\x3B\x87\xC8\xB9\x27\xF5\xB0\x8B\xEB"
+ "\x37\x67\x4C\x6F\x8E\x38\x0C\x04",
+ .out_len = 512,
+ .out = "\xCC\x2E\xAA\x04\xEE\xF8\x47\x9C\xDA\xE8\x56\x6E\xB8\xFF\xA1\x10"
+ "\x0A\x40\x79\x95\xBF\x99\x9A\xE9\x7E\xDE\x52\x66\x81\xDC\x34\x90"
+ "\x61\x6F\x28\x44\x2D\x20\xDA\x92\x12\x4C\xE0\x81\x58\x8B\x81\x49"
+ "\x1A\xED\xF6\x5C\xAA\xF0\xD2\x7E\x82\xA4\xB0\xE1\xD1\xCA\xB2\x38"
+ "\x33\x32\x8F\x1B\x8D\xA4\x30\xC8\xA0\x87\x66\xA8\x63\x70\xFA\x84"
+ "\x8A\x79\xB5\x99\x8D\xB3\xCF\xFD\x05\x7B\x96\xE1\xE2\xEE\x0E\xF2"
+ "\x29\xEC\xA1\x33\xC1\x55\x48\xF9\x83\x99\x02\x04\x37\x30\xE4\x4B"
+ "\xC5\x2C\x39\xFA\xDC\x1D\xDE\xEA\xD9\x5F\x99\x39\xF2\x20\xCA\x30"
+ "\x06\x61\x54\x0D\xF7\xED\xD9\xAF\x37\x8A\x5D\x4A\x19\xB2\xB9\x3E"
+ "\x6C\x78\xF4\x9C\x35\x33\x43\xA0\xB5\xF1\x19\x13\x2B\x53\x12\xD0"
+ "\x04\x83\x1D\x01\x76\x9A\x31\x6D\x2F\x51\xBF\x64\xCC\xB2\x0A\x21"
+ "\xC2\xCF\x7A\xC8\xFB\x6F\x6E\x90\x70\x61\x26\xBD\xAE\x06\x11\xDD"
+ "\x13\x96\x2E\x8B\x53\xD6\xEA\xE2\x6C\x7B\x0D\x25\x51\xDA\xF6\x24"
+ "\x8E\x9D\x65\x81\x73\x82\xB0\x4D\x23\x39\x2D\x10\x8E\x4D\x34\x43"
+ "\xDE\x5A\xDC\x72\x73\xC7\x21\xA8\xF8\x32\x0E\xCF\xE8\x17\x7A\xC0"
+ "\x67\xCA\x8A\x50\x16\x9A\x6E\x73\x00\x0E\xBC\xDC\x1E\x4E\xE6\x33"
+ "\x9F\xC8\x67\xC3\xD7\xAE\xAB\x84\x14\x63\x98\xD7\xBA\xDE\x12\x1D"
+ "\x19\x89\xFA\x45\x73\x35\x56\x4E\x97\x57\x70\xA3\xA0\x02\x59\xCA"
+ "\x08\x70\x61\x08\x26\x1A\xA2\xD3\x4D\xE0\x0F\x8C\xAC\x7D\x45\xD3"
+ "\x5E\x5A\xA6\x3E\xA6\x9E\x1D\x1A\x2F\x7D\xAB\x39\x00\xD5\x1E\x0B"
+ "\xC6\x53\x48\xA2\x55\x54\x00\x70\x39\xA5\x2C\x3C\x30\x99\x80\xD1"
+ "\x7C\xAD\x20\xF1\x15\x63\x10\xA3\x9C\xD3\x93\x76\x0C\xFE\x58\xF6"
+ "\xF8\xAD\xE4\x21\x31\x28\x82\x80\xA3\x5E\x1D\xB8\x70\x81\x83\xB9"
+ "\x1C\xFA\xF5\x82\x7E\x96\xB0\xF7\x74\xC4\x50\x93\xB4\x17\xAF\xF9"
+ "\xDD\x64\x17\xE5\x99\x64\xA0\x1B\xD2\xA6\x12\xFF\xCF\xBA\x18\xA0"
+ "\xF1\x93\xDB\x29\x7B\x9A\x6C\xC1\xD2\x70\xD9\x7A\xAE\x8F\x8A\x3A"
+ "\x6B\x26\x69\x5A\xB6\x64\x31\xC2\x02\xE1\x39\xD6\x3D\xD3\xA2\x47"
+ "\x78\x67\x6C\xEF\xE3\xE2\x1B\x02\xEC\x4E\x8F\x5C\xFD\x66\x58\x7A"
+ "\x12\xB4\x40\x78\xFC\xD3\x9E\xEE\x44\xBB\xEF\x4A\x94\x9A\x63\xC0"
+ "\xDF\xD5\x8C\xF2\xFB\x2C\xD5\xF0\x02\xE2\xB0\x21\x92\x66\xCF\xC0"
+ "\x31\x81\x74\x86\xDE\x70\xB4\x28\x5A\x8A\x70\xF3\xD3\x8A\x61\xD3"
+ "\x15\x5D\x99\xAA\xF4\xC2\x53\x90\xD7\x36\x45\xAB\x3E\x8D\x80\xF0"
+};
+
+xof_test_vector_t shake_256_255 = {
+ .alg = XOF_SHAKE_256, .len = 255,
+ .seed = "\x3A\x3A\x81\x9C\x48\xEF\xDE\x2A\xD9\x14\xFB\xF0\x0E\x18\xAB\x6B"
+ "\xC4\xF1\x45\x13\xAB\x27\xD0\xC1\x78\xA1\x88\xB6\x14\x31\xE7\xF5"
+ "\x62\x3C\xB6\x6B\x23\x34\x67\x75\xD3\x86\xB5\x0E\x98\x2C\x49\x3A"
+ "\xDB\xBF\xC5\x4B\x9A\x3C\xD3\x83\x38\x23\x36\xA1\xA0\xB2\x15\x0A"
+ "\x15\x35\x8F\x33\x6D\x03\xAE\x18\xF6\x66\xC7\x57\x3D\x55\xC4\xFD"
+ "\x18\x1C\x29\xE6\xCC\xFD\xE6\x3E\xA3\x5F\x0A\xDF\x58\x85\xCF\xC0"
+ "\xA3\xD8\x4A\x2B\x2E\x4D\xD2\x44\x96\xDB\x78\x9E\x66\x31\x70\xCE"
+ "\xF7\x47\x98\xAA\x1B\xBC\xD4\x57\x4E\xA0\xBB\xA4\x04\x89\xD7\x64"
+ "\xB2\xF8\x3A\xAD\xC6\x6B\x14\x8B\x4A\x0C\xD9\x52\x46\xC1\x27\xD5"
+ "\x87\x1C\x4F\x11\x41\x86\x90\xA5\xDD\xF0\x12\x46\xA0\xC8\x0A\x43"
+ "\xC7\x00\x88\xB6\x18\x36\x39\xDC\xFD\xA4\x12\x5B\xD1\x13\xA8\xF4"
+ "\x9E\xE2\x3E\xD3\x06\xFA\xAC\x57\x6C\x3F\xB0\xC1\xE2\x56\x67\x1D"
+ "\x81\x7F\xC2\x53\x4A\x52\xF5\xB4\x39\xF7\x2E\x42\x4D\xE3\x76\xF4"
+ "\xC5\x65\xCC\xA8\x23\x07\xDD\x9E\xF7\x6D\xA5\xB7\xC4\xEB\x7E\x08"
+ "\x51\x72\xE3\x28\x80\x7C\x02\xD0\x11\xFF\xBF\x33\x78\x53\x78\xD7"
+ "\x9D\xC2\x66\xF6\xA5\xBE\x6B\xB0\xE4\xA9\x2E\xCE\xEB\xAE\xB1",
+ .out_len = 512,
+ .out = "\x8A\x51\x99\xB4\xA7\xE1\x33\xE2\x64\xA8\x62\x02\x72\x06\x55\x89"
+ "\x4D\x48\xCF\xF3\x44\xA9\x28\xCF\x83\x47\xF4\x83\x79\xCE\xF3\x47"
+ "\xDF\xC5\xBC\xFF\xAB\x99\xB2\x7B\x1F\x89\xAA\x27\x35\xE2\x3D\x30"
+ "\x08\x8F\xFA\x03\xB9\xED\xB0\x2B\x96\x35\x47\x0A\xB9\xF1\x03\x89"
+ "\x85\xD5\x5F\x9C\xA7\x74\x57\x2D\xD0\x06\x47\x0E\xA6\x51\x45\x46"
+ "\x96\x09\xF9\xFA\x08\x31\xBF\x1F\xFD\x84\x2D\xC2\x4A\xCA\xDE\x27"
+ "\xBD\x98\x16\xE3\xB5\xBF\x28\x76\xCB\x11\x22\x32\xA0\xEB\x44\x75"
+ "\xF1\xDF\xF9\xF5\xC7\x13\xD9\xFF\xD4\xCC\xB8\x9A\xE5\x60\x7F\xE3"
+ "\x57\x31\xDF\x06\x31\x79\x49\xEE\xF6\x46\xE9\x59\x1C\xF3\xBE\x53"
+ "\xAD\xD6\xB7\xDD\x2B\x60\x96\xE2\xB3\xFB\x06\xE6\x62\xEC\x8B\x2D"
+ "\x77\x42\x2D\xAA\xD9\x46\x3C\xD1\x55\x20\x4A\xCD\xBD\x38\xE3\x19"
+ "\x61\x3F\x39\xF9\x9B\x6D\xFB\x35\xCA\x93\x65\x16\x00\x66\xDB\x19"
+ "\x83\x58\x88\xC2\x24\x1F\xF9\xA7\x31\xA4\xAC\xBB\x56\x63\x72\x7A"
+ "\xAC\x34\xA4\x01\x24\x7F\xBA\xA7\x49\x9E\x7D\x5E\xE5\xB6\x9D\x31"
+ "\x02\x5E\x63\xD0\x4C\x35\xC7\x98\xBC\xA1\x26\x2D\x56\x73\xA9\xCF"
+ "\x09\x30\xB5\xAD\x89\xBD\x48\x55\x99\xDC\x18\x45\x28\xDA\x47\x90"
+ "\xF0\x88\xEB\xD1\x70\xB6\x35\xD9\x58\x16\x32\xD2\xFF\x90\xDB\x79"
+ "\x66\x5C\xED\x43\x00\x89\xAF\x13\xC9\xF2\x1F\x6D\x44\x3A\x81\x80"
+ "\x64\xF1\x7A\xEC\x9E\x9C\x54\x57\x00\x1F\xA8\xDC\x6A\xFB\xAD\xBE"
+ "\x31\x38\xF3\x88\xD8\x9D\x0E\x6F\x22\xF6\x66\x71\x25\x5B\x21\x07"
+ "\x54\xED\x63\xD8\x1D\xCE\x75\xCE\x8F\x18\x9B\x53\x4E\x6D\x6B\x35"
+ "\x39\xAA\x51\xE8\x37\xC4\x2D\xF9\xDF\x59\xC7\x1E\x61\x71\xCD\x49"
+ "\x02\xFE\x1B\xDC\x73\xFB\x17\x75\xB5\xC7\x54\xA1\xED\x4E\xA7\xF3"
+ "\x10\x5F\xC5\x43\xEE\x04\x18\xDA\xD2\x56\xF3\xF6\x11\x8E\xA7\x71"
+ "\x14\xA1\x6C\x15\x35\x5B\x42\x87\x7A\x1D\xB2\xA7\xDF\x0E\x15\x5A"
+ "\xE1\xD8\x67\x0A\xBC\xEC\x34\x50\xF4\xE2\xEE\xC9\x83\x8F\x89\x54"
+ "\x23\xEF\x63\xD2\x61\x13\x8B\xAA\xF5\xD9\xF1\x04\xCB\x5A\x95\x7A"
+ "\xEA\x06\xC0\xB9\xB8\xC7\x8B\x0D\x44\x17\x96\xDC\x03\x50\xDD\xEA"
+ "\xBB\x78\xA3\x3B\x6F\x1F\x9E\x68\xED\xE3\xD1\x80\x5C\x7B\x7E\x2C"
+ "\xFD\x54\xE0\xFA\xD6\x2F\x0D\x8C\xA6\x7A\x77\x5D\xC4\x54\x6A\xF9"
+ "\x09\x6F\x2E\xDB\x22\x1D\xB4\x28\x43\xD6\x53\x27\x86\x12\x82\xDC"
+ "\x94\x6A\x0B\xA0\x1A\x11\x86\x3A\xB2\xD1\xDF\xD1\x6E\x39\x73\xD4"
+};
diff --git a/src/libstrongswan/plugins/test_vectors/test_vectors_plugin.c b/src/libstrongswan/plugins/test_vectors/test_vectors_plugin.c
index 0505e2c40..c4d71848d 100644
--- a/src/libstrongswan/plugins/test_vectors/test_vectors_plugin.c
+++ b/src/libstrongswan/plugins/test_vectors/test_vectors_plugin.c
@@ -24,6 +24,7 @@
#define TEST_VECTOR_SIGNER(x) extern signer_test_vector_t x;
#define TEST_VECTOR_HASHER(x) extern hasher_test_vector_t x;
#define TEST_VECTOR_PRF(x) extern prf_test_vector_t x;
+#define TEST_VECTOR_XOF(x) extern xof_test_vector_t x;
#define TEST_VECTOR_RNG(x) extern rng_test_vector_t x;
#define TEST_VECTOR_DH(x) extern dh_test_vector_t x;
@@ -34,6 +35,7 @@
#undef TEST_VECTOR_SIGNER
#undef TEST_VECTOR_HASHER
#undef TEST_VECTOR_PRF
+#undef TEST_VECTOR_XOF
#undef TEST_VECTOR_RNG
#undef TEST_VECTOR_DH
@@ -42,6 +44,7 @@
#define TEST_VECTOR_SIGNER(x)
#define TEST_VECTOR_HASHER(x)
#define TEST_VECTOR_PRF(x)
+#define TEST_VECTOR_XOF(x)
#define TEST_VECTOR_RNG(x)
#define TEST_VECTOR_DH(x)
@@ -86,6 +89,14 @@ static prf_test_vector_t *prf[] = {
#undef TEST_VECTOR_PRF
#define TEST_VECTOR_PRF(x)
+#undef TEST_VECTOR_XOF
+#define TEST_VECTOR_XOF(x) &x,
+static xof_test_vector_t *xof[] = {
+#include "test_vectors.h"
+};
+#undef TEST_VECTOR_XOF
+#define TEST_VECTOR_XOF(x)
+
#undef TEST_VECTOR_RNG
#define TEST_VECTOR_RNG(x) &x,
static rng_test_vector_t *rng[] = {
@@ -181,6 +192,11 @@ plugin_t *test_vectors_plugin_create()
lib->crypto->add_test_vector(lib->crypto,
PSEUDO_RANDOM_FUNCTION, prf[i]);
}
+ for (i = 0; i < countof(xof); i++)
+ {
+ lib->crypto->add_test_vector(lib->crypto,
+ EXTENDED_OUTPUT_FUNCTION, xof[i]);
+ }
for (i = 0; i < countof(rng); i++)
{
lib->crypto->add_test_vector(lib->crypto,
diff --git a/src/libstrongswan/plugins/unbound/Makefile.in b/src/libstrongswan/plugins/unbound/Makefile.in
index ea27fd384..665f77006 100644
--- a/src/libstrongswan/plugins/unbound/Makefile.in
+++ b/src/libstrongswan/plugins/unbound/Makefile.in
@@ -353,7 +353,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -387,8 +386,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -442,6 +439,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/unbound/unbound_response.c b/src/libstrongswan/plugins/unbound/unbound_response.c
index 6f6c25e89..950df344c 100644
--- a/src/libstrongswan/plugins/unbound/unbound_response.c
+++ b/src/libstrongswan/plugins/unbound/unbound_response.c
@@ -189,7 +189,7 @@ unbound_response_t *unbound_response_create_frm_libub_response(
*/
rr_list = linked_list_create();
- orig_rr_list = ldns_pkt_get_section_clone(dns_pkt, LDNS_SECTION_ANSWER);
+ orig_rr_list = ldns_pkt_answer(dns_pkt);
orig_rr_count = ldns_rr_list_rr_count(orig_rr_list);
for (i = 0; i < orig_rr_count; i++)
@@ -253,7 +253,6 @@ unbound_response_t *unbound_response_create_frm_libub_response(
this->rr_set = rr_set_create(rr_list, rrsig_list);
ldns_pkt_free(dns_pkt);
- ldns_rr_list_free(orig_rr_list);
}
return &this->public;
}
diff --git a/src/libstrongswan/plugins/unbound/unbound_rr.c b/src/libstrongswan/plugins/unbound/unbound_rr.c
index fc69eed00..91b5cdb33 100644
--- a/src/libstrongswan/plugins/unbound/unbound_rr.c
+++ b/src/libstrongswan/plugins/unbound/unbound_rr.c
@@ -154,11 +154,13 @@ unbound_rr_t *unbound_rr_create_frm_ldns_rr(ldns_rr *rr)
if (status != LDNS_STATUS_OK)
{
DBG1(DBG_LIB, "failed to get the RDATA field of a DNS RR");
+ ldns_buffer_free(buf);
_destroy(this);
return NULL;
}
this->rdata = ldns_buffer_export(buf);
+ ldns_buffer_free(buf);
return &this->public;
}
diff --git a/src/libstrongswan/plugins/winhttp/Makefile.in b/src/libstrongswan/plugins/winhttp/Makefile.in
index 0bf311c38..672ff5f4c 100644
--- a/src/libstrongswan/plugins/winhttp/Makefile.in
+++ b/src/libstrongswan/plugins/winhttp/Makefile.in
@@ -353,7 +353,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -387,8 +386,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -442,6 +439,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/x509/Makefile.in b/src/libstrongswan/plugins/x509/Makefile.in
index 6288e0f40..c96dac089 100644
--- a/src/libstrongswan/plugins/x509/Makefile.in
+++ b/src/libstrongswan/plugins/x509/Makefile.in
@@ -352,7 +352,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -386,8 +385,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -441,6 +438,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
diff --git a/src/libstrongswan/plugins/xcbc/Makefile.in b/src/libstrongswan/plugins/xcbc/Makefile.in
index 98fad6f8f..44021e4cd 100644
--- a/src/libstrongswan/plugins/xcbc/Makefile.in
+++ b/src/libstrongswan/plugins/xcbc/Makefile.in
@@ -350,7 +350,6 @@ clearsilver_LIBS = @clearsilver_LIBS@
cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
-dbusservicedir = @dbusservicedir@
dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
@@ -384,8 +383,6 @@ libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
-maemo_CFLAGS = @maemo_CFLAGS@
-maemo_LIBS = @maemo_LIBS@
manager_plugins = @manager_plugins@
mandir = @mandir@
medsrv_plugins = @medsrv_plugins@
@@ -439,6 +436,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+tss2_CFLAGS = @tss2_CFLAGS@
+tss2_LIBS = @tss2_LIBS@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@