uringmachine 0.16 → 0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +3 -0
  3. data/.gitmodules +4 -0
  4. data/CHANGELOG.md +8 -0
  5. data/TODO.md +12 -3
  6. data/examples/bm_send.rb +86 -0
  7. data/ext/um/um.c +28 -1
  8. data/ext/um/um.h +3 -0
  9. data/ext/um/um_class.c +17 -0
  10. data/ext/um/um_utils.c +38 -15
  11. data/lib/uringmachine/version.rb +1 -1
  12. data/test/test_um.rb +76 -0
  13. data/vendor/libressl/.github/scripts/changelog.sh +74 -0
  14. data/vendor/libressl/.github/workflows/android.yml +35 -0
  15. data/vendor/libressl/.github/workflows/cifuzz.yml +33 -0
  16. data/vendor/libressl/.github/workflows/cmake-config.yml +98 -0
  17. data/vendor/libressl/.github/workflows/coverity.yml +69 -0
  18. data/vendor/libressl/.github/workflows/emscripten.yml +71 -0
  19. data/vendor/libressl/.github/workflows/fedora-rawhide.yml +39 -0
  20. data/vendor/libressl/.github/workflows/freebsd.yml +71 -0
  21. data/vendor/libressl/.github/workflows/linux.yml +71 -0
  22. data/vendor/libressl/.github/workflows/macos.yml +37 -0
  23. data/vendor/libressl/.github/workflows/release.yml +81 -0
  24. data/vendor/libressl/.github/workflows/rust-openssl.yml +47 -0
  25. data/vendor/libressl/.github/workflows/solaris.yml +37 -0
  26. data/vendor/libressl/.github/workflows/windows.yml +70 -0
  27. data/vendor/libressl/.gitignore +333 -0
  28. data/vendor/libressl/CMakeLists.txt +581 -0
  29. data/vendor/libressl/COPYING +133 -0
  30. data/vendor/libressl/ChangeLog +3280 -0
  31. data/vendor/libressl/FindLibreSSL.cmake +232 -0
  32. data/vendor/libressl/LibreSSLConfig.cmake.in +36 -0
  33. data/vendor/libressl/Makefile.am +60 -0
  34. data/vendor/libressl/Makefile.am.common +20 -0
  35. data/vendor/libressl/OPENBSD_BRANCH +1 -0
  36. data/vendor/libressl/README.md +238 -0
  37. data/vendor/libressl/README.mingw.md +43 -0
  38. data/vendor/libressl/apps/CMakeLists.txt +18 -0
  39. data/vendor/libressl/apps/Makefile.am +5 -0
  40. data/vendor/libressl/apps/nc/CMakeLists.txt +67 -0
  41. data/vendor/libressl/apps/nc/Makefile.am +64 -0
  42. data/vendor/libressl/apps/nc/compat/accept4.c +17 -0
  43. data/vendor/libressl/apps/nc/compat/readpassphrase.c +205 -0
  44. data/vendor/libressl/apps/nc/compat/socket.c +29 -0
  45. data/vendor/libressl/apps/nc/compat/sys/socket.h +30 -0
  46. data/vendor/libressl/apps/ocspcheck/CMakeLists.txt +44 -0
  47. data/vendor/libressl/apps/ocspcheck/Makefile.am +45 -0
  48. data/vendor/libressl/apps/ocspcheck/compat/.gitignore +0 -0
  49. data/vendor/libressl/apps/openssl/CMakeLists.txt +97 -0
  50. data/vendor/libressl/apps/openssl/Makefile.am +108 -0
  51. data/vendor/libressl/apps/openssl/apps_win.c +138 -0
  52. data/vendor/libressl/apps/openssl/certhash_win.c +13 -0
  53. data/vendor/libressl/apps/openssl/compat/clock_gettime_osx.c +26 -0
  54. data/vendor/libressl/apps/openssl/compat/poll_win.c +329 -0
  55. data/vendor/libressl/appveyor.yml +53 -0
  56. data/vendor/libressl/autogen.sh +15 -0
  57. data/vendor/libressl/check-release.sh +86 -0
  58. data/vendor/libressl/cmake_export_symbol.cmake +71 -0
  59. data/vendor/libressl/cmake_uninstall.cmake.in +36 -0
  60. data/vendor/libressl/config +17 -0
  61. data/vendor/libressl/configure.ac +165 -0
  62. data/vendor/libressl/crypto/CMakeLists.txt +863 -0
  63. data/vendor/libressl/crypto/Makefile.am +962 -0
  64. data/vendor/libressl/crypto/Makefile.am.arc4random +46 -0
  65. data/vendor/libressl/crypto/Makefile.am.elf-mips +14 -0
  66. data/vendor/libressl/crypto/Makefile.am.elf-mips64 +14 -0
  67. data/vendor/libressl/crypto/Makefile.am.elf-x86_64 +35 -0
  68. data/vendor/libressl/crypto/Makefile.am.macosx-x86_64 +35 -0
  69. data/vendor/libressl/crypto/Makefile.am.masm-x86_64 +22 -0
  70. data/vendor/libressl/crypto/Makefile.am.mingw64-x86_64 +23 -0
  71. data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_darwin.c +60 -0
  72. data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_linux.c +62 -0
  73. data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_none.c +26 -0
  74. data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_windows.c +36 -0
  75. data/vendor/libressl/crypto/arch/loongarch64/crypto_arch.h +21 -0
  76. data/vendor/libressl/crypto/arch/mips/crypto_arch.h +21 -0
  77. data/vendor/libressl/crypto/bn/arch/loongarch64/bn_arch.h +23 -0
  78. data/vendor/libressl/crypto/bn/arch/mips/bn_arch.h +24 -0
  79. data/vendor/libressl/crypto/compat/.gitignore +31 -0
  80. data/vendor/libressl/crypto/compat/arc4random.h +41 -0
  81. data/vendor/libressl/crypto/compat/b_win.c +55 -0
  82. data/vendor/libressl/crypto/compat/bsd-asprintf.c +96 -0
  83. data/vendor/libressl/crypto/compat/crypto_lock_win.c +56 -0
  84. data/vendor/libressl/crypto/compat/explicit_bzero_win.c +13 -0
  85. data/vendor/libressl/crypto/compat/freezero.c +32 -0
  86. data/vendor/libressl/crypto/compat/getdelim.c +78 -0
  87. data/vendor/libressl/crypto/compat/getline.c +40 -0
  88. data/vendor/libressl/crypto/compat/getopt_long.c +528 -0
  89. data/vendor/libressl/crypto/compat/getpagesize.c +18 -0
  90. data/vendor/libressl/crypto/compat/getprogname_linux.c +23 -0
  91. data/vendor/libressl/crypto/compat/getprogname_unimpl.c +7 -0
  92. data/vendor/libressl/crypto/compat/getprogname_windows.c +13 -0
  93. data/vendor/libressl/crypto/compat/posix_win.c +296 -0
  94. data/vendor/libressl/crypto/compat/syslog_r.c +19 -0
  95. data/vendor/libressl/crypto/compat/ui_openssl_win.c +334 -0
  96. data/vendor/libressl/dist.sh +22 -0
  97. data/vendor/libressl/gen-coverage-report.sh +58 -0
  98. data/vendor/libressl/gen-openbsd-tags.sh +20 -0
  99. data/vendor/libressl/include/CMakeLists.txt +61 -0
  100. data/vendor/libressl/include/Makefile.am +79 -0
  101. data/vendor/libressl/include/arch/loongarch64/opensslconf.h +150 -0
  102. data/vendor/libressl/include/arch/mips/opensslconf.h +150 -0
  103. data/vendor/libressl/include/compat/arpa/inet.h +15 -0
  104. data/vendor/libressl/include/compat/arpa/nameser.h +25 -0
  105. data/vendor/libressl/include/compat/cet.h +19 -0
  106. data/vendor/libressl/include/compat/dirent.h +17 -0
  107. data/vendor/libressl/include/compat/dirent_msvc.h +611 -0
  108. data/vendor/libressl/include/compat/endian.h +161 -0
  109. data/vendor/libressl/include/compat/err.h +95 -0
  110. data/vendor/libressl/include/compat/fcntl.h +32 -0
  111. data/vendor/libressl/include/compat/getopt.h +50 -0
  112. data/vendor/libressl/include/compat/limits.h +25 -0
  113. data/vendor/libressl/include/compat/netdb.h +10 -0
  114. data/vendor/libressl/include/compat/netinet/in.h +19 -0
  115. data/vendor/libressl/include/compat/netinet/ip.h +49 -0
  116. data/vendor/libressl/include/compat/netinet/tcp.h +10 -0
  117. data/vendor/libressl/include/compat/poll.h +63 -0
  118. data/vendor/libressl/include/compat/pthread.h +122 -0
  119. data/vendor/libressl/include/compat/readpassphrase.h +44 -0
  120. data/vendor/libressl/include/compat/resolv.h +24 -0
  121. data/vendor/libressl/include/compat/stdint.h +31 -0
  122. data/vendor/libressl/include/compat/stdio.h +65 -0
  123. data/vendor/libressl/include/compat/stdlib.h +57 -0
  124. data/vendor/libressl/include/compat/string.h +98 -0
  125. data/vendor/libressl/include/compat/sys/_null.h +18 -0
  126. data/vendor/libressl/include/compat/sys/ioctl.h +11 -0
  127. data/vendor/libressl/include/compat/sys/mman.h +19 -0
  128. data/vendor/libressl/include/compat/sys/param.h +15 -0
  129. data/vendor/libressl/include/compat/sys/queue.h +536 -0
  130. data/vendor/libressl/include/compat/sys/select.h +10 -0
  131. data/vendor/libressl/include/compat/sys/socket.h +18 -0
  132. data/vendor/libressl/include/compat/sys/stat.h +129 -0
  133. data/vendor/libressl/include/compat/sys/time.h +37 -0
  134. data/vendor/libressl/include/compat/sys/tree.h +1006 -0
  135. data/vendor/libressl/include/compat/sys/types.h +69 -0
  136. data/vendor/libressl/include/compat/sys/uio.h +17 -0
  137. data/vendor/libressl/include/compat/syslog.h +38 -0
  138. data/vendor/libressl/include/compat/time.h +59 -0
  139. data/vendor/libressl/include/compat/unistd.h +83 -0
  140. data/vendor/libressl/include/compat/win32netcompat.h +57 -0
  141. data/vendor/libressl/include/openssl/Makefile.am.tpl +45 -0
  142. data/vendor/libressl/libcrypto.pc.in +28 -0
  143. data/vendor/libressl/libressl.pub +2 -0
  144. data/vendor/libressl/libssl.pc.in +28 -0
  145. data/vendor/libressl/libtls.pc.in +28 -0
  146. data/vendor/libressl/m4/ax_add_fortify_source.m4 +80 -0
  147. data/vendor/libressl/m4/ax_check_compile_flag.m4 +53 -0
  148. data/vendor/libressl/m4/check-hardening-options.m4 +110 -0
  149. data/vendor/libressl/m4/check-libc.m4 +189 -0
  150. data/vendor/libressl/m4/check-os-options.m4 +181 -0
  151. data/vendor/libressl/m4/disable-compiler-warnings.m4 +44 -0
  152. data/vendor/libressl/man/CMakeLists.txt +26 -0
  153. data/vendor/libressl/man/links +2780 -0
  154. data/vendor/libressl/man/update_links.sh +25 -0
  155. data/vendor/libressl/openssl.pc.in +11 -0
  156. data/vendor/libressl/patches/bn_shift.patch +34 -0
  157. data/vendor/libressl/patches/crypto_arch.h.patch +34 -0
  158. data/vendor/libressl/patches/crypto_namespace.h.patch +22 -0
  159. data/vendor/libressl/patches/netcat.c.patch +178 -0
  160. data/vendor/libressl/patches/openssl.c.patch +12 -0
  161. data/vendor/libressl/patches/opensslfeatures.h.patch +49 -0
  162. data/vendor/libressl/patches/patch-amd64-crypto-cpu-caps.c.patch +20 -0
  163. data/vendor/libressl/patches/patch-i386-crypto-cpu-caps.c.patch +20 -0
  164. data/vendor/libressl/patches/speed.c.patch +114 -0
  165. data/vendor/libressl/patches/ssl_namespace.h.patch +21 -0
  166. data/vendor/libressl/patches/tls.h.patch +16 -0
  167. data/vendor/libressl/patches/tls_config.c.patch +15 -0
  168. data/vendor/libressl/patches/win32_amd64_bn_arch.h.patch +28 -0
  169. data/vendor/libressl/patches/windows_headers.patch +80 -0
  170. data/vendor/libressl/scripts/config.guess +1774 -0
  171. data/vendor/libressl/scripts/config.sub +1907 -0
  172. data/vendor/libressl/scripts/i686-w64-mingw32.cmake +9 -0
  173. data/vendor/libressl/scripts/test +210 -0
  174. data/vendor/libressl/scripts/wrap-compiler-for-flag-check +31 -0
  175. data/vendor/libressl/scripts/x86_64-w64-mingw32.cmake +9 -0
  176. data/vendor/libressl/ssl/CMakeLists.txt +183 -0
  177. data/vendor/libressl/ssl/Makefile.am +187 -0
  178. data/vendor/libressl/tests/CMakeLists.txt +970 -0
  179. data/vendor/libressl/tests/Makefile.am +944 -0
  180. data/vendor/libressl/tests/aeadtest.sh +30 -0
  181. data/vendor/libressl/tests/arc4randomforktest.sh +21 -0
  182. data/vendor/libressl/tests/asn1time_small.test +10 -0
  183. data/vendor/libressl/tests/cmake/CMakeLists.txt +52 -0
  184. data/vendor/libressl/tests/cmake/crypto.c +7 -0
  185. data/vendor/libressl/tests/cmake/ssl.c +6 -0
  186. data/vendor/libressl/tests/cmake/tls.c +6 -0
  187. data/vendor/libressl/tests/compat/pipe2.c +186 -0
  188. data/vendor/libressl/tests/dtlstest.sh +28 -0
  189. data/vendor/libressl/tests/evptest.sh +22 -0
  190. data/vendor/libressl/tests/keypairtest.sh +27 -0
  191. data/vendor/libressl/tests/mlkem_tests.sh +39 -0
  192. data/vendor/libressl/tests/ocsptest.bat +25 -0
  193. data/vendor/libressl/tests/ocsptest.sh +23 -0
  194. data/vendor/libressl/tests/openssl.cnf +29 -0
  195. data/vendor/libressl/tests/optionstest.c +381 -0
  196. data/vendor/libressl/tests/pidwraptest.c +85 -0
  197. data/vendor/libressl/tests/pidwraptest.sh +26 -0
  198. data/vendor/libressl/tests/quictest.bat +27 -0
  199. data/vendor/libressl/tests/quictest.sh +30 -0
  200. data/vendor/libressl/tests/renegotiation_test.bat +27 -0
  201. data/vendor/libressl/tests/renegotiation_test.sh +30 -0
  202. data/vendor/libressl/tests/rfc5280time_small.test +10 -0
  203. data/vendor/libressl/tests/servertest.bat +27 -0
  204. data/vendor/libressl/tests/servertest.sh +30 -0
  205. data/vendor/libressl/tests/shutdowntest.bat +27 -0
  206. data/vendor/libressl/tests/shutdowntest.sh +30 -0
  207. data/vendor/libressl/tests/ssltest.bat +32 -0
  208. data/vendor/libressl/tests/ssltest.sh +48 -0
  209. data/vendor/libressl/tests/testdsa.bat +47 -0
  210. data/vendor/libressl/tests/testdsa.sh +57 -0
  211. data/vendor/libressl/tests/testenc.bat +85 -0
  212. data/vendor/libressl/tests/testenc.sh +93 -0
  213. data/vendor/libressl/tests/testrsa.bat +47 -0
  214. data/vendor/libressl/tests/testrsa.sh +57 -0
  215. data/vendor/libressl/tests/testssl.bat +171 -0
  216. data/vendor/libressl/tests/tlstest.bat +27 -0
  217. data/vendor/libressl/tests/tlstest.sh +28 -0
  218. data/vendor/libressl/tls/CMakeLists.txt +125 -0
  219. data/vendor/libressl/tls/Makefile.am +76 -0
  220. data/vendor/libressl/tls/compat/ftruncate.c +17 -0
  221. data/vendor/libressl/tls/compat/pread.c +29 -0
  222. data/vendor/libressl/tls/compat/pwrite.c +29 -0
  223. data/vendor/libressl/update.sh +460 -0
  224. data/vendor/liburing/.github/workflows/ci.yml +8 -0
  225. data/vendor/liburing/configure +23 -2
  226. data/vendor/liburing/examples/helpers.c +1 -1
  227. data/vendor/liburing/examples/helpers.h +1 -1
  228. data/vendor/liburing/examples/reg-wait.c +3 -3
  229. data/vendor/liburing/examples/zcrx.c +5 -5
  230. data/vendor/liburing/liburing.spec +1 -1
  231. data/vendor/liburing/src/include/liburing/io_uring.h +16 -0
  232. data/vendor/liburing/src/include/liburing.h +20 -4
  233. data/vendor/liburing/src/lib.h +2 -4
  234. data/vendor/liburing/src/liburing-ffi.map +7 -0
  235. data/vendor/liburing/src/liburing.map +7 -0
  236. data/vendor/liburing/src/register.c +5 -0
  237. data/vendor/liburing/src/sanitize.c +5 -4
  238. data/vendor/liburing/src/setup.c +43 -28
  239. data/vendor/liburing/test/Makefile +7 -0
  240. data/vendor/liburing/test/cmd-discard.c +2 -2
  241. data/vendor/liburing/test/evfd-short-read.c +84 -0
  242. data/vendor/liburing/test/fdinfo-sqpoll.c +117 -0
  243. data/vendor/liburing/test/fdinfo.c +1 -1
  244. data/vendor/liburing/test/fixed-buf-merge.c +2 -2
  245. data/vendor/liburing/test/futex-kill.c +135 -0
  246. data/vendor/liburing/test/helpers.c +1 -1
  247. data/vendor/liburing/test/helpers.h +1 -1
  248. data/vendor/liburing/test/init-mem.c +50 -12
  249. data/vendor/liburing/test/io_uring_passthrough.c +25 -6
  250. data/vendor/liburing/test/msg-ring.c +123 -9
  251. data/vendor/liburing/test/recv-bundle-short-ooo.c +16 -1
  252. data/vendor/liburing/test/recv-inc-ooo.c +411 -0
  253. data/vendor/liburing/test/recv-mshot-fair.c +513 -0
  254. data/vendor/liburing/test/reg-wait.c +14 -14
  255. data/vendor/liburing/test/send-zerocopy.c +4 -4
  256. data/vendor/liburing/test/timerfd-short-read.c +81 -0
  257. data/vendor/liburing/test/timestamp.c +382 -0
  258. data/vendor/liburing/test/zcrx.c +22 -22
  259. metadata +222 -2
