TLS 1.3 support for ssl_print_ticket()
authorDr. Stephen Henson <steve@openssl.org>
Sun, 26 Feb 2017 13:40:03 +0000 (13:40 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sun, 26 Feb 2017 18:26:09 +0000 (18:26 +0000)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2747)

ssl/t1_trce.c

index 6e65a4b..78c794d 100644 (file)
@@ -1265,7 +1265,7 @@ static int ssl_print_cert_request(BIO *bio, int indent, SSL *s,
     return 1;
 }
 
-static int ssl_print_ticket(BIO *bio, int indent,
+static int ssl_print_ticket(BIO *bio, int indent, SSL *s,
                             const unsigned char *msg, size_t msglen)
 {
     unsigned int tick_life;
@@ -1281,8 +1281,23 @@ static int ssl_print_ticket(BIO *bio, int indent,
     msg += 4;
     BIO_indent(bio, indent + 2, 80);
     BIO_printf(bio, "ticket_lifetime_hint=%u\n", tick_life);
+    if (SSL_IS_TLS13(s)) {
+        unsigned int ticket_age_add;
+        if (msglen < 4)
+            return 0;
+        ticket_age_add = (msg[0] << 24) | (msg[1] << 16) | (msg[2] << 8)
+                          | msg[3];
+        msglen -= 4;
+        msg += 4;
+        BIO_indent(bio, indent + 2, 80);
+        BIO_printf(bio, "ticket_age_add=%u\n", ticket_age_add);
+    }
     if (!ssl_print_hexbuf(bio, indent + 2, "ticket", 2, &msg, &msglen))
         return 0;
+    if (SSL_IS_TLS13(s) && !ssl_print_extensions(bio, indent + 2, 0,
+                                                 SSL3_MT_NEWSESSION_TICKET,
+                                                 &msg, &msglen))
+        return 0;
     if (msglen)
         return 0;
     return 1;
@@ -1368,7 +1383,7 @@ static int ssl_print_handshake(BIO *bio, SSL *ssl, int server,
         break;
 
     case SSL3_MT_NEWSESSION_TICKET:
-        if (!ssl_print_ticket(bio, indent + 2, msg, msglen))
+        if (!ssl_print_ticket(bio, indent + 2, ssl, msg, msglen))
             return 0;
         break;