73 Commits

Author SHA1 Message Date
Brent Cook
dd1d96f643 fix cross-compilation on Windows 11 Arm64
signal.h is less populated in this environment, remove stub signal
handlers
2023-10-30 22:57:33 -05:00
Brent Cook
51368394eb Land #886, add compat getopt implementation 2023-07-07 04:32:20 -05:00
Brent Cook
7463f87cf1 add compat getopt implementation, remove patches
This adds a getopt implementation for compatibility where it is not
available, removing a couple of regress patches.

Note, this is a slightly modified copy from OpenBSD libc that doesn't
expose getopt_long, which has dependency conflicts with Windows system
headers and isn't needed anyway.
2023-07-07 12:11:20 +03:00
Brent Cook
c9b18cb296 fix get/setsockopt reversed logic 2023-07-06 22:05:06 +03:00
Brent Cook
f75c00226c remove unneeded extern since we're not trying to hack this into mingw-w64 2023-07-06 20:53:12 +03:00
Brent Cook
afcd4be8a7 change socket / file descriptor checks on windows
based on discussion in https://github.com/libressl/portable/issues/266
and https://bugs.python.org/issue23524 adjust the compat layer for
Windows to use _get_osfhandle in combination with
_set_thread_local_invalid_parameter_handler if applicable to more
reliably determine if a handle is a socket, file, or closed socket.

This prevents assertions when calling tls_close on an already-closed
socket.
2023-07-06 20:32:34 +03:00
Theo Buehler
a911052d60 Adjust for ui_locl.h -> ui_local.h rename 2022-11-27 10:45:50 +01:00
Brent Cook
79f2a52a39 avoid exporting a sleep() symbol from libcrypto
Since it seems only MSVC lacks sleep(), and it's only used by apps, lets
special-case that and make it available as a static inline function
instead.
2020-04-14 22:29:37 -05:00
Ørjan Malde
b80c4bf262 initial support for midipix 2019-10-20 20:22:22 +02:00
kinichiro
856d0511d6 Use posix_win.c functions on WIN32
- read() returns bytes count as 1 for crlf unless binary mode isn't
  specified with open(). Reported by @ulfworsoe in libressl-portable#542
- err could be WSANOTINITIALISED when WSAStartup() is not called
2019-07-28 19:10:47 +09:00
Brent Cook
c199315ee9 condense android comments for clarity 2019-05-23 06:58:38 -05:00
Ishimoto Shinobu
65159f37d0
Remove info about glibc 2019-05-22 10:47:47 +03:00
Ishimoto Shinobu
a747aacc23
avoid glibc
cause problems on musl systems
2019-05-21 22:41:05 +09:00
Simone Basso
44082746db Fix getprogname_linux.c for Android API < 21
This diff fixes the build of LibreSSL for Android with API < 21 where
the `getprogname` system call was not part of libc.