@@ -0,0 +1,381 @@
1
+ /* $OpenBSD: optionstest.c,v 1.8 2015/01/22 05:48:00 doug Exp $ */
2
+ /*
3
+ * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4
+ *
5
+ * Permission to use, copy, modify, and distribute this software for any
6
+ * purpose with or without fee is hereby granted, provided that the above
7
+ * copyright notice and this permission notice appear in all copies.
8
+ *
9
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+ */
17
+
18
+ #include <stdio.h>
19
+ #include <stdlib.h>
20
+ #include <string.h>
21
+
22
+ #include <openssl/bio.h>
23
+ #include <openssl/conf.h>
24
+
25
+ #include <apps.h>
26
+ #include <apps.c>
27
+
28
+ /* Needed to keep apps.c happy... */
29
+ BIO *bio_err;
30
+ CONF *config;
31
+
32
+ static int argfunc(char *arg);
33
+ static int defaultarg(int argc, char **argv, int *argsused);
34
+ static int multiarg(int argc, char **argv, int *argsused);
35
+
36
+ static struct {
37
+ char *arg;
38
+ int flag;
39
+ } test_config;
40
+
41
+ static struct option test_options[] = {
42
+ {
43
+ .name = "arg",
44
+ .argname = "argname",
45
+ .type = OPTION_ARG,
46
+ .opt.arg = &test_config.arg,
47
+ },
48
+ {
49
+ .name = "argfunc",
50
+ .argname = "argname",
51
+ .type = OPTION_ARG_FUNC,
52
+ .opt.argfunc = argfunc,
53
+ },
54
+ {
55
+ .name = "flag",
56
+ .type = OPTION_FLAG,
57
+ .opt.flag = &test_config.flag,
58
+ },
59
+ {
60
+ .name = "multiarg",
61
+ .type = OPTION_ARGV_FUNC,
62
+ .opt.argvfunc = multiarg,
63
+ },
64
+ {
65
+ .name = NULL,
66
+ .type = OPTION_ARGV_FUNC,
67
+ .opt.argvfunc = defaultarg,
68
+ },
69
+ { NULL },
70
+ };
71
+
72
+ char *args1[] = { "opts" };
73
+ char *args2[] = { "opts", "-arg", "arg", "-flag" };
74
+ char *args3[] = { "opts", "-arg", "arg", "-flag", "unnamed" };
75
+ char *args4[] = { "opts", "-arg", "arg", "unnamed", "-flag" };
76
+ char *args5[] = { "opts", "unnamed1", "-arg", "arg", "-flag", "unnamed2" };
77
+ char *args6[] = { "opts", "-argfunc", "arg", "-flag" };
78
+ char *args7[] = { "opts", "-arg", "arg", "-flag", "-", "-unnamed" };
79
+ char *args8[] = { "opts", "-arg", "arg", "-flag", "file1", "file2", "file3" };
80
+ char *args9[] = { "opts", "-arg", "arg", "-flag", "file1", "-file2", "file3" };
81
+ char *args10[] = { "opts", "-arg", "arg", "-flag", "-", "file1", "file2" };
82
+ char *args11[] = { "opts", "-arg", "arg", "-flag", "-", "-file1", "-file2" };
83
+ char *args12[] = { "opts", "-multiarg", "arg1", "arg2", "-flag", "unnamed" };
84
+ char *args13[] = { "opts", "-multiargz", "arg1", "arg2", "-flagz", "unnamed" };
85
+
86
+ struct options_test {
87
+ int argc;
88
+ char **argv;
89
+ enum {
90
+ OPTIONS_TEST_NONE,
91
+ OPTIONS_TEST_UNNAMED,
92
+ OPTIONS_TEST_ARGSUSED,
93
+ } type;
94
+ char *unnamed;
95
+ int used;
96
+ int want;
97
+ char *wantarg;
98
+ int wantflag;
99
+ };
100
+
101
+ struct options_test options_tests[] = {
102
+ {
103
+ /* Test 1 - No arguments (only program name). */
104
+ .argc = 1,
105
+ .argv = args1,
106
+ .type = OPTIONS_TEST_NONE,
107
+ .want = 0,
108
+ .wantarg = NULL,
109
+ .wantflag = 0,
110
+ },
111
+ {
112
+ /* Test 2 - Named arguments (unnamed not permitted). */
113
+ .argc = 4,
114
+ .argv = args2,
115
+ .type = OPTIONS_TEST_NONE,
116
+ .want = 0,
117
+ .wantarg = "arg",
118
+ .wantflag = 1,
119
+ },
120
+ {
121
+ /* Test 3 - Named arguments (unnamed permitted). */
122
+ .argc = 4,
123
+ .argv = args2,
124
+ .type = OPTIONS_TEST_UNNAMED,
125
+ .unnamed = NULL,
126
+ .want = 0,
127
+ .wantarg = "arg",
128
+ .wantflag = 1,
129
+ },
130
+ {
131
+ /* Test 4 - Named and single unnamed (unnamed not permitted). */
132
+ .argc = 5,
133
+ .argv = args3,
134
+ .type = OPTIONS_TEST_NONE,
135
+ .want = 1,
136
+ },
137
+ {
138
+ /* Test 5 - Named and single unnamed (unnamed permitted). */
139
+ .argc = 5,
140
+ .argv = args3,
141
+ .type = OPTIONS_TEST_UNNAMED,
142
+ .unnamed = "unnamed",
143
+ .want = 0,
144
+ .wantarg = "arg",
145
+ .wantflag = 1,
146
+ },
147
+ {
148
+ /* Test 6 - Named and single unnamed (different sequence). */
149
+ .argc = 5,
150
+ .argv = args4,
151
+ .type = OPTIONS_TEST_UNNAMED,
152
+ .unnamed = "unnamed",
153
+ .want = 0,
154
+ .wantarg = "arg",
155
+ .wantflag = 1,
156
+ },
157
+ {
158
+ /* Test 7 - Multiple unnamed arguments (should fail). */
159
+ .argc = 6,
160
+ .argv = args5,
161
+ .type = OPTIONS_TEST_UNNAMED,
162
+ .want = 1,
163
+ },
164
+ {
165
+ /* Test 8 - Function. */
166
+ .argc = 4,
167
+ .argv = args6,
168
+ .type = OPTIONS_TEST_NONE,
169
+ .want = 0,
170
+ .wantarg = "arg",
171
+ .wantflag = 1,
172
+ },
173
+ {
174
+ /* Test 9 - Named and single unnamed (hyphen separated). */
175
+ .argc = 6,
176
+ .argv = args7,
177
+ .type = OPTIONS_TEST_UNNAMED,
178
+ .unnamed = "-unnamed",
179
+ .want = 0,
180
+ .wantarg = "arg",
181
+ .wantflag = 1,
182
+ },
183
+ {
184
+ /* Test 10 - Named and multiple unnamed. */
185
+ .argc = 7,
186
+ .argv = args8,
187
+ .used = 4,
188
+ .type = OPTIONS_TEST_ARGSUSED,
189
+ .want = 0,
190
+ .wantarg = "arg",
191
+ .wantflag = 1,
192
+ },
193
+ {
194
+ /* Test 11 - Named and multiple unnamed. */
195
+ .argc = 7,
196
+ .argv = args9,
197
+ .used = 4,
198
+ .type = OPTIONS_TEST_ARGSUSED,
199
+ .want = 0,
200
+ .wantarg = "arg",
201
+ .wantflag = 1,
202
+ },
203
+ {
204
+ /* Test 12 - Named and multiple unnamed. */
205
+ .argc = 7,
206
+ .argv = args10,
207
+ .used = 5,
208
+ .type = OPTIONS_TEST_ARGSUSED,
209
+ .want = 0,
210
+ .wantarg = "arg",
211
+ .wantflag = 1,
212
+ },
213
+ {
214
+ /* Test 13 - Named and multiple unnamed. */
215
+ .argc = 7,
216
+ .argv = args11,
217
+ .used = 5,
218
+ .type = OPTIONS_TEST_ARGSUSED,
219
+ .want = 0,
220
+ .wantarg = "arg",
221
+ .wantflag = 1,
222
+ },
223
+ {
224
+ /* Test 14 - Named only. */
225
+ .argc = 4,
226
+ .argv = args2,
227
+ .used = 4,
228
+ .type = OPTIONS_TEST_ARGSUSED,
229
+ .want = 0,
230
+ .wantarg = "arg",
231
+ .wantflag = 1,
232
+ },
233
+ {
234
+ /* Test 15 - Multiple argument callback. */
235
+ .argc = 6,
236
+ .argv = args12,
237
+ .unnamed = "unnamed",
238
+ .type = OPTIONS_TEST_UNNAMED,
239
+ .want = 0,
240
+ .wantarg = NULL,
241
+ .wantflag = 1,
242
+ },
243
+ {
244
+ /* Test 16 - Multiple argument callback. */
245
+ .argc = 6,
246
+ .argv = args12,
247
+ .used = 5,
248
+ .type = OPTIONS_TEST_ARGSUSED,
249
+ .want = 0,
250
+ .wantarg = NULL,
251
+ .wantflag = 1,
252
+ },
253
+ {
254
+ /* Test 17 - Default callback. */
255
+ .argc = 6,
256
+ .argv = args13,
257
+ .unnamed = "unnamed",
258
+ .type = OPTIONS_TEST_UNNAMED,
259
+ .want = 0,
260
+ .wantarg = NULL,
261
+ .wantflag = 1,
262
+ },
263
+ {
264
+ /* Test 18 - Default callback. */
265
+ .argc = 6,
266
+ .argv = args13,
267
+ .used = 5,
268
+ .type = OPTIONS_TEST_ARGSUSED,
269
+ .want = 0,
270
+ .wantarg = NULL,
271
+ .wantflag = 1,
272
+ },
273
+ };
274
+
275
+ #define N_OPTIONS_TESTS \
276
+ (sizeof(options_tests) / sizeof(*options_tests))
277
+
278
+ static int
279
+ argfunc(char *arg)
280
+ {
281
+ test_config.arg = arg;
282
+ return (0);
283
+ }
284
+
285
+ static int
286
+ defaultarg(int argc, char **argv, int *argsused)
287
+ {
288
+ if (argc < 1)
289
+ return (1);
290
+
291
+ if (strcmp(argv[0], "-multiargz") == 0) {
292
+ if (argc < 3)
293
+ return (1);
294
+ *argsused = 3;
295
+ return (0);
296
+ } else if (strcmp(argv[0], "-flagz") == 0) {
297
+ test_config.flag = 1;
298
+ *argsused = 1;
299
+ return (0);
300
+ }
301
+
302
+ return (1);
303
+ }
304
+
305
+ static int
306
+ multiarg(int argc, char **argv, int *argsused)
307
+ {
308
+ if (argc < 3)
309
+ return (1);
310
+
311
+ *argsused = 3;
312
+ return (0);
313
+ }
314
+
315
+ static int
316
+ do_options_test(int test_no, struct options_test *ot)
317
+ {
318
+ int *argsused = NULL;
319
+ char *unnamed = NULL;
320
+ char **arg = NULL;
321
+ int used = 0;
322
+ int ret;
323
+
324
+ if (ot->type == OPTIONS_TEST_UNNAMED)
325
+ arg = &unnamed;
326
+ else if (ot->type == OPTIONS_TEST_ARGSUSED)
327
+ argsused = &used;
328
+
329
+ memset(&test_config, 0, sizeof(test_config));
330
+ ret = options_parse(ot->argc, ot->argv, test_options, arg, argsused);
331
+ if (ret != ot->want) {
332
+ fprintf(stderr, "FAIL: test %i options_parse() returned %i, "
333
+ "want %i\n", test_no, ret, ot->want);
334
+ return (1);
335
+ }
336
+ if (ret != 0)
337
+ return (0);
338
+
339
+ if ((test_config.arg != NULL || ot->wantarg != NULL) &&
340
+ (test_config.arg == NULL || ot->wantarg == NULL ||
341
+ strcmp(test_config.arg, ot->wantarg) != 0)) {
342
+ fprintf(stderr, "FAIL: test %i got arg '%s', want '%s'\n",
343
+ test_no, test_config.arg, ot->wantarg);
344
+ return (1);
345
+ }
346
+ if (test_config.flag != ot->wantflag) {
347
+ fprintf(stderr, "FAIL: test %i got flag %i, want %i\n",
348
+ test_no, test_config.flag, ot->wantflag);
349
+ return (1);
350
+ }
351
+ if (ot->type == OPTIONS_TEST_UNNAMED &&
352
+ (unnamed != NULL || ot->unnamed != NULL) &&
353
+ (unnamed == NULL || ot->unnamed == NULL ||
354
+ strcmp(unnamed, ot->unnamed) != 0)) {
355
+ fprintf(stderr, "FAIL: test %i got unnamed '%s', want '%s'\n",
356
+ test_no, unnamed, ot->unnamed);
357
+ return (1);
358
+ }
359
+ if (ot->type == OPTIONS_TEST_ARGSUSED && used != ot->used) {
360
+ fprintf(stderr, "FAIL: test %i got used %i, want %i\n",
361
+ test_no, used, ot->used);
362
+ return (1);
363
+ }
364
+
365
+ return (0);
366
+ }
367
+
368
+ int
369
+ main(int argc, char **argv)
370
+ {
371
+ int failed = 0;
372
+ size_t i;
373
+
374
+ for (i = 0; i < N_OPTIONS_TESTS; i++) {
375
+ printf("Test %d%s\n", (int)(i + 1), options_tests[i].want == 0 ?
376
+ "" : " is expected to complain");
377
+ failed += do_options_test(i + 1, &options_tests[i]);
378
+ }
379
+
380
+ return (failed);
381
+ }
@@ -0,0 +1,85 @@
1
+ /*
2
+ * Checks if LibreSSL's PRNG is fork-safe.
3
+ * From https://www.agwa.name/blog/post/libressls_prng_is_unsafe_on_linux
4
+ * This code is in the public domain.
5
+ *
6
+ * Original source: https://gist.github.com/AGWA/eb84e55ca25a7da1deb0
7
+ */
8
+
9
+ #undef LIBRESSL_INTERNAL
10
+ #include <openssl/rand.h>
11
+ #include <stdio.h>
12
+ #include <stdlib.h>
13
+ #include <unistd.h>
14
+ #include <sys/wait.h>
15
+
16
+ static void random_bytes (unsigned char* p, size_t len)
17
+ {
18
+ if (RAND_bytes(p, len) != 1) {
19
+ fprintf(stderr, "RAND_bytes failed\n");
20
+ abort();
21
+ }
22
+ }
23
+
24
+ static void random_stir (void)
25
+ {
26
+ if (RAND_poll() != 1) {
27
+ fprintf(stderr, "RAND_poll failed\n");
28
+ abort();
29
+ }
30
+ }
31
+
32
+ static void print_buffer (unsigned char* p, size_t len)
33
+ {
34
+ while (len--) {
35
+ printf("%02x", (unsigned int)*p++);
36
+ }
37
+ }
38
+
39
+ int main ()
40
+ {
41
+ char c = 0;
42
+ int pipefd[2];
43
+ pipe(pipefd);
44
+ setbuf(stdout, NULL);
45
+
46
+ if (fork() == 0) {
47
+ unsigned char buffer[32];
48
+ pid_t grandparent_pid = getpid();
49
+
50
+ random_bytes(buffer, sizeof(buffer));
51
+
52
+ if (fork() == 0) {
53
+ random_stir();
54
+ setsid();
55
+ while (1) {
56
+ pid_t grandchild_pid = fork();
57
+ if (grandchild_pid == 0) {
58
+ random_stir();
59
+ if (getpid() == grandparent_pid) {
60
+ random_bytes(buffer, sizeof(buffer));
61
+ print_buffer(buffer, sizeof(buffer));
62
+ printf("\n");
63
+ }
64
+ _exit(0);
65
+ }
66
+ wait(NULL);
67
+ if (grandchild_pid == grandparent_pid) {
68
+ break;
69
+ }
70
+ }
71
+ write(pipefd[1], &c, 1);
72
+ _exit(0);
73
+ }
74
+
75
+ random_bytes(buffer, sizeof(buffer));
76
+ print_buffer(buffer, sizeof(buffer));
77
+ printf(" ");
78
+ _exit(0);
79
+ }
80
+ wait(NULL);
81
+ close(pipefd[1]);
82
+ read(pipefd[0], &c, 1);
83
+ return 0;
84
+ }
85
+
@@ -0,0 +1,26 @@
1
+ #!/bin/sh
2
+ #
3
+ # Copyright (c) 2014 Brent Cook
4
+ #
5
+ # Permission to use, copy, modify, and distribute this software for any
6
+ # purpose with or without fee is hereby granted, provided that the above
7
+ # copyright notice and this permission notice appear in all copies.
8
+ #
9
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+
17
+ ./pidwraptest > pidwraptest.txt
18
+ while read a b;
19
+ do
20
+ if [ "$a" = "$b" ]; then
21
+ echo "FAIL: $a = $b"
22
+ return 2
23
+ else
24
+ echo "PASS: $a != $b"
25
+ fi
26
+ done < pidwraptest.txt
@@ -0,0 +1,27 @@
1
+ @echo off
2
+ setlocal enabledelayedexpansion
3
+
4
+ :: Copyright (c) 2022 Brent Cook
5
+ ::
6
+ :: Permission to use, copy, modify, and distribute this software for any
7
+ :: purpose with or without fee is hereby granted, provided that the above
8
+ :: copyright notice and this permission notice appear in all copies.
9
+ ::
10
+ :: THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
+ :: WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
+ :: MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
+ :: ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
+ :: WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
+ :: ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
+ :: OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
+
18
+ set quictest_bin=%1
19
+ set quictest_bin=%quictest_bin:/=\%
20
+ if not exist %quictest_bin% exit /b 1
21
+
22
+ %quictest_bin% %srcdir%\server1-rsa.pem %srcdir%\server1-rsa-chain.pem %srcdir%\ca-root-rsa.pem
23
+ if !errorlevel! neq 0 (
24
+ exit /b 1
25
+ )
26
+
27
+ endlocal
@@ -0,0 +1,30 @@
1
+ #!/bin/sh
2
+ #
3
+ # Copyright (c) 2022 Brent Cook
4
+ #
5
+ # Permission to use, copy, modify, and distribute this software for any
6
+ # purpose with or without fee is hereby granted, provided that the above
7
+ # copyright notice and this permission notice appear in all copies.
8
+ #
9
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+
17
+ set -e
18
+
19
+ quictest_bin=./quictest
20
+ if [ -e ./quictest.exe ]; then
21
+ quictest_bin=./quictest.exe
22
+ elif [ -e ./quictest.js ]; then
23
+ quictest_bin="node ./quictest.js"
24
+ fi
25
+
26
+ if [ -z $srcdir ]; then
27
+ srcdir=.
28
+ fi
29
+
30
+ $quictest_bin $srcdir/server1-rsa.pem $srcdir/server1-rsa-chain.pem $srcdir/ca-root-rsa.pem
@@ -0,0 +1,27 @@
1
+ @echo off
2
+ setlocal enabledelayedexpansion
3
+
4
+ :: Copyright (c) 2025 Theo Beuhler
5
+ ::
6
+ :: Permission to use, copy, modify, and distribute this software for any
7
+ :: purpose with or without fee is hereby granted, provided that the above
8
+ :: copyright notice and this permission notice appear in all copies.
9
+ ::
10
+ :: THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
+ :: WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
+ :: MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
+ :: ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
+ :: WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
+ :: ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
+ :: OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
+
18
+ set renegotiation_test_bin=%1
19
+ set renegotiation_test_bin=%renegotiation_test_bin:/=\%
20
+ if not exist %renegotiation_test_bin% exit /b 1
21
+
22
+ %renegotiation_test_bin% %srcdir%\server1-rsa.pem %srcdir%\server1-rsa-chain.pem %srcdir%\ca-root-rsa.pem
23
+ if !errorlevel! neq 0 (
24
+ exit /b 1
25
+ )
26
+
27
+ endlocal
@@ -0,0 +1,30 @@
1
+ #!/bin/sh
2
+ #
3
+ # Copyright (c) 2025 Theo Buehler
4
+ #
5
+ # Permission to use, copy, modify, and distribute this software for any
6
+ # purpose with or without fee is hereby granted, provided that the above
7
+ # copyright notice and this permission notice appear in all copies.
8
+ #
9
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+
17
+ set -e
18
+
19
+ renegotiation_test_bin=./renegotiation_test
20
+ if [ -e ./renegotiation_test.exe ]; then
21
+ renegotiation_test_bin=./renegotiation_test.exe
22
+ elif [ -e ./renegotiation_test.js ]; then
23
+ renegotiation_test_bin="node ./renegotiation_test.js"
24
+ fi
25
+
26
+ if [ -z $srcdir ]; then
27
+ srcdir=.
28
+ fi
29
+
30
+ $renegotiation_test_bin $srcdir/server1-rsa.pem $srcdir/server1-rsa-chain.pem $srcdir/ca-root-rsa.pem
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ echo 1..1
3
+ TEST=./rfc5280
4
+ if [ -e ./rfc5280.exe ]; then
5
+ TEST=./rfc5280.exe
6
+ fi
7
+
8
+ # map test failure to XFAIL and success to XPASS
9
+ $TEST || echo -n "not "
10
+ echo "ok # this system is unable to represent times past 2038"
@@ -0,0 +1,27 @@
1
+ @echo off
2
+ setlocal enabledelayedexpansion
3
+
4
+ :: Copyright (c) 2017 Kinichiro Inoguchi
5
+ ::
6
+ :: Permission to use, copy, modify, and distribute this software for any
7
+ :: purpose with or without fee is hereby granted, provided that the above
8
+ :: copyright notice and this permission notice appear in all copies.
9
+ ::
10
+ :: THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
+ :: WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
+ :: MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
+ :: ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
+ :: WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
+ :: ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
+ :: OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
+
18
+ set servertest_bin=%1
19
+ set servertest_bin=%servertest_bin:/=\%
20
+ if not exist %servertest_bin% exit /b 1
21
+
22
+ %servertest_bin% %srcdir%\server1-rsa.pem %srcdir%\server1-rsa-chain.pem %srcdir%\ca-root.pem
23
+ if !errorlevel! neq 0 (
24
+ exit /b 1
25
+ )
26
+
27
+ endlocal
@@ -0,0 +1,30 @@
1
+ #!/bin/sh
2
+ #
3
+ # Copyright (c) 2017 Kinichiro Inoguchi
4
+ #
5
+ # Permission to use, copy, modify, and distribute this software for any
6
+ # purpose with or without fee is hereby granted, provided that the above
7
+ # copyright notice and this permission notice appear in all copies.
8
+ #
9
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+
17
+ set -e
18
+
19
+ servertest_bin=./servertest
20
+ if [ -e ./servertest.exe ]; then
21
+ servertest_bin=./servertest.exe
22
+ elif [ -e ./servertest.js ]; then
23
+ servertest_bin="node ./servertest.js"
24
+ fi
25
+
26
+ if [ -z $srcdir ]; then
27
+ srcdir=.
28
+ fi
29
+
30
+ $servertest_bin $srcdir/server1-rsa.pem $srcdir/server1-rsa-chain.pem $srcdir/ca-root-rsa.pem