summaryrefslogtreecommitdiffstats
path: root/lib (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Rename two local variables ssl to s for consistencytb2021-01-072-11/+11
| | | | | | | | | | | | | In our tls13_* files, we use SSL *s for local variables and SSL *ssl for function arguments. This is odd, but probably the result of finger memory. We intended to use ssl everywhere. Be that as it may, all local variables except in two functions ended up being called s, so align the two outliers with that. As noted by jsing, this is not ideal either as in tls13_legacy_servername_process() the ssl_ctx is now inconsistent. Renaming all s to ssl is a substantial amount of unnecessary churn at a moment that isn't ideal, so we have to live with that. ok bcook inoguchi jsing
* Make tls12_record_layer_free() NULL safe.jsing2021-01-071-1/+5
| | | | | | This is not an issue currently, but avoids future surprises. Noted by tb@
* Move the read MAC key into the TLSv1.2 record layer.jsing2021-01-074-23/+20
| | | | ok inoguchi@ tb@
* sleep(3): don't bypass nanosleep(2) if seconds is zerocheloha2021-01-071-4/+1
| | | | | | | | | | | | | | | | | | | | | | sleep(3) does not call nanosleep(2) if seconds is zero. This is bad. As a simplified interface to nanosleep(2), sleep(3) should delegate all decisions about whether or not to yield the CPU to nanosleep(2). This patch removes the nanosleep(2) bypass from sleep(3). This means that this code: sleep(0); will block for up to 1 tick, just like the equivalent nanosleep(2) call. Neither FreeBSD nor NetBSD bypass nanosleep(2) in the zero case, so this commit brings our sleep(3) closer to theirs in behavior. As an added bonus, sleep(3) will now *always* appear in a ktrace(1) as a call to nanosleep(2). ok millert@
* Use tls13_secret_{init,cleanup}() for the finished_keytb2021-01-062-10/+10
| | | | | | | | This trades an array on the stack for a dynamically allocated secret in tls13_{client,server}_finished_send() but has the benefit of wiping out an intermediate secret on function exit. ok jsing
* Fix two issues related to thread private data in asr.otto2021-01-064-20/+49
| | | | | | | | - setting up asr in single thread mode and then starting threads using asr would lead to multiple threads sharing the same resolver. - destruction of a thread that has been using asr would leak data. Problem originally reported by Alexey Sokolov and Uli Schlachter. ok kettenis@
* Avoid local variable in tls13_secret_init().tb2021-01-051-6/+2
| | | | suggested by jsing
* Convert tls13_record_layer.c to tls13_secret_{init,cleanup}()tb2021-01-051-21/+11
| | | | ok jsing
* Convert tls13_exporter() to tls13_secret_{init,cleanup}()tb2021-01-051-8/+5
| | | | ok jsing
* Use KNF for licence commenttb2021-01-051-2/+3
| | | | ok jsing
* Move tls13_secrets_destroy() below _create()tb2021-01-051-29/+29
| | | | ok jsing
* Convert tls13_secrets_{create,destroy}() to tls13_secret_{init,cleanup}()tb2021-01-051-71/+34
| | | | ok jsing
* Add tls13_secret_{init,cleanup}()tb2021-01-052-2/+29
| | | | | | | | These are two functions that will help streamlining various functions in the TLSv1.3 code that do not need to know about the interna of this struct. input/ok jsing
* Fix indent.jsing2021-01-051-2/+2
|
* Use consistent names in tls13_{client,server}_finished_{recv,send}().jsing2021-01-052-12/+12
| | | | | | | | | In tls13_{client,server}_finished_recv() we use verify_data_len, which makes more sense than hmac_len. Use the same name in tls13_{client,server}_finished_send(), keeping things consistent between functions. ok tb@
* Use legacy verifier when building auto chains.jsing2021-01-052-2/+6
| | | | | | | | | | | | | | | | | | The new verifier builds all chains, starting with the shortest possible path. It also does not currently return partial chains. Both of these things conflict with auto chain, where we want to build the longest possible chain (to include all intermediates, and probably the root unnecessarily), as well as using an incomplete chain when a trusted chain is not known. Depending on software configuration, we can end up building a chain consisting only of a leaf certificate, rather than a longer chain. This results in auto chain not including intermediates, which is undesireable. For now, switch auto chain building to use the legacy verifier. This should resolve the issues encountered by ajacoutot@ with sendmail. ok tb@
* Handle X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE in new verifier.jsing2021-01-051-1/+4
| | | | | | Yet another mostly meaningless error value... Noted by and ok tb@
* Gracefully handle root certificates being both trusted and untrusted.jsing2021-01-052-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | When a certificate (namely a root) is specified as both a trusted and untrusted certificate, the new verifier will find multiple chains - the first being back to the trusted root certificate and a second via the root that is untrusted, followed by the trusted root certificate. This situation can be triggered by a server that (unnecessarily) includes the root certificate in its certificate list. While this validates correctly (using the first chain), it means that we encounter a failure while building the second chain due to the root certificate already being in the chain. When this occurs we call the verify callback indicating a bad certificate. Some sensitive software (including bacula and icinga), treat this single bad chain callback as terminal, even though we successfully verify the certificate. Avoid this problem by simply dumping the chain if we encounter a situation where the certificate is already in the chain and also a trusted root - we'll have already picked up the trusted root as a shorter path. Issue with icinga2 initially reported by Theodore Wynnychenko. Fix tested by sthen@ for both bacula and icinga2. ok tb@
* Remove memset that was made redundant with the ASN1_time_parse()tb2021-01-051-4/+1
| | | | | | fix in libcrypto/asn1/a_time_tm.c r1.16. Suggested by jsing
* double word fix; from martin vahlensieckjmc2021-01-052-6/+6
|
* whitespacetb2021-01-043-10/+10
|
* Keep the various free calls of tls13_record_layer_free() in thetb2021-01-041-4/+4
| | | | | | order of the struct members for reviewability. ok jsing
* Make consistent reference to pathname.rob2021-01-0310-35/+35
| | | | OK schwarze@, jmc@, deraadt@
* Make CHIN() Boolean-valued and use this to turn an expression with atb2021-01-032-5/+5
| | | | | | quintuple negation into one with a simple negation. From miod, ok millert
* Turn macros into inline functions so that there is no need to document intb2021-01-031-5/+21
| | | | | | comments that they will evaluate their arguments multiple times. From miod, ok millert
* Remove two now-unused functions; a result of the categories removal.millert2021-01-021-39/+2
| | | | From miod@, OK tb@
* Move Makefiles for libc++ and libc++abi to gnu/lib in preparation for anpatrick2021-01-025-408/+2
| | | | | | | | upcoming update to those, which will see both codebases heading into the gnu/llvm dumpster. Feedback from jsg@ ok deraadt@ kettenis@
* Tweak previous:schwarze2021-01-021-19/+34
| | | | | | | * Do not abuse .Bl -tag for lists without bodies, use .Bl -item instead. * In tagged lists, put bodies into bodies, not into heads. * Add a few missing macros. * Drop some useless quoting.
* Make list of DHE parameters more prominentkn2021-01-021-6/+19
| | | | | | | Follow the previous commit and complete the manual page for consistency; better readable and tags for free. OK tb
* Free {alert,phh}_data in tls13_record_layer_free()tb2021-01-021-1/+4
| | | | | | | | | | | | | | httpd(8)'s incorrect tls_close() after closing the underlying socket led to a leak: tls_close()'s attempt to send out the close_notify won't work very well over a closed pipe. This resulted in alert_data still hanging off the TLSv1.3 context's record layer struct. The tls_free() call should have cleaned this up but failed to do so. The record layer's phh_data potentially has the same issue, so free it as well. This diff makes -current httpd(8) run in constant memory over hundreds of thousands TLS connections with a static site. ok inoguchi jsing
* Remove libunwind 8.0.0 now that we switched to libunwind 11.0.0 in thepatrick2021-01-0231-17857/+0
| | | | gnu/ directory.
* Switch libc++ and libc++abi to use libunwind 11.0.0. Bump major for bothpatrick2021-01-024-7/+7
| | | | | | | libraries due to dynamic export additions and removals in libc++abi. Tested by kettenis@, visa@ and myself ok kettenis@
* Whitespace.rob2021-01-022-39/+39
| | | | OK martijn@
* More regular error handling with the REQUIRE macro.millert2020-12-311-5/+4
| | | | | | | Changing it from ((condition) || function call) to an if() wrapped in a do/while is easier to read and more stylistically consistent. The seterr() function no longer needs to return a value. From miod@, OK tb@
* Remove unused categories in re_guts; they are written to but never read.millert2020-12-312-45/+3
| | | | From miod@, OK tb@
* Strings in struct parse can be const, they are never modified.millert2020-12-311-15/+11
| | | | | Also, the temporary array in nonnewline() can be made static const. From miod@, OK tb@
* getifaddrs() can return entries where ifa_addr is NULL. Check for thisbenno2020-12-302-4/+7
| | | | | before accessing anything in ifa_addr. ok claudio@
* Make the list of supported protocols more prominentkn2020-12-301-5/+15
| | | | | | | | | | Manuals like httpd.conf(5) refer to this for valid protocol strings, but elements inlined into sentences are hard find to spot. Use a list as already done elsewhere in this manual. OK jmc on earlier version Feeback OK tb
* regcomp.c uses the "start + count < end" idiom to check that there aretb2020-12-301-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | "count" bytes available in an array of char "start" and "end" both point to. This is fine, unless "start + count" goes beyond the last element of the array. In this case, pedantic interpretation of the C standard makes the comparison of such a pointer against "end" undefined, and optimizers from hell will happily remove as much code as possible because of this. An example of this occurs in regcomp.c's bothcases(), which defines bracket[3], sets "next" to "bracket" and "end" to "bracket + 2". Then it invokes p_bracket(), which starts with "if (p->next + 5 < p->end)"... Because bothcases() and p_bracket() are static functions in regcomp.c, there is a real risk of miscompilation if aggressive inlining happens. The following diff rewrites the "start + count < end" constructs into "end - start > count". Assuming "end" and "start" are always pointing in the array (such as "bracket[3]" above), "end - start" is well-defined and can be compared without trouble. As a bonus, MORE2() implies MORE() therefore SEETWO() can be simplified a bit. from miod, ok millert
* Constify the strings in regerror.c and make use of the strlcpy()tb2020-12-301-14/+14
| | | | | | return value to avoid a redundant strlen() call. from miod, ok millert
* cclasses[] multis field is always an empty string. Remove it and codetb2020-12-303-88/+16
| | | | | | dealing with it. This code was incomplete anyway. from miod, ok millert
* Constify the strings in cnames[]. No functional change.tb2020-12-302-5/+5
| | | | from miod, ok millert
* Allocate new buffer space based on requested need.rob2020-12-291-3/+3
| | | | OK martijn@
* Remove unnecessary assignment.rob2020-12-291-2/+1
| | | | OK martijn@
* Update libexpat to 2.2.10. Relevant are only bug fixes #390 #395bluhm2020-12-2910-116/+253
| | | | | #398 #404 #405 and other changes #354 #355 #412. OK deraadt@
* Document kern.video.record.mglocker2020-12-291-2/+19
| | | | | | With help/input from jmc@ and kn@. ok jmc@
* Fix an off-by-one error in the marking of the O_CH operator followingmillert2020-12-281-2/+2
| | | | | an OOR2 operator. Also includes a regress test for the issue. From FreeBSD via miod@
* Destroy the mutex in tls_config objects when tls_config_free is called.bcook2020-12-221-1/+3
| | | | | | Add a stub for pthread_mutex_destroy() for installers. ok tb@
* Revert call to pthread_mutex_destroy until installers have a stub.bcook2020-12-221-3/+1
| | | | noted by deraadt@
* Destroy the mutex in a tls_config object when tls_config_free is called.bcook2020-12-211-1/+3
| | | | ok inoguchi@