Remove proto_tree_add_text from packet-ssl-utils.c
authorMichael Mann <mmann78@netscape.net>
Mon, 25 May 2015 17:10:59 +0000 (13:10 -0400)
committerAnders Broman <a.broman58@gmail.com>
Tue, 26 May 2015 15:14:23 +0000 (15:14 +0000)
Change-Id: I64998e93e8d72faa76e0e7809abfd9ccae10ab36
Reviewed-on: https://code.wireshark.org/review/8653
Reviewed-by: Anders Broman <a.broman58@gmail.com>
epan/dissectors/packet-dtls.c
epan/dissectors/packet-ssl-utils.c
epan/dissectors/packet-ssl-utils.h
epan/dissectors/packet-ssl.c

index 60ab1b11a164912745bdf03d9241e9e74ef3d3fb..59334cc44954885b8ac5e8e155ba23e89fe48fbe 100644 (file)
@@ -1348,7 +1348,7 @@ dissect_dtls_handshake(tvbuff_t *tvb, packet_info *pinfo,
             break;
 
           case SSL_HND_SERVER_HELLO:
-            ssl_dissect_hnd_srv_hello(&dissect_dtls_hf, sub_tvb, ssl_hand_tree,
+            ssl_dissect_hnd_srv_hello(&dissect_dtls_hf, sub_tvb, pinfo, ssl_hand_tree,
                                       0, length, session, ssl);
             break;
 
index b2ac8b733ac26cc51f2e2f7f6b5002c4361bd801..1dc85287af1520731a5479800cac01c99b0feca8 100644 (file)
@@ -5003,7 +5003,7 @@ ssldecrypt_uat_fld_password_chk_cb(void* r _U_, const char* p, guint len _U_, co
    TLS1.2 certificate request */
 static gint
 ssl_dissect_hash_alg_list(ssl_common_dissect_t *hf, tvbuff_t *tvb, proto_tree *tree,
-                          guint32 offset, guint16 len)
+                          packet_info* pinfo, guint32 offset, guint16 len)
 {
     guint32     offset_start;
     proto_tree *subtree, *alg_tree;
@@ -5020,7 +5020,7 @@ ssl_dissect_hash_alg_list(ssl_common_dissect_t *hf, tvbuff_t *tvb, proto_tree *t
     subtree = proto_item_add_subtree(ti, hf->ett.hs_sig_hash_algs);
 
     if (len % 2) {
-        proto_tree_add_text(tree, tvb, offset, 2,
+        expert_add_info_format(pinfo, ti, &hf->ei.hs_sig_hash_algs_bad,
                             "Invalid Signature Hash Algorithm length: %d", len);
         return offset-offset_start;
     }
@@ -5043,7 +5043,7 @@ ssl_dissect_hash_alg_list(ssl_common_dissect_t *hf, tvbuff_t *tvb, proto_tree *t
 
 static gint
 ssl_dissect_hnd_hello_ext_sig_hash_algs(ssl_common_dissect_t *hf, tvbuff_t *tvb,
-                                        proto_tree *tree, guint32 offset, guint32 ext_len)
+                                        proto_tree *tree, packet_info* pinfo, guint32 offset, guint32 ext_len)
 {
     guint16  sh_alg_length;
     gint     ret;
@@ -5057,7 +5057,7 @@ ssl_dissect_hnd_hello_ext_sig_hash_algs(ssl_common_dissect_t *hf, tvbuff_t *tvb,
         return offset;
     }
 
-    ret = ssl_dissect_hash_alg_list(hf, tvb, tree, offset, sh_alg_length);
+    ret = ssl_dissect_hash_alg_list(hf, tvb, tree, pinfo, offset, sh_alg_length);
     if (ret >= 0)
         offset += ret;
 
@@ -5185,7 +5185,7 @@ ssl_dissect_hnd_hello_ext_reneg_info(ssl_common_dissect_t *hf, tvbuff_t *tvb,
     offset += 1;
 
     if (reneg_info_length > 0) {
-        proto_tree_add_text(reneg_info_tree, tvb, offset, reneg_info_length, "Renegotiation Info");
+        proto_tree_add_item(reneg_info_tree, hf->hf.hs_ext_reneg_info, tvb, offset, reneg_info_length, ENC_NA);
         offset += reneg_info_length;
     }
 
@@ -5396,7 +5396,7 @@ ssl_dissect_hnd_hello_common(ssl_common_dissect_t *hf, tvbuff_t *tvb,
 
 static gint
 ssl_dissect_hnd_hello_ext(ssl_common_dissect_t *hf, tvbuff_t *tvb, proto_tree *tree,
-                          guint32 offset, guint32 left, gboolean is_client,
+                          packet_info* pinfo, guint32 offset, guint32 left, gboolean is_client,
                           SslSession *session, SslDecryptSession *ssl);
 
 void
@@ -5511,7 +5511,7 @@ ssl_dissect_hnd_cli_hello(ssl_common_dissect_t *hf, tvbuff_t *tvb,
         }
     }
     if (length > offset - start_offset) {
-        ssl_dissect_hnd_hello_ext(hf, tvb, tree, offset,
+        ssl_dissect_hnd_hello_ext(hf, tvb, tree, pinfo, offset,
                                   length - (offset - start_offset), TRUE,
                                   session, ssl);
     }
@@ -5519,7 +5519,7 @@ ssl_dissect_hnd_cli_hello(ssl_common_dissect_t *hf, tvbuff_t *tvb,
 
 void
 ssl_dissect_hnd_srv_hello(ssl_common_dissect_t *hf, tvbuff_t *tvb,
-                          proto_tree *tree, guint32 offset, guint32 length,
+                          packet_info* pinfo, proto_tree *tree, guint32 offset, guint32 length,
                           SslSession *session, SslDecryptSession *ssl)
 {
     /* struct {
@@ -5572,7 +5572,7 @@ ssl_dissect_hnd_srv_hello(ssl_common_dissect_t *hf, tvbuff_t *tvb,
 
     /* remaining data are extensions */
     if (length > offset - start_offset) {
-        ssl_dissect_hnd_hello_ext(hf, tvb, tree, offset,
+        ssl_dissect_hnd_hello_ext(hf, tvb, tree, pinfo, offset,
                                   length - (offset - start_offset), FALSE,
                                   session, ssl);
     }
@@ -5786,7 +5786,7 @@ ssl_dissect_hnd_cert_req(ssl_common_dissect_t *hf, tvbuff_t *tvb,
                     tvb, offset, 2, sh_alg_length);
             offset += 2;
 
-            ret = ssl_dissect_hash_alg_list(hf, tvb, tree, offset, sh_alg_length);
+            ret = ssl_dissect_hash_alg_list(hf, tvb, tree, pinfo, offset, sh_alg_length);
             if (ret >= 0)
                 offset += ret;
             break;
@@ -6078,7 +6078,7 @@ ssl_dissect_hnd_hello_ext_ec_point_formats(ssl_common_dissect_t *hf, tvbuff_t *t
 
 static gint
 ssl_dissect_hnd_hello_ext(ssl_common_dissect_t *hf, tvbuff_t *tvb, proto_tree *tree,
-                          guint32 offset, guint32 left, gboolean is_client,
+                          packet_info* pinfo, guint32 offset, guint32 left, gboolean is_client,
                           SslSession *session, SslDecryptSession *ssl)
 {
     guint16     extension_length;
@@ -6133,7 +6133,7 @@ ssl_dissect_hnd_hello_ext(ssl_common_dissect_t *hf, tvbuff_t *tvb, proto_tree *t
             offset = ssl_dissect_hnd_hello_ext_ec_point_formats(hf, tvb, ext_tree, offset);
             break;
         case SSL_HND_HELLO_EXT_SIG_HASH_ALGS:
-            offset = ssl_dissect_hnd_hello_ext_sig_hash_algs(hf, tvb, ext_tree, offset, ext_len);
+            offset = ssl_dissect_hnd_hello_ext_sig_hash_algs(hf, tvb, ext_tree, pinfo, offset, ext_len);
             break;
         case SSL_HND_HELLO_EXT_ALPN:
             offset = ssl_dissect_hnd_hello_ext_alpn(hf, tvb, ext_tree, offset, ext_len, is_client, session);
index 6a4242f5a8871b66687e0860d87f4c7f294236d4..6c202bf93ac2d2a0993809753dd436081f3a0a41 100644 (file)
@@ -661,6 +661,7 @@ typedef struct ssl_common_dissect {
         gint hs_ext_npn_str;
         gint hs_ext_npn_str_len;
         gint hs_ext_reneg_info_len;
+        gint hs_ext_reneg_info;
         gint hs_ext_server_name;
         gint hs_ext_server_name_len;
         gint hs_ext_server_name_list_len;
@@ -760,6 +761,7 @@ typedef struct ssl_common_dissect {
         expert_field hs_ext_cert_status_undecoded;
         expert_field hs_sig_hash_alg_len_bad;
         expert_field hs_cipher_suites_len_bad;
+        expert_field hs_sig_hash_algs_bad;
 
         /* do not forget to update SSL_COMMON_LIST_T and SSL_COMMON_EI_LIST! */
     } ei;
@@ -789,7 +791,7 @@ ssl_dissect_hnd_cli_hello(ssl_common_dissect_t *hf, tvbuff_t *tvb,
                           dtls_hfs_t *dtls_hfs);
 
 extern void
-ssl_dissect_hnd_srv_hello(ssl_common_dissect_t *hf, tvbuff_t *tvb,
+ssl_dissect_hnd_srv_hello(ssl_common_dissect_t *hf, tvbuff_t *tvb, packet_info* pinfo,
                           proto_tree *tree, guint32 offset, guint32 length,
                           SslSession *session, SslDecryptSession *ssl);
 
@@ -842,14 +844,14 @@ ssl_common_dissect_t name = {   \
         -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, \
         -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, \
         -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, \
-        -1, -1,                                                         \
+        -1, -1, -1                                                      \
     },                                                                  \
     /* ett */ {                                                         \
         -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, \
         -1, -1, -1, -1,                                                 \
     },                                                                  \
     /* ei */ {                                                          \
-        EI_INIT, EI_INIT, EI_INIT,                                      \
+        EI_INIT, EI_INIT, EI_INIT, EI_INIT,                             \
     },                                                                  \
 }
 /* }}} */
@@ -936,6 +938,11 @@ ssl_common_dissect_t name = {   \
         FT_UINT8, BASE_DEC, NULL, 0x0,                                  \
         NULL, HFILL }                                                   \
     },                                                                  \
+    { & name .hf.hs_ext_reneg_info,                                     \
+      { "Renegotiation info", prefix ".handshake.extensions_reneg_info",\
+        FT_BYTES, BASE_NONE, NULL, 0x0,                                 \
+        NULL, HFILL }                                                   \
+    },                                                                  \
     { & name .hf.hs_ext_server_name_list_len,                           \
       { "Server Name list length", prefix ".handshake.extensions_server_name_list_len",    \
         FT_UINT16, BASE_DEC, NULL, 0x0,                                 \
@@ -1386,6 +1393,10 @@ ssl_common_dissect_t name = {   \
     { & name .ei.hs_cipher_suites_len_bad, \
         { prefix ".handshake.cipher_suites_length.mult2", PI_MALFORMED, PI_ERROR, \
         "Cipher suite length must be a multiple of 2", EXPFILL } \
+    }, \
+    { & name .ei.hs_sig_hash_algs_bad, \
+        { prefix ".handshake.sig_hash_algs.mult2", PI_MALFORMED, PI_ERROR, \
+        "Hash Algorithm length must be a multiple of 2", EXPFILL } \
     }
 /* }}} */
 
index 1ee3bb4cd3afd47caa71a9f93f2c3a81c831d3ca..a5f2efa4bd9e326ef3dd66a249d7be485c579a1d 100644 (file)
@@ -2003,7 +2003,7 @@ dissect_ssl3_handshake(tvbuff_t *tvb, packet_info *pinfo,
                 break;
 
             case SSL_HND_SERVER_HELLO:
-                ssl_dissect_hnd_srv_hello(&dissect_ssl3_hf, tvb, ssl_hand_tree,
+                ssl_dissect_hnd_srv_hello(&dissect_ssl3_hf, tvb, pinfo, ssl_hand_tree,
                                           offset, length, session, ssl);
                 break;