summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2018-08-17 14:43:30 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2018-08-20 10:36:12 +0200
commite28073163a398604311fb5128e54cde46c1b7cfc (patch)
tree3e5c733822a4a284b453f25096f6419058f12552
parent36900a0ac016faab9ed874e5073fd412b035a9ae (diff)
downloadgnutls-e28073163a398604311fb5128e54cde46c1b7cfc.tar.gz
gnutls_session_resumption_requested: fixed behavior under TLS1.3
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>
-rw-r--r--lib/ext/pre_shared_key.c2
-rw-r--r--lib/gnutls_int.h5
-rw-r--r--tests/resume.c6
3 files changed, 12 insertions, 1 deletions
diff --git a/lib/ext/pre_shared_key.c b/lib/ext/pre_shared_key.c
index b2f24bc3ba..f3bd9c5973 100644
--- a/lib/ext/pre_shared_key.c
+++ b/lib/ext/pre_shared_key.c
@@ -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) {
diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h
index 925759049c..f4dc71bb3c 100644
--- a/lib/gnutls_int.h
+++ b/lib/gnutls_int.h
@@ -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() */
diff --git a/tests/resume.c b/tests/resume.c
index c0217b5dc0..953c017388 100644
--- a/tests/resume.c
+++ b/tests/resume.c
@@ -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);