diff options
| author | David M. Syzdek <david@syzdek.net> | 2023-01-07 09:55:39 -0900 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2023-01-07 09:58:48 -0900 |
| commit | 65d1534624d376b0f5fd16265a82c0c365184a20 (patch) | |
| tree | eefc3a4ec5f901956dc7bcb787586127d8f4a90e | |
| parent | 9e316405edd78cca19d5d5b8b2f59be7416b3868 (diff) | |
| download | otputils-65d1534624d376b0f5fd16265a82c0c365184a20.tar.gz otputils-65d1534624d376b0f5fd16265a82c0c365184a20.tar.bz2 otputils-65d1534624d376b0f5fd16265a82c0c365184a20.tar.xz otputils-65d1534624d376b0f5fd16265a82c0c365184a20.zip | |
test-dict-otp: moving OTP dictionaries from library to test sources
| -rw-r--r-- | Makefile.am | 17 | ||||
| -rw-r--r-- | tests/otp-dicts/otp-dicts.h | 61 | ||||
| -rw-r--r-- | tests/otp-dicts/otp-md4.c (renamed from lib/libotputil/ldict-otp-md4.c) | 5 | ||||
| -rw-r--r-- | tests/otp-dicts/otp-md4.txt (renamed from lib/libotputil/ldict-otp-md4.txt) | 0 | ||||
| -rw-r--r-- | tests/otp-dicts/otp-md5.c (renamed from lib/libotputil/ldict-otp-md5.c) | 5 | ||||
| -rw-r--r-- | tests/otp-dicts/otp-md5.txt (renamed from lib/libotputil/ldict-otp-md5.txt) | 0 | ||||
| -rw-r--r-- | tests/otp-dicts/otp-sha1.c (renamed from lib/libotputil/ldict-otp-sha1.c) | 5 | ||||
| -rw-r--r-- | tests/otp-dicts/otp-sha1.txt (renamed from lib/libotputil/ldict-otp-sha1.txt) | 0 | ||||
| -rw-r--r-- | tests/otp-dicts/rfc2289-md4.c (renamed from lib/libotputil/ldict-rfc2289-md4.c) | 5 | ||||
| -rw-r--r-- | tests/otp-dicts/rfc2289-md4.txt (renamed from lib/libotputil/ldict-rfc2289-md4.txt) | 0 | ||||
| -rw-r--r-- | tests/otp-dicts/rfc2289-md5.c (renamed from lib/libotputil/ldict-rfc2289-md5.c) | 5 | ||||
| -rw-r--r-- | tests/otp-dicts/rfc2289-md5.txt (renamed from lib/libotputil/ldict-rfc2289-md5.txt) | 0 | ||||
| -rw-r--r-- | tests/otp-dicts/rfc2289-sha1.c (renamed from lib/libotputil/ldict-rfc2289-sha1.c) | 5 | ||||
| -rw-r--r-- | tests/otp-dicts/rfc2289-sha1.txt (renamed from lib/libotputil/ldict-rfc2289-sha1.txt) | 0 | ||||
| -rw-r--r-- | tests/test-dict-otp.c | 8 |
15 files changed, 84 insertions, 32 deletions
diff --git a/Makefile.am b/Makefile.am index 87ffbf9..6f791ee 100644 --- a/Makefile.am +++ b/Makefile.am | |||
| @@ -105,6 +105,7 @@ EXTRA_DIST = $(noinst_HEADERS) \ | |||
| 105 | TODO.md \ | 105 | TODO.md \ |
| 106 | include/otputil.h \ | 106 | include/otputil.h \ |
| 107 | lib/libotputil/libotputil.sym \ | 107 | lib/libotputil/libotputil.sym \ |
| 108 | tests/otp-dicts/otp-dicts.h \ | ||
| 108 | tests/test-otputil-hotp.sh \ | 109 | tests/test-otputil-hotp.sh \ |
| 109 | tests/test-otputil-totp.sh | 110 | tests/test-otputil-totp.sh |
| 110 | CLEANFILES = $(builddir)/a.out $(srcdir)/a.out \ | 111 | CLEANFILES = $(builddir)/a.out $(srcdir)/a.out \ |
| @@ -167,13 +168,7 @@ lib_libotputil_a_SOURCES = $(noinst_HEADERS) \ | |||
| 167 | $(BINDLE_LIBBINDLE_SRCS) \ | 168 | $(BINDLE_LIBBINDLE_SRCS) \ |
| 168 | lib/libotputil/libotputil.h \ | 169 | lib/libotputil/libotputil.h \ |
| 169 | lib/libotputil/libotputil.c \ | 170 | lib/libotputil/libotputil.c \ |
| 170 | lib/libotputil/ldict-otp-md4.c \ | 171 | lib/libotputil/ldict-rfc1760.c |
| 171 | lib/libotputil/ldict-otp-md5.c \ | ||
| 172 | lib/libotputil/ldict-otp-sha1.c \ | ||
| 173 | lib/libotputil/ldict-rfc1760.c \ | ||
| 174 | lib/libotputil/ldict-rfc2289-md4.c \ | ||
| 175 | lib/libotputil/ldict-rfc2289-md5.c \ | ||
| 176 | lib/libotputil/ldict-rfc2289-sha1.c | ||
| 177 | 172 | ||
| 178 | 173 | ||
| 179 | # macros for lib/libotputil.la | 174 | # macros for lib/libotputil.la |
| @@ -205,7 +200,13 @@ src_otputil_SOURCES = src/otputil.c \ | |||
| 205 | # macros for tests/test-dict-otp | 200 | # macros for tests/test-dict-otp |
| 206 | tests_test_dict_otp_DEPENDENCIES = Makefile $(noinst_LIBRARIES) $(lib_LTLIBRARIES) | 201 | tests_test_dict_otp_DEPENDENCIES = Makefile $(noinst_LIBRARIES) $(lib_LTLIBRARIES) |
| 207 | tests_test_dict_otp_LDADD = $(AM_LIBS) $(noinst_LIBRARIES) $(lib_LTLIBRARIES) | 202 | tests_test_dict_otp_LDADD = $(AM_LIBS) $(noinst_LIBRARIES) $(lib_LTLIBRARIES) |
| 208 | tests_test_dict_otp_SOURCES = tests/test-dict-otp.c | 203 | tests_test_dict_otp_SOURCES = tests/test-dict-otp.c \ |
| 204 | tests/otp-dicts/otp-md4.c \ | ||
| 205 | tests/otp-dicts/otp-md5.c \ | ||
| 206 | tests/otp-dicts/otp-sha1.c \ | ||
| 207 | tests/otp-dicts/rfc2289-md4.c \ | ||
| 208 | tests/otp-dicts/rfc2289-md5.c \ | ||
| 209 | tests/otp-dicts/rfc2289-sha1.c | ||
| 209 | 210 | ||
| 210 | 211 | ||
| 211 | # macros for tests/test-hotp | 212 | # macros for tests/test-hotp |
diff --git a/tests/otp-dicts/otp-dicts.h b/tests/otp-dicts/otp-dicts.h new file mode 100644 index 0000000..fa6b59f --- /dev/null +++ b/tests/otp-dicts/otp-dicts.h | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | /* | ||
| 2 | * OTP Utilities | ||
| 3 | * Copyright (C) 2022 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file lib/libotputil/libotputil.c | ||
| 32 | */ | ||
| 33 | #ifndef _TESTS_OTP_DICTS_OTP_DICTS_H | ||
| 34 | #define _TESTS_OTP_DICTS_OTP_DICTS_H 1 | ||
| 35 | |||
| 36 | /////////////// | ||
| 37 | // // | ||
| 38 | // Headers // | ||
| 39 | // // | ||
| 40 | /////////////// | ||
| 41 | #pragma mark - Headers | ||
| 42 | |||
| 43 | #include <stdio.h> | ||
| 44 | |||
| 45 | |||
| 46 | ///////////////// | ||
| 47 | // // | ||
| 48 | // Variables // | ||
| 49 | // // | ||
| 50 | ///////////////// | ||
| 51 | #pragma mark - Variables | ||
| 52 | |||
| 53 | extern const char * otputil_dict_otp_md4[]; | ||
| 54 | extern const char * otputil_dict_otp_md5[]; | ||
| 55 | extern const char * otputil_dict_otp_sha1[]; | ||
| 56 | extern const char * otputil_dict_rfc2289_md4[]; | ||
| 57 | extern const char * otputil_dict_rfc2289_md5[]; | ||
| 58 | extern const char * otputil_dict_rfc2289_sha1[]; | ||
| 59 | |||
| 60 | |||
| 61 | #endif /* end of header file */ | ||
diff --git a/lib/libotputil/ldict-otp-md4.c b/tests/otp-dicts/otp-md4.c index fb0eb09..379e960 100644 --- a/lib/libotputil/ldict-otp-md4.c +++ b/tests/otp-dicts/otp-md4.c | |||
| @@ -30,9 +30,8 @@ | |||
| 30 | /* | 30 | /* |
| 31 | * @file lib/libotputil/libotputil.c | 31 | * @file lib/libotputil/libotputil.c |
| 32 | */ | 32 | */ |
| 33 | #define _LIB_LDICT_OTP_MD5_C 1 | 33 | #define _TESTS_OTP_DICTS_OTP_MD4_C 1 |
| 34 | #include "libotputil.h" | 34 | #include "otp-dicts.h" |
| 35 | |||
| 36 | 35 | ||
| 37 | ///////////////// | 36 | ///////////////// |
| 38 | // // | 37 | // // |
diff --git a/lib/libotputil/ldict-otp-md4.txt b/tests/otp-dicts/otp-md4.txt index d221f3b..d221f3b 100644 --- a/lib/libotputil/ldict-otp-md4.txt +++ b/tests/otp-dicts/otp-md4.txt | |||
diff --git a/lib/libotputil/ldict-otp-md5.c b/tests/otp-dicts/otp-md5.c index 558cb50..8639357 100644 --- a/lib/libotputil/ldict-otp-md5.c +++ b/tests/otp-dicts/otp-md5.c | |||
| @@ -30,9 +30,8 @@ | |||
| 30 | /* | 30 | /* |
| 31 | * @file lib/libotputil/libotputil.c | 31 | * @file lib/libotputil/libotputil.c |
| 32 | */ | 32 | */ |
| 33 | #define _LIB_LDICT_OTP_MD5_C 1 | 33 | #define _TESTS_OTP_DICTS_OTP_MD5_C 1 |
| 34 | #include "libotputil.h" | 34 | #include "otp-dicts.h" |
| 35 | |||
| 36 | 35 | ||
| 37 | ///////////////// | 36 | ///////////////// |
| 38 | // // | 37 | // // |
diff --git a/lib/libotputil/ldict-otp-md5.txt b/tests/otp-dicts/otp-md5.txt index ed9fbe6..ed9fbe6 100644 --- a/lib/libotputil/ldict-otp-md5.txt +++ b/tests/otp-dicts/otp-md5.txt | |||
diff --git a/lib/libotputil/ldict-otp-sha1.c b/tests/otp-dicts/otp-sha1.c index d708ef2..549ba47 100644 --- a/lib/libotputil/ldict-otp-sha1.c +++ b/tests/otp-dicts/otp-sha1.c | |||
| @@ -30,9 +30,8 @@ | |||
| 30 | /* | 30 | /* |
| 31 | * @file lib/libotputil/libotputil.c | 31 | * @file lib/libotputil/libotputil.c |
| 32 | */ | 32 | */ |
| 33 | #define _LIB_LDICT_OTP_SHA1_C 1 | 33 | #define _TESTS_OTP_DICTS_OTP_SHA1_C 1 |
| 34 | #include "libotputil.h" | 34 | #include "otp-dicts.h" |
| 35 | |||
| 36 | 35 | ||
| 37 | ///////////////// | 36 | ///////////////// |
| 38 | // // | 37 | // // |
diff --git a/lib/libotputil/ldict-otp-sha1.txt b/tests/otp-dicts/otp-sha1.txt index 64ee4e1..64ee4e1 100644 --- a/lib/libotputil/ldict-otp-sha1.txt +++ b/tests/otp-dicts/otp-sha1.txt | |||
diff --git a/lib/libotputil/ldict-rfc2289-md4.c b/tests/otp-dicts/rfc2289-md4.c index 4a688d8..9c9d98e 100644 --- a/lib/libotputil/ldict-rfc2289-md4.c +++ b/tests/otp-dicts/rfc2289-md4.c | |||
| @@ -30,9 +30,8 @@ | |||
| 30 | /* | 30 | /* |
| 31 | * @file lib/libotputil/libotputil.c | 31 | * @file lib/libotputil/libotputil.c |
| 32 | */ | 32 | */ |
| 33 | #define _LIB_LDICT_OTP_MD5_C 1 | 33 | #define _TESTS_OTP_DICTS_OTP_MD5_C 1 |
| 34 | #include "libotputil.h" | 34 | #include "otp-dicts.h" |
| 35 | |||
| 36 | 35 | ||
| 37 | ///////////////// | 36 | ///////////////// |
| 38 | // // | 37 | // // |
diff --git a/lib/libotputil/ldict-rfc2289-md4.txt b/tests/otp-dicts/rfc2289-md4.txt index 794b5e8..794b5e8 100644 --- a/lib/libotputil/ldict-rfc2289-md4.txt +++ b/tests/otp-dicts/rfc2289-md4.txt | |||
diff --git a/lib/libotputil/ldict-rfc2289-md5.c b/tests/otp-dicts/rfc2289-md5.c index 4ae9fa6..8c1b4a2 100644 --- a/lib/libotputil/ldict-rfc2289-md5.c +++ b/tests/otp-dicts/rfc2289-md5.c | |||
| @@ -30,9 +30,8 @@ | |||
| 30 | /* | 30 | /* |
| 31 | * @file lib/libotputil/libotputil.c | 31 | * @file lib/libotputil/libotputil.c |
| 32 | */ | 32 | */ |
| 33 | #define _LIB_LDICT_OTP_MD5_C 1 | 33 | #define _TESTS_OTP_DICTS_OTP_MD5_C 1 |
| 34 | #include "libotputil.h" | 34 | #include "otp-dicts.h" |
| 35 | |||
| 36 | 35 | ||
| 37 | ///////////////// | 36 | ///////////////// |
| 38 | // // | 37 | // // |
diff --git a/lib/libotputil/ldict-rfc2289-md5.txt b/tests/otp-dicts/rfc2289-md5.txt index 9f90c7d..9f90c7d 100644 --- a/lib/libotputil/ldict-rfc2289-md5.txt +++ b/tests/otp-dicts/rfc2289-md5.txt | |||
diff --git a/lib/libotputil/ldict-rfc2289-sha1.c b/tests/otp-dicts/rfc2289-sha1.c index d6e7536..557f7f5 100644 --- a/lib/libotputil/ldict-rfc2289-sha1.c +++ b/tests/otp-dicts/rfc2289-sha1.c | |||
| @@ -30,9 +30,8 @@ | |||
| 30 | /* | 30 | /* |
| 31 | * @file lib/libotputil/libotputil.c | 31 | * @file lib/libotputil/libotputil.c |
| 32 | */ | 32 | */ |
| 33 | #define _LIB_LDICT_OTP_SHA1_C 1 | 33 | #define _TESTS_OTP_DICTS_OTP_SHA1_C 1 |
| 34 | #include "libotputil.h" | 34 | #include "otp-dicts.h" |
| 35 | |||
| 36 | 35 | ||
| 37 | ///////////////// | 36 | ///////////////// |
| 38 | // // | 37 | // // |
diff --git a/lib/libotputil/ldict-rfc2289-sha1.txt b/tests/otp-dicts/rfc2289-sha1.txt index 3dd0141..3dd0141 100644 --- a/lib/libotputil/ldict-rfc2289-sha1.txt +++ b/tests/otp-dicts/rfc2289-sha1.txt | |||
diff --git a/tests/test-dict-otp.c b/tests/test-dict-otp.c index e9e5794..bfc4530 100644 --- a/tests/test-dict-otp.c +++ b/tests/test-dict-otp.c | |||
| @@ -54,6 +54,8 @@ | |||
| 54 | 54 | ||
| 55 | #include <otputil.h> | 55 | #include <otputil.h> |
| 56 | 56 | ||
| 57 | #include "otp-dicts/otp-dicts.h" | ||
| 58 | |||
| 57 | 59 | ||
| 58 | /////////////////// | 60 | /////////////////// |
| 59 | // // | 61 | // // |
| @@ -88,12 +90,6 @@ | |||
| 88 | 90 | ||
| 89 | static int verbose = 0; | 91 | static int verbose = 0; |
| 90 | static int quiet = 0; | 92 | static int quiet = 0; |
| 91 | extern const char * otputil_dict_otp_md4[]; | ||
| 92 | extern const char * otputil_dict_otp_md5[]; | ||
| 93 | extern const char * otputil_dict_otp_sha1[]; | ||
| 94 | extern const char * otputil_dict_rfc2289_md4[]; | ||
| 95 | extern const char * otputil_dict_rfc2289_md5[]; | ||
| 96 | extern const char * otputil_dict_rfc2289_sha1[]; | ||
| 97 | 93 | ||
| 98 | 94 | ||
| 99 | ////////////////// | 95 | ////////////////// |
