crypto/compat

Branch


Log

Author Commit Date CI Message
Brent Cook 659e87fe 2025-10-07T03:49:29 move ftruncate to common libcompat for tests
Brent Cook 15bc02ad 2025-05-18T20:45:36 fix gitignore brokenness in crypto /crypto/* masks too much and breaks the exclusion function. The docs for gitignore state that if a parent directory is ignored, negating a pattern with a ! prefix has no effect since it is not possible to reinclude a file if the parent director is excluded. https://git-scm.com/docs/gitignore This just is more explicit, which catches files added out of tree more readily. Also delete the long-removed libtls-standalone references
Theo Buehler 8f6cbc89 2025-05-10T21:56:33 b_win.c: whitespace nit
Theo Buehler 364fc5b9 2025-05-10T21:56:05 Include "err_local.h" rather than <openssl/err.h>
Brent Cook 9ba4b33d 2025-04-16T04:26:34 change prefix for fstat
Brent Cook 06297aa3 2025-04-16T03:59:46 reapply special case for std file descriptors
Brent Cook 78b86a2a 2025-04-12T16:59:51 switch to using high bit for fd detection of file/socket
datadiode ec123956 2024-10-15T18:16:19 Don't break std* file descriptors (inspired by the other is_socket() which lives in poll_win.c)
datadiode 2c5e2c60 2024-07-17T10:40:05 Issue #1069 - Make file descriptors created through posix_open() distinguishable from sockets by having them take odd values only
Theo Buehler ccc254e9 2025-03-09T11:31:39 Fix UI_OpenSSL for Windows
Theo Buehler bf808ea0 2024-12-19T20:24:33 Provide getdelim and getline compat shims These are portable implementations from NetBSD that are needed on Windows and perhaps some other platforms with the new versions of the mlkem tests.
Theo Buehler 16c2e3cd 2024-10-15T14:19:52 Make gettimeofday() definition match the prototype Should fix #1111
Theo Buehler 3467d6f2 2024-08-02T21:54:08 Attempt to fix 2038 problem with MSVC
Mostafa Saad 3478d5cf 2024-05-28T23:39:52 Add Emscripten branch to arc4random The Emscripten platform already supports the necessary Linux API. The only missing piece was adding a branch specifically for Emscripten and including the existing Linux file. This update enables all LibreSSL libraries to be built using the Emscripten toolchain.
Brent Cook 82d645aa 2024-05-28T08:28:31 Land #1046, [Windows] Mark old_report_mode as unused for release builds
Theo Buehler f9874d49 2024-05-25T08:56:45 Remove timegm() compat Now that all uses of gmtime_r() and timegm() have been converted to OPENSSL_gmtime() and OPENSSL_timegm(), this is no longer needed.
Christian Andersen 8ce97109 2024-04-01T22:00:33 [Windows] Mark old_report_mode as unused When compiling in release mode the _CrtSetReportMode macro gets replaced by void(0). This makes old_report_mode unused. Silence a warning about it.
Christian Andersen 64f18675 2024-02-04T17:04:09 Windows: Fix assertion pop-up up when using Debug compiled libressl. When running the signertest, or the test project in https://github.com/libressl/portable/issues/266 an assertion window pops up. This was fixed in afcd4be8a72a for a release compiled library. To prevent the issue in debug mode, it looks like it is necessary to also disable the assertion window popup. With this all tests pass when compiling and running them with a Debug, Release or RelWithDebInfo CMake build on windows (for me).
Theo Buehler 0d8aa3eb 2023-12-12T08:25:37 Land #964
Viktor Szakats 529f90dd 2023-12-11T21:53:59 windows: minor compat header fixes - posix_win.c: use `snprintf` as-is with _MSC_VER >= 1900 - stdio.h: include socket header before windows.h - pthread.h: delete exec permission from source file
Viktor Szakats 2d6d9fcc 2023-12-11T16:21:00 upgrade links in comments to HTTPS
Viktor Szakats e1217db8 2023-11-03T17:56:32 delete unused `savsig` variable Follow-up to dd1d96f643b01a5edbe7e0db8399f3c88f5f0c8b Fixes #925
Brent Cook dd1d96f6 2023-10-30T22:49:47 fix cross-compilation on Windows 11 Arm64 signal.h is less populated in this environment, remove stub signal handlers
Brent Cook 51368394 2023-07-07T04:32:20 Land #886, add compat getopt implementation
Brent Cook 7463f87c 2023-07-07T11:46:21 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.
Brent Cook c9b18cb2 2023-07-06T22:05:06 fix get/setsockopt reversed logic
Brent Cook f75c0022 2023-07-06T20:53:12 remove unneeded extern since we're not trying to hack this into mingw-w64
Brent Cook afcd4be8 2023-07-06T20:32:34 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.
Theo Buehler a911052d 2022-11-27T10:45:50 Adjust for ui_locl.h -> ui_local.h rename
Brent Cook 79f2a52a 2020-04-14T22:29:37 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.
Ørjan Malde b80c4bf2 2019-10-20T20:22:22 initial support for midipix
kinichiro 856d0511 2019-07-28T19:03:27 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
Brent Cook c199315e 2019-05-23T06:58:38 condense android comments for clarity
Ishimoto Shinobu 65159f37 2019-05-22T10:47:47 Remove info about glibc
Ishimoto Shinobu a747aacc 2019-05-21T22:41:05 avoid glibc cause problems on musl systems
Simone Basso 44082746 2019-05-04T09:15:23 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.
Brent Cook 40c84831 2019-02-03T18:50:14 add unimpl fallback for getprogname
Brent Cook a6d7ea95 2019-01-31T09:45:56 update autoconf for latest compat functions
John Norrbin 1e848d2e 2019-01-04T19:24:59 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.
Brent Cook 68314274 2019-01-01T15:13:26 enable getpagesize for all Windows builds
Brent Cook 565258a4 2019-01-01T13:50:17 use InterlockedExchangeAdd for add
Brent Cook e5081719 2019-01-01T02:40:59 make locks self-initialize, switch to critical sections
Brent Cook ff7a1831 2018-11-11T10:59:15 include header
Brent Cook 1e2937e1 2018-11-11T09:14:00 added crypto_lock portable bits
Brent Cook 9e7fd1fa 2017-08-13T16:04:03 declare struct timezone outside of the function declaration
Brent Cook 8b80bcda 2017-06-11T11:21:34 re-add getpagesize fallback, needed for Android
Brent Cook 993f5cf6 2017-04-28T00:26:40 add back copyright notice from OpenBSD malloc.c from which this came.
kinichiro 048625cf 2017-04-22T23:08:17 Add freezero support
Brent Cook 764ab1e6 2017-03-16T19:25:42 remove sysconf fallback for now
kinichiro c61c9821 2017-03-15T21:02:22 Add support for getpagesize
kinichiro c957ff63 2017-02-01T01:13:09 Fix SYSerr and BIOerr in b_win.c
kinichiro 58eb645f 2017-01-28T03:40:38 Copy libc compat files rather than adding into the repository - remove the CP_LIBC files from repo - move tests/memmem.c to tests/compat/
Brent Cook 3b2560fe 2017-01-16T10:36:05 MSVSC fixes
Brent Cook f21bd20c 2017-01-16T09:56:20 add open(2) shim to handle O_BINARY and O_CLOEXEC
Brent Cook 69e2a7fb 2017-01-15T10:02:37 handle EBADF, which is returned when a file is passed
Brent Cook 3af1387b 2015-12-11T09:22:12 Revert back to GetStdHandle, since it works fine with pipes. Also include the formerly-missing NULL check, since this can fail in two ways.
Brent Cook bd8fe586 2015-12-11T09:21:43 include stdint.h uint*_t
Anthony Novatsis 5727d327 2015-12-11T16:29:50 Replace STDIN_FILENO with _fileno Replace STDIN_FILENO with _fileno as STDIN_FILENO results in compile errors with Visual Studio 2015 (using CMake).
Brent Cook afcc027d 2015-12-05T22:14:42 only set the console mode if stdin is a console (not a pipe) This allows piping commands and running from a cygwin console.
Brent Cook 75ef5bb1 2015-12-05T13:58:37 wrap gets on Windows, replacing '\r\n' with '\n'
Brent Cook 3f79a49d 2015-10-21T22:17:13 check bounds before casting (long long) to time_t
Brent Cook 0197a589 2015-10-18T09:28:10 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
Brent Cook cac089b5 2015-10-15T14:32:02 make internal functions static
Brent Cook c0243664 2015-10-15T14:26:24 use timegm from musl
Brent Cook 4298ac93 2015-10-14T23:53:52 include timegm fallback
Brent Cook eeb286af 2015-09-13T09:30:26 fix spelling of OPENSSL_cleanse
Brent Cook c66d80a4 2015-08-03T06:56:59 add win32-specific explicit_bzero implementation
Brent Cook 9d5eb631 2015-07-21T12:52:29 move sleep shim to posix_win.c
Brent Cook 5d8a1cf7 2014-07-10T22:06:10 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.
Brent Cook ddeb7404 2015-07-16T10:23:57 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@
Brent Cook 54545427 2015-06-29T22:51:40 add check for inet_pton, nudge minimum win32 compat to 0x0501
Brent Cook bc7b9347 2015-06-13T21:43:55 add a missing header and fix typo in windows posix layer
Brent Cook b4a6a615 2015-06-05T04:31:56 refactor win32 shims into posix_win.c this also adds a rename shim that allows overwrites
Brent Cook 3096ab0e 2015-04-14T07:55:23 remove issetuigid wrappers, now that all getenv calls are gone. From deraadt@ upstream: Remove all getenv() calls, especially those wrapped by issetugid(). getenv()'s wrapped by issetugid() are safe, but issetugid() is ... difficult to impliment on many operating systems. By accident, a grand experiment was run over the last year, where issetugid() returned 1 (the safe value) on a few operating systems. Noone noticed & complained that certain environment variables were not working.......
Brent Cook fe3f7fc6 2015-02-10T23:49:31 Add experimental AIX support. This includes a WIP failsafe issetugid for now, while research continues on the proper way to do this in a race-free fashion in AIX.
Brent Cook a859b93f 2015-02-16T22:22:29 disable system issetugid on OS X since it is not fork-safe Noticed while testing similar code for AIX. ok beck@
Brent Cook adc416e9 2015-02-16T22:19:01 remove getuid/getgid fallbacks from hp-ux issetugid emulation Fail closed if we cannot obtain the process flags. Noticed while looking at a similar function for AIX.
Brent Cook a2233651 2015-01-21T06:14:24 add NetBSD shims for arc4random The current NetBSD release, 6.1.5, fails to reseed arc4random fork. Work around it by providing arc4random/getentropy shims. Revisit when NetBSD 7 is available.
kinichiro 0308b63c 2014-12-08T11:08:45 Add support for HP-UX tested on: HP-UX 11.31 ia64, gcc 4.7.1(HP AllianceOne version) gcc 4.2.3(http://hpux.connect.org.uk) HP C/aC++ HP-UX defaults to use LP32 and it treats long as 32 bit (= 4 bytes). This build forces LP64 for treating long as 64 bit.
Brent Cook 58fcd3c3 2014-11-20T00:26:55 Add conditional compilation for windows and posix functions. This adds a Windows-specific versions of several symbols from libcrypto and openssl(1).
宋冬生 648e9136 2014-11-05T20:52:00 Use _WIN32 instead of __WIN32. ok bcook@
Brent Cook 0aeb93b9 2014-10-27T19:22:03 override native arc4random_buf on FreeBSD The FreeBSD-native arc4random_buf implementation falls back to weak sources of entropy if the sysctl fails. Remove these dangerous fallbacks by overriding locally. Unfortunately, pthread_atfork() is broken on FreeBSD (at least 9 and 10) if a program does not link to -lthr. Callbacks registered with pthread_atfork() simply fail silently. So, it is not always possible to detect a PID wraparound. I wish we could do better. This improves arc4random_buf's safety compared to the native FreeBSD implementation. Tested on FreeBSD 9 and 10. ok beck@ deraadt@
Brent Cook a2373f70 2014-10-30T10:52:29 wrap arc4random header ok @doug
Brent Cook a4cc9539 2014-10-29T15:44:36 Improve and simplify function and header detection logic. Simplify autoconf checks by using AC_CHECK_FUNCS/HEADERS. Clarify some ambiguous dependencies around strnlen/strndup. Unconditionally enable pidwraptest for all arc4random implementations. Remove HAVE_VASPRINTF conditional, since asprintf requires vasprintf. ok @doug
Brent Cook b9ff0728 2014-07-30T06:53:02 harmonize asprintf with OpenSSH * use the original name for the file from OpenSSH (remove duplicate version) * add va_copy/__va_copy checks to configure * incorporate proposed fixes to openssh version: + include more system headers directly for various definitions + limit the scope of va_copy/va_end to their affected vsnprintf calls + simplify error handling, removing a dead assignment
Brent Cook a07e3370 2014-07-29T18:21:58 include comment on windows services
Brent Cook 983103b0 2014-07-28T21:06:37 stub win32 issetugid implementation ok deraadt@ beck@
Brent Cook d328203f 2014-07-28T20:57:43 produce a error if platform has no arc4random hook ok deraadt@ beck@
Brent Cook 35e2d8d0 2014-07-28T19:26:15 add asprintf / vasprintf from OpenSSH portable ok deraadt@ beck@
Brent Cook 6383a072 2014-07-27T06:09:51 remove thread_private.h, no longer needed
Brent Cook edebb7a6 2014-07-19T10:49:08 remove thread_private.h defines, moved to arc4random_*.h
Brent Cook 1b1bce16 2014-07-17T23:58:46 update to newly-refactored arc4random compatibility shims the thread-private bits can move next ok beck@
Brent Cook 32d9eeee 2014-07-15T14:50:05 register the atfork handler from arc4random From kettenis@ People have suggested using pthread_atfork(3) before, but discarded the idea because it involves linking with -lpthread, which has other undesirable consequences. However: * Most systems actually have pthread_atfork(3) in libc. I verified this on OS X and Solaris. I believe this is the case on Linux systems that use musl as well. * On Linux systems that use glibc, this isn't the case. However, those systems have __register_atfork(3), which is fully documented in the "Linux Standard Base Core Specification". ok kettenis@ deraadt@ beck@
Bob Beck c1f7374d 2014-07-12T09:15:11 We're probably gonna need this for solaris 10
Brent Cook 2b6dbc39 2014-07-10T06:21:51 initial top-level import of subdirectories