Minor improvement to formatting of SCT output in s_client
authorRob Percival <robpercival@google.com>
Fri, 4 Mar 2016 19:07:25 +0000 (19:07 +0000)
committerRich Salz <rsalz@openssl.org>
Wed, 9 Mar 2016 18:07:09 +0000 (13:07 -0500)
Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
apps/s_client.c

index cf238c795b13e1e0eef4004b63f38c58e39c2e62..c338b0c5250a5b07f43383f1e3c0c6d5927e8cea 100644 (file)
@@ -2613,14 +2613,19 @@ static void print_stuff(BIO *bio, SSL *s, int full)
 
 #ifndef OPENSSL_NO_CT
         scts = SSL_get0_peer_scts(s);
-        BIO_printf(bio, "---\nSCTs present (%i)\n---\n",
-                   scts ? sk_SCT_num(scts) : 0);
-        SCT_LIST_print(scts, bio, 0, "\n---\n");
-        BIO_printf(bio, "\n");
+        BIO_printf(bio, "---\nSCTs present (%i)\n",
+                   scts != NULL ? sk_SCT_num(scts) : 0);
+
         if (SSL_get_ct_validation_callback(s) == NULL) {
-          BIO_printf(bio, "---\nWarning: CT validation is disabled, so not all "
+          BIO_printf(bio, "Warning: CT validation is disabled, so not all "
                      "SCTs may be displayed. Re-run with \"-requestct\".\n");
         }
+
+        if (scts != NULL && sk_SCT_num(scts) > 0) {
+            BIO_printf(bio, "---\n");
+            SCT_LIST_print(scts, bio, 0, "\n---\n");
+            BIO_printf(bio, "\n");
+        }
 #endif
 
         BIO_printf(bio,