summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/reallocarray.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2020-09-01Hoist ERR_clear_error() call into the derr: labeltb1-4/+2
The only path that sets TLS1_TICKET_NOT_DECRPYTED is through this label and the ERR_clear_error() is called conditionally on this. We clear the errors to make decrypt errors non-fatal. The free functions should not set the errors and if they do, we don't want to hide that. discussed with jsing
2020-09-01simplify tls1_process_ticket() exit pathtb2-19/+7
tls1_process_ticket() - the only caller of tls_decrypt_ticket() - ends in a switch over the return value of tls_decrypt_ticket() to decide whether or not to set s->internal->tlsext_ticket_expected = 1. Since tls_decrypt_ticket() already knows what it will return and partly bases its decision on what to return on whether or not the ticket needs to be renewed, it can also take care of setting this flag. This way we don't need to have a confusing switch that conflates some return values and sets this flag. Moreover, we can get rid of the ugly TLS1_TICKET_DECRYPTED_RENEW whose only purpose is to signal that the flag should be set. ok jsing
2020-08-31Return code tweaks for session ticket handlerstb3-47/+51
In tls1_process_ticket() and tls_decrypt_ticket() use #defines with descriptive names instead of hardcoding -1 1 2 3 4 and occasionally explaining the magic numbers with comments. ok beck inoguchi
2020-08-31Send alert on ssl_get_prev_session failuretb4-20/+32
ssl_get_prev_session() can fail for various reasons some of which may be internal_error others decode_error alerts. Propagate the appropriate alert up to the caller so we can abort the handshake by sending a fatal alert instead of rudely closing the pipe. Currently only 28 of 292 test cases of tlsfuzzer's test-extension.py pass. With this diff, 272 pass. The rest will require fixes elsewhere. ok beck inoguchi jsing
2020-08-30Start replacing the existing TLSv1.2 record layer.jsing7-195/+614
This takes the same design/approach used in TLSv1.3 and provides an opaque struct that is self contained and cannot reach back into other layers. For now this just implements/replaces the writing of records for DTLSv1/TLSv1.0/TLSv1.1/TLSv1.2. In doing so we stop copying the plaintext into the same buffer that is used to transmit to the wire. ok inoguchi@ tb@
2020-08-29define OPENSSL_NO_SSL_TRACE in opensslfeatures.hinoguchi1-1/+1
ok jsing@ tb@
2020-08-17Fix append mode so it always writes to the end and expand regress.libressl-v3.2.1millert1-26/+77
OK deraadt@ martijn@
2020-08-17Also print a list of missing scripts in summarytb1-5/+10
2020-08-17Avoid test failures due to outdated packagestb1-1/+6
Indicate missing test scripts prominently in the result but do not count them as an error.
2020-08-15enable jsing's zero content type testtb1-1/+2
2020-08-11Send an unexpected message alert if no valid content type is found.jsing1-2/+5
When record protection is engaged, the plaintext must be followed by a non-zero content type and optional zero padding. If the plaintext is zero length or only consists of zero bytes then it is not a valid message, since the content type is unspecified. ok tb@
2020-08-11Increment the epoch in the same place for both read and write.jsing1-3/+3
ok inoguchi@ tb@
2020-08-11Use 0 instead of 0x00 for memset() calls.jsing2-8/+8
ok inoguchi@ tb@
2020-08-11Use SSL3_SEQUENCE_SIZE for last_write_sequence[] rather than hardcoding.jsing1-2/+2
ok inoguchi@ tb@
2020-08-11In SSL_new() just 'goto err' on allocation failure.jsing1-11/+6
The error path does the same as the currently duplicated code. ok inoguchi@ tb@
2020-08-11I accidentally zeored out a few bytes of the TLSv1.0 session ID.tb1-1/+1
Restore them to their previous values.
2020-08-10Avoid passing -1 to freezero.tb1-9/+10
If a peer sends a bogus record consisting of all-zero plaintext, the content_len would be decremented to -1 and cause a crash in freezero. ok inoguchi jsing
2020-08-09Fix some wrapping/indent.jsing1-4/+3
2020-08-09Convert openssl req option handling.jsing1-378/+572
With input from inoguchi@ ok beck@ inoguchi@
2020-08-09Update TLS versions to match TLSv1.3 being enabled for TLS_method().jsing1-8/+8
2020-08-09Fix regress test so that it exits non-zero for failure cases.jsing1-1/+11
2020-08-09Update golden values to match P-521 being enabled by default in the client.jsing1-20/+21
Diff from tb@
2020-08-09Update golden values to match P-521 being enabled by default in the client.jsing1-10/+11
2020-08-09Add P-521 to the list of curves supported by default in the client.jsing1-5/+18
A certain VPN provider appears to have configured their servers to only accept P-521 for TLSv1.3 key exchange. The particular VPN software in use also does not currently allow for the TLSv1.3 key share groups to be configured, which means that there is no way to easily use LibreSSL in this situation. Include P-521 in the list of curves that are supported by default in the client, in order to increase interoperability. Discussed at length with beck@, inoguchi@ and tb@. ok tb@
2020-08-09Use CBB more correctly when writing SSL3/DTLS records.jsing2-66/+92
Previously we used CBB to build the record headers, but not the entire record. Use CBB_init_fixed() upfront, then build the record header and add space for the record content. However, in order to do this we need to determine the length of the record upfront. This simplifies the code, removes a number of manual bounds checks and makes way for further improvements. ok inoguchi@ tb@
2020-08-09Make the explicit IV length handling in DTLS the same as SSL3/TLS.jsing1-8/+13
ok inoguchi@ tb@
2020-08-08Session resumption is not currently supported for TLSv1.3.tb1-4/+4
2020-08-08Enable P-521 and run the tests that use it.tb1-5/+3
2020-08-06delete another word to improve the wording; suggested by jmc@schwarze1-2/+2
2020-08-06Explain the purpose of CMAC_resume(3) in more detail.schwarze1-3/+9
Triggered by jmc@ apparently misunderstanding the intention of the text and fixing a grammatical error in a way that wasn't ideal, so i guess he wouldn't have been the only one to find the previous version hard to understand. OK jmc@
2020-08-04Cleanup aead_ctxinoguchi1-1/+3
ok jsing@ tb@
2020-08-03Only parse a client's status_request in the CHtb1-1/+4
A client should only send a status_request as part of the CH. Pointed out by Michael Forney ok inoguchi jsing
2020-08-03Ensure clients only send a status_request in the CHtb1-3/+7
The current code might cause a client to send a status_request containing a CertificateStatusRequest with its certificate. This makes no sense. Pointed out by Michael Forney ok inoguchi jsing
2020-08-03Correctly handle server requests for an OCSP responsetb1-1/+12
According to RFC 8446, 4.4.2.1, a server may request that a client present an OCSP response with its certificate by sending an empty status_request extension as part of the certificate request. The current code expects a full CertificateStatus structure, which is only sent if the server sends an OCSP response with its certificate. This causes interoperability issues with Go's TLS server and with newer GnuTLS where we would abort the handshake with a decode_error alert and length mismatch error. Issue reported and diagnosed by Michael Forney Problem also found by Mikolaj Kucharski and inoguchi. ok inoguchi jsing
2020-08-02Check the return value of tls1_enc() in the write path.jsing2-6/+6
The write path can return a failure in the AEAD path and there is no reason not to check a return value. Spotted by tb@ during another review. ok tb@
2020-08-01Clean up/simplify more of the dtls1/ssl3 record writing code:jsing2-73/+34
- Make the DTLS code much more consistent with the ssl3 code. - Avoid assigning wr->input and wr->length just so they can be used as arguments to memcpy(). - Remove the arc4random_buf() call for the explicit IV, since tls1_enc() already does this for us. ok tb@
2020-08-01Pull record version selection code up and pass it as an argument tojsing1-15/+15
ssl3_create_record(). ok tb@
2020-08-01Replace hostname underscore with hyphen in appstest.shinoguchi1-28/+28
2020-07-30Have ssl_init_wbio_buffer() push the buffering BIO rather than doing itjsing1-5/+2
ourselves. Spotted by tb@ during a previous review.
2020-07-30Clean up and simplify some of the SSL3/DTLS1 record writing code.jsing2-76/+72
This will allow for further changes to be made with less complexity and easier review. In particular, decide if we need an empty fragment early on and only do the alignment calculation once (rather than in two separate parts of the function. ok tb@ inoguchi@
2020-07-30Add minimal info callback support for TLSv1.3tb3-3/+32
As abieber@ found the hard way, some python frameworks (twisted, synapse) thought it a great idea to use the info callback mechanism (designed to get state information about SSL objects) to modify state information such as setting and verifying the SNI. The switch of TLS_method() to default to TLSv1.3 broke these contraptions. Further bits of the info callback mechanism will likely metastasize throughout the TLSv1.3 stack if we need them, so we only do what's really necessary now. Lots of debugging, crucial hint and testing by abieber input & ok jsing
2020-07-27Wrap long lines s_server.cinoguchi1-67/+130
2020-07-27Add function prototype and move sub functions to bottominoguchi1-198/+197
2020-07-27Remove space between '*' and pointer variable in s_server.cinoguchi1-12/+12
2020-07-27Remove 's_' prefix from member of s_server_config structinoguchi1-110/+110
2020-07-27Convert openssl(1) s_server option handlinginoguchi1-568/+929
ok and comments from jsing@
2020-07-25Handle SSL_MODE_AUTO_RETRY being changed during a TLSv1.3 session.jsing1-1/+4
Both Perl's HTTP::Tiny and IO::Socket::SSL know about SSL_MODE_AUTO_RETRY and try to work around the fact that OpenSSL enabled it by default. However, this can lead to the mode being disabled prior to the TLSv1.3 handshake and then enabled after the handshake has completed. In order to handle this correctly we have to check the mode and inform the record layer prior to every read. Issue reported and test case provided by Nathanael Rensen <nathanael@polymorpheus.com>. ok inoguchi@ tb@
2020-07-25remove half a dozen "goto" statements and a labelschwarze1-14/+1
that change nothing whatsoever, except making the code harder to read; OK tb@
2020-07-24tweak previous;jmc1-4/+4
2020-07-23document PEM_X509_INFO_read(3) and PEM_X509_INFO_read_bio(3)schwarze7-14/+207
OK tb@