summaryrefslogtreecommitdiffstats
path: root/mutt_ssl.c
AgeCommit message (Collapse)Author
2019-01-18Merge branch 'stable'Kevin McCarthy
2019-01-18Wrap ssl init calls for LibreSSL too.Kevin McCarthy
It looks like LibreSSL does not perform automatic initialization of the library and error strings. Since LibreSSL defines OPENSSL_VERSION_NUMBER as a "version 2", add a check if LIBRESSL_VERSION_NUMBER is defined and call the initialization functions for that case.
2019-01-08Fix compilation with LibreSSL <2.7.0. (closes #112)Stefan Strogin
(cherry picked from commit 9c9bea5e04e2a562017af0ac7a27b1b0e00e8907)
2019-01-08Fix compilation with LibreSSL <2.7.0. (closes #112)Stefan Strogin
2019-01-04Clean up formatting.Kevin McCarthy
Add spaces after if, else, while, for, switch. Unify the brace placement style. The vast majority of the code uses Allman style so convert the relatively few K&R braces over.
2019-01-04Clean up code indentation.Kevin McCarthy
These are mostly automated changes corresponding to the emacs settings: (c-set-style "linux") (setq c-basic-offset 2) (c-set-offset 'case-label '+) Most of the code follows the convention: (add-to-list 'c-cleanup-list 'space-before-funcall) but this is not enforced by this indentation cleanup. Also, I personally dislike tabs, so I have: (setq-default indent-tabs-mode nil) in my own configuration. However I have no desire to change every line just for that effect. So this cleanup does nothing about the mix issue. Some of the secondary files (e.g. regex.c) have been skipped. I've also skipped crypt-gpgme.c, because I need to think about that file. Werner Koch and the GnuPG team contributed most it, and it follows the Gnu indentation settings. It should probably be made uniform with Mutt, but I don't want to discourage future GnuPG contribution to the file. I manually reverted a few unsightly cleanups, and added a few tweeks when I saw things that could be improved.
2018-12-20Fix compilation without deprecated OpenSSL 1.1 APIsRosen Penev
2018-12-02Fix compilation without deprecated OpenSSL 1.1 APIsRosen Penev
2018-08-31Convert certificate prompts to show sha-256 instead of md5.Kevin McCarthy
Due to the length of the sha-256 fingerprint, split the output into two lines. Note that this change now requires OpenSSL 0.9.8+ [2005-07-05], and GnuTLS 1.7.4+ [2007-02-05].
2018-06-01Correct spelling mistakes.Edward Betts
2018-05-28fix inappropriate use of FREE() in ssl init error pathOswald Buddenhagen
OpenSSL structures need to be freed with dedicated functions.
2018-04-15Add libidn2 supportMatej Muzila
2017-06-01Fix "format string is not a string literal" warnings. (closes #3949)TAKAHASHI Tamotsu
Mutt calls msgfmt with '-c' to verify that translation format strings match, but it is still safer to indirect strings with no formatting through %s.
2017-03-26Set refresh when popping the menu stack.Kevin McCarthy
This removes the need for the OPTNEEDREDRAW option and MAYBE_REDRAW macro previously used to communicate back the need to refresh after exiting a menu. Remove the redraw parameter from ci_bounce_message() and mix_make_chain() which served the same purpose.
2017-03-26Add a menu stack to track current and past menus.Kevin McCarthy
Change the pager to use a MENU, right now just to hold the refresh state.
2017-03-13Change OpenSSL to use SHA-256 for cert comparison. (closes #3924)Kevin McCarthy
Note the GnuTLS code compares the certs directly to check if they are in the certfile.
2017-03-09Add SNI support for OpenSSL. (see #3923)Kevin McCarthy
The original patch for this is by Phil Pennock at: https://people.spodhuis.org/phil.pennock/software/mutt-patches/ I have removed the OpenSSL version check and defined(OPENSSL_NO_TLSEXT) check because: * SSL_set_tlsext_host_name() was added in 0.9.8f [11 Oct 2007] * OpenSSL 1.1 no longer has the OPENSSL_NO_TLSEXT compilation option * https://rt.openssl.org/Ticket/Display.html?id=2788&user=guest&pass=guest shows that the no-tlsext compilation option has been broken for some time. * Going forward, I'd like to minimize and start removing cruft required to support ancient/insecure versions of libraries.
2017-03-09OpenSSL: Don't offer (a)ccept always choice for hostname mismatches. (closes ↵Kevin McCarthy
#3914) On a hostname mismatch, saving the certificate is pointless because mutt will ask the user no matter if the certificate is saved or not. The only invocation allowing "accept always" is guarded by a call to check_certificate_digest(), which means the check_certificate_file() check is redundant. Therefore remove that check and add a comment noting why. Thanks to Matthias Andree for the original version of this patch.
2017-03-09Prevent skipped certs from showing a second time. (see #3916)Kevin McCarthy
OpenSSL sometimes passes a skipped certificate to ssl_verify_callback() a second time, with preverify_ok=1. From OpenSSL's viewpoint there is nothing wrong with this, but mutt will end up showing the certificate in the interactive prompt again. Cache the last cert and position, and compare with the latest when skip_mode and preverify_ok are both set.
2017-03-07Don't allow storing duplicate certs for OpenSSL interactive prompt. (closes ↵Kevin McCarthy
#3914) Check to make sure the certificate is not already in the $certificate_file before offering the (a)ccept always option. To allow a cert with a new validity timespan to be added to the file, check the expiration dates when comparing certificates in the certficate file.
2017-03-07Move the OpenSSL partial chain support check inside configure.ac. (see #3916)Kevin McCarthy
Instead of directly checking whether X509_V_FLAG_PARTIAL_CHAIN is defined everywhere, do it once inside configure. This will allow better support in the future if the test needs to change.
2017-03-07Add $ssl_verify_partial_chains option for OpenSSL. (closes #3916)Matthias Andree
The reworked OpenSSL certificate validation took away a "feature" of the previous implementation: the ability to reject a node in the chain and yet continue to the next node. If this new option is set to 'yes', enables OpenSSL's X509_V_FLAG_PARTIAL_CHAIN flag to reinstate the functionality and permit to use a non-root certificate as the trust anchor. This option is only available if OpenSSL offers the X509_V_FLAG_PARTIAL_CHAIN macro, which should be the case as of 1.0.2b or later. Code written by Kevin McCarthy and Matthias Andree.
2017-03-02SSL: Fix memory leak in subject alternative name code. (closes #3920)Matthias Andree
2017-03-02Clear out extraneous errors before SSL_connect() (see #3916)Kevin McCarthy
Call ERR_clear_error() just before the call to SSL_connect() to make sure the error queue doesn't have any old errors in it. PEM_read_X509() sets an error PEM_R_NO_START_LINE on end-of-file. Clear that out so it doesn't show up as the SSL_connect() error message.
2017-02-12Show SHA1 fp in interactive cert check menu.Matthias Andree
While here, fix a few compiler warnings about sign mismatch in comparison.
2017-02-12Fix potential cert memory leak in check_certificate_by_digest().Kevin McCarthy
Thanks to Matthias Andree's debugging, it appears the cert is not freed when PEM_read_X509() encounters EOF. Change the return value check to not overwrite cert. It is already updated via the second parameter.
2017-02-12Plug memory leak in weed-expired-certs code.Matthias Andree
X509_STORE_add_cert() creates a copy of the certificate we're offering, so we need to free our copy afterwards. This isn't documented, but from observed behaviour in OpenSSL 1.0.2 and its master branch source code. Change PEM_read_X509() call to reuse cert to avoid free/reallocation overhead.
2017-02-12Filter expired local certs for OpenSSL verification.Kevin McCarthy
OpenSSL has trouble establishing the chain and verifying when duplicate expired certs are loaded in from $certificate_file. A warning about this is mentioned in SSL_CTX_load_verify_locations(3SSL). Filter out expired certs when loading verify certs. Note that the full certicates file is still used for verification in check_certificate_by_digest().
2016-12-13Rework OpenSSL certificate verification to support alternative chains. ↵Michał Kępień
(closes #3903) The way Mutt currently verifies SSL certificates using OpenSSL does not support alternative chains, which may cause confusion when some popular mail providers (e.g. Gmail) are used with specific sets of trusted CA certificates. Replace the "manual" verification done by mutt in check_certificate_by_signer() with SSL_set_verify() using a callback. OpenSSL then does the certificate verification, including properly looking at alternative chains. The callback still provides the opportunity to override using ~/.mutt_certificates or an interactive prompt.
2016-11-29Add mutt_array_size macro, change interactive_check_cert() to use it. (see ↵Kevin McCarthy
#3899) While I have reservations about the construct, it does make the interactive_check_cert() menu->max and part loop less fragile.
2016-11-29Improve openssl interactive_check_cert. (closes #3899)Kevin McCarthy
Don't use X509_NAME_oneline() with a fixed size buffer, which could truncate the string, perhaps leaving off the CN field entirely. Instead, work directly off the X509_NAME. Rather than use strstr to tokenize it, call X509_NAME_get_text_by_NID() with the nid types. Although X509_NAME_get_text_by_NID() is "legacy", it is the most directly useful for mutt in this simple interactive prompt. The function was set up to include the ST and C fields in the prompt, but the loop limit was too low. I believe this was an oversight, so increase the loop to include those two fields.
2016-11-22Corrected comment.Vincent Lefevre
2016-11-21Revert db13010a2e8d but add a comment. (see #3870)Kevin McCarthy
X509_NAME_oneline() always NULL-terminates the string, even when it has to truncate the data to fit in buf.
2016-11-21Make sure that the output of X509_NAME_oneline is null-terminated.Vincent Lefevre
2016-11-19More openssl1.1 fixes: remove uses of X509->name in debugging. (closes #3870)Kevin McCarthy
X509->name was a shortcut for the longer name = X509_NAME_oneline (X509_get_subject_name (cert), buf, sizeof (buf)); invocation. Change the debugging to print the cert name and chain names in the ssl_check_certificate() loop instead.
2016-09-07Fix openssl 1.1 compilation issues. (closes #3870)TAKAHASHI Tamotsu
With these changes, Mutt will no longer compile for versions less than 0.9.6.
2016-08-30Redraw screen after an SSL cert promptDavid Champion
2016-05-09Change M_* symbols to MUTT_*Derek Martin
Changeset 23334e967dd7 created a workaround for a namespace conflict with Solaris and derivatives. After some discussion, the team decided it would be best to move away from using the "M_" prefix for macros. This patch was automatically generated by running: perl -wpi -e 's/\bM_(\w+)\b/MUTT_$1/g' `find . -name '*.[ch]' -print` with the exception that sys_socket.h was exempted. (That file will be backed out subsequent to this commit.) Thanks to Andras Salamon for supplying the perl script used to make this change.
2016-04-11Add null-terminator to BIO_get_mem_data() output.Kevin McCarthy
It turns out the output isn't necessarily null-terminated.
2016-04-11Add an error message and debugging if SSL_CTX_new() fails. (closes #3831)Kevin McCarthy
Generate a mutt_error(). Add a debugging function ssl_dprint_err_stack() to dprint the ssl error stack.
2016-04-10Check for SSL_CTX_new returning NULL in ssl_sock_open(). (closes #3831)Kevin McCarthy
Thanks to Yuan Kang and the security researchers at Columbia University and the University of Virginia for reporting the bug.
2016-03-19Fix a few typos in translation messages.Kevin McCarthy
Thanks to Moritz Barsnick for reporting these.
2016-03-18Fix typo in debug message.Vincent Lefevre
2015-10-04Create a separate macro/push/exec event buffer. (closes #3779)Kevin McCarthy
Currently, the SSL and TLS certficate prompts turn on OPTUNBUFFEREDINPUT, (to prevent macros and such from running right through the dialog). Unfortunately, the menu dialog processing in menu_dialog_dokey() is using mutt_ungetch() to forward non-dialog keys on to standard menu processing. With OPTUNBUFFEREDINPUT set, those keys never make it to the menu and are buffered until after the menu dialog. This patch creates a new event buffer, separate from the standard "unget" buffer, for use by macros, exec, and push events. These events can be temporarily ignored by setting OPTIGNOREMACROEVENTS (renamed from OPTUNBUFFEREDINPUT), while continuing to allow unget events to be processed. Since the "push" and "unget" functions now go to different buffers, function names were slightly renamed, to make it less easy to unintentionally use the wrong function at the wrong time.
2015-10-04Fix menu type in certificate prompt. (see #3779)Kevin McCarthy
The menu type is used in several places as a direct index into Keymaps[], so passing in -1 to mutt_new_menu() was leading to illegal memory accesses later on. Add a range check in mutt_new_menu(), defaulting to MENU_GENERIC, to prevent this problem in the future.
2015-09-13Add translation comments and improvements.Kevin McCarthy
These were suggested by TAKAHASHI Tamotsu.
2015-05-03Provide SSL cipher selection option. (closes #3167)Kevin McCarthy
Creates a $ssl_ciphers option that allows direct selection of the ciphers for OpenSSL (via SSL_CTX_set_cipher_list) and GnuTLS (via gnutls_priority_set_direct). Thank you Sergio Gelato for the patch.
2013-07-23fix typos in commentsOndřej Bílka
2012-12-22Uses SSLv23_client_method() in mutt_ssl_starttls() because ↵Michael Elkins
TLSv1_2_client_method() does not honor the SSL_OP_NO_TLS* flags. closes #3612
2012-12-18disable tls v1.1/1.2 in mutt_ssl_starttls() based on $ssl_use_tlsv1_*Michael Elkins
see #3571