diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-04-11 08:34:15 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-04-13 08:49:19 +0200 |
commit | 74830d83eb09f440214b3dedb929677ebc0358a7 (patch) | |
tree | 0edcc6dcb663920de5f5a0ee18697a98695112f3 /lib/handshake.h | |
parent | 6009094a8cb41ce82f634708dd846ab867d9483a (diff) | |
download | gnutls-74830d83eb09f440214b3dedb929677ebc0358a7.tar.gz |
ANON,SRP,NULL ciphersuites: when set do not negotiate TLS1.3 or later
The reason is that these ciphersuites cannot be negotiated using TLS1.3.
There is a different strategy followed for these.
* NULL ciphersuites: they are not something normally enabled and used
for debugging purposes mostly. When set both in client and server side
only TLS1.2 can be used.
* SRP ciphersuites: they are used on client side when the client is actually
performing a username-password authentication with SRP. On server side we
can have indeed a server support SRP and non-SRP. In that case we limit
both on TLS1.2. That an unfortunate restriction, but is not a regression
and IMHO these servers would most likely be phased out as very few would
want to stick to TLS1.2 connections for SRP; or we may have an SRP update
for TLS1.3 which could lift that limitation in the future.
* ANON ciphersuites: they are used in certain client/server setups where very
basic level of security is required, and in opportunistic encryption scenarios.
There is a difference in the handling of these cases. In the case of Anon-only
server/clients they provide the session with anonymous credentials structure; in
the case of opportunistic encryption they provide both certificate and anonymous
credentials. Thus we allow the protocol (TLS1.3) be in the priorities, but if we
see no certificate or PSK credentials we disable TLS1.3 negotiation.
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'lib/handshake.h')
-rw-r--r-- | lib/handshake.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/handshake.h b/lib/handshake.h index 1096226410..2175d6f2db 100644 --- a/lib/handshake.h +++ b/lib/handshake.h @@ -26,6 +26,7 @@ #include "errors.h" #include "record.h" +#include <assert.h> #define IMED_RET( str, ret, allow_alert) do { \ if (ret < 0) { \ @@ -107,6 +108,20 @@ inline static int handshake_remaining_time(gnutls_session_t session) return 0; } +/* Returns non-zero if the present credentials are sufficient for TLS1.3 negotiation. + * This is to be used in client side only. On server side, it is allowed to start + * without credentials. + */ +inline static unsigned have_creds_for_tls13(gnutls_session_t session) +{ + assert(session->security_parameters.entity == GNUTLS_CLIENT); + if (_gnutls_get_cred(session, GNUTLS_CRD_CERTIFICATE) != NULL || + _gnutls_get_cred(session, GNUTLS_CRD_PSK) != NULL) + return 1; + + return 0; +} + int _gnutls_handshake_get_session_hash(gnutls_session_t session, gnutls_datum_t *shash); int _gnutls_check_id_for_change(gnutls_session_t session); |