A comment in the diff itself explains in detail the issue.
2019-05-04 09:15:23 +02:00
Brent Cook
40c848316e add unimpl fallback for getprogname 2019-02-03 18:50:14 -06:00
Brent Cook
a6d7ea9562 update autoconf for latest compat functions 2019-01-31 13:56:56 -06:00
John Norrbin
1e848d2e4e
Handle malloc returning null
Locks are required for multi-threading. If memory can't be allocated, exit the program with memory error. If we let the program continue, it will deadlock in the next part of the code anyway so better end it before.
2019-01-04 19:24:59 +01:00
Brent Cook
6831427442 enable getpagesize for all Windows builds 2019-01-01 15:48:27 -06:00
Brent Cook
565258a447 use InterlockedExchangeAdd for add 2019-01-01 15:44:37 -06:00
Brent Cook
e508171956 make locks self-initialize, switch to critical sections 2019-01-01 15:44:37 -06:00
Brent Cook
ff7a18318c include header 2018-11-11 10:59:15 -06:00
Brent Cook
1e2937e1a2 added crypto_lock portable bits 2018-11-11 09:14:00 -06:00
Brent Cook
9e7fd1fa31 declare struct timezone outside of the function declaration 2017-08-13 16:04:03 -05:00
Brent Cook
8b80bcdad8 re-add getpagesize fallback, needed for Android 2017-06-11 11:21:34 -05:00
Brent Cook
993f5cf6f9 add back copyright notice from OpenBSD malloc.c from which this came. 2017-04-28 00:26:40 -05:00
kinichiro
048625cf2b Add freezero support 2017-04-22 23:37:20 +09:00
Brent Cook
764ab1e6a9 remove sysconf fallback for now 2017-03-16 19:25:42 -05:00
kinichiro
c61c9821e8 Add support for getpagesize 2017-03-15 22:02:11 +09:00
kinichiro
c957ff63c0 Fix SYSerr and BIOerr in b_win.c 2017-02-01 01:13:09 +09:00
kinichiro
58eb645fdb Copy libc compat files rather than adding into the repository
- remove the CP_LIBC files from repo
- move tests/memmem.c to tests/compat/
2017-01-28 03:40:38 +09:00
Brent Cook
3b2560feb3 MSVSC fixes 2017-01-16 10:59:24 -06:00
Brent Cook
f21bd20c7e add open(2) shim to handle O_BINARY and O_CLOEXEC 2017-01-16 10:59:15 -06:00
Brent Cook
69e2a7fb75 handle EBADF, which is returned when a file is passed 2017-01-15 16:00:16 -06:00
Brent Cook
3af1387b18 Revert back to GetStdHandle, since it works fine with pipes.
Also include the formerly-missing NULL check, since this can fail in two
ways.
2015-12-11 09:22:12 -06:00
Brent Cook
bd8fe5868f include stdint.h uint*_t 2015-12-11 09:21:43 -06:00
Anthony Novatsis
5727d3274e Replace STDIN_FILENO with _fileno
Replace STDIN_FILENO with _fileno as STDIN_FILENO results in compile
errors with Visual Studio 2015 (using CMake).
2015-12-11 16:32:00 +11:00
Brent Cook
afcc027da7 only set the console mode if stdin is a console (not a pipe)
This allows piping commands and running from a cygwin console.
2015-12-06 16:49:01 -06:00
Brent Cook
75ef5bb160 wrap gets on Windows, replacing '\r\n' with '\n' 2015-12-05 13:58:37 -06:00
Brent Cook
3f79a49dd2 check bounds before casting (long long) to time_t 2015-10-21 22:17:13 -05:00
Brent Cook
0197a58969 Windows compatibility fixes
VS2013 has trouble with relative include paths for apps/openssl, so move
certhash_win/apps_win.c back to apps/openssl.

gmtime_r on mingw64 fails with negative time_t, override

gmtime_s fails all of the time unit tests, override

SHUT_RD/WR are defined in newer mingw64 headers, check before overriding
2015-10-18 09:28:10 -05:00
Brent Cook
cac089b5d6 make internal functions static 2015-10-15 14:32:02 -05:00
Brent Cook
c02436645d use timegm from musl 2015-10-15 14:26:24 -05:00
Brent Cook
4298ac9305 include timegm fallback 2015-10-15 09:16:38 -05:00
Brent Cook
eeb286af5a fix spelling of OPENSSL_cleanse 2015-09-13 09:31:41 -05:00
Brent Cook
c66d80a438 add win32-specific explicit_bzero implementation 2015-08-03 06:56:59 -05:00
Brent Cook
9d5eb631e3 move sleep shim to posix_win.c 2015-07-21 12:52:29 -06:00
Brent Cook
5d8a1cf715 add initial CMake and Visual Studio build support
This moves the compatibility include files from include to
include/compat so we can use the awful MS C compiler
<../include/> trick to emulate the GNU #include_next extension.

This also removes a few old compat files we do not need anymore.
2015-07-21 12:08:18 -05:00
Brent Cook
ddeb740426 win32 openssl CLI: preserve original echo state
Mirror the patch to ui_openssl.c, also fix the broken conditional that
made it not actually turn off echo in the first place.

ok guenther@
2015-07-16 10:27:57 -05:00
Brent Cook
545454277a add check for inet_pton, nudge minimum win32 compat to 0x0501 2015-07-02 00:19:53 -05:00
Brent Cook
bc7b93470f add a missing header and fix typo in windows posix layer 2015-06-13 21:43:55 -05:00