summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2021-09-01Remove assignment of value that is never read.Bob Beck
ok tb@
2021-08-31Remove some dead code that was missed in an earlier cleanup andTheo Buehler
fix a stale comment. Found by mortimer with clang 13's -Wunused-but-set-variable. ok beck
2021-08-31Defragment DTLS.Joel Sing
In normal TLS, it is possible for record fragments to be sent that contain one byte of alert or handshake message payload. In this case we have to read and collate multiple message fragments before we can decide what to do with the record. However, in the case of DTLS, one record is effectively one packet and while it is possible to send handshake messages across multiple records/packets, the minimum payload is the DTLS handshake message header (plus one byte of data if the handshake message has a payload) - without this, there is insufficient information available to be able to reassemble the handshake message. Likewise, splitting an alert across multiple DTLS records simply does not work, as we have no way of knowing if we're collating the same alert or two different alerts that we lost half of each from (unfortunately, these details are not really specified in the DTLS RFC). This means that for DTLS we can expect to receive a full alert message (a whole two bytes) or a handshake record with at least the handshake message header (12 bytes). If we receive messages with less than these lengths we discard them and carry on (which is what the DTLS code already does). Remove all of the pointless fragment handling code from DTLS, while also fixing an issue where one case used rr->data instead of the handshake fragment. ok inoguchi@ tb@
2021-08-31Remove a nonsensical s->version == TLS1_VERSION from DTLS code.Joel Sing
ok inoguchi@ tb@ (as part of a larger diff)
2021-08-31whitespaceTheo Buehler
2021-08-30Make uuid_from_string() reject a string of the correct length but having aKenneth R Westerback
non-hex digit in the last character. Inspired by code in uuid_parse() from Ted Ts'o. ok millert@
2021-08-30Clean up and simplify info and msg callbacks.Joel Sing
The info and msg callbacks result in duplication - both for code that refers to the function pointers and for the call sites. Avoid this by providing typedefs for the function pointers and pulling the calling sequences into their own functions. ok inoguchi@ tb@
2021-08-30Replace DTLS r_epoch with the read epoch from the TLSv1.2 record layer.Joel Sing
ok inoguchi@ tb@
2021-08-30Move to an AEAD nonce allocated in the TLSv1.2 record layer.Joel Sing
There is little to gain by mallocing and freeing the AEAD nonce for each record - move to an AEAD nonce allocated for the record layer, which matches what we do for TLSv1.3. ok inoguchi@ tb@
2021-08-30sync with OpenSSL 1.1.1, which is still under a free license;Ingo Schwarze
in particular, this includes new text by Matt Caswell from OpenSSL commit 721eb8f6 Nov 28 12:03:00 2019 +0000 and corrects a wrong argument type that i introduced into the SYNOPSIS; requested by tb@
2021-08-30Document that %n has been neutered -- it now does syslog+abort.Theo de Raadt
ok ingo
2021-08-30Ignore warning alert returns from servername callback in TLSv1.3Theo Buehler
If a servername callback returns SSL_TLSEXT_ERR_ALERT_WARNING, this results in a fatal error in TLSv1.3 since alert levels are implicit in the alert type and neither close_notify nor user_canceled make sense in this context. OpenSSL chose to ignore this, so we need to follow suit. Found via a broken servername callback in p5-IO-Socket-SSL which returns a Boolean instead of SSL_TLSEXT_ERR_*. This happened to have worked before TLSv1.3 since warning alerts are often ignored. This "fixes" sni.t and sni-verify.t in p5-IO-Socket-SSL. ok beck jsing
2021-08-30jca and I converted %n to a syslog warning about a year ago, and the portsTheo de Raadt
ecosystem experienced a very good cleanup. Time has arrived to switch (as planned) to syslog + abort, which will result in a coredump thus identifying the remaining culprits in a more visible fashion. vfprintf(3) and vfwprintf(3) man pages still require documentation changes. with jca
2021-08-30Revert previous change that changed our default return for unable toBob Beck
find leaf cert issuers. This breaks perl and ruby regress, as noticed by tb that "we tried this before". Jan's regress that cares about 21 vs 20 needs to change ok tb@
2021-08-30Fix Jan's regress in openssl/x509 to do what it says it does,Bob Beck
then fix the only thing it still has complaints about which is that we don't return the leaf version of the error code when we can't verify the leaf (as opposed to the rest of the chain) ok jan@ tb@
2021-08-29fix an obvious mixup regarding the order of lines in the SYNOPSIS,Ingo Schwarze
and an omission below HISTORY
2021-08-29Don't call the verify callback twice on success.Bob Beck
This fixes a problem in the perl regress where it notices the callback is called twice and complains. ok tb@ bluhm@
2021-08-29Add ober_dup. Needed for upcoming SNMPv3 support for trap receiver inMartijn van Duren
snmpd(8). OK jmatthew@ OK deraadt@ for bumping libutil now.
2021-08-28Get rid of historical code to extract the roots in the legacy case.Bob Beck
Due to the need to support by_dir, we use the get_issuer stuff when running in x509_vfy compatibility mode amyway - so just use it any time we are doing that. Removes a bunch of yukky stuff and a "Don't Look Ethel" ok tb@ jsing@
2021-08-28Clean up and simplify ssl3_dispatch_alert() and ssl3_send_alert().Joel Sing
ok inoguchi@ tb@
2021-08-28Zap blanks before tabs.Theo Buehler
2021-08-28Remove the "dump_chain" flag and code. This was a workaround for a problem whereBob Beck
roots were not checked correctly before intermediates that has since been fixed and is no longer necessary. It is regress checked by case 2c in regress/lib/libcrypto/x509/verify.c ok jsing@ tb@
2021-08-27Remove unused #include <assert.h>.Theo Buehler
This is from upstream where there is an assert() that EVP_MD_size(digest) matches the length returned by HMAC(). We avoid asserts in our libraries. From Martin Vahlensieck
2021-08-24Fix various read buffer overflow when printing ASN.1 strings (which areTheo Buehler
not necessarily NUL terminated). Same as schwarze's fix in t_x509a.c r1.9. From David Benjamin and Matt Caswell (part of the fixes in OpenSSL 1.1.1l) ok inoguchi
2021-08-19Pull roots out of the trust store in the legacy xsc when building chainsBob Beck
to handly by_dir and fun things correctly. - fixes dlg@'s case and by_dir regress in openssl-ruby ok jsing@
2021-08-18Import initial code for the SM2 cipherTheo Buehler
This adds the SM2 algorithm defined in the Chinese standards GB/T 32918.1-2016, GB/T 32918.2-2016, GB/T 32918.3-2016, GB/T 32918.4-2016 and GB/T 32918.5-2017. This is an ISC licensed implementation contributed by Ribose.inc, based on the same code that was contributed to OpenSSL by Jack Lloyd. The port to LibreSSL was done by Ronald Tse and Nickolay Olshevsky. Github PR #105 I made quite a few cleanup passes on this, but more is needed, some of which will happen in-tree before this is linked to the build. ok deraadt inoguchi (a long time ago), jsing
2021-08-18Add a check_trust call to the legacy chain validation on chain add, rememberingBob Beck
the result in order to return the same errors as OpenSSL users expect to override the generic "Untrusted cert" error. This fixes the openssl-ruby timestamp test. ok tb@
2021-08-18Refactor the legacy chain validation from the chain adding code into itsBob Beck
own function, in preparation for subesquent change. No functional change. ok tb@
2021-08-16typo in commentTheo Buehler
2021-08-14when talking about non-blocking I/O, .Xr both FIONBIO and O_NONBLOCKIngo Schwarze
in the most concise way i managed to come up with; suggested by martijn@ and OK millert@ martijn@
2021-08-13Stop using a while loop for code that runs at most once,Ingo Schwarze
and garbage collect an automatic variable that is no longer needed and a comment that was probably contributed by Capt. Obvious. No functional change. OK millert@ martijn@
2021-08-12Stop playing hopeless games with FIONBIO.Ingo Schwarze
If the calling program sets this flag, that is (1) either a bug (or at least needless) (2) or clearing it in el_wgets(3) will break other functionality of the calling program if it really requires it. In both cases, treating EAGAIN as a fatal error in el_wgets(3) is better than brushing the issue under the carpet: at least it tells the program author that something is amiss. Instead of attempting automatic repairs that will almost never do the right thing, clearly state in the manual page that the editline(3) library is not designed to work with non-blocking I/O. The problem was found while investigating a bug report from deraadt@ in sftp(1). OK millert@ and "mostly OK" martijn@
2021-08-11Only enter the sig_no switch if we actually return from read(2) withMartijn van Duren
errno == EINTR. There was a race here where read(2) can return with a different errno, but the signal handler enters between the read return and the switch, which could result in handling a signal, while we should be handling the error. This fix assumes that signal handlers don't clobber our errno, but doing that would open a whole other can of worms. OK schwarze@, millert@
2021-08-10While el_gets(3) and el_wgets(3) wait for user input, no longer ignoreIngo Schwarze
the first signal received. No change for SIGCONT and SIGWINCH, but for other signals, return to the application program and let that program decide what to do, typically either exit or provide a fresh prompt. Bug originally reported by deraadt@ regarding behaviour of Ctrl-C in sftp(1). With this patch, sftp(1) no longer ignores Ctrl-C but exists, and the same applies to a few other programs. Some others that used to ignore Ctrl-C now provide a fresh prompt instead. For several, behaviour is unchanged. At this point, i'm not aware of a serious regression in any program. OK deraadt@ martijn@ and no objection from millert@. Patch also tested by claudio@ with bgplgsh(8).
2021-08-09Unifdef read__fixio() to make it readable.Ingo Schwarze
Also, no need to clear O_NDELAY with fcntl(F_SETFL) when ioctl(FIONBIO) is called right afterwards. No functional change intended. OK martijn@
2021-08-06link X509_STORE_get_by_subject(3) and X509_ocspid_print(3) to the build,Ingo Schwarze
forgotten in earlier commits
2021-08-06new manual page X509_ocspid_print(3)Ingo Schwarze
using input from tb@, and OK tb@ on an earlier version
2021-08-06add a roff(7) comment marking the API function X509_get_default_private_dir()Ingo Schwarze
as intentionally undocumented because it is trivial and unused in the wild; OK tb@
2021-08-04SSL_CTX_remove_session() checks for a NULL session, avoid doing it twice.Joel Sing
Noted by tb@ during review of a larger change.
2021-08-03Document X509_get_default_cert_dir_env(3)Ingo Schwarze
and X509_get_default_cert_file_env(3). LibreSSL itself does not call getenv(3), but a few application programs including epic5, fetchmail, fossil, slic3r call these functions, so in case programmers find them in existing code, telling them what they do seems useful.
2021-08-03Document X509_get_default_cert_area(3).Ingo Schwarze
Put it into this page because this is the code actually using it. Despite its name and include file, it is unrelated to X.509 and unrelated to certificates: it is just the default directory containing the library configuration file, openssl.cnf(5).
2021-08-02tweaks regarding X509_LOOKUP_by_subject(3):Ingo Schwarze
* document the X509_OBJECT output parameter * more precision regarding return values * clarify relationship with X509_LOOKUP_ctrl(3) for the dir lookup method
2021-08-02new manual page X509_STORE_get_by_subject(3)Ingo Schwarze
2021-08-01document X509_STORE_load_mem(3) and X509_STORE_add_lookup(3)Ingo Schwarze
2021-07-31document X509_LOOKUP_mem(3) in X509_LOOKUP_hash_dir(3)Ingo Schwarze
and add a new manual page X509_LOOKUP_new(3)
2021-07-31We have defines for alert levels - use them instead of magic numbers.Joel Sing
2021-07-30Move the explanations related to *ptree closer together and correctIngo Schwarze
the lie that *ptree is set upon success - in some cases of success, it is set to NULL, whereas in some cases of failure, a non-trivial tree may be returned. beck@ pointed out that statements related to *ptree were scattered all over the place, and this patch works for him.
2021-07-29Fix a documentation bug i introduced that tb@ pointed out:Ingo Schwarze
X509_policy_check(3) never returns 2. If validation succeeds, it always returns 1.
2021-07-29Document X509_STORE_set_verify_func(3), mostly using text from theIngo Schwarze
OpenSSL 1.1.1 branch, which is still under a free license, tweaked by me. While here, garbage collect the weird BUGS section.
2021-07-29document X509_STORE_CTX_get0_parent_ctx(3)Ingo Schwarze