From e3bc617e20ab69d4c0285f33eac4fc64afcaae86 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 09 Aug 2020 16:51:31 -0400 Subject: Replace everything with README indicating move --- diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b0c7746..0000000 --- a/.gitignore +++ /dev/null @@ -1,35 +0,0 @@ -# Swap and backup files -*.s[a-w]? -*.vim -*~ -*.orig - -# Files generated by aclocal, autoconf, and automake -/aclocal.m4 -/autom4te.cache/ -/configure -/config.h.in -/build-aux/* -!/build-aux/tap-driver.sh -/ChangeLog -/INSTALL -Makefile.in - -# Files generated by configure -/config.log -/config.status -Makefile -/config.h -/stamp-h1 - -# Files generated by Makefile -.deps -.dirstamp -*.o -/version.c -/wolfutil -/wolfutil-*.tar* -/wolfutil-*/ -/test-suite.log -/MD5SUMS -/SHA256SUMS diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 95b566f..0000000 --- a/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Patrick McDermott diff --git a/COPYING b/COPYING deleted file mode 100644 index d159169..0000000 --- a/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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. - - 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. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index c8f8d24..0000000 --- a/Makefile.am +++ /dev/null @@ -1,105 +0,0 @@ -# Process this file with automake to produce an input makefile. -# -# Copyright (C) 2014, 2017, 2018 Patrick McDermott -# -# This file is part of wolfutil. -# -# wolfutil 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. -# -# wolfutil 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. -# -# You should have received a copy of the GNU General Public License -# along with wolfutil. If not, see . - -KEY = '2250 31F0 47FF E516 63ED 516F 1A45 9ECD E4D6 04BE' - -if IN_GIT -PACKAGE_VERSION_GIT = $$(printf ' (%s)' \ - "$$({ git describe --tags --dirty 2>/dev/null || \ - printf '%s-g%s' \ - "$$(git rev-list --count HEAD)" \ - "$$(git describe --tags --dirty --always)"; \ - } | sed 's|^.*/||')") -else -PACKAGE_VERSION_GIT = -endif - -# PACKAGE_STRING is used in the test suite output and log. -# PACKAGE_VERSION can't be overridden. Automake ignores it in the IN_GIT -# conditional (and throws a warning), and setting it to $(PACKAGE_VERSION_GIT) -# outside the conditional causes PACKAGE_VERSION_GIT to reference itself. -# VERSION is not set here because it is used by: -# * Automake's distdir macro -# * Automake's distdir target (which checks for $(VERSION) in NEWS) -# * Our release target -PACKAGE_STRING = $(PACKAGE_NAME) $(PACKAGE_VERSION)$(PACKAGE_VERSION_GIT) - -bin_PROGRAMS = wolfutil - -wolfutil_SOURCES = -wolfutil_CFLAGS = \ - $(WARN_CFLAGS) \ - $(ASAN_CFLAGS) -wolfutil_CPPFLAGS = \ - -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\" \ - -DBINDIR=\"$(bindir)\" \ - -DPKGDATADIR=\"$(pkgdatadir)\" \ - -DLOCALEDIR=\"$(localedir)\" \ - -DPROGRAM_NAME=\"wolfutil\" \ - $(LIBPNG_CFLAGS) -wolfutil_LDADD = \ - $(WOLFSSL_LIBS) \ - $(ASAN_CFLAGS) -wolfutil_LINK = $(LINK) version.c -EXTRA_wolfutil_DEPENDENCIES = version.c -EXTRA_DIST = -CLEANFILES = version.c - -version.c: $(wolfutil_OBJECTS) $(wolfutil_DEPENDENCIES) - $(AM_V_GEN)printf 'const char *PACKAGE_VERSION_GIT = "%s";\n' \ - "$(PACKAGE_VERSION_GIT)" >version.c - -dist-hook: - set -e; \ - if [ -d '$(srcdir)/.git' ]; then \ - printf 'Generated file. Do not edit.\n\n' \ - >'$(distdir)/ChangeLog~'; \ - GIT_DIR='$(srcdir)/.git' git log --stat --color=never \ - >>'$(distdir)/ChangeLog~'; \ - mv '$(distdir)/ChangeLog~' '$(distdir)/ChangeLog'; \ - fi - -release: - sed "s/^Released: ????-??-??\$$/Released: $$(date '+%Y-%m-%d')/" \ - '$(srcdir)/NEWS' >'$(srcdir)/NEWS~' - mv '$(srcdir)/NEWS~' '$(srcdir)/NEWS' - $(MAKE) distcheck - set -e; \ - export GIT_DIR='$(srcdir)/.git'; \ - export GIT_WORK_TREE='$(srcdir)'; \ - git commit -m 'NEWS: Release $(PACKAGE) $(VERSION)' -- NEWS; \ - git tag '$(PACKAGE)/$(VERSION)' HEAD; \ - git push --tags origin master:master - md5sum $(DIST_ARCHIVES) >MD5SUMS - sha256sum $(DIST_ARCHIVES) >SHA256SUMS - set -e; \ - sigs=''; \ - for f in $(DIST_ARCHIVES); do \ - gpg --local-user $(KEY) --armor --detach-sign $${f}; \ - sigs="$${sigs} $${f}.asc"; \ - done; \ - ssh files@files.proteanos.com mkdir -p files/pub/$(PACKAGE); \ - rsync -az --progress --stats $(DIST_ARCHIVES) $${sigs} \ - MD5SUMS SHA256SUMS \ - files@files.proteanos.com:files/pub/$(PACKAGE)/$(VERSION)/ - '$(srcdir)/scripts/announce-release.sh' \ - $(PACKAGE) $(VERSION) '$(PACKAGE_NAME)' - -include $(top_srcdir)/src/local.mk -include $(top_srcdir)/tests/local.mk diff --git a/NEWS b/NEWS deleted file mode 100644 index b6351aa..0000000 --- a/NEWS +++ /dev/null @@ -1,17 +0,0 @@ -Unofficial wolfSSL Utility version 1.0.0 ----------------------------------------- - -Released: 2020-08-09 - -This is the initial release of the Unofficial wolfSSL Utility, in development -since 2019-07-28. - -Copyright Information ---------------------- - -Copyright (C) 2019 Libiquity LLC - -Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. This file is offered as-is, -without any warranty. diff --git a/README b/README index e94892d..032721f 100644 --- a/README +++ b/README @@ -1,52 +1,5 @@ Unofficial wolfSSL Utility -------------------------- -wolfutil is a command-line tool for the wolfSSL embedded (SSL/)TLS -library. It is similar to the OpenSSL command-line tool, providing only -a limited `s_client` TLS client command. The primary goal is to provide -enough functionality for use by BusyBox's wget applet. - -wolfutil's `s_client` command is designed to be stronger by default than -OpenSSL's, as the latter is only meant to be a "diagnostic tool". That -is, the following command: - - $ wolfutil s_client -quiet -connect ${host}:${port} \ - > -servername ${servername} - -is roughly equivalent to the more complicated: - - $ openssl s_client -quiet -connect ${host}:${port} \ - > -servername ${servername} -verify 9 -verify_return_error \ - > -no_ssl3 -no_tls1 -no_tls1_1 - -This utility is in no way authored by or affiliated with wolfSSL Inc. or -its contributors. - -Recommended wolfSSL Configuration ---------------------------------- - -Building wolfSSL with the following configuration options (keeping other -defaults) is recommended for wolfutil to perform as a strong modern TLS -implementation: - - --enable-maxstrength - --disable-aescbc - --disable-oldtls - --disable-md5 - --enable-ocsp - --enable-ocspstapling - --enable-ocspstapling2 - --enable-sni - -The test suite is written to verify the strength of wolfutil linked -against wolfSSL configured with these options. - -Copyright ---------- - -Copyright (C) 2019 Libiquity LLC - -Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. This file is offered as-is, -without any warranty. +wolfssl-util has been renamed to wolfutil, and its Git repository has been moved +to . diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 28c30e4..0000000 --- a/autogen.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# Script to generate the build system. -# -# Copyright (C) 2013 Patrick McDermott -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - -set -e - -srcdir="${0%/*}" - -{( - cd "${srcdir}" - [ -d build-aux ] || mkdir build-aux - cat >ChangeLog <<-EOF -This file is generated upon release. Run \`git log\` for a list of changes. -EOF - aclocal - autoconf - autoheader - automake --add-missing --copy -)} - -"${srcdir}/configure" "${@}" diff --git a/build-aux/tap-driver.sh b/build-aux/tap-driver.sh deleted file mode 100755 index 82efa96..0000000 --- a/build-aux/tap-driver.sh +++ /dev/null @@ -1,651 +0,0 @@ -#! /bin/sh -# Copyright (C) 2011-2017 Free Software Foundation, Inc. -# -# 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, or (at your option) -# any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -scriptversion=2013-12-23.17; # UTC - -# Make unconditional expansion of undefined variables an error. This -# helps a lot in preventing typo-related bugs. -set -u - -me=tap-driver.sh - -fatal () -{ - echo "$me: fatal: $*" >&2 - exit 1 -} - -usage_error () -{ - echo "$me: $*" >&2 - print_usage >&2 - exit 2 -} - -print_usage () -{ - cat < - # - trap : 1 3 2 13 15 - if test $merge -gt 0; then - exec 2>&1 - else - exec 2>&3 - fi - "$@" - echo $? - ) | LC_ALL=C ${AM_TAP_AWK-awk} \ - -v me="$me" \ - -v test_script_name="$test_name" \ - -v log_file="$log_file" \ - -v trs_file="$trs_file" \ - -v expect_failure="$expect_failure" \ - -v merge="$merge" \ - -v ignore_exit="$ignore_exit" \ - -v comments="$comments" \ - -v diag_string="$diag_string" \ -' -# TODO: the usages of "cat >&3" below could be optimized when using -# GNU awk, and/on on systems that supports /dev/fd/. - -# Implementation note: in what follows, `result_obj` will be an -# associative array that (partly) simulates a TAP result object -# from the `TAP::Parser` perl module. - -## ----------- ## -## FUNCTIONS ## -## ----------- ## - -function fatal(msg) -{ - print me ": " msg | "cat >&2" - exit 1 -} - -function abort(where) -{ - fatal("internal error " where) -} - -# Convert a boolean to a "yes"/"no" string. -function yn(bool) -{ - return bool ? "yes" : "no"; -} - -function add_test_result(result) -{ - if (!test_results_index) - test_results_index = 0 - test_results_list[test_results_index] = result - test_results_index += 1 - test_results_seen[result] = 1; -} - -# Whether the test script should be re-run by "make recheck". -function must_recheck() -{ - for (k in test_results_seen) - if (k != "XFAIL" && k != "PASS" && k != "SKIP") - return 1 - return 0 -} - -# Whether the content of the log file associated to this test should -# be copied into the "global" test-suite.log. -function copy_in_global_log() -{ - for (k in test_results_seen) - if (k != "PASS") - return 1 - return 0 -} - -function get_global_test_result() -{ - if ("ERROR" in test_results_seen) - return "ERROR" - if ("FAIL" in test_results_seen || "XPASS" in test_results_seen) - return "FAIL" - all_skipped = 1 - for (k in test_results_seen) - if (k != "SKIP") - all_skipped = 0 - if (all_skipped) - return "SKIP" - return "PASS"; -} - -function stringify_result_obj(result_obj) -{ - if (result_obj["is_unplanned"] || result_obj["number"] != testno) - return "ERROR" - - if (plan_seen == LATE_PLAN) - return "ERROR" - - if (result_obj["directive"] == "TODO") - return result_obj["is_ok"] ? "XPASS" : "XFAIL" - - if (result_obj["directive"] == "SKIP") - return result_obj["is_ok"] ? "SKIP" : COOKED_FAIL; - - if (length(result_obj["directive"])) - abort("in function stringify_result_obj()") - - return result_obj["is_ok"] ? COOKED_PASS : COOKED_FAIL -} - -function decorate_result(result) -{ - color_name = color_for_result[result] - if (color_name) - return color_map[color_name] "" result "" color_map["std"] - # If we are not using colorized output, or if we do not know how - # to colorize the given result, we should return it unchanged. - return result -} - -function report(result, details) -{ - if (result ~ /^(X?(PASS|FAIL)|SKIP|ERROR)/) - { - msg = ": " test_script_name - add_test_result(result) - } - else if (result == "#") - { - msg = " " test_script_name ":" - } - else - { - abort("in function report()") - } - if (length(details)) - msg = msg " " details - # Output on console might be colorized. - print decorate_result(result) msg - # Log the result in the log file too, to help debugging (this is - # especially true when said result is a TAP error or "Bail out!"). - print result msg | "cat >&3"; -} - -function testsuite_error(error_message) -{ - report("ERROR", "- " error_message) -} - -function handle_tap_result() -{ - details = result_obj["number"]; - if (length(result_obj["description"])) - details = details " " result_obj["description"] - - if (plan_seen == LATE_PLAN) - { - details = details " # AFTER LATE PLAN"; - } - else if (result_obj["is_unplanned"]) - { - details = details " # UNPLANNED"; - } - else if (result_obj["number"] != testno) - { - details = sprintf("%s # OUT-OF-ORDER (expecting %d)", - details, testno); - } - else if (result_obj["directive"]) - { - details = details " # " result_obj["directive"]; - if (length(result_obj["explanation"])) - details = details " " result_obj["explanation"] - } - - report(stringify_result_obj(result_obj), details) -} - -# `skip_reason` should be empty whenever planned > 0. -function handle_tap_plan(planned, skip_reason) -{ - planned += 0 # Avoid getting confused if, say, `planned` is "00" - if (length(skip_reason) && planned > 0) - abort("in function handle_tap_plan()") - if (plan_seen) - { - # Error, only one plan per stream is acceptable. - testsuite_error("multiple test plans") - return; - } - planned_tests = planned - # The TAP plan can come before or after *all* the TAP results; we speak - # respectively of an "early" or a "late" plan. If we see the plan line - # after at least one TAP result has been seen, assume we have a late - # plan; in this case, any further test result seen after the plan will - # be flagged as an error. - plan_seen = (testno >= 1 ? LATE_PLAN : EARLY_PLAN) - # If testno > 0, we have an error ("too many tests run") that will be - # automatically dealt with later, so do not worry about it here. If - # $plan_seen is true, we have an error due to a repeated plan, and that - # has already been dealt with above. Otherwise, we have a valid "plan - # with SKIP" specification, and should report it as a particular kind - # of SKIP result. - if (planned == 0 && testno == 0) - { - if (length(skip_reason)) - skip_reason = "- " skip_reason; - report("SKIP", skip_reason); - } -} - -function extract_tap_comment(line) -{ - if (index(line, diag_string) == 1) - { - # Strip leading `diag_string` from `line`. - line = substr(line, length(diag_string) + 1) - # And strip any leading and trailing whitespace left. - sub("^[ \t]*", "", line) - sub("[ \t]*$", "", line) - # Return what is left (if any). - return line; - } - return ""; -} - -# When this function is called, we know that line is a TAP result line, -# so that it matches the (perl) RE "^(not )?ok\b". -function setup_result_obj(line) -{ - # Get the result, and remove it from the line. - result_obj["is_ok"] = (substr(line, 1, 2) == "ok" ? 1 : 0) - sub("^(not )?ok[ \t]*", "", line) - - # If the result has an explicit number, get it and strip it; otherwise, - # automatically assing the next progresive number to it. - if (line ~ /^[0-9]+$/ || line ~ /^[0-9]+[^a-zA-Z0-9_]/) - { - match(line, "^[0-9]+") - # The final `+ 0` is to normalize numbers with leading zeros. - result_obj["number"] = substr(line, 1, RLENGTH) + 0 - line = substr(line, RLENGTH + 1) - } - else - { - result_obj["number"] = testno - } - - if (plan_seen == LATE_PLAN) - # No further test results are acceptable after a "late" TAP plan - # has been seen. - result_obj["is_unplanned"] = 1 - else if (plan_seen && testno > planned_tests) - result_obj["is_unplanned"] = 1 - else - result_obj["is_unplanned"] = 0 - - # Strip trailing and leading whitespace. - sub("^[ \t]*", "", line) - sub("[ \t]*$", "", line) - - # This will have to be corrected if we have a "TODO"/"SKIP" directive. - result_obj["description"] = line - result_obj["directive"] = "" - result_obj["explanation"] = "" - - if (index(line, "#") == 0) - return # No possible directive, nothing more to do. - - # Directives are case-insensitive. - rx = "[ \t]*#[ \t]*([tT][oO][dD][oO]|[sS][kK][iI][pP])[ \t]*" - - # See whether we have the directive, and if yes, where. - pos = match(line, rx "$") - if (!pos) - pos = match(line, rx "[^a-zA-Z0-9_]") - - # If there was no TAP directive, we have nothing more to do. - if (!pos) - return - - # Let`s now see if the TAP directive has been escaped. For example: - # escaped: ok \# SKIP - # not escaped: ok \\# SKIP - # escaped: ok \\\\\# SKIP - # not escaped: ok \ # SKIP - if (substr(line, pos, 1) == "#") - { - bslash_count = 0 - for (i = pos; i > 1 && substr(line, i - 1, 1) == "\\"; i--) - bslash_count += 1 - if (bslash_count % 2) - return # Directive was escaped. - } - - # Strip the directive and its explanation (if any) from the test - # description. - result_obj["description"] = substr(line, 1, pos - 1) - # Now remove the test description from the line, that has been dealt - # with already. - line = substr(line, pos) - # Strip the directive, and save its value (normalized to upper case). - sub("^[ \t]*#[ \t]*", "", line) - result_obj["directive"] = toupper(substr(line, 1, 4)) - line = substr(line, 5) - # Now get the explanation for the directive (if any), with leading - # and trailing whitespace removed. - sub("^[ \t]*", "", line) - sub("[ \t]*$", "", line) - result_obj["explanation"] = line -} - -function get_test_exit_message(status) -{ - if (status == 0) - return "" - if (status !~ /^[1-9][0-9]*$/) - abort("getting exit status") - if (status < 127) - exit_details = "" - else if (status == 127) - exit_details = " (command not found?)" - else if (status >= 128 && status <= 255) - exit_details = sprintf(" (terminated by signal %d?)", status - 128) - else if (status > 256 && status <= 384) - # We used to report an "abnormal termination" here, but some Korn - # shells, when a child process die due to signal number n, can leave - # in $? an exit status of 256+n instead of the more standard 128+n. - # Apparently, both behaviours are allowed by POSIX (2008), so be - # prepared to handle them both. See also Austing Group report ID - # 0000051 - exit_details = sprintf(" (terminated by signal %d?)", status - 256) - else - # Never seen in practice. - exit_details = " (abnormal termination)" - return sprintf("exited with status %d%s", status, exit_details) -} - -function write_test_results() -{ - print ":global-test-result: " get_global_test_result() > trs_file - print ":recheck: " yn(must_recheck()) > trs_file - print ":copy-in-global-log: " yn(copy_in_global_log()) > trs_file - for (i = 0; i < test_results_index; i += 1) - print ":test-result: " test_results_list[i] > trs_file - close(trs_file); -} - -BEGIN { - -## ------- ## -## SETUP ## -## ------- ## - -'"$init_colors"' - -# Properly initialized once the TAP plan is seen. -planned_tests = 0 - -COOKED_PASS = expect_failure ? "XPASS": "PASS"; -COOKED_FAIL = expect_failure ? "XFAIL": "FAIL"; - -# Enumeration-like constants to remember which kind of plan (if any) -# has been seen. It is important that NO_PLAN evaluates "false" as -# a boolean. -NO_PLAN = 0 -EARLY_PLAN = 1 -LATE_PLAN = 2 - -testno = 0 # Number of test results seen so far. -bailed_out = 0 # Whether a "Bail out!" directive has been seen. - -# Whether the TAP plan has been seen or not, and if yes, which kind -# it is ("early" is seen before any test result, "late" otherwise). -plan_seen = NO_PLAN - -## --------- ## -## PARSING ## -## --------- ## - -is_first_read = 1 - -while (1) - { - # Involutions required so that we are able to read the exit status - # from the last input line. - st = getline - if (st < 0) # I/O error. - fatal("I/O error while reading from input stream") - else if (st == 0) # End-of-input - { - if (is_first_read) - abort("in input loop: only one input line") - break - } - if (is_first_read) - { - is_first_read = 0 - nextline = $0 - continue - } - else - { - curline = nextline - nextline = $0 - $0 = curline - } - # Copy any input line verbatim into the log file. - print | "cat >&3" - # Parsing of TAP input should stop after a "Bail out!" directive. - if (bailed_out) - continue - - # TAP test result. - if ($0 ~ /^(not )?ok$/ || $0 ~ /^(not )?ok[^a-zA-Z0-9_]/) - { - testno += 1 - setup_result_obj($0) - handle_tap_result() - } - # TAP plan (normal or "SKIP" without explanation). - else if ($0 ~ /^1\.\.[0-9]+[ \t]*$/) - { - # The next two lines will put the number of planned tests in $0. - sub("^1\\.\\.", "") - sub("[^0-9]*$", "") - handle_tap_plan($0, "") - continue - } - # TAP "SKIP" plan, with an explanation. - else if ($0 ~ /^1\.\.0+[ \t]*#/) - { - # The next lines will put the skip explanation in $0, stripping - # any leading and trailing whitespace. This is a little more - # tricky in truth, since we want to also strip a potential leading - # "SKIP" string from the message. - sub("^[^#]*#[ \t]*(SKIP[: \t][ \t]*)?", "") - sub("[ \t]*$", ""); - handle_tap_plan(0, $0) - } - # "Bail out!" magic. - # Older versions of prove and TAP::Harness (e.g., 3.17) did not - # recognize a "Bail out!" directive when preceded by leading - # whitespace, but more modern versions (e.g., 3.23) do. So we - # emulate the latter, "more modern" behaviour. - else if ($0 ~ /^[ \t]*Bail out!/) - { - bailed_out = 1 - # Get the bailout message (if any), with leading and trailing - # whitespace stripped. The message remains stored in `$0`. - sub("^[ \t]*Bail out![ \t]*", ""); - sub("[ \t]*$", ""); - # Format the error message for the - bailout_message = "Bail out!" - if (length($0)) - bailout_message = bailout_message " " $0 - testsuite_error(bailout_message) - } - # Maybe we have too look for dianogtic comments too. - else if (comments != 0) - { - comment = extract_tap_comment($0); - if (length(comment)) - report("#", comment); - } - } - -## -------- ## -## FINISH ## -## -------- ## - -# A "Bail out!" directive should cause us to ignore any following TAP -# error, as well as a non-zero exit status from the TAP producer. -if (!bailed_out) - { - if (!plan_seen) - { - testsuite_error("missing test plan") - } - else if (planned_tests != testno) - { - bad_amount = testno > planned_tests ? "many" : "few" - testsuite_error(sprintf("too %s tests run (expected %d, got %d)", - bad_amount, planned_tests, testno)) - } - if (!ignore_exit) - { - # Fetch exit status from the last line. - exit_message = get_test_exit_message(nextline) - if (exit_message) - testsuite_error(exit_message) - } - } - -write_test_results() - -exit 0 - -} # End of "BEGIN" block. -' - -# TODO: document that we consume the file descriptor 3 :-( -} 3>"$log_file" - -test $? -eq 0 || fatal "I/O or internal error" - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC0" -# time-stamp-end: "; # UTC" -# End: diff --git a/configure.ac b/configure.ac deleted file mode 100644 index ce26416..0000000 --- a/configure.ac +++ /dev/null @@ -1,176 +0,0 @@ -# Process this file with autoconf to produce a configure script. -# -# Copyright (C) 2017 Patrick McDermott -# Copyright (C) 2019-2020 Libiquity LLC -# -# This file is part of wolfutil. -# -# wolfutil 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. -# -# wolfutil 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. -# -# You should have received a copy of the GNU General Public License -# along with wolfutil. If not, see . - -AC_INIT([Unofficial wolfSSL Utility], [1.0.0], - [mailto:patrick.mcdermott@libiquity.com], [wolfutil]) -AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_SRCDIR([src/main.c]) - -AM_INIT_AUTOMAKE([gnu check-news dist-bzip2 dist-xz subdir-objects]) -AM_SILENT_RULES([yes]) - -AM_CONDITIONAL([IN_GIT], - [test -d "${srcdir}/.git" && command -v git >/dev/null 2>&1]) - -save_CFLAGS="${CFLAGS-}" -AC_PROG_CC() -AM_PROG_CC_C_O() -test -d "${srcdir}/.git" || CFLAGS="${save_CFLAGS}" - -AX_CFLAGS_WARN_ALL() dnl Adds -Wall or equivalent -AX_CHECK_COMPILE_FLAG([-Wpedantic], [AX_APPEND_FLAG([-Wpedantic])]) -AX_CHECK_COMPILE_FLAG([-Wextra], [AX_APPEND_FLAG([-Wextra])]) - -AC_ARG_ENABLE([gcc-warnings], - [AS_HELP_STRING([--enable-gcc-warnings], [turn on many GCC warnings])], - [case "${enableval}" in yes|no) gcc_warnings=${enableval};; - *) AC_MSG_ERROR( - [bad value ${enableval} for gcc-warnings option]);; - esac], - [ - gcc_warnings=no - test -d "${srcdir}/.git" && gcc_warnings=yes - ] -) -if test "x${gcc_warnings}" = 'xyes'; then - nowarns='' - nowarns="${nowarns} -Wsystem-headers" - gl_MANYWARN_ALL_GCC([warns]) - gl_MANYWARN_COMPLEMENT([warns], [${warns}], [${nowarns}]) - for warn in ${warns}; do - gl_WARN_ADD([${warn}]) - done - AC_SUBST([WARN_CFLAGS]) -fi - -AX_CHECK_COMPILE_FLAG([-fdiagnostics-color=auto], - [AX_APPEND_FLAG([-fdiagnostics-color=auto])]) - -AC_ARG_ENABLE([address-sanitization], - [AS_HELP_STRING([--enable-address-sanitization], - [turn on AddressSanitizer (if available)])], - [case "${enableval}" in yes|no) address_sanitization=${enableval};; - *) AC_MSG_ERROR( - [bad value ${enableval} for address-sanitization option] - );; - esac], - [ - address_sanitization=no - gl_GCC_VERSION_IFELSE([4], [8], - [test -d "${srcdir}/.git" && address_sanitization=yes]) - ] -) -if test "x${address_sanitization}" = 'xyes'; then - AX_CHECK_COMPILE_FLAG([-fsanitize=address], - [AX_APPEND_FLAG([-fsanitize=address], [ASAN_CFLAGS])]) - AX_CHECK_COMPILE_FLAG([-fno-omit-frame-pointer], - [AX_APPEND_FLAG([-fno-omit-frame-pointer], [ASAN_CFLAGS])]) - AC_SUBST([ASAN_CFLAGS]) -fi - -AX_APPEND_FLAG([-DTFM_TIMING_RESISTANT]) -AX_APPEND_FLAG([-DECC_TIMING_RESISTANT]) - -if ! test -d "${srcdir}/.git"; then - AX_CHECK_COMPILE_FLAG([-s], [AX_APPEND_FLAG([-s])]) -fi -for flag in -Os -fno-unwind-tables -fno-asynchronous-unwind-tables \ - -ffunction-sections -fdata-sections -Wl,--gc-sections \ - -fstack-protector-strong -flto \ - -Wl,-z,now -Wl,--hash-style=sysv -Wl,--build-id=none; do - AX_CHECK_COMPILE_FLAG([${flag}], [AX_APPEND_FLAG([${flag}])]) -done - -HAVE_CA_CERTS='' -CA_CERTS_DIR='NULL' -CA_CERTS_FILE='NULL' -AC_ARG_WITH([ca-certificates-dir], - [AS_HELP_STRING([--with-ca-certificates-dir=PATH], - [path to CA root certificates directory])], - [ - case "${withval}" in - 'yes'|'') - HAVE_CA_CERTS='1' - ;; - 'no') - HAVE_CA_CERTS='0' - ;; - *) - HAVE_CA_CERTS='1' - CA_CERTS_DIR="\"${withval}\"" - ;; - esac - ] -) -if test x"${HAVE_CA_CERTS}" != x'0' && test x"${CA_CERTS_DIR}" = x'NULL'; then - AC_MSG_CHECKING([for CA root certificates directory]) - for d in /etc/ssl/certs /usr/lib/ssl/certs /usr/share/ssl \ - /usr/local/ssl /etc/ssl /usr/share/ca-certificates \ - /etc/x509/server-auth; do - if test -d "${d}"; then - AC_MSG_RESULT([${d}]) - HAVE_CA_CERTS='1' - CA_CERTS_DIR="\"${d}\"" - break - fi - done - if test x"${CA_CERTS_DIR}" = x'NULL'; then - AC_MSG_RESULT([no]) - if test x"${HAVE_CA_CERTS}" = x'1'; then - AC_MSG_ERROR([CA root certificates directory not found]) - fi - HAVE_CA_CERTS='0' - fi -fi -AC_ARG_WITH([ca-certificates-file], - [AS_HELP_STRING([--with-ca-certificates-file=PATH], - [path to CA root certificates file])], - [ - case "${withval}" in - 'yes'|'') - AC_MSG_ERROR([--with-ca-certificates-file $(: \ - )requires an argument]) - ;; - 'no') - ;; - *) - HAVE_CA_CERTS='1' - CA_CERTS_FILE="\"${withval}\"" - ;; - esac - ] -) -AC_DEFINE_UNQUOTED([HAVE_CA_CERTS], [${HAVE_CA_CERTS}], - [Define to 1 to verify certificates against installed CA root - certificates.]) -AC_DEFINE_UNQUOTED([CA_CERTS_DIR], [${CA_CERTS_DIR}], - [Define to the path to CA root certificates directory.]) -AC_DEFINE_UNQUOTED([CA_CERTS_FILE], [${CA_CERTS_FILE}], - [Define to the path to CA root certificates file.]) - -PKG_PROG_PKG_CONFIG() -PKG_CHECK_MODULES([WOLFSSL], [wolfssl]) -WOLFSSL_CFLAGS="$(printf ' %s' "${WOLFSSL_CFLAGS}" | \ - sed 's/ -I/ -isystem/g;')" - -AC_CONFIG_FILES([Makefile]) -AC_CONFIG_HEADERS([config.h]) -AC_OUTPUT() diff --git a/m4/ax_append_flag.m4 b/m4/ax_append_flag.m4 deleted file mode 100644 index e8c5312..0000000 --- a/m4/ax_append_flag.m4 +++ /dev/null @@ -1,71 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) -# -# DESCRIPTION -# -# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space -# added in between. -# -# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. -# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains -# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly -# FLAG. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# 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 3 of the License, or (at your -# option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 7 - -AC_DEFUN([AX_APPEND_FLAG], -[dnl -AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF -AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) -AS_VAR_SET_IF(FLAGS,[ - AS_CASE([" AS_VAR_GET(FLAGS) "], - [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], - [ - AS_VAR_APPEND(FLAGS,[" $1"]) - AC_RUN_LOG([: FLAGS="$FLAGS"]) - ]) - ], - [ - AS_VAR_SET(FLAGS,[$1]) - AC_RUN_LOG([: FLAGS="$FLAGS"]) - ]) -AS_VAR_POPDEF([FLAGS])dnl -])dnl AX_APPEND_FLAG diff --git a/m4/ax_cflags_warn_all.m4 b/m4/ax_cflags_warn_all.m4 deleted file mode 100644 index 094577e..0000000 --- a/m4/ax_cflags_warn_all.m4 +++ /dev/null @@ -1,122 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] -# AX_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] -# AX_FCFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] -# -# DESCRIPTION -# -# Try to find a compiler option that enables most reasonable warnings. -# -# For the GNU compiler it will be -Wall (and -ansi -pedantic) The result -# is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default. -# -# Currently this macro knows about the GCC, Solaris, Digital Unix, AIX, -# HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and -# Intel compilers. For a given compiler, the Fortran flags are much more -# experimental than their C equivalents. -# -# - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS -# - $2 add-value-if-not-found : nothing -# - $3 action-if-found : add value to shellvariable -# - $4 action-if-not-found : nothing -# -# NOTE: These macros depend on AX_APPEND_FLAG. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2010 Rhys Ulerich -# -# 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 3 of the License, or (at your -# option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 16 - -AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl -AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], -VAR,[VAR="no, unknown" -ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "-warn all % -warn all" dnl Intel - "-pedantic % -Wall" dnl GCC - "-xstrconst % -v" dnl Solaris C - "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix - "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX - "-ansi -ansiE % -fullwarn" dnl IRIX - "+ESlit % +w1" dnl HP-UX C - "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) - "-h conform % -h msglevel 2" dnl Cray C (Unicos) - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_COMPILE_IFELSE([AC_LANG_PROGRAM], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done -FLAGS="$ac_save_[]FLAGS" -]) -AS_VAR_POPDEF([FLAGS])dnl -AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;; - *) m4_default($3,[AX_APPEND_FLAG([$VAR], [$1])]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -])dnl AX_FLAGS_WARN_ALL -dnl implementation tactics: -dnl the for-argument contains a list of options. The first part of -dnl these does only exist to detect the compiler - usually it is -dnl a global option to enable -ansi or -extrawarnings. All other -dnl compilers will fail about it. That was needed since a lot of -dnl compilers will give false positives for some option-syntax -dnl like -Woption or -Xoption as they think of it is a pass-through -dnl to later compile stages or something. The "%" is used as a -dnl delimiter. A non-option comment can be given after "%%" marks -dnl which will be shown but not added to the respective C/CXXFLAGS. - -AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl -AC_LANG_PUSH([C]) -AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) -AC_LANG_POP([C]) -]) - -AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl -AC_LANG_PUSH([C++]) -AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) -AC_LANG_POP([C++]) -]) - -AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl -AC_LANG_PUSH([Fortran]) -AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) -AC_LANG_POP([Fortran]) -]) diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 deleted file mode 100644 index dcabb92..0000000 --- a/m4/ax_check_compile_flag.m4 +++ /dev/null @@ -1,74 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) -# -# DESCRIPTION -# -# Check whether the given FLAG works with the current language's compiler -# or gives an error. (Warnings, however, are ignored) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# If EXTRA-FLAGS is defined, it is added to the current language's default -# flags (e.g. CFLAGS) when the check is done. The check is thus made with -# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to -# force the compiler to issue an error when a bad flag is given. -# -# INPUT gives an alternative input source to AC_COMPILE_IFELSE. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this -# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# 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 3 of the License, or (at your -# option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 5 - -AC_DEFUN([AX_CHECK_COMPILE_FLAG], -[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl -AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ - ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" - AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], - [AS_VAR_SET(CACHEVAR,[yes])], - [AS_VAR_SET(CACHEVAR,[no])]) - _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) -AS_VAR_IF(CACHEVAR,yes, - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_COMPILE_FLAGS diff --git a/m4/ax_require_defined.m4 b/m4/ax_require_defined.m4 deleted file mode 100644 index 17c3eab..0000000 --- a/m4/ax_require_defined.m4 +++ /dev/null @@ -1,37 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_REQUIRE_DEFINED(MACRO) -# -# DESCRIPTION -# -# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have -# been defined and thus are available for use. This avoids random issues -# where a macro isn't expanded. Instead the configure script emits a -# non-fatal: -# -# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found -# -# It's like AC_REQUIRE except it doesn't expand the required macro. -# -# Here's an example: -# -# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) -# -# LICENSE -# -# Copyright (c) 2014 Mike Frysinger -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 2 - -AC_DEFUN([AX_REQUIRE_DEFINED], [dnl - m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) -])dnl AX_REQUIRE_DEFINED diff --git a/m4/gcc_version.m4 b/m4/gcc_version.m4 deleted file mode 100644 index 9e16450..0000000 --- a/m4/gcc_version.m4 +++ /dev/null @@ -1,38 +0,0 @@ -dnl Copied from GNU Coreutils configure.ac -dnl -dnl The 17 lines are probably too trivial to be copyrightable, but just in case: -dnl -dnl Copyright (C) 1991-2017 Free Software Foundation, Inc. -dnl -dnl This program is free software: you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation, either version 3 of the License, or -dnl (at your option) any later version. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program. If not, see . -dnl -dnl Written by Jim Meyering. - -# gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found]) -# ------------------------------------------------ -# If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND. -# Otherwise, run RUN-IF-NOT-FOUND. -AC_DEFUN([gl_GCC_VERSION_IFELSE], - [AC_PREPROC_IFELSE( - [AC_LANG_PROGRAM( - [[ -#if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__) -/* ok */ -#else -# error "your version of gcc is older than $1.$2" -#endif - ]]), - ], [$3], [$4]) - ] -) diff --git a/m4/gl_manywarnings.m4 b/m4/gl_manywarnings.m4 deleted file mode 100644 index d10bcd0..0000000 --- a/m4/gl_manywarnings.m4 +++ /dev/null @@ -1,329 +0,0 @@ -# manywarnings.m4 serial 13 -dnl Copyright (C) 2008-2017 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Simon Josefsson - -# gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR) -# -------------------------------------------------- -# Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR. -# Elements separated by whitespace. In set logic terms, the function -# does OUTVAR = LISTVAR \ REMOVEVAR. -AC_DEFUN([gl_MANYWARN_COMPLEMENT], -[ - gl_warn_set= - set x $2; shift - for gl_warn_item - do - case " $3 " in - *" $gl_warn_item "*) - ;; - *) - gl_warn_set="$gl_warn_set $gl_warn_item" - ;; - esac - done - $1=$gl_warn_set -]) - -# gl_MANYWARN_ALL_GCC(VARIABLE) -# ----------------------------- -# Add all documented GCC warning parameters to variable VARIABLE. -# Note that you need to test them using gl_WARN_ADD if you want to -# make sure your gcc understands it. -# -# The effects of this macro depend on the current language (_AC_LANG). -AC_DEFUN([gl_MANYWARN_ALL_GCC], -[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) - -# Specialization for _AC_LANG = C. -# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b. -m4_defun([gl_MANYWARN_ALL_GCC(C)], -[ - AC_LANG_PUSH([C]) - - dnl First, check for some issues that only occur when combining multiple - dnl gcc warning categories. - AC_REQUIRE([AC_PROG_CC]) - if test -n "$GCC"; then - - dnl Check if -W -Werror -Wno-missing-field-initializers is supported - dnl with the current $CC $CFLAGS $CPPFLAGS. - AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported]) - AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [ - gl_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[]], [[]])], - [gl_cv_cc_nomfi_supported=yes], - [gl_cv_cc_nomfi_supported=no]) - CFLAGS="$gl_save_CFLAGS"]) - AC_MSG_RESULT([$gl_cv_cc_nomfi_supported]) - - if test "$gl_cv_cc_nomfi_supported" = yes; then - dnl Now check whether -Wno-missing-field-initializers is needed - dnl for the { 0, } construct. - AC_MSG_CHECKING([whether -Wno-missing-field-initializers is needed]) - AC_CACHE_VAL([gl_cv_cc_nomfi_needed], [ - gl_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -W -Werror" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[int f (void) - { - typedef struct { int a; int b; } s_t; - s_t s1 = { 0, }; - return s1.b; - } - ]], - [[]])], - [gl_cv_cc_nomfi_needed=no], - [gl_cv_cc_nomfi_needed=yes]) - CFLAGS="$gl_save_CFLAGS" - ]) - AC_MSG_RESULT([$gl_cv_cc_nomfi_needed]) - fi - - dnl Next, check if -Werror -Wuninitialized is useful with the - dnl user's choice of $CFLAGS; some versions of gcc warn that it - dnl has no effect if -O is not also used - AC_MSG_CHECKING([whether -Wuninitialized is supported]) - AC_CACHE_VAL([gl_cv_cc_uninitialized_supported], [ - gl_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror -Wuninitialized" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[]], [[]])], - [gl_cv_cc_uninitialized_supported=yes], - [gl_cv_cc_uninitialized_supported=no]) - CFLAGS="$gl_save_CFLAGS"]) - AC_MSG_RESULT([$gl_cv_cc_uninitialized_supported]) - - fi - - # List all gcc warning categories. - # To compare this list to your installed GCC's, run this Bash command: - # - # comm -3 \ - # <(sed -n 's/^ *\(-[^ ]*\) .*/\1/p' manywarnings.m4 | sort) \ - # <(gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort | - # grep -v -x -F -f <( - # awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec)) - - gl_manywarn_set= - for gl_manywarn_item in -fno-common \ - -W \ - -Wabi \ - -Waddress \ - -Waggressive-loop-optimizations \ - -Wall \ - -Wattributes \ - -Wbad-function-cast \ - -Wbool-compare \ - -Wbool-operation \ - -Wbuiltin-declaration-mismatch \ - -Wbuiltin-macro-redefined \ - -Wcast-align \ - -Wchar-subscripts \ - -Wchkp \ - -Wclobbered \ - -Wcomment \ - -Wcomments \ - -Wcoverage-mismatch \ - -Wcpp \ - -Wdangling-else \ - -Wdate-time \ - -Wdeprecated \ - -Wdeprecated-declarations \ - -Wdesignated-init \ - -Wdisabled-optimization \ - -Wdiscarded-array-qualifiers \ - -Wdiscarded-qualifiers \ - -Wdiv-by-zero \ - -Wdouble-promotion \ - -Wduplicated-branches \ - -Wduplicated-cond \ - -Wduplicate-decl-specifier \ - -Wempty-body \ - -Wendif-labels \ - -Wenum-compare \ - -Wexpansion-to-defined \ - -Wextra \ - -Wformat-contains-nul \ - -Wformat-extra-args \ - -Wformat-nonliteral \ - -Wformat-security \ - -Wformat-signedness \ - -Wformat-y2k \ - -Wformat-zero-length \ - -Wframe-address \ - -Wfree-nonheap-object \ - -Whsa \ - -Wignored-attributes \ - -Wignored-qualifiers \ - -Wimplicit \ - -Wimplicit-function-declaration \ - -Wimplicit-int \ - -Wincompatible-pointer-types \ - -Winit-self \ - -Winline \ - -Wint-conversion \ - -Wint-in-bool-context \ - -Wint-to-pointer-cast \ - -Winvalid-memory-model \ - -Winvalid-pch \ - -Wjump-misses-init \ - -Wlogical-not-parentheses \ - -Wlogical-op \ - -Wmain \ - -Wmaybe-uninitialized \ - -Wmemset-elt-size \ - -Wmemset-transposed-args \ - -Wmisleading-indentation \ - -Wmissing-braces \ - -Wmissing-declarations \ - -Wmissing-field-initializers \ - -Wmissing-include-dirs \ - -Wmissing-parameter-type \ - -Wmissing-prototypes \ - -Wmultichar \ - -Wnarrowing \ - -Wnested-externs \ - -Wnonnull \ - -Wnonnull-compare \ - -Wnull-dereference \ - -Wodr \ - -Wold-style-declaration \ - -Wold-style-definition \ - -Wopenmp-simd \ - -Woverflow \ - -Woverlength-strings \ - -Woverride-init \ - -Wpacked \ - -Wpacked-bitfield-compat \ - -Wparentheses \ - -Wpointer-arith \ - -Wpointer-compare \ - -Wpointer-sign \ - -Wpointer-to-int-cast \ - -Wpragmas \ - -Wpsabi \ - -Wrestrict \ - -Wreturn-local-addr \ - -Wreturn-type \ - -Wscalar-storage-order \ - -Wsequence-point \ - -Wshadow \ - -Wshift-count-negative \ - -Wshift-count-overflow \ - -Wshift-negative-value \ - -Wsizeof-array-argument \ - -Wsizeof-pointer-memaccess \ - -Wstack-protector \ - -Wstrict-aliasing \ - -Wstrict-overflow \ - -Wstrict-prototypes \ - -Wsuggest-attribute=const \ - -Wsuggest-attribute=format \ - -Wsuggest-attribute=noreturn \ - -Wsuggest-attribute=pure \ - -Wsuggest-final-methods \ - -Wsuggest-final-types \ - -Wswitch \ - -Wswitch-bool \ - -Wswitch-default \ - -Wswitch-unreachable \ - -Wsync-nand \ - -Wsystem-headers \ - -Wtautological-compare \ - -Wtrampolines \ - -Wtrigraphs \ - -Wtype-limits \ - -Wuninitialized \ - -Wunknown-pragmas \ - -Wunsafe-loop-optimizations \ - -Wunused \ - -Wunused-but-set-parameter \ - -Wunused-but-set-variable \ - -Wunused-function \ - -Wunused-label \ - -Wunused-local-typedefs \ - -Wunused-macros \ - -Wunused-parameter \ - -Wunused-result \ - -Wunused-value \ - -Wunused-variable \ - -Wvarargs \ - -Wvariadic-macros \ - -Wvector-operation-performance \ - -Wvla \ - -Wvolatile-register-var \ - -Wwrite-strings \ - \ - ; do - gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" - done - - # gcc --help=warnings outputs an unusual form for these options; list - # them here so that the above 'comm' command doesn't report a false match. - # Would prefer "min (PTRDIFF_MAX, SIZE_MAX)", but it must be a literal. - # Also, AC_COMPUTE_INT requires it to fit in a long; it is 2**63 on - # the only platforms where it does not fit in a long, so make that - # a special case. - AC_MSG_CHECKING([max safe object size]) - AC_COMPUTE_INT([gl_alloc_max], - [LONG_MAX < (PTRDIFF_MAX < (size_t) -1 ? PTRDIFF_MAX : (size_t) -1) - ? -1 - : PTRDIFF_MAX < (size_t) -1 ? (long) PTRDIFF_MAX : (long) (size_t) -1], - [[#include - #include - #include - ]], - [gl_alloc_max=2147483647]) - case $gl_alloc_max in - -1) gl_alloc_max=9223372036854775807;; - esac - AC_MSG_RESULT([$gl_alloc_max]) - gl_manywarn_set="$gl_manywarn_set -Walloc-size-larger-than=$gl_alloc_max" - gl_manywarn_set="$gl_manywarn_set -Warray-bounds=2" - gl_manywarn_set="$gl_manywarn_set -Wformat-overflow=2" - gl_manywarn_set="$gl_manywarn_set -Wformat-truncation=2" - gl_manywarn_set="$gl_manywarn_set -Wimplicit-fallthrough=5" - gl_manywarn_set="$gl_manywarn_set -Wnormalized=nfc" - gl_manywarn_set="$gl_manywarn_set -Wshift-overflow=2" - gl_manywarn_set="$gl_manywarn_set -Wstringop-overflow=2" - gl_manywarn_set="$gl_manywarn_set -Wunused-const-variable=2" - gl_manywarn_set="$gl_manywarn_set -Wvla-larger-than=4031" - - # These are needed for older GCC versions. - if test -n "$GCC"; then - case `($CC --version) 2>/dev/null` in - 'gcc (GCC) '[[0-3]].* | \ - 'gcc (GCC) '4.[[0-7]].*) - gl_manywarn_set="$gl_manywarn_set -fdiagnostics-show-option" - gl_manywarn_set="$gl_manywarn_set -funit-at-a-time" - ;; - esac - fi - - # Disable specific options as needed. - if test "$gl_cv_cc_nomfi_needed" = yes; then - gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" - fi - - if test "$gl_cv_cc_uninitialized_supported" = no; then - gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized" - fi - - $1=$gl_manywarn_set - - AC_LANG_POP([C]) -]) - -# Specialization for _AC_LANG = C++. -# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b. -m4_defun([gl_MANYWARN_ALL_GCC(C++)], -[ - gl_MANYWARN_ALL_GCC_CXX_IMPL([$1]) -]) diff --git a/m4/gl_warnings.m4 b/m4/gl_warnings.m4 deleted file mode 100644 index 870472b..0000000 --- a/m4/gl_warnings.m4 +++ /dev/null @@ -1,106 +0,0 @@ -# warnings.m4 serial 13 -dnl Copyright (C) 2008-2017 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Simon Josefsson - -# gl_AS_VAR_APPEND(VAR, VALUE) -# ---------------------------- -# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it. -m4_ifdef([AS_VAR_APPEND], -[m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])], -[m4_define([gl_AS_VAR_APPEND], -[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])]) - - -# gl_COMPILER_OPTION_IF(OPTION, [IF-SUPPORTED], [IF-NOT-SUPPORTED], -# [PROGRAM = AC_LANG_PROGRAM()]) -# ----------------------------------------------------------------- -# Check if the compiler supports OPTION when compiling PROGRAM. -# -# The effects of this macro depend on the current language (_AC_LANG). -AC_DEFUN([gl_COMPILER_OPTION_IF], -[ -dnl FIXME: gl_Warn must be used unquoted until we can assume Autoconf -dnl 2.64 or newer. -AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl -AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl -AS_LITERAL_IF([$1], - [m4_pushdef([gl_Positive], m4_bpatsubst([$1], [^-Wno-], [-W]))], - [gl_positive="$1" -case $gl_positive in - -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;; -esac -m4_pushdef([gl_Positive], [$gl_positive])])dnl -AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [ - gl_save_compiler_FLAGS="$gl_Flags" - gl_AS_VAR_APPEND(m4_defn([gl_Flags]), - [" $gl_unknown_warnings_are_errors ]m4_defn([gl_Positive])["]) - AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])], - [AS_VAR_SET(gl_Warn, [yes])], - [AS_VAR_SET(gl_Warn, [no])]) - gl_Flags="$gl_save_compiler_FLAGS" -]) -AS_VAR_IF(gl_Warn, [yes], [$2], [$3]) -m4_popdef([gl_Positive])dnl -AS_VAR_POPDEF([gl_Flags])dnl -AS_VAR_POPDEF([gl_Warn])dnl -]) - -# gl_UNKNOWN_WARNINGS_ARE_ERRORS -# ------------------------------ -# Clang doesn't complain about unknown warning options unless one also -# specifies -Wunknown-warning-option -Werror. Detect this. -# -# The effects of this macro depend on the current language (_AC_LANG). -AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS], -[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) - -# Specialization for _AC_LANG = C. This macro can be AC_REQUIREd. -# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b. -m4_defun([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C)], -[ - AC_LANG_PUSH([C]) - gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL - AC_LANG_POP([C]) -]) - -# Specialization for _AC_LANG = C++. This macro can be AC_REQUIREd. -# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b. -m4_defun([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C++)], -[ - AC_LANG_PUSH([C++]) - gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL - AC_LANG_POP([C++]) -]) - -AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL], -[gl_COMPILER_OPTION_IF([-Werror -Wunknown-warning-option], - [gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror'], - [gl_unknown_warnings_are_errors=])]) - -# gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS/WARN_CXXFLAGS], -# [PROGRAM = AC_LANG_PROGRAM()]) -# ----------------------------------------------------------- -# Adds parameter to WARN_CFLAGS/WARN_CXXFLAGS if the compiler supports it -# when compiling PROGRAM. For example, gl_WARN_ADD([-Wparentheses]). -# -# If VARIABLE is a variable name, AC_SUBST it. -# -# The effects of this macro depend on the current language (_AC_LANG). -AC_DEFUN([gl_WARN_ADD], -[AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS(]_AC_LANG[)]) -gl_COMPILER_OPTION_IF([$1], - [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_]_AC_LANG_PREFIX[FLAGS]], [[$2]]), [" $1"])], - [], - [$3]) -m4_ifval([$2], - [AS_LITERAL_IF([$2], [AC_SUBST([$2])])], - [AC_SUBST([WARN_]_AC_LANG_PREFIX[FLAGS])])dnl -]) - -# Local Variables: -# mode: autoconf -# End: diff --git a/scripts/announce-release.sh b/scripts/announce-release.sh deleted file mode 100755 index c7f8dea..0000000 --- a/scripts/announce-release.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/bin/sh - -set -e - -FROM_NAME='Patrick McDermott' -FROM_EMAIL='patrick.mcdermott@libiquity.com' -SIG="$(cat <<-EOF - Patrick McDermott, CEO - Libiquity - Putting customers in control of high-quality technologies - https://www.libiquity.com/ - EOF - )" -KEY='2250 31F0 47FF E516 63ED 516F 1A45 9ECD E4D6 04BE' -TO_EMAIL='proteanos-dev@lists.proteanos.com' - -package="${1}" -version="${2}" -package_name="${3}" -srcdir="${0%/scripts/announce-release.sh}" - -export GIT_DIR="${srcdir}/.git" - -heading() -{ - local name="${1}" - shift 1 - - printf '%s\n' "${name}" - printf '%s\n' "${name}" | sed 's/./=/g' -} - -about="$(sed -n ' - H; - ${ - g; - s/^\n*[^\n][^\n]*\n[=-][=-]*\n\n*//; - s/\n*[^\n][^\n]*\n[=-][=-]*\n.*$//; - p; - }; - ' "${srcdir}/README")" -news="$(sed -n ' - H; - ${ - g; - s/^\n*[^\n][^\n]*\n[=-][=-]*\n\n*//; - s/^Released: [^\n]*\n\n*//; - s/\n*[^\n][^\n]*\n[=-][=-]*\n.*$//; - p; - }; - ' "${srcdir}/NEWS")" -old_version="$(sed -n "/^${package_name} version /p;" "${srcdir}/NEWS" | \ - sed -n "2{ s/^${package_name} version / Since Version /p; };")" -old_tag="$(git tag --sort=-creatordate | sed -n '2{p;q;}')" -# Empty tree SHA-1 hash: -[ -z "${old_tag}" ] && old_tag='4b825dc642cb6eb9a060e54bf8d69288fbee4904' - -shortlog="$(git shortlog "${old_tag}..HEAD" | \ - sed '/^..*$/s/^//')" -if [ $(printf '%s\n' "${shortlog}" | wc -l) -gt 100 ]; then - shortlog="$(git shortlog -s "${old_tag}..HEAD"; cat <<-EOF - - Commit descriptions suppressed for brevity. To see a log summary with - descriptions, run: - - \$ git shortlog ${old_tag}..${package}/${version} - EOF - )" -fi -diffstat="$(git diff --stat=72 --color=never --find-renames=50% \ - "${old_tag}..HEAD")" -if [ $(printf '%s\n' "${diffstat}" | wc -l) -gt 50 ]; then - diffstat="$(printf '%s\n' "${diffstat}" | tail -n 1; cat <<-EOF - - Difference statistics truncated for brevity. To see full statistics, - run: - - \$ git diff --stat --find-renames=50% \\ - > ${old_tag}..${package}/${version} - EOF - )" -fi - -message="$({ cat | sed 's/=/=3D/g; s/ $/=20/; s/\t$/=09/;'; } <<-EOF - Content-Type: text/plain; charset=UTF-8 - Content-Transfer-Encoding: quoted-printable - - $(heading 'About') - - ${about} - - $(heading 'Downloading') - - Source archives are available from the files site by HTTP or FTP: - - http://files.proteanos.com/pub/${package}/${version}/ - ftp://files.proteanos.com/pub/${package}/${version}/ - - Here are the MD5 checksums: - - $(sed 's/^/ /' MD5SUMS) - - Here are the SHA-256 checksums: - - $(sed 's/^/ /' SHA256SUMS) - - The sources are maintained in a Git repository: - - http://git.proteanos.com/${package}/${package}.git/ - git://git.proteanos.com/${package}/${package}.git/ - - This release is marked by the "${package}/${version}" tag. - - $(heading "NEWS for Version ${version}") - - ${news} - - $(heading "Shortlog of Changes${old_version}") - - ${shortlog} - - $(heading "Diffstat of Changes${old_version}") - - ${diffstat} - - -- - ${SIG} - EOF - )" - -{ sed 's/$/\r/' | /usr/sbin/sendmail -f "${FROM_EMAIL}" \ - "${TO_EMAIL}"; } <<-EOF - Date: $(LC_ALL='POSIX' date '+%a, %d %b %Y %H:%M:%S %z') - From: ${FROM_NAME} <${FROM_EMAIL}> - To: ${TO_EMAIL} - Subject: ${package_name} ${version} released - Message-ID: $(LC_ALL='POSIX' date \ - '+%Y%m%d%H%M%S').${FROM_EMAIL} - Organization: Libiquity LLC - MIME-Version: 1.0 - Content-Type: multipart/signed; micalg=pgp-sha256; boundary="=-=-="; - protocol="application/pgp-signature" - - --=-=-= - ${message} - - --=-=-= - Content-Type: application/pgp-signature - Content-Description: OpenPGP digital signature - - $(printf '%s\n' "${message}" | sed 's/$/\r/' | \ - gpg --local-user "${KEY}" --armor --output - \ - --digest-algo SHA256 --detach-sign) - - --=-=-=-- - EOF diff --git a/src/commands.h b/src/commands.h deleted file mode 100644 index 697bb24..0000000 --- a/src/commands.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Command prototypes - * - * Copyright (C) 2019 Libiquity LLC - * - * This file is part of wolfutil. - * - * wolfutil 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. - * - * wolfutil 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. - * - * You should have received a copy of the GNU General Public License - * along with wolfutil. If not, see . - */ - -#ifndef COMMANDS_H_ -#define COMMANDS_H_ - -int -s_client(int argc, char **argv); - -#endif /* COMMANDS_H_ */ diff --git a/src/local.mk b/src/local.mk deleted file mode 100644 index 86376d7..0000000 --- a/src/local.mk +++ /dev/null @@ -1,4 +0,0 @@ -wolfutil_SOURCES += \ - %reldir%/commands.h \ - %reldir%/main.c \ - %reldir%/s_client.c diff --git a/src/main.c b/src/main.c deleted file mode 100644 index f89cb74..0000000 --- a/src/main.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Program entry point - * - * Copyright (C) 2019 Libiquity LLC - * - * This file is part of wolfutil. - * - * wolfutil 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. - * - * wolfutil 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. - * - * You should have received a copy of the GNU General Public License - * along with wolfutil. If not, see . - */ - -#include -#include -#include - -#include "commands.h" - -static void -usage(FILE *stream, const char *program_name) -{ - fprintf(stream, "Usage: %s s_client [options]\n", program_name); -} - -int -main(int argc, char **argv) -{ - if (argc < 2 || strcmp(argv[1], "s_client") != 0) { - usage(stderr, argv[0]); - return EXIT_FAILURE; - } - - return s_client(argc - 2, argv + 2); -} diff --git a/src/s_client.c b/src/s_client.c deleted file mode 100644 index cf7440d..0000000 --- a/src/s_client.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * s_client command - * - * Copyright (C) 2019 Libiquity LLC - * - * This file is part of wolfutil. - * - * wolfutil 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. - * - * wolfutil 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. - * - * You should have received a copy of the GNU General Public License - * along with wolfutil. If not, see . - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "commands.h" - -#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) -#undef MAX -#define MAX(a, b) (((a) > (b)) ? (a) : (b)) -#undef MIN -#define MIN(a, b) (((a) < (b)) ? (a) : (b)) - -static _Bool -parse_host_port(char *hostport, char **host, char **port) -{ - *host = hostport; - /* XXX: Port is required. Otherwise, this will mangle IPv6 addresses - * without some more intelligent (and larger) code. */ - *port = strrchr(*host, ':'); - if (*port == NULL) { - fputs("Port is required\n", stderr); - return false; - } - **port = '\0'; - ++*port; - - return true; -} - -static int -connect_socket(const char *host, const char *port) -{ - struct addrinfo hints = {0}; - struct addrinfo *result; - int s; - struct addrinfo *rp; - int sfd; - - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = AI_PASSIVE; - hints.ai_protocol = 0; - - s = getaddrinfo(host, port, &hints, &result); - if (s != 0) { - fprintf(stderr, "Failed to resolve host and port: %s\n", - gai_strerror(s)); - return -1; - } - - for (rp = result; rp != NULL; rp = rp->ai_next) { - sfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); - if (sfd == -1) { - continue; - } - if (connect(sfd, rp->ai_addr, rp->ai_addrlen) == -1) { - close(sfd); - continue; - } - break; - } - if (rp == NULL) { - fputs("Failed to connect\n", stderr); - sfd = -1; - } - - freeaddrinfo(result); - - return sfd; -} - -static _Bool -write_all(int fd, const void *buf, size_t count) -{ - ssize_t ret; - - while (count > 0) { - while ((ret = write(fd, buf, count)) < 0 && errno == EINTR) { - continue; - } - if (ret < 0) { - return false; - } - buf = ((const char *) buf) + ret; - count -= ret; - } - - return true; -} - -static _Bool -poll_fds(int sfd, WOLFSSL *ssl) -{ - struct pollfd fds[2] = { - { .fd = -1, .events = POLLIN|POLLERR, .revents = 0 }, - { .fd = -1, .events = POLLIN|POLLERR, .revents = 0 }, - }; - char buf[MAX(8192, WOLFSSL_MAX_ERROR_SZ)]; - ssize_t len; - int ret; - - fds[0].fd = STDIN_FILENO; - fds[1].fd = sfd; - - for (;;) { - while (poll(fds, ARRAY_SIZE(fds), -1) < 0 && (errno == EINTR || - errno == EAGAIN)) { - continue; - } - if (fds[0].revents > 0) { /* stdin */ - len = read(STDIN_FILENO, buf, sizeof(buf)); - if (len < 0) { - fputs("Input read error\n", stderr); - return false; - } else if (len == 0) { - fds[0].fd = -1; /* Stop polling. */ - } else if ((ret = wolfSSL_write(ssl, buf, len)) <= 0) { - wolfSSL_ERR_error_string(wolfSSL_get_error(ssl, - ret), buf); - fprintf(stderr, "Socket write error: %s\n", - buf); - return false; - } - } - if (fds[1].revents > 0) { /* socket */ - ret = wolfSSL_read(ssl, buf, MIN(sizeof(buf), 1024)); - if (ret < 0) { - wolfSSL_ERR_error_string(wolfSSL_get_error(ssl, - ret), buf); - fprintf(stderr, "Socket read error: %s\n", - buf); - return false; - } else if (ret == 0) { - fds[1].fd = -1; /* Stop polling. */ - close(STDOUT_FILENO); /* Signal socket EOF. */ - } else if (write_all(STDOUT_FILENO, buf, (size_t) ret) - == false) { - return false; - } - } - if (fds[0].fd == fds[1].fd) { /* Both -1 (no longer polled) */ - return true; - } - } - - /* Unreached */ -} - -int -s_client(int argc, char **argv) -{ - _Bool quiet = false; - char *host = NULL; - char *port = NULL; - const char *servername = NULL; - int ret = EXIT_FAILURE; - WOLFSSL_METHOD *method; - WOLFSSL_CTX *ctx = NULL; - WOLFSSL *ssl = NULL; - int sfd = -1; - int err; - char buf[WOLFSSL_MAX_ERROR_SZ]; - - for (; argc > 0; --argc, ++argv) { - if (strcmp(*argv, "-quiet") == 0) { - quiet = true; - } else if (strcmp(*argv, "-connect") == 0) { - --argc, ++argv; - if (parse_host_port(*argv, &host, &port) == false) { - return EXIT_FAILURE; - } - } else if (strcmp(*argv, "-servername") == 0) { - --argc, ++argv; - servername = *argv; - } else if (**argv == '-') { - fprintf(stderr, "Unsupported option \"%s\"\n", *argv); - } - } - - wolfSSL_Init(); - - if (quiet == false) { - wolfSSL_Debugging_ON(); - } - - if ( - (method = wolfTLSv1_2_client_method()) == NULL || - (ctx = wolfSSL_CTX_new(method)) == NULL || -#ifdef HAVE_CERTIFICATE_STATUS_REQUEST_V2 - wolfSSL_CTX_EnableOCSPStapling(ctx) != WOLFSSL_SUCCESS - || wolfSSL_CTX_UseOCSPStaplingV2(ctx, - WOLFSSL_CSR2_OCSP_MULTI, 0) != - WOLFSSL_SUCCESS || -#endif -#ifdef HAVE_CERTIFICATE_STATUS_REQUEST - wolfSSL_CTX_EnableOCSPStapling(ctx) != WOLFSSL_SUCCESS - || wolfSSL_CTX_UseOCSPStapling(ctx, WOLFSSL_CSR_OCSP, 0) - != WOLFSSL_SUCCESS || -#endif -#ifdef HAVE_OCSP - wolfSSL_CTX_EnableOCSP(ctx, WOLFSSL_OCSP_CHECKALL) != - WOLFSSL_SUCCESS || -#endif -#if defined(HAVE_CRL) && defined(HAVE_CRL_IO) - wolfSSL_CTX_EnableCRL(ctx, WOLFSSL_CRL_CHECKALL) != - WOLFSSL_SUCCESS || -#endif -#ifdef HAVE_SNI - (servername != NULL && wolfSSL_CTX_UseSNI(ctx, - WOLFSSL_SNI_HOST_NAME, servername, - strlen(servername)) != WOLFSSL_SUCCESS) || -#endif - (ssl = wolfSSL_new(ctx)) == NULL || - wolfSSL_check_domain_name(ssl, servername) != - WOLFSSL_SUCCESS - ) { - fputs("Out of memory\n", stderr); - goto error; - } - -#if defined(HAVE_CA_CERTS) && HAVE_CA_CERTS - if (wolfSSL_CTX_load_verify_locations_ex(ctx, - CA_CERTS_FILE, CA_CERTS_DIR, - WOLFSSL_LOAD_FLAG_IGNORE_ERR) != - WOLFSSL_SUCCESS) { - fputs("Failed to load CA certificates\n", stderr); - goto error; - } -#endif - - if ((sfd = connect_socket(host, port)) == -1) { - goto error; - } - wolfSSL_set_fd(ssl, sfd); - - if ((err = wolfSSL_connect(ssl)) != WOLFSSL_SUCCESS) { - wolfSSL_ERR_error_string(wolfSSL_get_error(ssl, err), buf); - fprintf(stderr, "Handshake error: %s\n", buf); - goto error; - } - - if (poll_fds(sfd, ssl) == false) { - goto error; - } - - ret = EXIT_SUCCESS; -error: - close(sfd); - wolfSSL_free(ssl); - wolfSSL_CTX_free(ctx); - wolfSSL_Cleanup(); - - return ret; -} diff --git a/tests/.gitignore b/tests/.gitignore deleted file mode 100644 index 7e563b8..0000000 --- a/tests/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.log -*.trs diff --git a/tests/aux/json.sh b/tests/aux/json.sh deleted file mode 100644 index 3c9783f..0000000 --- a/tests/aux/json.sh +++ /dev/null @@ -1,402 +0,0 @@ -# `json.sh`, a pure-shell JSON parser. -# -# Copied from in repository . -# -# Copyright 2011 Richard Crowley. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY RICHARD CROWLEY AS IS'' AND ANY EXPRESS -# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL RICHARD CROWLEY OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. -# -# The views and conclusions contained in the software and documentation -# are those of the authors and should not be interpreted as representing -# official policies, either expressed or implied, of Richard Crowley. - -set -e - -# Most users will be happy with the default '/' separator that makes trees -# of keys look like filesystem paths but that breaks down if keys can -# contain slashes. In that case, set `JSON_SEPARATOR` to desired character. -[ -z "$JSON_SEPARATOR" ] && _J_S="/" || _J_S="$JSON_SEPARATOR" - -# File descriptor 3 is commandeered for debug output, which may end up being -# forwarded to standard error. -[ -z "$JSON_DEBUG" ] && exec 3>/dev/null || exec 3>&2 - -# File descriptor 4 is commandeered for use as a sink for literal and -# variable output of (inverted) sections that are not destined for standard -# output because their condition is not met. -exec 4>/dev/null - -# Consume standard input one character at a time to parse JSON. -json() { - - # Initialize the file descriptor to be used to emit characters. At - # times this value will be 4 to send output to `/dev/null`. - _J_FD=1 - - # Initialize storage for the "pathname", the concatenation of all - # the keys in the tree at any point in time, the current state of - # the machine, and the state to which the machine returns after - # completing a key or value. - _J_PATHNAME="$_J_S" _J_STATE="whitespace" _J_STATE_DEFAULT="whitespace" - - # IFS must only contain '\n' so as to be able to read space and tab - # characters from standard input one-at-a-time. The easiest way to - # convince it to actually contain the correct byte, and only the - # correct byte, is to use a single-quoted literal newline. - IFS=' -' - - # Consuming standard input one character at a time is quite a feat - # within the confines of POSIX shell. Bash's `read` builtin has - # `-n` for limiting the number of characters consumed. Here it is - # faked using `sed`(1) to place each character on its own line. - # The subtlety is that real newline characters are chomped so they - # must be indirectly detected by checking for zero-length - # characters, which is done as the character is emitted. - sed " - s/./&$(printf "\036")/g - s/\\\\/\\\\\\\\/g - " | tr "\036" "\n" | _json - - # TODO Replace the original value of IFS. Be careful if it's unset. - -} - -# Consume the one-character-per-line stream from `sed` via a state machine. -# This function will be called recursively in subshell environments to -# isolate values from their containing scope. -# -# The `read` builtin consumes one line at a time but by now each line -# contains only a single character. -_json() { - while read _J_C - do - _json_char - _J_PREV_C="$_J_C" - done -} - -# Consume a single character as stored in `_J_C`. This function is broken -# out from `_json` so it may be called to reconsume a character as is -# necessary following the end of any number since numbers do not have a -# well-known ending in the grammar. -# -# The state machine implemented here follows very naturally from the -# diagrams of the JSON grammar on . -_json_char() { - echo " _J_C: $_J_C (${#_J_C}), _J_STATE: $_J_STATE" >&3 - case "$_J_STATE" in - - # The machine starts in the "whitespace" state and learns - # from leading characters what state to enter next. JSON's - # grammar doesn't contain any tokens that are ambiguous in - # their first character so the parser's job is relatively - # easier. - # - # Further whitespace characters are consumed and ignored. - # - # Arrays are unique in that their parsing rules are a strict - # superset of the rules in open whitespace. When an opening - # bracket is encountered, the remainder of the array is - # parsed in a subshell which goes around again when a comma - # is encountered and exits back to the containing scope when - # the closing bracket is encountered. - # - # Objects are not parsed as a superset of open whitespace but - # they are parsed in a subshell to protect the containing scope. - "array-0"|"array-even"|"array-odd"|"whitespace") - case "$_J_STATE" in - "array-0") - case "$_J_C" in - "]") exit;; - esac;; - "array-even") - case "$_J_C" in - ",") - _J_DIRNAME="${_J_PATHNAME%"$_J_S"*}" - [ "$_J_DIRNAME" = "$_J_S" ] && _J_DIRNAME="" - _J_BASENAME="${_J_PATHNAME##*"$_J_S"}" - _J_BASENAME="$(($_J_BASENAME + 1))" - _J_PATHNAME="$_J_DIRNAME$_J_S$_J_BASENAME" - _J_STATE="array-odd" - return;; - "]") exit;; - esac;; - esac - case "$_J_C" in - "\"") _J_STATE="string" _J_V="";; - "-") _J_STATE="number-negative" _J_V="$_J_C";; - 0) _J_STATE="number-leading-zero" _J_V="$_J_C";; - [1-9]) _J_STATE="number-leading-nonzero" _J_V="$_J_C";; - "[") - ( - [ "$_J_PATHNAME" = "/" ] && _J_PATHNAME="" - _J_PATHNAME="$_J_PATHNAME/0" - _J_STATE="array-0" _J_STATE_DEFAULT="array-even" - _json - ) - _J_STATE="$_J_STATE_DEFAULT" _J_V="";; - "f"|"t") _J_STATE="boolean" _J_V="$_J_C";; - "n") _J_STATE="null" _J_V="$_J_C";; - "{") - ( - _J_STATE="object-0" _J_STATE_DEFAULT="object-even" - _json - ) - _J_STATE="$_J_STATE_DEFAULT" _J_V="";; - " "|""|" ") ;; - *) _json_die "syntax: $_J_PATHNAME";; - esac;; - - # Boolean values are multicharacter literals but they're unique - # from their first character. This means the eventual value is - # already known when the "boolean" state is entered so we can - # raise syntax errors as soon as the input goes south. - "boolean") - case "$_J_V$_J_C" in - "f"|"fa"|"fal"|"fals"|"t"|"tr"|"tru") _J_V="$_J_V$_J_C";; - "false"|"true") - _J_STATE="$_J_STATE_DEFAULT" - echo "$_J_PATHNAME boolean $_J_V$_J_C" >&$_J_FD;; - *) _json_die "syntax: $_J_PATHNAME boolean $_J_V$_J_C";; - esac;; - - # Object values are relatively more complex than array values. - # They begin in the "object-0" state, which is almost but not - # quite a subset of the "whitespace" state for strings. When - # a string is encountered it is parsed as usual but the parser - # is set to return to the "object-value" state afterward. - # - # As in the "whitespace" state, extra whitespace characters - # are consumed and ignored. - # - # The parser will return to this "object" state later to - # either consume a comma and go around again or exit the - # subshell in which this object has been parsed. - "object-0") - case "$_J_C" in - "\"") - _J_FD=4 - _J_STATE="string" - _J_STATE_DEFAULT="object-value" - _J_V="";; - "}") exit;; - " "|""|" ") ;; - *) _json_die "syntax: $_J_PATHNAME";; - esac;; - - # "object-even" is like "object-0" but additionally commas are - # consumed to enforce the another key/value pair is coming. - "object-even") - case "$_J_C" in - "\"") - _J_FD=4 - _J_STATE="string" - _J_STATE_DEFAULT="object-value" - _J_V="";; - ",") _J_STATE="object-odd";; - "}") exit;; - " "|""|" ") ;; - *) _json_die "syntax: $_J_PATHNAME";; - esac;; - - # Object values have to return from whence they came. They use - # the "object-exit" state to signal the last character consumed - # to the containing scope. - "object-exit") #exit;; - case "$_J_C" in - ",") exit 101;; - "}") exit 102;; - *) exit 0;; - esac;; - - # "object-even" is like "object-0" but cannot consume a closing - # brace because it has just consumed a comma. - "object-odd") - case "$_J_C" in - "\"") - _J_FD=4 - _J_STATE="string" - _J_STATE_DEFAULT="object-value" - _J_V="";; - " "|""|" ") ;; - *) _json_die "syntax: $_J_PATHNAME";; - esac;; - - # After a string key has been consumed, the state machine - # progresses here where a colon and a value are parsed. The - # value is parsed in a subshell so the pathname can have the - # key appended to it before the parser continues. - "object-value") - case "$_J_C" in - ":") - _J_FD=1 - ( - [ "$_J_PATHNAME" = "/" ] && _J_PATHNAME="" - _J_PATHNAME="$_J_PATHNAME/$_J_V" - _J_STATE="whitespace" - _J_STATE_DEFAULT="object-exit" - _json - ) || case "$?" in - 101) _J_STATE="object-even" _J_C="," _json_char;; - 102) _J_STATE="object-even" _J_C="}" _json_char;; - esac - _J_STATE="object-even";; - " "|""|" ") ;; - *) _json_die "syntax: $_J_PATHNAME";; - esac;; - - # Null values work exactly like boolean values. See above. - "null") - case "$_J_V$_J_C" in - "n"|"nu"|"nul") _J_V="$_J_V$_J_C";; - "null") - _J_STATE="$_J_STATE_DEFAULT" - echo "$_J_PATHNAME null null" >&$_J_FD;; - *) _json_die "syntax: $_J_PATHNAME null $_J_V$_J_C";; - esac;; - - # Numbers that encounter a '.' become floating point and may - # continue consuming digits forever or may become - # scientific-notation. Any other character sends the parser - # back to its default state. - "number-float") - case "$_J_C" in - [0-9]) _J_V="$_J_V$_J_C";; - "E"|"e") _J_STATE="number-sci" _J_V="$_J_V$_J_C";; - *) - _J_STATE="$_J_STATE_DEFAULT" - echo "$_J_PATHNAME number $_J_V" >&$_J_FD - _json_char;; - esac;; - - # This is an entrypoint into parsing a number, used when - # the first digit consumed is non-zero. From here, a number - # may continue on a positive integer, become a floating-point - # number by consuming a '.', or become scientific-notation by - # consuming an 'E' or 'e'. Any other character sends the - # parser back to its default state. - "number-leading-nonzero") - case "$_J_C" in - ".") _J_STATE="number-float" _J_V="$_J_V$_J_C";; - [0-9]) _J_V="$_J_V$_J_C";; - "E"|"e") _J_STATE="number-sci" _J_V="$_J_V$_J_C";; - *) - _J_STATE="$_J_STATE_DEFAULT" - echo "$_J_PATHNAME number $_J_V" >&$_J_FD - _json_char;; - esac;; - - # This is an entrypoint into parsing a number, used when - # the first digit consumed is zero. From here, a number - # may remain zero, become a floating-point number by - # consuming a '.', or become scientific-notation by consuming - # an 'E' or 'e'. Any other character sends the parser back - # to its default state. - "number-leading-zero") - case "$_J_C" in - ".") _J_STATE="number-float" _J_V="$_J_V$_J_C";; - [0-9]) _json_die "syntax: $_J_PATHNAME number $_J_V$_J_C";; - "E"|"e") _J_STATE="number-sci" _J_V="$_J_V$_J_C";; - *) - _J_STATE="$_J_STATE_DEFAULT" - echo "$_J_PATHNAME number $_J_V" >&$_J_FD - _json_char;; - esac;; - - # This is an entrypoint into parsing a number, used when - # the first character consumed is a '-'. From here, a number - # may progress to the "number-leading-nonzero" or - # "number-leading-zero" states. Any other character sends - # the parser back to its default state. - "number-negative") - case "$_J_C" in - 0) _J_STATE="number-leading-zero" _J_V="$_J_V$_J_C";; - [1-9]) - _J_STATE="number-leading-nonzero" - _J_V="$_J_V$_J_C";; - *) - _J_STATE="$_J_STATE_DEFAULT" - echo "$_J_PATHNAME number $_J_V" >&$_J_FD - _json_char;; - esac;; - - # Numbers that encounter an 'E' or 'e' become - # scientific-notation and consume digits, optionally prefixed - # by a '+' or '-', forever. The actual consumption is - # delegated to the "number-sci-neg" and "number-sci-pos" - # states. Any other character immediately following the 'E' - # or 'e' is a syntax error. - "number-sci") - case "$_J_C" in - "+") _J_STATE="number-sci-pos" _J_V="$_J_V$_J_C";; - "-") _J_STATE="number-sci-neg" _J_V="$_J_V$_J_C";; - [0-9]) _J_STATE="number-sci-pos" _J_V="$_J_V$_J_C";; - *) _json_die "syntax: $_J_PATHNAME number $_J_V$_J_C";; - esac;; - - # Once in these states, numbers may consume digits forever. - # Any other character sends the parser back to its default - # state. - "number-sci-neg"|"number-sci-pos") - case "$_J_C" in - [0-9]) _J_V="$_J_V$_J_C";; - *) - _J_STATE="$_J_STATE_DEFAULT" - echo "$_J_PATHNAME number $_J_V" >&$_J_FD - _json_char;; - esac;; - - # Strings aren't as easy as they look. JSON supports several - # escape sequences that require the state machine to keep a - # history of its input. Basic backslash/newline/etc. escapes - # are simple because they only require one character of - # history. Unicode codepoint escapes require more. The - # strategy there is to add states to the machine. - # - # TODO It'd be nice to decode all escape sequences, including - # Unicode codepoints but that would definitely ruin the - # line-oriented thing we've got goin' on. - "string") - case "$_J_PREV_C$_J_C" in - "\\\""|"\\/"|"\\\\") _J_V="$_J_V$_J_C";; - "\\b"|"\\f"|"\\n"|"\\r") _J_V="$_J_V\\\\$_J_C";; - "\\u") _J_V="$_J_V\\\\$_J_C";; - *"\"") - _J_STATE="$_J_STATE_DEFAULT" - echo "$_J_PATHNAME string $_J_V" >&$_J_FD;; - *"\\") ;; - *) _J_V="$_J_V$_J_C";; - esac;; - - esac -} - -# Print an error message and GTFO. The message is the concatenation -# of all the arguments to this function. -_json_die() { - echo "json.sh: $*" >&2 - exit 1 -} diff --git a/tests/aux/tap-functions.sh b/tests/aux/tap-functions.sh deleted file mode 100644 index 29ff437..0000000 --- a/tests/aux/tap-functions.sh +++ /dev/null @@ -1,229 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (C) 2011-2017 Free Software Foundation, Inc. -# -# 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, or (at your option) -# any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Helper functions used by TAP-producing tests of the Automake testsuite. - -# -# IMPORTANT: All the functions defined in this file can *not* be used -# from within a subshell, unless explicitly noted otherwise. -# - -# The counts of the TAP test results seen so far: total count and -# per-result counts. -tap_count_=0 -tap_pass_count_=0 -tap_skip_count_=0 -tap_fail_count_=0 -tap_xfail_count_=0 -tap_xpass_count_=0 - -# not COMMAND [ARGS...] -# --------------------- -# Run the given command and invert its exit status. -not () { ! "$@"; } - -# plan_ [unknown|later|lazy|now|NUMBER-OF-PLANNED-TESTS] -# ------------------------------------------------------ -# Print a TAP plan for the given number of tests. This must be called -# before reporting any test result. If called with the special argument -# "unknown" or "later", it will do nothing, expecting the calling script -# to declare the plan later. If called with the special argument "lazy" -# or "now", it will print a TAP plan that accounts for the number of tests -# seen so far. -plan_ () -{ - if test $# -eq 0; then - bailout_ "plan_: missing argument" - elif test $# -ge 2; then - bailout_ "plan_: too many arguments" - elif test x"$planned_" != x"none" && test x"$planned_" != x"later"; then - bailout_ "plan_: called to many times" - elif test x"$1" = x"unknown" || test x"$1" = x"later"; then - # This means we want to get back later to declaring the TAP plan. - planned_=later - return 0 - elif test x"$1" = x"lazy" || test x"$1" = x"now"; then - planned_=$tap_count_ # Number of test results seen so far. - elif test $1 -ge 0; then - planned_=$1 - else - bailout_ "plan_: invalid argument '$1'" - fi - echo "1..$planned_" -} -planned_=none - -# diag_ [EXPLANATION] -# ------------------ -# Report the given text as TAP diagnostic. Assumes the string denoting -# TAP diagnostic lines is stored in the '$diag_string_' variable; this is -# done to allow better interplay with TAP drivers that allow such a string -# to be configured. -diag_ () -{ - test $# -eq 0 || echo "$diag_string_ $*" -} - -# Used by the 'diag_' function above. User-overridable. -diag_string_="#" - -# warn_ [EXPLANATION] -# ------------------ -# Give a warning (using TAP diagnostic). -warn_ () -{ - case $# in - 0) diag_ "WARNING: (unknown warning)";; - *) diag_ "WARNING: $*";; - esac -} - -# result_ RESULT [-D DIRECTIVE] [-r REASON] [--] [DESCRIPTION...] -# --------------------------------------------------------------- -# Report a test case with the given RESULT (valid values are "ok" and -# "not ok") and the given DESCRIPTION (if any). If DIRECTIVE is given -# and non-empty (valid values being "TODO" and "SKIP"), it will be -# reported too, with the REASON (if given) appended. -result_ () -{ - test $# -gt 0 || bailout_ "result_: missing argument" - tap_result_=$1; shift - case $tap_result_ in - "ok"|"not ok") ;; - *) bailout_ "result_: invalid result '$tap_result'" ;; - esac - tap_directive_= tap_reason_= - while test $# -gt 0; do - case $1 in - -D|--directive) tap_directive_=$2; shift;; - -r|--reason) tap_reason_=$2; shift;; - --) shift; break;; - -*) bailout_ "result_: invalid option '$1'";; - *) break;; - esac - shift - done - case $tap_directive_ in - ""|TODO|SKIP) ;; - *) bailout_ "result_: invalid directive '$directive_'" ;; - esac - tap_count_=$(($tap_count_ + 1)) - case $tap_result_,$tap_directive_ in - ok,) # Passed. - tap_pass_count_=$(($tap_pass_count_ + 1)) ;; - not\ ok,TODO) # Expected failure. - tap_xfail_count_=$(($tap_xfail_count_ + 1)) ;; - not\ ok,*) # Failed. - tap_fail_count_=$(($tap_fail_count_ + 1)) ;; - ok,TODO) # Unexpected pass. - tap_xpass_count_=$(($tap_xpass_count_ + 1)) ;; - ok,SKIP) # Skipped. - tap_skip_count_=$(($tap_skip_count_ + 1)) ;; - *) # Can't happen. - bailout_ "internal error in 'result_'" ;; - esac - tap_text_="$tap_result_ $tap_count_" - if test x"$*" != x; then - tap_text_="$tap_text_ - $*" - fi - if test x"$tap_directive_" != x; then - tap_text_="$tap_text_ # $tap_directive_"${tap_reason_:+" $tap_reason_"} - fi - printf '%s\n' "$tap_text_" -} - -# Shorthands for common usages of 'result_'. -ok_ () { result_ 'ok' ${1+"$@"}; } -not_ok_ () { result_ 'not ok' ${1+"$@"}; } -skip_ () { result_ 'ok' -D SKIP ${1+"$@"}; } - -# skip_row_ COUNT [-r REASON] [--] [DESCRIPTION...] -# ------------------------------------------------- -# Report a COUNT of skipped test, with the given reason and descriptions -# (if any). Useful to avoid cascade failures in case a fair number of -# tests depend on an earlier one that failed. -skip_row_ () -{ - skip_count_=$1; shift - for i_ in $(seq_ $skip_count_); do skip_ ${1+"$@"}; done -} - -# skip_all_ [REASON ...] -# ---------------------- -# Skip all the tests in a test script. Must be used before calling 'plan_' -# or reporting any test result. Can't be used from within a subshell. -skip_all_ () -{ - echo "1..0 # SKIP" ${1+"$@"} - planned_=0 - exit 0 -} - -# bailout_ [REASON ...] -# --------------------- -# Stop the execution of the current test suite right now, due to an -# unrecoverable error. Can be called at any point, but cannot be used -# from within a subshell. -bailout_ () -{ - echo 'Bail out!' ${1+"$@"} - exit 99 -} - -# fatal_ [REASON ...] -# ------------------- -# Same as 'bailout_'; for compatibility with 'plain-functions.sh'. -fatal_ () -{ - bailout_ ${1+"$@"} -} - -# framework_failure_ [REASON ...] -# ------------------------------- -# Stop the execution of the current test suite right now, due to an -# unrecoverable error in the set-up of the test case. Can be called -# at any point, but cannot be used from within a subshell. -framework_failure_ () -{ - bailout_ "set-up failure"${1+": $*"} -} - -# command_ok_ TEST-DESCRIPTION [OPTIONS..] [--] CMD [ARGS...] -# ----------------------------------------------------------- -# Helper subroutine for when a TAP result must be determined by the -# outcome of a command. -command_ok_ () -{ - tap_directive_= tap_reason_= - test $# -gt 0 || bailout_ "command_ok_: missing argument" - tap_description_=$1; shift - while test $# -gt 0; do - case $1 in - -D|--directive) tap_directive_=$2; shift;; - -r|--reason) tap_reason_=$2; shift;; - --) shift; break;; - -*) bailout_ "command_ok_: invalid option '$1'";; - *) break;; - esac - shift - done - tap_result_="ok"; "$@" || tap_result_="not ok" - result_ "$tap_result_" -D "$tap_directive_" -r "$tap_reason_" \ - -- "$tap_description_" -} - -: diff --git a/tests/badssl.sh b/tests/badssl.sh deleted file mode 100755 index 90e1795..0000000 --- a/tests/badssl.sh +++ /dev/null @@ -1,119 +0,0 @@ -# Tests using Google's badssl.com Web service -# -# Copyright (C) 2019 Libiquity LLC -# -# This file is part of wolfutil. -# -# wolfutil 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. -# -# wolfutil 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. -# -# You should have received a copy of the GNU General Public License -# along with wolfutil. If not, see . - -set -eu - -. "${TOP_SRCDIR}/tests/aux/tap-functions.sh" - -do_test() -{ - local directive="${1}" - local ok="${2}" - local host="${3}" - local port="${4}" - shift 4 - local out= - local result= - - if out="$(${ok} "${TOP_BUILDDIR}/wolfutil" s_client \ - -connect "${host}.badssl.com:${port}" \ - -servername "${host}.badssl.com" 2>&1 \ - <<-EOF - GET / HTTP/1.1 - Host: ${host}.badssl.com:${port} - Connection: close - - EOF - )" - then - result='ok' - else - result='not ok' - fi - printf '%s\n' "${out}" | sed 's/^/ | /' - result_ "${result}" -D "${directive}" -- "${ok} ${host}" -} - -plan_ 38 - -# Certificate - -do_test '' 'not' 'expired' 443 -do_test '' 'not' 'wrong.host' 443 -do_test '' 'not' 'self-signed' 443 -do_test '' 'not' 'untrusted-root' 443 -do_test '' 'not' 'revoked' 443 - -do_test 'TODO' ' ' 'no-common-name' 443 -diag_ 'no-common-name fails since 2020-06-23 due to an expired certificate:' -diag_ 'https://github.com/chromium/badssl.com/issues/447' -do_test 'TODO' ' ' 'no-subject' 443 -diag_ 'no-subject fails since 2020-06-23 due to an expired certificate:' -diag_ 'https://github.com/chromium/badssl.com/issues/447' -do_test '' 'not' 'incomplete-chain' 443 - -do_test '' ' ' 'sha256' 443 -do_test '' ' ' 'sha384' 443 -do_test '' ' ' 'sha512' 443 - -do_test '' 'not' '1000-sans' 443 -do_test '' 'not' '10000-sans' 443 - -do_test '' ' ' 'ecc256' 443 -do_test '' ' ' 'ecc384' 443 - -do_test '' ' ' 'rsa2048' 443 -do_test '' ' ' 'rsa4096' 443 -do_test '' 'not' 'rsa8192' 443 - -do_test '' ' ' 'extended-validation' 443 - -# HTTP - -do_test '' 'not' 'http' 80 - -# Cipher Suite - -do_test '' 'not' 'cbc' 443 -do_test '' 'not' 'rc4-md5' 443 -do_test '' 'not' 'rc4' 443 -do_test '' 'not' '3des' 443 -do_test '' 'not' 'null' 443 - -do_test 'TODO' 'not' 'mozilla-old' 443 -do_test '' ' ' 'mozilla-intermediate' 443 -do_test '' ' ' 'mozilla-modern' 443 - -# Key Exchange - -do_test '' 'not' 'dh480' 443 -do_test '' 'not' 'dh512' 443 -do_test '' 'not' 'dh1024' 443 -do_test '' ' ' 'dh2048' 443 - -do_test 'TODO' 'not' 'dh-small-subgroup' 443 -do_test '' 'not' 'dh-compsite' 443 - -do_test '' 'not' 'static-rsa' 443 - -# Protocol - -do_test '' 'not' 'tls-v1-0' 1010 -do_test '' 'not' 'tls-v1-1' 1011 -do_test '' ' ' 'tls-v1-2' 1012 diff --git a/tests/howsmyssl.sh b/tests/howsmyssl.sh deleted file mode 100755 index d9ee89e..0000000 --- a/tests/howsmyssl.sh +++ /dev/null @@ -1,67 +0,0 @@ -# Tests using Jeff Hodges's How's My SSL? Web service -# -# Copyright (C) 2019 Libiquity LLC -# -# This file is part of wolfutil. -# -# wolfutil 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. -# -# wolfutil 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. -# -# You should have received a copy of the GNU General Public License -# along with wolfutil. If not, see . - -set -eu - -. "${TOP_SRCDIR}/tests/aux/tap-functions.sh" -JSON_SEPARATOR='/' JSON_DEBUG='' . "${TOP_SRCDIR}/tests/aux/json.sh" - -test_grep() -{ - printf '%s\n' "${members}" | grep "${@}" -} - -plan_ 7 - -json="$(printf 'GET /a/check HTTP/1.1\r\n'$(: \ - )'Host: www.howsmyssl.com:443\r\nConnection: close\r\n\r\n' | \ - "${TOP_BUILDDIR}/wolfutil" s_client \ - -connect www.howsmyssl.com:443 \ - -servername www.howsmyssl.com | \ - sed -n 's/\r$//; /^{/,$p')" -printf '%s\n' - -IFS=' -' -printf '# JSON:\n' -printf '# %s\n' ${json} -unset IFS - -members="$(printf '%s\n' "${json}" | json)" - -IFS=' -' -printf '# Parsed members:\n' -printf '# %s\n' ${members} -unset IFS - -command_ok_ 'Ephemeral keys supported' -- \ - test_grep -q '^/ephemeral_keys_supported boolean true$' -command_ok_ 'No TLS compression supported' -- \ - test_grep -q '^/tls_compression_supported boolean false$' -command_ok_ 'No unknown cipher suites supported' -- \ - test_grep -q '^/unknown_cipher_suite_supported boolean false$' -command_ok_ 'No BEAST vulnerability' -- \ - test_grep -q '^/beast_vuln boolean false$' -command_ok_ 'No weak cipher suites supported' -- \ - test_grep -vq '^/insecure_cipher_suites/' -command_ok_ 'TLS 1.2' -- \ - test_grep -q '^/tls_version string TLS 1.2$' -command_ok_ 'Probably OK' -- \ - test_grep -q '^/rating string Probably Okay$' diff --git a/tests/local.mk b/tests/local.mk deleted file mode 100644 index 5b5be3b..0000000 --- a/tests/local.mk +++ /dev/null @@ -1,14 +0,0 @@ -TESTS = \ - %reldir%/badssl.sh \ - %reldir%/howsmyssl.sh -TEST_EXTENSIONS = .sh -SH_LOG_DRIVER = \ - AM_TAP_AWK='$(AWK)' \ - TOP_SRCDIR="$(abs_top_srcdir)" \ - TOP_BUILDDIR="$(abs_top_builddir)" \ - $(SHELL) $(top_srcdir)/build-aux/tap-driver.sh -EXTRA_DIST += \ - $(TESTS) \ - build-aux/tap-driver.sh \ - tests/aux/tap-functions.sh \ - tests/aux/json.sh -- cgit v0.9.1