summaryrefslogtreecommitdiffstats
path: root/include (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Implement OSSL_PROVIDER_get0_default_search_path, add docs and tests.Patrick Mills2022-12-061-1/+2
| | | | | | Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19752)
* Implement deterministic ECDSA sign (RFC6979)slontis2022-11-304-1/+36
| | | | | | | | | | | | | | | | | This PR is based off the contributions in PR #9223 by Jemmy1228. It has been modified and reworked to: (1) Work with providers (2) Support ECDSA and DSA (3) Add a KDF HMAC_DRBG implementation that shares code with the RAND HMAC_DRBG. A nonce_type is passed around inside the Signing API's, in order to support any future deterministic algorithms. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18809)
* providers: Add SM4 XTS implementationXu Yizhou2022-11-292-0/+7
| | | | | | | | Signed-off-by: Xu Yizhou <xuyizhou1@huawei.com> Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19619)
* obj: Add SM4 XTS OIDXu Yizhou2022-11-291-0/+5
| | | | | | | | | | Add the following OID: SM4-XTS: 1.2.156.10197.1.104.10 Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19619)
* Implements Hybrid Public Key Encryption (HPKE) as per RFC9180.Stephen Farrell2022-11-254-48/+247
| | | | | | | | | | | | | | | | | | | | | | | This supports all the modes, suites and export mechanisms defined in RFC9180 and should be relatively easily extensible if/as new suites are added. The APIs are based on the pseudo-code from the RFC, e.g. OSS_HPKE_encap() roughly maps to SetupBaseS(). External APIs are defined in include/openssl/hpke.h and documented in doc/man3/OSSL_HPKE_CTX_new.pod. Tests (test/hpke_test.c) include verifying a number of the test vectors from the RFC as well as round-tripping for all the modes and suites. We have demonstrated interoperability with other HPKE implementations via a fork [1] that implements TLS Encrypted ClientHello (ECH) which uses HPKE. @slontis provided huge help in getting this done and this makes extensive use of the KEM handling code from his PR#19068. [1] https://github.com/sftcd/openssl/tree/ECH-draft-13c Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17172)
* Disable atomic refcounts with no-threadsJ.W. Jagersma2022-11-251-1/+1
| | | | | | | | | | | | This is needed for building with '-march=i386 no-threads', on platforms where libatomic is not available (djgpp, specifically). The implementation now falls back to 'CRYPTO_atomic_add()', which performs plain lock-free addition in a 'no-threads' build. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19751)
* add missing OSSL_CMP_CTX_reset_geninfo_ITAVs() functionDr. David von Oheimb2022-11-251-0/+1
| | | | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/19216)
* CMP: fix status held in OSSL_CMP_CTX, in particular for genp messagesDr. David von Oheimb2022-11-241-6/+9
| | | | | | | | | On this occasion, replace magic constants by mnemonic ones; update doc Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/19205)
* CMP+CRMF: fix formatting nits in crypto/, include/, and test/Dr. David von Oheimb2022-11-242-2/+2
| | | | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/19230)
* Add support for KTLS zerocopy sendfile on LinuxMaxim Mikityanskiy2022-11-244-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TLS device offload allows to perform zerocopy sendfile transmissions. FreeBSD provides this feature by default, and Linux 5.19 introduced it as an opt-in. Zerocopy improves the TX rate significantly, but has a side effect: if the underlying file is changed while being transmitted, and a TCP retransmission happens, the receiver may get a TLS record containing both new and old data, which leads to an authentication failure and termination of connection. This effect is the reason Linux makes a copy on sendfile by default. This commit adds support for TLS zerocopy sendfile on Linux disabled by default to avoid any unlikely backward compatibility issues on Linux, although sacrificing consistency in OpenSSL's behavior on Linux and FreeBSD. A new option called KTLSTxZerocopySendfile is added to enable the new zerocopy behavior on Linux. This option should be used when the the application guarantees that the file is not modified during transmission, or it doesn't care about breaking the connection. The related documentation is also added in this commit. The unit test added doesn't test the actual functionality (it would require specific hardware and a non-local peer), but solely checks that it's possible to set the new option flag. Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Boris Pismenny <borisp@nvidia.com> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18650)
* QUIC TX Packetiser and Streams MapperHugo Landau2022-11-2411-6/+473
| | | | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19346)
* Cleanup : directly include of `internal/nelem.h` when required.FdaSilvaYY2022-11-231-1/+0
| | | | | | | | And so clean a few useless includes Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19721)
* CMP: add API functions OSSL_CMP_CTX_get0_libctx() and OSSL_CMP_CTX_get0_propq()Dr. David von Oheimb2022-11-231-0/+2
| | | | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/19715)
* Improve FIPS RSA keygen performance.slontis2022-11-231-0/+2
| | | | | | | | | Reduce the Miller Rabin counts to the values specified by FIPS 186-5. The old code was using a fixed value of 64. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19579)
* Improve FIPS RSA keygen performance.slontis2022-11-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | FIPS 186-4 has 5 different algorithms for key generation, and all of them rely on testing GCD(a,n) == 1 many times. Cachegrind was showing that during a RSA keygen operation, the function BN_gcd() was taking a considerable percentage of the total cycles. The default provider uses multiprime keygen, which seemed to be much faster. This is because it uses BN_mod_inverse() instead. For a 4096 bit key, the entropy of a key that was taking a long time to generate was recorded and fed back into subsequent runs. Roughly 40% of the cycle time was BN_gcd() with most of the remainder in the prime testing. Changing to use the inverse resulted in the cycle count being 96% in the prime testing. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19578)
* Ensure that SIZE_MAX is defined where OSSL_SSIZE_MAX is used.Richard Levitte2022-11-161-0/+1
| | | | | | | | | | | | include/openssl/e_os2.h defines OSSL_SSIZE_MAX in terms of SIZE_MAX as a fallback. This doesn't work well on platforms where SIZE_MAX isn't defined, so we must ensure that it's defined by including "internal/numbers.h". Since this is compensating for operating system discrepancies, it's reasonable to make this change in include/internal/e_os.h. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19693)
* list: add debug sanity checksPauli2022-11-161-0/+28
| | | | | | Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/19377)
* list: add an is empty functionPauli2022-11-161-0/+11
| | | | | | Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/19377)
* list: rename internal fieldsPauli2022-11-161-24/+24
| | | | | | | | | | This makes conversion to using list.h easier because the compiler will error on an unknown field name rather than accepting `head` and `tail` and missing some changes. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/19377)
* QUIC: use list.hPauli2022-11-161-4/+4
| | | | | | | | | The demux and record RX implemented lists internally. This changes them over to using list.h. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/19377)
* QUIC ackm: use list.hPauli2022-11-161-5/+7
| | | | | | | | Instead of implementing a list internally. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/19377)
* uint_set: convert uint_set to use the list data typePauli2022-11-161-8/+7
| | | | | | | | This is instead of re-implementing a linked list itself. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/19377)
* Propagate selection all the way on key exportSimo Sorce2022-11-151-4/+7
| | | | | | | | | | | | | | | | | | | | EVP_PKEY_eq() is used to check, among other things, if a certificate public key corresponds to a private key. When the private key belongs to a provider that does not allow to export private keys this currently fails as the internal functions used to import/export keys ignored the selection given (which specifies that only the public key needs to be considered) and instead tries to export everything. This patch allows to propagate the selection all the way down including adding it in the cache so that a following operation actually looking for other selection parameters does not mistakenly pick up an export containing only partial information. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19648)
* Plug the QUIC_RSTREAM to the RX depacketizerTomas Mraz2022-11-143-2/+3
| | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19351)
* QUIC Receive Stream Management: Call QUIC flow controlTomas Mraz2022-11-141-5/+18
| | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19351)
* QUIC Receive Stream ManagementTomas Mraz2022-11-143-0/+162
| | | | | | | | | Added SFRAME_LIST structure and QUIC_RSTREAM object to manage received stream data. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19351)
* djgpp: Skip check for negative timevalJ.W. Jagersma2022-11-141-0/+2
| | | | | | | | This causes a warning since tv_sec is unsigned. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19322)
* fuzz: add punycode decoder fuzz testPauli2022-11-101-0/+2
| | | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/19591)
* punycode: update to use WPACKET instead of using custom range checkingPauli2022-11-101-1/+2
| | | | | | | | | | | | | | Add test for `.' overflows, remove the output size argument from ossl_a2ulabel() since it was never used and greatly complicated the code. Convert ossl_a2ulabel() to use WPACKET for building the output string. Update the documentation to match the new definition of ossl_a2ulabel(). x509: let punycode handle the '\0' string termination. Saves a memset(3) and some size fiddling. Also update to deal with the modified parameters. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/19591)
* QUIC CFQ FixesHugo Landau2022-11-072-10/+11
| | | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19206)
* QUIC FIFDHugo Landau2022-11-072-1/+64
| | | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19206)
* QUIC TXPIMHugo Landau2022-11-071-0/+109
| | | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19206)
* QUIC CFQHugo Landau2022-11-071-0/+140
| | | | | | Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19206)
* Add zlib oneshot compressionTodd Short2022-11-071-0/+1
| | | | | | | | Fixes #19520 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19603)
* Add d2i_PUBKEY_ex_fp and d2i_PUBKEY_ex_bio.slontis2022-11-021-0/+4
| | | | | | | | | These functions pass a library content and prop query. The i2d documentation related to these functions has been corrected since the bio and fp functions always return 0 or 1. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18427)
* Release the drbg in the global default context before enginesTomas Mraz2022-11-021-0/+1
| | | | | | | | | Fixes #17995 Fixes #18578 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/19386)
* Apply SM4 optimization patch to Kunpeng-920Xu Yizhou2022-11-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the ideal scenario, performance can reach up to 2.2X. But in single block input or CFB/OFB mode, CBC encryption, performance could drop about 50%. Perf data on Kunpeng-920 2.6GHz hardware, before and after optimization: Before: type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes SM4-CTR 75318.96k 79089.62k 79736.15k 79934.12k 80325.44k 80068.61k SM4-ECB 80211.39k 84998.36k 86472.28k 87024.93k 87144.80k 86862.51k SM4-GCM 72156.19k 82012.08k 83848.02k 84322.65k 85103.65k 84896.43k SM4-CBC 77956.13k 80638.81k 81976.17k 81606.31k 82078.91k 81750.70k SM4-CFB 78078.20k 81054.87k 81841.07k 82396.38k 82203.99k 82236.76k SM4-OFB 78282.76k 82074.03k 82765.74k 82989.06k 83200.68k 83487.17k After: type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes SM4-CTR 35678.07k 120687.25k 176632.27k 177192.62k 177586.18k 178295.18k SM4-ECB 35540.32k 122628.07k 175067.90k 178007.84k 178298.88k 178328.92k SM4-GCM 34215.75k 116720.50k 170275.16k 171770.88k 172714.21k 172272.30k SM4-CBC 35645.60k 36544.86k 36515.50k 36732.15k 36618.24k 36629.16k SM4-CFB 35528.14k 35690.99k 35954.86k 35843.42k 35809.18k 35809.96k SM4-OFB 35563.55k 35853.56k 35963.05k 36203.52k 36233.85k 36307.82k Signed-off-by: Xu Yizhou <xuyizhou1@huawei.com> Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19547)
* Update FIPS KATs for 140-3Pauli2022-11-011-0/+2
| | | | | | | | | | | Co-authored-by: Randall Steck <rsteck@thinqsoft.com> Co-authored-by: Mark J. Minnoch <mark@keypair.us> Co-authored-by: Steve Weymann <steve@keypair.us> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/19510)
* rand: add set0 calls for the private and public DRBGsPauli2022-11-012-0/+3
| | | | | | | | | | The FIPS 140-3 DSA and ECDSA tests need to be known answer tests which means the entropy needs to be cooked. This permits this. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/19510)
* Fix 32-bit Windows issues related to QUIC_ACKM / QUIC_CCRichard Levitte2022-10-251-8/+8
| | | | | | | | | The re-occuring surprise is that in Win32, size_t is 32 bits... Fixed by changing size_t to uint64_t in QUIC_CC Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19345)
* Fix definitions of SHUT_RD and SHUT_WRRichard Levitte2022-10-251-0/+11
| | | | | | Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19345)
* crypto: thread: remove ossl_crypto_thread_native_terminateČestmír Kalina2022-10-211-2/+0
| | | | | | | | Signed-off-by: Čestmír Kalina <ckalina@redhat.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19473)
* crypto: thread: serialize concurrent joinsČestmír Kalina2022-10-211-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | Multiple concurrent joins with a running thread suffer from a race condition that allows concurrent join calls to perform concurrent arch specific join calls, which is UB on POSIX, or to concurrently execute join and terminate calls. As soon as a thread T1 exists, one of the threads that joins with T1 is selected to perform the join, the remaining ones await completion. Once completed, the remaining calls immediately return. If the join failed, another thread is selected to attempt the join operation. Forcefully terminating a thread that is in the process of joining another thread is not supported. Common code from thread_posix and thread_win was refactored to use common wrapper that handles synchronization. Signed-off-by: Čestmír Kalina <ckalina@redhat.com> Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19433)
* Fix make updateMatt Caswell2022-10-201-1/+1
| | | | | | | | | | The recent DTLS write record layer code and the certificate compression code both added new SSL_R_ reason codes. The numbers are conflicting due to rebase issues and causing make update to fail. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19457)
* Consolidate sequence counter incrementing codeMatt Caswell2022-10-201-0/+1
| | | | | | | | | | | The sequence counter was incremented in numerous different ways in numerous different locations. We introduce a single function to do this inside the record layer. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19424)
* Add `for_comp` flag when retrieving certs for compressionTodd Short2022-10-181-0/+1
| | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18186)
* Add support for compressed certificates (RFC8879)Todd Short2022-10-186-8/+55
| | | | | | | | | | * Compressed Certificate extension (server/client) * Server certificates (send/receive) * Client certificate (send/receive) Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18186)
* Convert ZLIB defines to OPENSSL_NO_ZLIBTodd Short2022-10-181-2/+0
| | | | | | | | | Use the normal OPENSSL_NO_ prefix to enable/disable ZLIB Make `BIO_f_zlib()` always available. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18186)
* Add ZSTD compression support (RFC8478bis)Todd Short2022-10-184-0/+12
| | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18186)
* Add brotli compression support (RFC7924)Todd Short2022-10-184-0/+13
| | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18186)