uringmachine 0.15 → 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 (261) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +3 -0
  3. data/.gitmodules +4 -0
  4. data/CHANGELOG.md +12 -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_stream_class.c +0 -1
  11. data/ext/um/um_utils.c +38 -15
  12. data/lib/uringmachine/version.rb +1 -1
  13. data/lib/uringmachine.rb +4 -3
  14. data/test/test_um.rb +76 -0
  15. data/vendor/libressl/.github/scripts/changelog.sh +74 -0
  16. data/vendor/libressl/.github/workflows/android.yml +35 -0
  17. data/vendor/libressl/.github/workflows/cifuzz.yml +33 -0
  18. data/vendor/libressl/.github/workflows/cmake-config.yml +98 -0
  19. data/vendor/libressl/.github/workflows/coverity.yml +69 -0
  20. data/vendor/libressl/.github/workflows/emscripten.yml +71 -0
  21. data/vendor/libressl/.github/workflows/fedora-rawhide.yml +39 -0
  22. data/vendor/libressl/.github/workflows/freebsd.yml +71 -0
  23. data/vendor/libressl/.github/workflows/linux.yml +71 -0
  24. data/vendor/libressl/.github/workflows/macos.yml +37 -0
  25. data/vendor/libressl/.github/workflows/release.yml +81 -0
  26. data/vendor/libressl/.github/workflows/rust-openssl.yml +47 -0
  27. data/vendor/libressl/.github/workflows/solaris.yml +37 -0
  28. data/vendor/libressl/.github/workflows/windows.yml +70 -0
  29. data/vendor/libressl/.gitignore +333 -0
  30. data/vendor/libressl/CMakeLists.txt +581 -0
  31. data/vendor/libressl/COPYING +133 -0
  32. data/vendor/libressl/ChangeLog +3280 -0
  33. data/vendor/libressl/FindLibreSSL.cmake +232 -0
  34. data/vendor/libressl/LibreSSLConfig.cmake.in +36 -0
  35. data/vendor/libressl/Makefile.am +60 -0
  36. data/vendor/libressl/Makefile.am.common +20 -0
  37. data/vendor/libressl/OPENBSD_BRANCH +1 -0
  38. data/vendor/libressl/README.md +238 -0
  39. data/vendor/libressl/README.mingw.md +43 -0
  40. data/vendor/libressl/apps/CMakeLists.txt +18 -0
  41. data/vendor/libressl/apps/Makefile.am +5 -0
  42. data/vendor/libressl/apps/nc/CMakeLists.txt +67 -0
  43. data/vendor/libressl/apps/nc/Makefile.am +64 -0
  44. data/vendor/libressl/apps/nc/compat/accept4.c +17 -0
  45. data/vendor/libressl/apps/nc/compat/readpassphrase.c +205 -0
  46. data/vendor/libressl/apps/nc/compat/socket.c +29 -0
  47. data/vendor/libressl/apps/nc/compat/sys/socket.h +30 -0
  48. data/vendor/libressl/apps/ocspcheck/CMakeLists.txt +44 -0
  49. data/vendor/libressl/apps/ocspcheck/Makefile.am +45 -0
  50. data/vendor/libressl/apps/ocspcheck/compat/.gitignore +0 -0
  51. data/vendor/libressl/apps/openssl/CMakeLists.txt +97 -0
  52. data/vendor/libressl/apps/openssl/Makefile.am +108 -0
  53. data/vendor/libressl/apps/openssl/apps_win.c +138 -0
  54. data/vendor/libressl/apps/openssl/certhash_win.c +13 -0
  55. data/vendor/libressl/apps/openssl/compat/clock_gettime_osx.c +26 -0
  56. data/vendor/libressl/apps/openssl/compat/poll_win.c +329 -0
  57. data/vendor/libressl/appveyor.yml +53 -0
  58. data/vendor/libressl/autogen.sh +15 -0
  59. data/vendor/libressl/check-release.sh +86 -0
  60. data/vendor/libressl/cmake_export_symbol.cmake +71 -0
  61. data/vendor/libressl/cmake_uninstall.cmake.in +36 -0
  62. data/vendor/libressl/config +17 -0
  63. data/vendor/libressl/configure.ac +165 -0
  64. data/vendor/libressl/crypto/CMakeLists.txt +863 -0
  65. data/vendor/libressl/crypto/Makefile.am +962 -0
  66. data/vendor/libressl/crypto/Makefile.am.arc4random +46 -0
  67. data/vendor/libressl/crypto/Makefile.am.elf-mips +14 -0
  68. data/vendor/libressl/crypto/Makefile.am.elf-mips64 +14 -0
  69. data/vendor/libressl/crypto/Makefile.am.elf-x86_64 +35 -0
  70. data/vendor/libressl/crypto/Makefile.am.macosx-x86_64 +35 -0
  71. data/vendor/libressl/crypto/Makefile.am.masm-x86_64 +22 -0
  72. data/vendor/libressl/crypto/Makefile.am.mingw64-x86_64 +23 -0
  73. data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_darwin.c +60 -0
  74. data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_linux.c +62 -0
  75. data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_none.c +26 -0
  76. data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_windows.c +36 -0
  77. data/vendor/libressl/crypto/arch/loongarch64/crypto_arch.h +21 -0
  78. data/vendor/libressl/crypto/arch/mips/crypto_arch.h +21 -0
  79. data/vendor/libressl/crypto/bn/arch/loongarch64/bn_arch.h +23 -0
  80. data/vendor/libressl/crypto/bn/arch/mips/bn_arch.h +24 -0
  81. data/vendor/libressl/crypto/compat/.gitignore +31 -0
  82. data/vendor/libressl/crypto/compat/arc4random.h +41 -0
  83. data/vendor/libressl/crypto/compat/b_win.c +55 -0
  84. data/vendor/libressl/crypto/compat/bsd-asprintf.c +96 -0
  85. data/vendor/libressl/crypto/compat/crypto_lock_win.c +56 -0
  86. data/vendor/libressl/crypto/compat/explicit_bzero_win.c +13 -0
  87. data/vendor/libressl/crypto/compat/freezero.c +32 -0
  88. data/vendor/libressl/crypto/compat/getdelim.c +78 -0
  89. data/vendor/libressl/crypto/compat/getline.c +40 -0
  90. data/vendor/libressl/crypto/compat/getopt_long.c +528 -0
  91. data/vendor/libressl/crypto/compat/getpagesize.c +18 -0
  92. data/vendor/libressl/crypto/compat/getprogname_linux.c +23 -0
  93. data/vendor/libressl/crypto/compat/getprogname_unimpl.c +7 -0
  94. data/vendor/libressl/crypto/compat/getprogname_windows.c +13 -0
  95. data/vendor/libressl/crypto/compat/posix_win.c +296 -0
  96. data/vendor/libressl/crypto/compat/syslog_r.c +19 -0
  97. data/vendor/libressl/crypto/compat/ui_openssl_win.c +334 -0
  98. data/vendor/libressl/dist.sh +22 -0
  99. data/vendor/libressl/gen-coverage-report.sh +58 -0
  100. data/vendor/libressl/gen-openbsd-tags.sh +20 -0
  101. data/vendor/libressl/include/CMakeLists.txt +61 -0
  102. data/vendor/libressl/include/Makefile.am +79 -0
  103. data/vendor/libressl/include/arch/loongarch64/opensslconf.h +150 -0
  104. data/vendor/libressl/include/arch/mips/opensslconf.h +150 -0
  105. data/vendor/libressl/include/compat/arpa/inet.h +15 -0
  106. data/vendor/libressl/include/compat/arpa/nameser.h +25 -0
  107. data/vendor/libressl/include/compat/cet.h +19 -0
  108. data/vendor/libressl/include/compat/dirent.h +17 -0
  109. data/vendor/libressl/include/compat/dirent_msvc.h +611 -0
  110. data/vendor/libressl/include/compat/endian.h +161 -0
  111. data/vendor/libressl/include/compat/err.h +95 -0
  112. data/vendor/libressl/include/compat/fcntl.h +32 -0
  113. data/vendor/libressl/include/compat/getopt.h +50 -0
  114. data/vendor/libressl/include/compat/limits.h +25 -0
  115. data/vendor/libressl/include/compat/netdb.h +10 -0
  116. data/vendor/libressl/include/compat/netinet/in.h +19 -0
  117. data/vendor/libressl/include/compat/netinet/ip.h +49 -0
  118. data/vendor/libressl/include/compat/netinet/tcp.h +10 -0
  119. data/vendor/libressl/include/compat/poll.h +63 -0
  120. data/vendor/libressl/include/compat/pthread.h +122 -0
  121. data/vendor/libressl/include/compat/readpassphrase.h +44 -0
  122. data/vendor/libressl/include/compat/resolv.h +24 -0
  123. data/vendor/libressl/include/compat/stdint.h +31 -0
  124. data/vendor/libressl/include/compat/stdio.h +65 -0
  125. data/vendor/libressl/include/compat/stdlib.h +57 -0
  126. data/vendor/libressl/include/compat/string.h +98 -0
  127. data/vendor/libressl/include/compat/sys/_null.h +18 -0
  128. data/vendor/libressl/include/compat/sys/ioctl.h +11 -0
  129. data/vendor/libressl/include/compat/sys/mman.h +19 -0
  130. data/vendor/libressl/include/compat/sys/param.h +15 -0
  131. data/vendor/libressl/include/compat/sys/queue.h +536 -0
  132. data/vendor/libressl/include/compat/sys/select.h +10 -0
  133. data/vendor/libressl/include/compat/sys/socket.h +18 -0
  134. data/vendor/libressl/include/compat/sys/stat.h +129 -0
  135. data/vendor/libressl/include/compat/sys/time.h +37 -0
  136. data/vendor/libressl/include/compat/sys/tree.h +1006 -0
  137. data/vendor/libressl/include/compat/sys/types.h +69 -0
  138. data/vendor/libressl/include/compat/sys/uio.h +17 -0
  139. data/vendor/libressl/include/compat/syslog.h +38 -0
  140. data/vendor/libressl/include/compat/time.h +59 -0
  141. data/vendor/libressl/include/compat/unistd.h +83 -0
  142. data/vendor/libressl/include/compat/win32netcompat.h +57 -0
  143. data/vendor/libressl/include/openssl/Makefile.am.tpl +45 -0
  144. data/vendor/libressl/libcrypto.pc.in +28 -0
  145. data/vendor/libressl/libressl.pub +2 -0
  146. data/vendor/libressl/libssl.pc.in +28 -0
  147. data/vendor/libressl/libtls.pc.in +28 -0
  148. data/vendor/libressl/m4/ax_add_fortify_source.m4 +80 -0
  149. data/vendor/libressl/m4/ax_check_compile_flag.m4 +53 -0
  150. data/vendor/libressl/m4/check-hardening-options.m4 +110 -0
  151. data/vendor/libressl/m4/check-libc.m4 +189 -0
  152. data/vendor/libressl/m4/check-os-options.m4 +181 -0
  153. data/vendor/libressl/m4/disable-compiler-warnings.m4 +44 -0
  154. data/vendor/libressl/man/CMakeLists.txt +26 -0
  155. data/vendor/libressl/man/links +2780 -0
  156. data/vendor/libressl/man/update_links.sh +25 -0
  157. data/vendor/libressl/openssl.pc.in +11 -0
  158. data/vendor/libressl/patches/bn_shift.patch +34 -0
  159. data/vendor/libressl/patches/crypto_arch.h.patch +34 -0
  160. data/vendor/libressl/patches/crypto_namespace.h.patch +22 -0
  161. data/vendor/libressl/patches/netcat.c.patch +178 -0
  162. data/vendor/libressl/patches/openssl.c.patch +12 -0
  163. data/vendor/libressl/patches/opensslfeatures.h.patch +49 -0
  164. data/vendor/libressl/patches/patch-amd64-crypto-cpu-caps.c.patch +20 -0
  165. data/vendor/libressl/patches/patch-i386-crypto-cpu-caps.c.patch +20 -0
  166. data/vendor/libressl/patches/speed.c.patch +114 -0
  167. data/vendor/libressl/patches/ssl_namespace.h.patch +21 -0
  168. data/vendor/libressl/patches/tls.h.patch +16 -0
  169. data/vendor/libressl/patches/tls_config.c.patch +15 -0
  170. data/vendor/libressl/patches/win32_amd64_bn_arch.h.patch +28 -0
  171. data/vendor/libressl/patches/windows_headers.patch +80 -0
  172. data/vendor/libressl/scripts/config.guess +1774 -0
  173. data/vendor/libressl/scripts/config.sub +1907 -0
  174. data/vendor/libressl/scripts/i686-w64-mingw32.cmake +9 -0
  175. data/vendor/libressl/scripts/test +210 -0
  176. data/vendor/libressl/scripts/wrap-compiler-for-flag-check +31 -0
  177. data/vendor/libressl/scripts/x86_64-w64-mingw32.cmake +9 -0
  178. data/vendor/libressl/ssl/CMakeLists.txt +183 -0
  179. data/vendor/libressl/ssl/Makefile.am +187 -0
  180. data/vendor/libressl/tests/CMakeLists.txt +970 -0
  181. data/vendor/libressl/tests/Makefile.am +944 -0
  182. data/vendor/libressl/tests/aeadtest.sh +30 -0
  183. data/vendor/libressl/tests/arc4randomforktest.sh +21 -0
  184. data/vendor/libressl/tests/asn1time_small.test +10 -0
  185. data/vendor/libressl/tests/cmake/CMakeLists.txt +52 -0
  186. data/vendor/libressl/tests/cmake/crypto.c +7 -0
  187. data/vendor/libressl/tests/cmake/ssl.c +6 -0
  188. data/vendor/libressl/tests/cmake/tls.c +6 -0
  189. data/vendor/libressl/tests/compat/pipe2.c +186 -0
  190. data/vendor/libressl/tests/dtlstest.sh +28 -0
  191. data/vendor/libressl/tests/evptest.sh +22 -0
  192. data/vendor/libressl/tests/keypairtest.sh +27 -0
  193. data/vendor/libressl/tests/mlkem_tests.sh +39 -0
  194. data/vendor/libressl/tests/ocsptest.bat +25 -0
  195. data/vendor/libressl/tests/ocsptest.sh +23 -0
  196. data/vendor/libressl/tests/openssl.cnf +29 -0
  197. data/vendor/libressl/tests/optionstest.c +381 -0
  198. data/vendor/libressl/tests/pidwraptest.c +85 -0
  199. data/vendor/libressl/tests/pidwraptest.sh +26 -0
  200. data/vendor/libressl/tests/quictest.bat +27 -0
  201. data/vendor/libressl/tests/quictest.sh +30 -0
  202. data/vendor/libressl/tests/renegotiation_test.bat +27 -0
  203. data/vendor/libressl/tests/renegotiation_test.sh +30 -0
  204. data/vendor/libressl/tests/rfc5280time_small.test +10 -0
  205. data/vendor/libressl/tests/servertest.bat +27 -0
  206. data/vendor/libressl/tests/servertest.sh +30 -0
  207. data/vendor/libressl/tests/shutdowntest.bat +27 -0
  208. data/vendor/libressl/tests/shutdowntest.sh +30 -0
  209. data/vendor/libressl/tests/ssltest.bat +32 -0
  210. data/vendor/libressl/tests/ssltest.sh +48 -0
  211. data/vendor/libressl/tests/testdsa.bat +47 -0
  212. data/vendor/libressl/tests/testdsa.sh +57 -0
  213. data/vendor/libressl/tests/testenc.bat +85 -0
  214. data/vendor/libressl/tests/testenc.sh +93 -0
  215. data/vendor/libressl/tests/testrsa.bat +47 -0
  216. data/vendor/libressl/tests/testrsa.sh +57 -0
  217. data/vendor/libressl/tests/testssl.bat +171 -0
  218. data/vendor/libressl/tests/tlstest.bat +27 -0
  219. data/vendor/libressl/tests/tlstest.sh +28 -0
  220. data/vendor/libressl/tls/CMakeLists.txt +125 -0
  221. data/vendor/libressl/tls/Makefile.am +76 -0
  222. data/vendor/libressl/tls/compat/ftruncate.c +17 -0
  223. data/vendor/libressl/tls/compat/pread.c +29 -0
  224. data/vendor/libressl/tls/compat/pwrite.c +29 -0
  225. data/vendor/libressl/update.sh +460 -0
  226. data/vendor/liburing/.github/workflows/ci.yml +8 -0
  227. data/vendor/liburing/configure +23 -2
  228. data/vendor/liburing/examples/helpers.c +1 -1
  229. data/vendor/liburing/examples/helpers.h +1 -1
  230. data/vendor/liburing/examples/reg-wait.c +3 -3
  231. data/vendor/liburing/examples/zcrx.c +5 -5
  232. data/vendor/liburing/liburing.spec +1 -1
  233. data/vendor/liburing/src/include/liburing/io_uring.h +16 -0
  234. data/vendor/liburing/src/include/liburing.h +20 -4
  235. data/vendor/liburing/src/lib.h +2 -4
  236. data/vendor/liburing/src/liburing-ffi.map +7 -0
  237. data/vendor/liburing/src/liburing.map +7 -0
  238. data/vendor/liburing/src/register.c +5 -0
  239. data/vendor/liburing/src/sanitize.c +5 -4
  240. data/vendor/liburing/src/setup.c +43 -28
  241. data/vendor/liburing/test/Makefile +7 -0
  242. data/vendor/liburing/test/cmd-discard.c +2 -2
  243. data/vendor/liburing/test/evfd-short-read.c +84 -0
  244. data/vendor/liburing/test/fdinfo-sqpoll.c +117 -0
  245. data/vendor/liburing/test/fdinfo.c +1 -1
  246. data/vendor/liburing/test/fixed-buf-merge.c +2 -2
  247. data/vendor/liburing/test/futex-kill.c +135 -0
  248. data/vendor/liburing/test/helpers.c +1 -1
  249. data/vendor/liburing/test/helpers.h +1 -1
  250. data/vendor/liburing/test/init-mem.c +50 -12
  251. data/vendor/liburing/test/io_uring_passthrough.c +25 -6
  252. data/vendor/liburing/test/msg-ring.c +123 -9
  253. data/vendor/liburing/test/recv-bundle-short-ooo.c +16 -1
  254. data/vendor/liburing/test/recv-inc-ooo.c +411 -0
  255. data/vendor/liburing/test/recv-mshot-fair.c +513 -0
  256. data/vendor/liburing/test/reg-wait.c +14 -14
  257. data/vendor/liburing/test/send-zerocopy.c +4 -4
  258. data/vendor/liburing/test/timerfd-short-read.c +81 -0
  259. data/vendor/liburing/test/timestamp.c +382 -0
  260. data/vendor/liburing/test/zcrx.c +22 -22
  261. metadata +222 -2
