]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
gnutls_session_resumption_requested: fixed behavior under TLS1.3
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Fri, 17 Aug 2018 12:43:30 +0000 (14:43 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 20 Aug 2018 08:36:12 +0000 (10:36 +0200)
This makes gnutls_session_resumption_requested() functional under
TLS1.3 and introduces a unit test of the function.

Resolves #546

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
lib/ext/pre_shared_key.c
lib/gnutls_int.h
tests/resume.c

index b2f24bc3baacb677855fd1624e56f773b3ba0ae3..f3bd9c5973399482cbbb606a7e061b2a4253c019 100644 (file)
@@ -493,6 +493,8 @@ static int server_recv_params(gnutls_session_t session,
                    (ret = _gnutls13_unpack_session_ticket(session, &psk.identity, &ticket_data)) == 0) {
                        prf = ticket_data.prf;
 
+                       session->internals.resumption_requested = 1;
+
                        /* Check whether ticket is stale or not */
                        ticket_age = psk.ob_ticket_age - ticket_data.age_add;
                        if (ticket_age < 0) {
index 925759049cc725e567455a9f25889a5bc6725add..f4dc71bb3c32194c8d44649c227ccd954fe9c1e7 100644 (file)
@@ -1091,7 +1091,10 @@ typedef struct {
 
        /* resumed session */
        bool resumed;   /* RESUME_TRUE or FALSE - if we are resuming a session */
-       bool resumption_requested;      /* non-zero if resumption was requested by client */
+
+       /* server side: non-zero if resumption was requested by client
+        * client side: non-zero if we set resumption parameters */
+       bool resumption_requested;
        security_parameters_st resumed_security_parameters;
        gnutls_datum_t resumption_data; /* copy of input to gnutls_session_set_data() */
 
index c0217b5dc0f9df21808026c73e48d395edaee7e2..953c0173885fcd6a07cfdfa2973c53a5ec0c74c6 100644 (file)
@@ -355,6 +355,12 @@ static void verify_server_params(gnutls_session_t session, unsigned counter, str
                }
        }
 
+       if (counter > 0) {
+               if (gnutls_session_resumption_requested(session) == 0) {
+                       fail("client did not request resumption!\n");
+               }
+       }
+
        if (params->no_early_start) {
                if (gnutls_session_get_flags(session) & GNUTLS_SFLAGS_EARLY_START) {
                        fail("early start did happen on %d but was not expected!\n", counter);