summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/merge.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2020-05-24Briefly mention the obsolete function OPENSSL_init(3).schwarze1-7/+23
Suggested by bluhm@, OK beck@ tb@.
2020-05-24The version detection doesn't work on bluhm's test machine, causingtb1-3/+3
the test to fail. Neuter it for now and just assume we do TLSv1.3. I have been intending to purge this version detection hack once I'm sure we can leave the 1.3 server enabled but I'll leave it here for now.
2020-05-23Define REGRESS_TARGETS explicitly.tb1-2/+4
2020-05-23Enforce that SNI hostnames be correct as per rfc 6066 and 5980.beck3-18/+159
Correct SNI alerts to differentiate between illegal parameter and an unknown name. ok tb@`
2020-05-23While the second SSL_CTX in this code is only used on servernametb1-1/+2
callback, so its mode is not used to update the ssl's mode, it seems more appropriate to clear the SSL_MODE_AUTO_RETRY flag on it as well. ok jsing
2020-05-23In ssl_lib.c revision 1.217, jsing enabled SSL_MODE_AUTO_RETRY bytb2-2/+7
default. To avoid hanging on a blocking read, we need to clear the SSL_MODE_AUTO_RETRY flag in the s_client and the s_server. ok beck inoguchi jsing
2020-05-23Enable SSL_MODE_AUTO_RETRY by default.jsing1-1/+2
In TLSv1.2 and earlier, when an application goes to read application data, handshake messages may be received instead, when the peer has triggered renegotation. A similar thing occurs in TLSv1.3 when key updates are triggered or the server sends new session tickets. Due to the SSL_read() API there is no way to indicate that we got no application data, instead after processing the in-band handshake messages it would be normal to return SSL_ERROR_WANT_READ and have the caller call SSL_read() again. However, various applications expect SSL_read() to return with either application data or a fatal error, when used on a blocking socket. These applications do not play well with TLSv1.3 post-handshake handshake messages (PHH), as they fail to handle SSL_ERROR_WANT_READ. The same code is also broken in the case of a TLSv1.2 or older renegotiation, however these are less likely to be encountered. Such code should set SSL_MODE_AUTO_RETRY in order to avoid these issues. Contrary to the naming, SSL_MODE_AUTO_RETRY does not actually retry in every case - it retries following handshake messages in the application data stream (i.e. renegotiation and PHH messages). This works around the unretried SSL_read() on a blocking socket case, however in the case where poll/select is used with blocking sockets, the retry will likely result in the read blocking after the handshake messages are processed. Rather than pushing for broken code to be fixed, OpenSSL decided to enable SSL_MODE_AUTO_RETRY by default, instead breaking code that does poll or select on blocking sockets (like s_client and s_server). Unfortunately we get to follow suit. ok beck@ inoguchi@ tb@
2020-05-23Wire up SSL_MODE_AUTO_RETRY mode to retrying after PHH messages.jsing2-2/+8
ok beck@ inoguchi@ tb@
2020-05-23Provide the option to retry or return after post-handshake messages.jsing2-4/+16
In TLSv1.3 post-handshake handshake messages are used for key updates and session tickets. These are in-band and mean that when the upper layer goes to read application data, we can end up reading and having to process handshake messages - this option changes whether we retry and read the next TLS record, or if we return, signalling that we want more data to be available. ok beck@ inoguchi@ tb@
2020-05-23fix a confusingly wrapped linetb1-3/+3
2020-05-23Avoid an out-of-bounds array access in the s_server.tb1-1/+3
It can be triggered by sending a line to stdin while no connection is open and then connecting a client. The first SSL_write() fails, sends SSL_ERROR_WANT_* and then causes a segfault deep down in the tls stack when accessing &(buf[-1]). ok beck inoguchi
2020-05-23Do not assume that server_group != 0 or tlsext_supportedgroups != NULLtb2-9/+15
implies that we're dealing with a HRR in the extension handling code. Explicitly check that we're in this situation by inspecting the flag in the handshake context. Add missing error checks and send the appropriate alerts. The hrr flag needs to be unset after parsing the client hello retry to avoid breaking the server hello handling. All this is far from ideal, but better than nothing. The correct fix would likely be to make the message type available but that would need to be part of a more extensive rearchitecture of the extension handling. Discussed at length with jsing
2020-05-22sockaddr should be sockaddr_storage, otherwise "openssl s_client -6 -dtls1"deraadt1-3/+4
(gurn) copies getsockname() retrieves a truncated result and 14 bytes of stack garbage get copied onwards. ok tb
2020-05-22Ensure we only attach an ocsp staple to a leaf certificate, becausebeck2-5/+16
for the moment that is all we support. fixes an issue where gnuTLS cares that mistmatching staples come back on the certs in the chain. This should be fixed correctly later by associating the staple to the individual certs rather than the ssl, so this is temporary. running on www@. ok tb@, "got that's oopy but an interim ok" jsing@
2020-05-21Simplify: transform a dangling else into an early return andtb1-20/+20
unindent a bunch of code. Suggested by jsing
2020-05-21Make ssl_set_cert_masks() more consistent and closer to readable.jsing1-44/+27
Prompted by tb@ ok tb@
2020-05-21Avoid a shadowing issue by renaming cbs and cbb to cbb_hs and cbb_hs,tb1-8/+7
respectively. Discussed with jsing
2020-05-21A failure of tls13_handshake_msg_new() could lead to a NULL dereftb1-11/+15
in the following tls13_handshake_msg_start() call. Add a check. Stop clobbering the ctx's hs_msg variable, use a local variable instead. ok beck jsing
2020-05-21beck fixed most of the keyupdate tests. update annotationtb1-3/+8
2020-05-21Actually set the hrr flag when sending a HelloRetryRequest.jsing1-1/+3
Without this, when SNI is in use the second ClientHello will result in an error. Found the hard way by sthen@. ok sthen@ tb@
2020-05-21hook tlsfuzzer to regresstb1-1/+2
2020-05-21Add a harness that runs tests from tlsfuzzertb2-0/+781
This currently runs 54 tests from the tlsfuzzer suite against the TLSv1.3 server which exercise a large portion of the code. They already found a number of bugs and misbehaviors and also inspired a few diffs currently in the pipeline. This regress requires the py3-tlsfuzzer package to be installed, otherwise the tests are skipped. Many thanks to kmos for helping with the ports side and to beck for his positive feedback. ok beck
2020-05-20Revert 1.43 - this fix for PHH in blocking mode breaks SSL_accept andbeck1-2/+2
SSL_connect in blocking mode. While this will probably need a rethink, until we land on a solution for PHH in blocking mode, the breakage this causes is visible in real things, and we've only managed to hit the PHH breakage in a test case. ok tb@
2020-05-20new manual page for PKCS7_set_content(3) and PKCS7_content_new(3);schwarze4-5/+127
OK beck@ tb@
2020-05-19Replace SSL_PKEY_RSA_ENC/SSL_PKEY_RSA_SIGN with SSL_PKEY_RSA.jsing8-46/+31
Some time prior to SSLeay 0.8.1b, SSL_PKEY_RSA_SIGN got added with the intention of handling RSA sign only certificates... this incomplete code had the following comment: /* check to see if this is a signing only certificate */ /* EAY EAY EAY EAY */ And while the comment was removed in 2005, the incomplete RSA sign-only handling has remained ever since. Remove SSL_PKEY_RSA_SIGN and rename SSL_PKEY_RSA_ENC to SSL_PKEY_RSA. While here also remove the unused SSL_PKEY_DH_RSA. ok tb@
2020-05-19Add -status and -servername test for s_server and s_client in appstest.shinoguchi1-1/+3
2020-05-19Add -groups test for s_server and s_client in appstest.shinoguchi1-3/+17
2020-05-19Only send ocsp staples if the client asked for ocsp certificate status.beck1-1/+2
noticed by dlg@ on www.openbsd.org with curl. ok dlg@
2020-05-19Add support for TLS 1.3 server to send certificate statusbeck5-15/+38
messages with oscp staples. ok jsing@ tb@
2020-05-18Add client certificate test in appstest.shinoguchi1-2/+89
2020-05-18Rename variables for key, csr, pass, certinoguchi1-85/+85
2020-05-17Send alerts back correctly when handling key shares, includingbeck1-8/+19
sending back illegal parameter if our phh key share request type is not 0 or 1. ok jsing@ tb@
2020-05-17Free handshake message correctly, noticed by tb@beck1-2/+2
ok tb@ jsing@
2020-05-17As done everywhere else, use a local version of MINIMUM() and avoidderaadt5-21/+21
conflict against a potential define min() from some other scope.
2020-05-17Send a decode error alert if a server provides an empty certificate list.jsing1-2/+2
According to RFC 8446 section 4.4.2.4, a client receiving an empty certificate list must abort the handshake with a decode error alert. ok beck@ inoguchi@ tb@ ('it rarely is the alert you'd expect it to be...')
2020-05-17Add GOST certificate test in appstest.shinoguchi1-26/+107
Enabled by -g option, and default to disabled (RSA certificate is used)
2020-05-17Suppress display output and reduce s_time to 1 sec in appstest.shinoguchi1-28/+38
2020-05-17Fix server client test with TLSv1.3 in appstest.shinoguchi1-20/+27
2020-05-16Return TLS13_IO_WANT_POLLIN after processing post-handshake messages.jsing1-2/+2
After post-handshake handshake messages have been processed, we need to return TLS13_IO_WANT_POLLIN rather than TLS13_IO_WANT_RETRY. The latter will cause us to try to read another TLS record, when there may not be any data available - this will then block in the case of a blocking read. This reverts part of r1.25. Issue noticed by inoguchi@ ok beck@ tb@
2020-05-16Ensure that a TLSv1.3 server has provided a certificate.jsing1-1/+9
The RFC requires that a server always provide a certificate for authentication. Ensure that this is the case, rather than proceeding and attempting validation. In the case where validation was disabled and the server returned an empty certificate list, this would have previously resulted in a NULL pointer deference. Issue reported by otto@ ok inoguchi@ tb@
2020-05-16Add TLS13_ERR_NO_CERTIFICATE.jsing2-3/+7
This was missed in previous tls13_server.c commit. ok inoguchi@ tb@
2020-05-16Avoid sending an empty certificate list from the TLSv1.3 server.jsing1-5/+8
A TLSv1.3 server must always send a certificate - return an error and abort the handshake if none is available. ok inoguchi@ tb@
2020-05-16document PKCS7_set_type(3);schwarze3-3/+123
OK beck@, who was amused by the "darkly comic value of reading" it
2020-05-15Factor out session reuse test and verification testinoguchi1-56/+74
2020-05-15Factor out the test for all available ciphers and add TLSv1.3 caseinoguchi1-46/+61
2020-05-15Add ECDSA certificate test in appstest.shinoguchi1-8/+71
Enabled by -e option, and default to disabled (RSA certificate is used)
2020-05-14go fmt whitespace nittb1-3/+3
2020-05-14reinstate an error check that was commented out while waiting for armtb1-5/+4
packages to appear
2020-05-14move a #define after the last #include linetb1-3/+3
2020-05-14Skip protocol version message check in appstest.shinoguchi1-10/+15
- OpenSSL1.1.1 with TLSv1.3 does not call SSL_SESSION_print() until NewSessionTicket arrival - Shorten function name