diff options
Diffstat (limited to 'src/libstrongswan/plugins/bliss/tests')
6 files changed, 14 insertions, 140 deletions
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; |