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,108 @@
1
+ #
2
+ # Copyright (c) 2015 Brent Cook
3
+ #
4
+ # Permission to use, copy, modify, and distribute this software for any
5
+ # purpose with or without fee is hereby granted, provided that the above
6
+ # copyright notice and this permission notice appear in all copies.
7
+ #
8
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
+ # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
+ # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
+ # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
+ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
+ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
+ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
+
16
+ include $(top_srcdir)/Makefile.am.common
17
+
18
+ -include $(abs_top_builddir)/crypto/libcrypto_la_objects.mk
19
+ -include $(abs_top_builddir)/ssl/libssl_la_objects.mk
20
+
21
+ if !ENABLE_LIBTLS_ONLY
22
+ bin_PROGRAMS = openssl
23
+ dist_man_MANS = openssl.1
24
+ else
25
+ noinst_PROGRAMS = openssl
26
+ endif
27
+
28
+ openssl_LDADD = $(libcrypto_la_objects)
29
+ openssl_LDADD += $(libcompat_la_objects)
30
+ openssl_LDADD += $(libcompatnoopt_la_objects)
31
+ openssl_LDADD += $(libssl_la_objects)
32
+ openssl_LDADD += $(PLATFORM_LDADD) $(PROG_LDADD)
33
+
34
+ openssl_SOURCES = apps.c
35
+ openssl_SOURCES += asn1pars.c
36
+ openssl_SOURCES += ca.c
37
+ openssl_SOURCES += ciphers.c
38
+ openssl_SOURCES += crl.c
39
+ openssl_SOURCES += crl2p7.c
40
+ openssl_SOURCES += cms.c
41
+ openssl_SOURCES += dgst.c
42
+ openssl_SOURCES += dh.c
43
+ openssl_SOURCES += dhparam.c
44
+ openssl_SOURCES += dsa.c
45
+ openssl_SOURCES += dsaparam.c
46
+ openssl_SOURCES += ec.c
47
+ openssl_SOURCES += ecparam.c
48
+ openssl_SOURCES += enc.c
49
+ openssl_SOURCES += errstr.c
50
+ openssl_SOURCES += gendh.c
51
+ openssl_SOURCES += gendsa.c
52
+ openssl_SOURCES += genpkey.c
53
+ openssl_SOURCES += genrsa.c
54
+ openssl_SOURCES += ocsp.c
55
+ openssl_SOURCES += openssl.c
56
+ openssl_SOURCES += passwd.c
57
+ openssl_SOURCES += pkcs12.c
58
+ openssl_SOURCES += pkcs7.c
59
+ openssl_SOURCES += pkcs8.c
60
+ openssl_SOURCES += pkey.c
61
+ openssl_SOURCES += pkeyparam.c
62
+ openssl_SOURCES += pkeyutl.c
63
+ openssl_SOURCES += prime.c
64
+ openssl_SOURCES += rand.c
65
+ openssl_SOURCES += req.c
66
+ openssl_SOURCES += rsa.c
67
+ openssl_SOURCES += rsautl.c
68
+ openssl_SOURCES += s_cb.c
69
+ openssl_SOURCES += s_client.c
70
+ openssl_SOURCES += s_server.c
71
+ openssl_SOURCES += s_socket.c
72
+ openssl_SOURCES += s_time.c
73
+ openssl_SOURCES += sess_id.c
74
+ openssl_SOURCES += smime.c
75
+ openssl_SOURCES += speed.c
76
+ openssl_SOURCES += ts.c
77
+ openssl_SOURCES += verify.c
78
+ openssl_SOURCES += version.c
79
+ openssl_SOURCES += x509.c
80
+
81
+ if BUILD_CERTHASH
82
+ openssl_SOURCES += certhash.c
83
+ else
84
+ openssl_SOURCES += certhash_win.c
85
+ endif
86
+
87
+ if HOST_WIN
88
+ openssl_SOURCES += apps_win.c
89
+ else
90
+ openssl_SOURCES += apps_posix.c
91
+ endif
92
+
93
+ if !HAVE_POLL
94
+ if HOST_WIN
95
+ openssl_SOURCES += compat/poll_win.c
96
+ endif
97
+ endif
98
+
99
+ if !HAVE_CLOCK_GETTIME
100
+ if HOST_DARWIN
101
+ openssl_SOURCES += compat/clock_gettime_osx.c
102
+ endif
103
+ endif
104
+
105
+ noinst_HEADERS = apps.h
106
+
107
+ EXTRA_DIST = CMakeLists.txt
108
+
@@ -0,0 +1,138 @@
1
+ /*
2
+ * Public domain
3
+ *
4
+ * Dongsheng Song <dongsheng.song@gmail.com>
5
+ * Brent Cook <bcook@openbsd.org>
6
+ */
7
+
8
+ #include <windows.h>
9
+
10
+ #include <io.h>
11
+ #include <fcntl.h>
12
+
13
+ #include "apps.h"
14
+
15
+ double
16
+ app_timer_real(int get)
17
+ {
18
+ static __int64 start;
19
+ __int64 now;
20
+
21
+ now = GetTickCount64();
22
+ if (get) {
23
+ return (now - start) / 1000.0;
24
+ }
25
+ start = now;
26
+ return 0.0;
27
+ }
28
+
29
+ double
30
+ app_timer_user(int stop)
31
+ {
32
+ static unsigned __int64 tmstart;
33
+ union {
34
+ unsigned __int64 u64;
35
+ FILETIME ft;
36
+ } ct, et, kt, ut;
37
+
38
+ GetProcessTimes(GetCurrentProcess(), &ct.ft, &et.ft, &kt.ft, &ut.ft);
39
+ if (stop)
40
+ return (ut.u64 + kt.u64 - tmstart) / (double) 10000000;
41
+
42
+ tmstart = ut.u64 + kt.u64;
43
+ return 0.0;
44
+ }
45
+
46
+ int
47
+ setup_ui(void)
48
+ {
49
+ ui_method = UI_create_method("OpenSSL application user interface");
50
+ UI_method_set_opener(ui_method, ui_open);
51
+ UI_method_set_reader(ui_method, ui_read);
52
+ UI_method_set_writer(ui_method, ui_write);
53
+ UI_method_set_closer(ui_method, ui_close);
54
+
55
+ /*
56
+ * Set STDIO to binary
57
+ */
58
+ _setmode(_fileno(stdin), _O_BINARY);
59
+ _setmode(_fileno(stdout), _O_BINARY);
60
+ _setmode(_fileno(stderr), _O_BINARY);
61
+
62
+ return 0;
63
+ }
64
+
65
+ void
66
+ destroy_ui(void)
67
+ {
68
+ if (ui_method) {
69
+ UI_destroy_method(ui_method);
70
+ ui_method = NULL;
71
+ }
72
+ }
73
+
74
+ static void (*speed_alarm_handler)(int);
75
+ static HANDLE speed_thread;
76
+ static unsigned int speed_lapse;
77
+ static volatile unsigned int speed_schlock;
78
+
79
+ void
80
+ speed_signal(int sigcatch, void (*func)(int sigraised))
81
+ {
82
+ speed_alarm_handler = func;
83
+ }
84
+
85
+ static DWORD WINAPI
86
+ speed_timer(VOID * arg)
87
+ {
88
+ speed_schlock = 1;
89
+ Sleep(speed_lapse);
90
+ (*speed_alarm_handler)(0);
91
+ return (0);
92
+ }
93
+
94
+ unsigned int
95
+ speed_alarm(unsigned int seconds)
96
+ {
97
+ DWORD err;
98
+
99
+ speed_lapse = seconds * 1000;
100
+ speed_schlock = 0;
101
+
102
+ speed_thread = CreateThread(NULL, 4096, speed_timer, NULL, 0, NULL);
103
+ if (speed_thread == NULL) {
104
+ err = GetLastError();
105
+ BIO_printf(bio_err, "CreateThread failed (%lu)", err);
106
+ ExitProcess(err);
107
+ }
108
+
109
+ while (!speed_schlock)
110
+ Sleep(0);
111
+
112
+ return (seconds);
113
+ }
114
+
115
+ void
116
+ speed_alarm_free(int run)
117
+ {
118
+ DWORD err;
119
+
120
+ if (run) {
121
+ if (TerminateThread(speed_thread, 0) == 0) {
122
+ err = GetLastError();
123
+ BIO_printf(bio_err, "TerminateThread failed (%lu)",
124
+ err);
125
+ ExitProcess(err);
126
+ }
127
+ }
128
+
129
+ if (CloseHandle(speed_thread) == 0) {
130
+ err = GetLastError();
131
+ BIO_printf(bio_err, "CloseHandle failed (%lu)", err);
132
+ ExitProcess(err);
133
+ }
134
+
135
+ speed_thread = NULL;
136
+ speed_lapse = 0;
137
+ speed_schlock = 0;
138
+ }
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Public domain
3
+ * certhash dummy implementation for platforms without symlinks
4
+ */
5
+
6
+ #include "apps.h"
7
+
8
+ int
9
+ certhash_main(int argc, char **argv)
10
+ {
11
+ fprintf(stderr, "certhash is not enabled on this platform\n");
12
+ return (1);
13
+ }
@@ -0,0 +1,26 @@
1
+ #include <time.h>
2
+
3
+ #include <mach/mach_time.h>
4
+ #define ORWL_NANO (+1.0E-9)
5
+ #define ORWL_GIGA UINT64_C(1000000000)
6
+
7
+ int
8
+ clock_gettime(clockid_t clock_id, struct timespec *tp)
9
+ {
10
+ static double orwl_timebase = 0.0;
11
+ static uint64_t orwl_timestart = 0;
12
+
13
+ if (!orwl_timestart) {
14
+ mach_timebase_info_data_t tb = { 0 };
15
+ mach_timebase_info(&tb);
16
+ orwl_timebase = tb.numer;
17
+ orwl_timebase /= tb.denom;
18
+ orwl_timestart = mach_absolute_time();
19
+ }
20
+
21
+ double diff = (mach_absolute_time() - orwl_timestart) * orwl_timebase;
22
+ tp->tv_sec = diff * ORWL_NANO;
23
+ tp->tv_nsec = diff - (tp->tv_sec * ORWL_GIGA);
24
+
25
+ return 0;
26
+ }
@@ -0,0 +1,329 @@
1
+ /*
2
+ * Public domain
3
+ *
4
+ * poll(2) emulation for Windows
5
+ *
6
+ * This emulates just-enough poll functionality on Windows to work in the
7
+ * context of the openssl(1) program. This is not a replacement for
8
+ * POSIX.1-2001 poll(2), though it may come closer than I care to admit.
9
+ *
10
+ * Dongsheng Song <dongsheng.song@gmail.com>
11
+ * Brent Cook <bcook@openbsd.org>
12
+ */
13
+
14
+ #include <conio.h>
15
+ #include <errno.h>
16
+ #include <io.h>
17
+ #include <poll.h>
18
+ #include <ws2tcpip.h>
19
+
20
+ static int
21
+ conn_is_closed(int fd)
22
+ {
23
+ char buf[1];
24
+ int ret = recv(fd, buf, 1, MSG_PEEK);
25
+ if (ret == -1) {
26
+ switch (WSAGetLastError()) {
27
+ case WSAECONNABORTED:
28
+ case WSAECONNRESET:
29
+ case WSAENETRESET:
30
+ case WSAESHUTDOWN:
31
+ return 1;
32
+ }
33
+ }
34
+ return 0;
35
+ }
36
+
37
+ static int
38
+ conn_has_oob_data(int fd)
39
+ {
40
+ char buf[1];
41
+ return (recv(fd, buf, 1, MSG_PEEK | MSG_OOB) == 1);
42
+ }
43
+
44
+ static int
45
+ is_socket(int fd)
46
+ {
47
+ if (fd < 3)
48
+ return 0;
49
+ WSANETWORKEVENTS events;
50
+ return (WSAEnumNetworkEvents((SOCKET)fd, NULL, &events) == 0);
51
+ }
52
+
53
+ static int
54
+ compute_select_revents(int fd, short events,
55
+ fd_set *rfds, fd_set *wfds, fd_set *efds)
56
+ {
57
+ int rc = 0;
58
+
59
+ if ((events & (POLLIN | POLLRDNORM | POLLRDBAND)) &&
60
+ FD_ISSET(fd, rfds)) {
61
+ if (conn_is_closed(fd))
62
+ rc |= POLLHUP;
63
+ else
64
+ rc |= POLLIN | POLLRDNORM;
65
+ }
66
+
67
+ if ((events & (POLLOUT | POLLWRNORM | POLLWRBAND)) &&
68
+ FD_ISSET(fd, wfds))
69
+ rc |= POLLOUT;
70
+
71
+ if (FD_ISSET(fd, efds)) {
72
+ if (conn_is_closed(fd))
73
+ rc |= POLLHUP;
74
+ else if (conn_has_oob_data(fd))
75
+ rc |= POLLRDBAND | POLLPRI;
76
+ }
77
+
78
+ return rc;
79
+ }
80
+
81
+ static int
82
+ compute_wait_revents(HANDLE h, short events, int object, int wait_rc)
83
+ {
84
+ int rc = 0;
85
+ INPUT_RECORD record;
86
+ DWORD num_read;
87
+
88
+ /*
89
+ * Assume we can always write to file handles (probably a bad
90
+ * assumption but works for now, at least it doesn't block).
91
+ */
92
+ if (events & (POLLOUT | POLLWRNORM))
93
+ rc |= POLLOUT;
94
+
95
+ /*
96
+ * Check if this handle was signaled by WaitForMultipleObjects
97
+ */
98
+ if (wait_rc >= WAIT_OBJECT_0 && (object == (wait_rc - WAIT_OBJECT_0))
99
+ && (events & (POLLIN | POLLRDNORM))) {
100
+
101
+ /*
102
+ * Check if this file is stdin, and if so, if it is a console.
103
+ */
104
+ if (h == GetStdHandle(STD_INPUT_HANDLE) &&
105
+ PeekConsoleInput(h, &record, 1, &num_read) == 1) {
106
+
107
+ /*
108
+ * Handle the input console buffer differently,
109
+ * since it can signal on other events like
110
+ * window and mouse, but read can still block.
111
+ */
112
+ if (record.EventType == KEY_EVENT &&
113
+ record.Event.KeyEvent.bKeyDown) {
114
+ rc |= POLLIN;
115
+ } else {
116
+ /*
117
+ * Flush non-character events from the
118
+ * console buffer.
119
+ */
120
+ ReadConsoleInput(h, &record, 1, &num_read);
121
+ }
122
+ } else {
123
+ rc |= POLLIN;
124
+ }
125
+ }
126
+
127
+ return rc;
128
+ }
129
+
130
+ static int
131
+ wsa_select_errno(int err)
132
+ {
133
+ switch (err) {
134
+ case WSAEINTR:
135
+ case WSAEINPROGRESS:
136
+ errno = EINTR;
137
+ break;
138
+ case WSAEFAULT:
139
+ /*
140
+ * Windows uses WSAEFAULT for both resource allocation failures
141
+ * and arguments not being contained in the user's address
142
+ * space. So, we have to choose EFAULT or ENOMEM.
143
+ */
144
+ errno = EFAULT;
145
+ break;
146
+ case WSAEINVAL:
147
+ errno = EINVAL;
148
+ break;
149
+ case WSANOTINITIALISED:
150
+ errno = EPERM;
151
+ break;
152
+ case WSAENETDOWN:
153
+ errno = ENOMEM;
154
+ break;
155
+ }
156
+ return -1;
157
+ }
158
+
159
+ int
160
+ poll(struct pollfd *pfds, nfds_t nfds, int timeout_ms)
161
+ {
162
+ nfds_t i;
163
+ int timespent_ms, looptime_ms;
164
+
165
+ /*
166
+ * select machinery
167
+ */
168
+ fd_set rfds, wfds, efds;
169
+ int rc;
170
+ int num_sockets;
171
+
172
+ /*
173
+ * wait machinery
174
+ */
175
+ DWORD wait_rc;
176
+ HANDLE handles[FD_SETSIZE];
177
+ int num_handles;
178
+
179
+ if (pfds == NULL) {
180
+ errno = EINVAL;
181
+ return -1;
182
+ }
183
+
184
+ if (nfds <= 0) {
185
+ return 0;
186
+ }
187
+
188
+ FD_ZERO(&rfds);
189
+ FD_ZERO(&wfds);
190
+ FD_ZERO(&efds);
191
+ num_sockets = 0;
192
+ num_handles = 0;
193
+
194
+ for (i = 0; i < nfds; i++) {
195
+ if ((int)pfds[i].fd < 0)
196
+ continue;
197
+
198
+ if (is_socket(pfds[i].fd)) {
199
+ if (num_sockets >= FD_SETSIZE) {
200
+ errno = EINVAL;
201
+ return -1;
202
+ }
203
+
204
+ FD_SET(pfds[i].fd, &efds);
205
+
206
+ if (pfds[i].events &
207
+ (POLLIN | POLLRDNORM | POLLRDBAND)) {
208
+ FD_SET(pfds[i].fd, &rfds);
209
+ }
210
+
211
+ if (pfds[i].events &
212
+ (POLLOUT | POLLWRNORM | POLLWRBAND)) {
213
+ FD_SET(pfds[i].fd, &wfds);
214
+ }
215
+ num_sockets++;
216
+
217
+ } else {
218
+ if (num_handles >= FD_SETSIZE) {
219
+ errno = EINVAL;
220
+ return -1;
221
+ }
222
+
223
+ handles[num_handles++] =
224
+ (HANDLE)_get_osfhandle(pfds[i].fd);
225
+ }
226
+ }
227
+
228
+ /*
229
+ * Determine if the files, pipes, sockets, consoles, etc. have signaled.
230
+ *
231
+ * Do this by alternating a loop between WaitForMultipleObjects for
232
+ * non-sockets and and select for sockets.
233
+ *
234
+ * I tried to implement this all in terms of WaitForMultipleObjects
235
+ * with a select-based 'poll' of the sockets at the end to get extra
236
+ * specific socket status.
237
+ *
238
+ * However, the cost of setting up an event handle for each socket and
239
+ * cleaning them up reliably was pretty high. Since the event handle
240
+ * associated with a socket is also global, creating a new one here
241
+ * cancels one that may exist externally to this function.
242
+ *
243
+ * At any rate, even if global socket event handles were not an issue,
244
+ * the 'FD_WRITE' status of a socket event handle does not behave in an
245
+ * expected fashion, being triggered by an edge on a write buffer rather
246
+ * than simply triggering if there is space available.
247
+ */
248
+ timespent_ms = 0;
249
+ wait_rc = WAIT_FAILED;
250
+
251
+ looptime_ms = (timeout_ms > 100 || timeout_ms == -1) ? 100 : timeout_ms;
252
+ if (timeout_ms == -1)
253
+ timeout_ms = INFINITE;
254
+
255
+ do {
256
+ TIMEVAL tv;
257
+ tv.tv_sec = 0;
258
+ tv.tv_usec = looptime_ms * 1000;
259
+ int handle_signaled = 0;
260
+
261
+ /*
262
+ * Check if any file handles have signaled
263
+ */
264
+ if (num_handles) {
265
+ wait_rc = WaitForMultipleObjects(num_handles, handles,
266
+ FALSE, 0);
267
+ if (wait_rc == WAIT_FAILED) {
268
+ /*
269
+ * The documentation for WaitForMultipleObjects
270
+ * does not specify what values GetLastError
271
+ * may return here. Rather than enumerate
272
+ * badness like for wsa_select_errno, assume a
273
+ * general errno value.
274
+ */
275
+ errno = ENOMEM;
276
+ return 0;
277
+ }
278
+ }
279
+
280
+ /*
281
+ * If we signaled on a file handle, don't wait on the sockets.
282
+ */
283
+ if (wait_rc >= WAIT_OBJECT_0 &&
284
+ (wait_rc <= WAIT_OBJECT_0 + num_handles - 1)) {
285
+ tv.tv_usec = 0;
286
+ handle_signaled = 1;
287
+ }
288
+
289
+ /*
290
+ * Check if any sockets have signaled
291
+ */
292
+ rc = select(0, &rfds, &wfds, &efds, &tv);
293
+ if (!handle_signaled && rc == SOCKET_ERROR)
294
+ return wsa_select_errno(WSAGetLastError());
295
+
296
+ if (handle_signaled || (num_sockets && rc > 0))
297
+ break;
298
+
299
+ timespent_ms += looptime_ms;
300
+
301
+ } while (timespent_ms < timeout_ms);
302
+
303
+ rc = 0;
304
+ num_handles = 0;
305
+ for (i = 0; i < nfds; i++) {
306
+ pfds[i].revents = 0;
307
+
308
+ if ((int)pfds[i].fd < 0)
309
+ continue;
310
+
311
+ if (is_socket(pfds[i].fd)) {
312
+
313
+ pfds[i].revents = compute_select_revents(pfds[i].fd,
314
+ pfds[i].events, &rfds, &wfds, &efds);
315
+
316
+ } else {
317
+ pfds[i].revents = compute_wait_revents(
318
+ handles[num_handles], pfds[i].events, num_handles,
319
+ wait_rc);
320
+ num_handles++;
321
+ }
322
+
323
+ if (pfds[i].revents)
324
+ rc++;
325
+ }
326
+
327
+ return rc;
328
+ }
329
+
@@ -0,0 +1,53 @@
1
+ image:
2
+ - Visual Studio 2019
3
+
4
+ environment:
5
+ PATH: C:\msys64\usr\bin;C:\msys64\mingw64\bin;C:\Windows\System32;C:\Windows;%PATH%
6
+
7
+ matrix:
8
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
9
+ GENERATOR: Visual Studio 16 2019
10
+ ARCHITECTURE: Win32
11
+ CONFIG: Release
12
+ SHARED_LIBS: ON
13
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
14
+ GENERATOR: Visual Studio 16 2019
15
+ ARCHITECTURE: Win32
16
+ CONFIG: Release
17
+ SHARED_LIBS: OFF
18
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
19
+ GENERATOR: Visual Studio 16 2019
20
+ ARCHITECTURE: x64
21
+ CONFIG: Release
22
+ SHARED_LIBS: ON
23
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
24
+ GENERATOR: Visual Studio 16 2019
25
+ ARCHITECTURE: x64
26
+ CONFIG: Release
27
+ SHARED_LIBS: OFF
28
+
29
+ init:
30
+ # update mysy2
31
+ - C:\msys64\usr\bin\bash -lc "pacman --needed --noconfirm -Sy pacman-mirrors"
32
+ - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syu"
33
+ - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Sy autoconf perl git automake libtool"
34
+
35
+ before_build:
36
+ - bash autogen.sh
37
+ - mkdir build
38
+ - cd build
39
+ - cmake .. -G "%GENERATOR%" -A "%ARCHITECTURE%" -DBUILD_SHARED_LIBS=%SHARED_LIBS% -DCMAKE_INSTALL_PREFIX=../local
40
+
41
+ build_script:
42
+ - cmake --build . --config %CONFIG%
43
+
44
+ test_script:
45
+ - ctest -C %CONFIG% --timeout 150 --output-on-failure
46
+
47
+ on_failure:
48
+ - 7z a Testing.zip Testing
49
+ - appveyor PushArtifact Testing.zip
50
+
51
+ artifacts:
52
+ - path: build
53
+ type: zip
@@ -0,0 +1,15 @@
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ ./update.sh
5
+ mkdir -p m4
6
+ autoreconf -i -f
7
+
8
+ # Patch libtool 2.4.2 to pass -fstack-protector as a linker argument
9
+ sed 's/-fuse-linker-plugin)/-fuse-linker-plugin|-fstack-protector*)/' \
10
+ ltmain.sh > ltmain.sh.fixed
11
+ mv -f ltmain.sh.fixed ltmain.sh
12
+
13
+ # Update config scripts and fixup permissions
14
+ find . ! -perm -u=w -exec chmod u+w {} \;
15
+ cp scripts/config.* .