@@ -0,0 +1,161 @@
1
+ /*
2
+ * Public domain
3
+ * endian.h compatibility shim
4
+ */
5
+
6
+ #ifndef LIBCRYPTOCOMPAT_BYTE_ORDER_H_
7
+ #define LIBCRYPTOCOMPAT_BYTE_ORDER_H_
8
+
9
+ #if defined(_WIN32)
10
+
11
+ #define LITTLE_ENDIAN 1234
12
+ #define BIG_ENDIAN 4321
13
+ #define PDP_ENDIAN 3412
14
+
15
+ /*
16
+ * Use GCC compiler defines to determine endianness.
17
+ */
18
+ #if defined(__BYTE_ORDER__)
19
+ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
20
+ #define BYTE_ORDER LITTLE_ENDIAN
21
+ #else
22
+ #define BYTE_ORDER BIG_ENDIAN
23
+ #endif
24
+ #endif
25
+
26
+ /*
27
+ * Use build system defines to determine endianness.
28
+ */
29
+ #if !defined(BYTE_ORDER)
30
+ #if defined(HAVE_LITTLE_ENDIAN)
31
+ #define BYTE_ORDER LITTLE_ENDIAN
32
+ #elif defined(HAVE_BIG_ENDIAN)
33
+ #define BYTE_ORDER BIG_ENDIAN
34
+ #else
35
+ #error "Could not detect endianness."
36
+ #endif
37
+ #endif
38
+
39
+ #elif defined(HAVE_ENDIAN_H)
40
+ #include_next <endian.h>
41
+
42
+ #elif defined(HAVE_MACHINE_ENDIAN_H)
43
+ #include_next <machine/endian.h>
44
+
45
+ #elif defined(__sun) || defined(_AIX) || defined(__hpux)
46
+ #include <arpa/nameser_compat.h>
47
+ #include <sys/types.h>
48
+
49
+ #elif defined(__sgi)
50
+ #include <standards.h>
51
+ #include <sys/endian.h>
52
+
53
+ #endif
54
+
55
+ #ifndef __STRICT_ALIGNMENT
56
+ #define __STRICT_ALIGNMENT
57
+ #if defined(__i386) || defined(__i386__) || defined(__x86_64) || \
58
+ defined(__x86_64__) || defined(__s390__) || defined(__s390x__) || \
59
+ defined(__aarch64__) || \
60
+ ((defined(__arm__) || defined(__arm)) && __ARM_ARCH >= 6)
61
+ #undef __STRICT_ALIGNMENT
62
+ #endif
63
+ #endif
64
+
65
+ #if defined(__APPLE__)
66
+ #include <libkern/OSByteOrder.h>
67
+ #define be16toh(x) OSSwapBigToHostInt16((x))
68
+ #define htobe16(x) OSSwapHostToBigInt16((x))
69
+ #define le32toh(x) OSSwapLittleToHostInt32((x))
70
+ #define be32toh(x) OSSwapBigToHostInt32((x))
71
+ #define htole32(x) OSSwapHostToLittleInt32(x)
72
+ #define htobe32(x) OSSwapHostToBigInt32(x)
73
+ #define htole64(x) OSSwapHostToLittleInt64(x)
74
+ #define htobe64(x) OSSwapHostToBigInt64(x)
75
+ #define le64toh(x) OSSwapLittleToHostInt64(x)
76
+ #define be64toh(x) OSSwapBigToHostInt64(x)
77
+ #endif /* __APPLE__ */
78
+
79
+ #if defined(_WIN32) && !defined(HAVE_ENDIAN_H)
80
+ #include <winsock2.h>
81
+
82
+ #define be16toh(x) ntohs((x))
83
+ #define htobe16(x) htons((x))
84
+ #define le32toh(x) (x)
85
+ #define be32toh(x) ntohl((x))
86
+ #define htole32(x) (x)
87
+ #define htobe32(x) ntohl((x))
88
+ #define be64toh(x) ntohll((x))
89
+
90
+ #if !defined(ntohll)
91
+ #define ntohll(x) \
92
+ ((1 == htonl(1)) \
93
+ ? (x) \
94
+ : ((uint64_t)ntohl((x)&0xFFFFFFFF) << 32) | ntohl((x) >> 32))
95
+ #endif
96
+ #if !defined(htonll)
97
+ #define htonll(x) \
98
+ ((1 == ntohl(1)) \
99
+ ? (x) \
100
+ : ((uint64_t)htonl((x)&0xFFFFFFFF) << 32) | htonl((x) >> 32))
101
+ #endif
102
+
103
+ #define htobe64(x) ntohll((x))
104
+ #define htole64(x) (x)
105
+ #define le64toh(x) (x)
106
+ #endif /* _WIN32 && !HAVE_ENDIAN_H */
107
+
108
+ #ifdef __linux__
109
+ #if !defined(betoh16)
110
+ #define betoh16(x) be16toh(x)
111
+ #endif
112
+ #if !defined(betoh32)
113
+ #define betoh32(x) be32toh(x)
114
+ #endif
115
+ #if !defined(betoh64)
116
+ #define betoh64(x) be64toh(x)
117
+ #endif
118
+ #endif /* __linux__ */
119
+
120
+ #if defined(__FreeBSD__)
121
+ #if !defined(HAVE_ENDIAN_H)
122
+ #include <sys/endian.h>
123
+ #endif
124
+ #if !defined(betoh16)
125
+ #define betoh16(x) be16toh(x)
126
+ #endif
127
+ #if !defined(betoh32)
128
+ #define betoh32(x) be32toh(x)
129
+ #endif
130
+ #if !defined(betoh64)
131
+ #define betoh64(x) be64toh(x)
132
+ #endif
133
+ #endif
134
+
135
+ #if defined(__NetBSD__)
136
+ #if !defined(betoh16)
137
+ #define betoh16(x) be16toh(x)
138
+ #endif
139
+ #if !defined(betoh32)
140
+ #define betoh32(x) be32toh(x)
141
+ #endif
142
+ #if !defined(betoh64)
143
+ #define betoh64(x) be64toh(x)
144
+ #endif
145
+ #endif
146
+
147
+ #if defined(__sun)
148
+ #include <sys/byteorder.h>
149
+ #define be16toh(x) BE_16(x)
150
+ #define htobe16(x) BE_16(x)
151
+ #define le32toh(x) LE_32(x)
152
+ #define be32toh(x) BE_32(x)
153
+ #define htole32(x) LE_32(x)
154
+ #define htobe32(x) BE_32(x)
155
+ #define be64toh(x) BE_64(x)
156
+ #define le64toh(x) LE_64(x)
157
+ #define htole64(x) LE_64(x)
158
+ #define htobe64(x) BE_64(x)
159
+ #endif
160
+
161
+ #endif
@@ -0,0 +1,95 @@
1
+ /*
2
+ * Public domain
3
+ * err.h compatibility shim
4
+ */
5
+
6
+ #ifdef HAVE_ERR_H
7
+
8
+ #include_next <err.h>
9
+
10
+ #else
11
+
12
+ #ifndef LIBCRYPTOCOMPAT_ERR_H
13
+ #define LIBCRYPTOCOMPAT_ERR_H
14
+
15
+ #include <errno.h>
16
+ #include <stdarg.h>
17
+ #include <stdlib.h>
18
+ #include <stdio.h>
19
+ #include <string.h>
20
+
21
+ #if defined(_MSC_VER)
22
+ __declspec(noreturn)
23
+ #else
24
+ __attribute__((noreturn))
25
+ #endif
26
+ static inline void
27
+ err(int eval, const char *fmt, ...)
28
+ {
29
+ int sverrno = errno;
30
+ va_list ap;
31
+
32
+ va_start(ap, fmt);
33
+ if (fmt != NULL) {
34
+ vfprintf(stderr, fmt, ap);
35
+ fprintf(stderr, ": ");
36
+ }
37
+ va_end(ap);
38
+ fprintf(stderr, "%s\n", strerror(sverrno));
39
+ exit(eval);
40
+ }
41
+
42
+ #if defined(_MSC_VER)
43
+ __declspec(noreturn)
44
+ #else
45
+ __attribute__((noreturn))
46
+ #endif
47
+ static inline void
48
+ errx(int eval, const char *fmt, ...)
49
+ {
50
+ va_list ap;
51
+
52
+ va_start(ap, fmt);
53
+ if (fmt != NULL)
54
+ vfprintf(stderr, fmt, ap);
55
+ va_end(ap);
56
+ fprintf(stderr, "\n");
57
+ exit(eval);
58
+ }
59
+
60
+ static inline void
61
+ warn(const char *fmt, ...)
62
+ {
63
+ int sverrno = errno;
64
+ va_list ap;
65
+
66
+ va_start(ap, fmt);
67
+ if (fmt != NULL) {
68
+ vfprintf(stderr, fmt, ap);
69
+ fprintf(stderr, ": ");
70
+ }
71
+ va_end(ap);
72
+ fprintf(stderr, "%s\n", strerror(sverrno));
73
+ }
74
+
75
+ static inline void
76
+ vwarnx(const char *fmt, va_list args)
77
+ {
78
+ if (fmt != NULL)
79
+ vfprintf(stderr, fmt, args);
80
+ fprintf(stderr, "\n");
81
+ }
82
+
83
+ static inline void
84
+ warnx(const char *fmt, ...)
85
+ {
86
+ va_list ap;
87
+
88
+ va_start(ap, fmt);
89
+ vwarnx(fmt, ap);
90
+ va_end(ap);
91
+ }
92
+
93
+ #endif
94
+
95
+ #endif
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Public domain
3
+ * fcntl.h compatibility shim
4
+ */
5
+
6
+ #ifndef _WIN32
7
+ #include_next <fcntl.h>
8
+ #else
9
+
10
+ #ifdef _MSC_VER
11
+ #if _MSC_VER >= 1900
12
+ #include <../ucrt/fcntl.h>
13
+ #else
14
+ #include <../include/fcntl.h>
15
+ #endif
16
+ #else
17
+ #include_next <fcntl.h>
18
+ #endif
19
+
20
+ #endif
21
+
22
+ #ifndef O_NONBLOCK
23
+ #define O_NONBLOCK 0x100000
24
+ #endif
25
+
26
+ #ifndef O_CLOEXEC
27
+ #define O_CLOEXEC 0x200000
28
+ #endif
29
+
30
+ #ifndef FD_CLOEXEC
31
+ #define FD_CLOEXEC 1
32
+ #endif
@@ -0,0 +1,50 @@
1
+ /* $OpenBSD: getopt.h,v 1.3 2013/11/22 21:32:49 millert Exp $ */
2
+ /* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */
3
+
4
+ /*-
5
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
6
+ * All rights reserved.
7
+ *
8
+ * This code is derived from software contributed to The NetBSD Foundation
9
+ * by Dieter Baron and Thomas Klausner.
10
+ *
11
+ * Redistribution and use in source and binary forms, with or without
12
+ * modification, are permitted provided that the following conditions
13
+ * are met:
14
+ * 1. Redistributions of source code must retain the above copyright
15
+ * notice, this list of conditions and the following disclaimer.
16
+ * 2. Redistributions in binary form must reproduce the above copyright
17
+ * notice, this list of conditions and the following disclaimer in the
18
+ * documentation and/or other materials provided with the distribution.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
+ * POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ #ifdef HAVE_GETOPT
34
+
35
+ #include_next <getopt.h>
36
+
37
+ #else
38
+
39
+ #ifndef _GETOPT_DEFINED_
40
+ #define _GETOPT_DEFINED_
41
+ int getopt(int, char * const *, const char *);
42
+
43
+ extern char *optarg; /* getopt(3) external variables */
44
+ extern int opterr;
45
+ extern int optind;
46
+ extern int optopt;
47
+ extern int optreset;
48
+ #endif
49
+
50
+ #endif /* HAVE_GETOPT */
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Public domain
3
+ * limits.h compatibility shim
4
+ */
5
+
6
+ #ifdef _MSC_VER
7
+ #include <../include/limits.h>
8
+ #if _MSC_VER >= 1900
9
+ #include <../ucrt/stdlib.h>
10
+ #else
11
+ #include <../include/stdlib.h>
12
+ #endif
13
+ #ifndef PATH_MAX
14
+ #define PATH_MAX _MAX_PATH
15
+ #endif
16
+ #else
17
+ #include_next <limits.h>
18
+ #endif
19
+
20
+ #ifdef __hpux
21
+ #include <sys/param.h>
22
+ #ifndef PATH_MAX
23
+ #define PATH_MAX MAXPATHLEN
24
+ #endif
25
+ #endif
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Public domain
3
+ * netdb.h compatibility shim
4
+ */
5
+
6
+ #ifndef _WIN32
7
+ #include_next <netdb.h>
8
+ #else
9
+ #include <win32netcompat.h>
10
+ #endif
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Public domain
3
+ * netinet/in.h compatibility shim
4
+ */
5
+
6
+ #ifndef _WIN32
7
+ #include_next <netinet/in.h>
8
+ #else
9
+ #include <win32netcompat.h>
10
+ #endif
11
+
12
+ #ifndef LIBCRYPTOCOMPAT_NETINET_IN_H
13
+ #define LIBCRYPTOCOMPAT_NETINET_IN_H
14
+
15
+ #ifdef __ANDROID__
16
+ typedef uint16_t in_port_t;
17
+ #endif
18
+
19
+ #endif
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Public domain
3
+ * netinet/ip.h compatibility shim
4
+ */
5
+
6
+ #if defined(__hpux)
7
+ #include <netinet/in_systm.h>
8
+ #endif
9
+
10
+ #ifndef _WIN32
11
+ #ifdef HAVE_NETINET_IP_H
12
+ #include_next <netinet/ip.h>
13
+ #endif
14
+ #else
15
+ #include <win32netcompat.h>
16
+ #endif
17
+
18
+ /*
19
+ * Definitions for DiffServ Codepoints as per RFC2474
20
+ */
21
+ #ifndef IPTOS_DSCP_CS0
22
+ #define IPTOS_DSCP_CS0 0x00
23
+ #define IPTOS_DSCP_CS1 0x20
24
+ #define IPTOS_DSCP_CS2 0x40
25
+ #define IPTOS_DSCP_CS3 0x60
26
+ #define IPTOS_DSCP_CS4 0x80
27
+ #define IPTOS_DSCP_CS5 0xa0
28
+ #define IPTOS_DSCP_CS6 0xc0
29
+ #define IPTOS_DSCP_CS7 0xe0
30
+ #endif
31
+
32
+ #ifndef IPTOS_DSCP_AF11
33
+ #define IPTOS_DSCP_AF11 0x28
34
+ #define IPTOS_DSCP_AF12 0x30
35
+ #define IPTOS_DSCP_AF13 0x38
36
+ #define IPTOS_DSCP_AF21 0x48
37
+ #define IPTOS_DSCP_AF22 0x50
38
+ #define IPTOS_DSCP_AF23 0x58
39
+ #define IPTOS_DSCP_AF31 0x68
40
+ #define IPTOS_DSCP_AF32 0x70
41
+ #define IPTOS_DSCP_AF33 0x78
42
+ #define IPTOS_DSCP_AF41 0x88
43
+ #define IPTOS_DSCP_AF42 0x90
44
+ #define IPTOS_DSCP_AF43 0x98
45
+ #endif
46
+
47
+ #ifndef IPTOS_DSCP_EF
48
+ #define IPTOS_DSCP_EF 0xb8
49
+ #endif
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Public domain
3
+ * netinet/tcp.h compatibility shim
4
+ */
5
+
6
+ #ifndef _WIN32
7
+ #include_next <netinet/tcp.h>
8
+ #else
9
+ #include <win32netcompat.h>
10
+ #endif
@@ -0,0 +1,63 @@
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).
9
+ *
10
+ * Dongsheng Song <dongsheng.song@gmail.com>
11
+ * Brent Cook <bcook@openbsd.org>
12
+ */
13
+
14
+ #ifndef LIBCRYPTOCOMPAT_POLL_H
15
+ #define LIBCRYPTOCOMPAT_POLL_H
16
+
17
+ #ifndef _WIN32
18
+ #include_next <poll.h>
19
+ #else
20
+
21
+ #include <winsock2.h>
22
+
23
+ /* Type used for the number of file descriptors. */
24
+ typedef unsigned long int nfds_t;
25
+
26
+ #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0600)
27
+ /* Data structure describing a polling request. */
28
+ struct pollfd {
29
+ int fd; /* file descriptor */
30
+ short events; /* requested events */
31
+ short revents; /* returned events */
32
+ };
33
+
34
+ /* Event types that can be polled */
35
+ #define POLLIN 0x001 /* There is data to read. */
36
+ #define POLLPRI 0x002 /* There is urgent data to read. */
37
+ #define POLLOUT 0x004 /* Writing now will not block. */
38
+
39
+ # define POLLRDNORM 0x040 /* Normal data may be read. */
40
+ # define POLLRDBAND 0x080 /* Priority data may be read. */
41
+ # define POLLWRNORM 0x100 /* Writing now will not block. */
42
+ # define POLLWRBAND 0x200 /* Priority data may be written. */
43
+
44
+ /* Event types always implicitly polled. */
45
+ #define POLLERR 0x008 /* Error condition. */
46
+ #define POLLHUP 0x010 /* Hung up. */
47
+ #define POLLNVAL 0x020 /* Invalid polling request. */
48
+
49
+ #endif
50
+
51
+ #ifdef __cplusplus
52
+ extern "C" {
53
+ #endif
54
+
55
+ int poll(struct pollfd *pfds, nfds_t nfds, int timeout);
56
+
57
+ #ifdef __cplusplus
58
+ }
59
+ #endif
60
+
61
+ #endif /* HAVE_POLL */
62
+
63
+ #endif /* LIBCRYPTOCOMPAT_POLL_H */
@@ -0,0 +1,122 @@
1
+ /*
2
+ * Public domain
3
+ * pthread.h compatibility shim
4
+ */
5
+
6
+ #ifndef LIBCRYPTOCOMPAT_PTHREAD_H
7
+ #define LIBCRYPTOCOMPAT_PTHREAD_H
8
+
9
+ #ifdef _WIN32
10
+
11
+ #include <malloc.h>
12
+ #include <stdlib.h>
13
+ #include <windows.h>
14
+
15
+ /*
16
+ * Static once initialization values.
17
+ */
18
+ #define PTHREAD_ONCE_INIT { INIT_ONCE_STATIC_INIT }
19
+
20
+ /*
21
+ * Static mutex initialization values.
22
+ */
23
+ #define PTHREAD_MUTEX_INITIALIZER { .lock = NULL }
24
+
25
+ /*
26
+ * Once definitions.
27
+ */
28
+ struct pthread_once {
29
+ INIT_ONCE once;
30
+ };
31
+ typedef struct pthread_once pthread_once_t;
32
+
33
+ struct _pthread_win32_cb_arg {
34
+ void (*cb)(void);
35
+ };
36
+
37
+ static inline BOOL CALLBACK
38
+ _pthread_once_win32_cb(PINIT_ONCE once, PVOID param, PVOID *context)
39
+ {
40
+ struct _pthread_win32_cb_arg *arg = param;
41
+ arg->cb();
42
+ return TRUE;
43
+ }
44
+
45
+ static inline int
46
+ pthread_once(pthread_once_t *once, void (*cb) (void))
47
+ {
48
+ struct _pthread_win32_cb_arg arg = { .cb = cb };
49
+ BOOL rc = InitOnceExecuteOnce(&once->once, _pthread_once_win32_cb, &arg, NULL);
50
+ if (rc == 0)
51
+ return EINVAL;
52
+ else
53
+ return 0;
54
+ }
55
+
56
+ typedef DWORD pthread_t;
57
+
58
+ static inline pthread_t
59
+ pthread_self(void)
60
+ {
61
+ return GetCurrentThreadId();
62
+ }
63
+
64
+ static inline int
65
+ pthread_equal(pthread_t t1, pthread_t t2)
66
+ {
67
+ return t1 == t2;
68
+ }
69
+
70
+ struct pthread_mutex {
71
+ volatile LPCRITICAL_SECTION lock;
72
+ };
73
+ typedef struct pthread_mutex pthread_mutex_t;
74
+ typedef void pthread_mutexattr_t;
75
+
76
+ static inline int
77
+ pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
78
+ {
79
+ if ((mutex->lock = malloc(sizeof(CRITICAL_SECTION))) == NULL)
80
+ exit(ENOMEM);
81
+ InitializeCriticalSection(mutex->lock);
82
+ return 0;
83
+ }
84
+
85
+ static inline int
86
+ pthread_mutex_lock(pthread_mutex_t *mutex)
87
+ {
88
+ if (mutex->lock == NULL) {
89
+ LPCRITICAL_SECTION lcs;
90
+
91
+ if ((lcs = malloc(sizeof(CRITICAL_SECTION))) == NULL)
92
+ exit(ENOMEM);
93
+ InitializeCriticalSection(lcs);
94
+ if (InterlockedCompareExchangePointer((PVOID*)&mutex->lock, (PVOID)lcs, NULL) != NULL) {
95
+ DeleteCriticalSection(lcs);
96
+ free(lcs);
97
+ }
98
+ }
99
+ EnterCriticalSection(mutex->lock);
100
+ return 0;
101
+ }
102
+
103
+ static inline int
104
+ pthread_mutex_unlock(pthread_mutex_t *mutex)
105
+ {
106
+ LeaveCriticalSection(mutex->lock);
107
+ return 0;
108
+ }
109
+
110
+ static inline int
111
+ pthread_mutex_destroy(pthread_mutex_t *mutex)
112
+ {
113
+ DeleteCriticalSection(mutex->lock);
114
+ free(mutex->lock);
115
+ return 0;
116
+ }
117
+
118
+ #else
119
+ #include_next <pthread.h>
120
+ #endif
121
+
122
+ #endif
@@ -0,0 +1,44 @@
1
+ /* $OpenBSD: readpassphrase.h,v 1.5 2003/06/17 21:56:23 millert Exp $ */
2
+
3
+ /*
4
+ * Copyright (c) 2000, 2002 Todd C. Miller <Todd.Miller@courtesan.com>
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
+ * Sponsored in part by the Defense Advanced Research Projects
19
+ * Agency (DARPA) and Air Force Research Laboratory, Air Force
20
+ * Materiel Command, USAF, under agreement number F39502-99-1-0512.
21
+ */
22
+
23
+ #ifdef HAVE_READPASSPHRASE_H
24
+
25
+ #include_next <readpassphrase.h>
26
+
27
+ #else
28
+
29
+ #ifndef _READPASSPHRASE_H_
30
+ #define _READPASSPHRASE_H_
31
+
32
+ #define RPP_ECHO_OFF 0x00 /* Turn off echo (default). */
33
+ #define RPP_ECHO_ON 0x01 /* Leave echo on. */
34
+ #define RPP_REQUIRE_TTY 0x02 /* Fail if there is no tty. */
35
+ #define RPP_FORCELOWER 0x04 /* Force input to lower case. */
36
+ #define RPP_FORCEUPPER 0x08 /* Force input to upper case. */
37
+ #define RPP_SEVENBIT 0x10 /* Strip the high bit from input. */
38
+ #define RPP_STDIN 0x20 /* Read from stdin, not /dev/tty */
39
+
40
+ char * readpassphrase(const char *, char *, size_t, int);
41
+
42
+ #endif /* !_READPASSPHRASE_H_ */
43
+
44
+ #endif
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Public domain
3
+ * resolv.h compatibility shim
4
+ */
5
+
6
+ #ifndef LIBCRYPTOCOMPAT_RESOLV_H
7
+ #define LIBCRYPTOCOMPAT_RESOLV_H
8
+
9
+ #ifdef _MSC_VER
10
+ #if _MSC_VER >= 1900
11
+ #include <../ucrt/resolv.h>
12
+ #else
13
+ #include <../include/resolv.h>
14
+ #endif
15
+ #elif defined(HAVE_RESOLV_H)
16
+ #include_next <resolv.h>
17
+ #endif
18
+
19
+ #ifndef HAVE_B64_NTOP
20
+ int b64_ntop(unsigned char const *, size_t, char *, size_t);
21
+ int b64_pton(char const *, unsigned char *, size_t);
22
+ #endif
23
+
24
+ #endif