|
|
dbc6ab |
diff --git a/epan/dissectors/packet-dtls.c b/epan/dissectors/packet-dtls.c
|
|
|
dbc6ab |
index 5e287e0..c43126d 100644
|
|
|
dbc6ab |
--- a/epan/dissectors/packet-dtls.c
|
|
|
dbc6ab |
+++ b/epan/dissectors/packet-dtls.c
|
|
|
dbc6ab |
@@ -307,31 +307,31 @@ dtls_parse_old_keys(void)
|
|
|
dbc6ab |
/* record layer dissector */
|
|
|
dbc6ab |
static gint dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint *conv_version,
|
|
|
dbc6ab |
+ SslSession *session,
|
|
|
dbc6ab |
SslDecryptSession *conv_data);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* change cipher spec dissector */
|
|
|
dbc6ab |
static void dissect_dtls_change_cipher_spec(tvbuff_t *tvb,
|
|
|
dbc6ab |
proto_tree *tree,
|
|
|
dbc6ab |
guint32 offset,
|
|
|
dbc6ab |
- guint *conv_version, guint8 content_type);
|
|
|
dbc6ab |
+ SslSession *session, guint8 content_type);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* alert message dissector */
|
|
|
dbc6ab |
static void dissect_dtls_alert(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint *conv_version);
|
|
|
dbc6ab |
+ SslSession *session);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* handshake protocol dissector */
|
|
|
dbc6ab |
static void dissect_dtls_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
guint32 record_length,
|
|
|
dbc6ab |
- guint *conv_version,
|
|
|
dbc6ab |
+ SslSession *session,
|
|
|
dbc6ab |
SslDecryptSession *conv_data, guint8 content_type);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* heartbeat message dissector */
|
|
|
dbc6ab |
static void dissect_dtls_heartbeat(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint *conv_version, guint32 record_length);
|
|
|
dbc6ab |
+ SslSession *session, guint32 record_length);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
|
|
|
dbc6ab |
static void dissect_dtls_hnd_cli_hello(tvbuff_t *tvb,
|
|
|
dbc6ab |
@@ -363,7 +363,7 @@ static void dissect_dtls_hnd_cert_req(tvbuff_t *tvb,
|
|
|
dbc6ab |
static void dissect_dtls_hnd_finished(tvbuff_t *tvb,
|
|
|
dbc6ab |
proto_tree *tree,
|
|
|
dbc6ab |
guint32 offset,
|
|
|
dbc6ab |
- guint* conv_version);
|
|
|
dbc6ab |
+ SslSession *session);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/*
|
|
|
dbc6ab |
* Support Functions
|
|
|
dbc6ab |
@@ -395,7 +395,7 @@ dissect_dtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
dbc6ab |
guint32 offset;
|
|
|
dbc6ab |
gboolean first_record_in_frame;
|
|
|
dbc6ab |
SslDecryptSession *ssl_session;
|
|
|
dbc6ab |
- guint* conv_version;
|
|
|
dbc6ab |
+ SslSession *session;
|
|
|
dbc6ab |
Ssl_private_key_t *private_key;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
ti = NULL;
|
|
|
dbc6ab |
@@ -427,7 +427,7 @@ dissect_dtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
dbc6ab |
|
|
|
dbc6ab |
ssl_session = se_new0(SslDecryptSession);
|
|
|
dbc6ab |
ssl_session_init(ssl_session);
|
|
|
dbc6ab |
- ssl_session->version = SSL_VER_UNKNOWN;
|
|
|
dbc6ab |
+ ssl_session->session.version = SSL_VER_UNKNOWN;
|
|
|
dbc6ab |
conversation_add_proto_data(conversation, proto_dtls, ssl_session);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* we need to know witch side of conversation is speaking */
|
|
|
dbc6ab |
@@ -454,7 +454,7 @@ dissect_dtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
dbc6ab |
ssl_session->private_key = private_key->sexp_pkey;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
- conv_version= & ssl_session->version;
|
|
|
dbc6ab |
+ session = &ssl_session->session;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* try decryption only the first time we see this packet
|
|
|
dbc6ab |
* (to keep cipher synchronized) */
|
|
|
dbc6ab |
@@ -490,15 +490,15 @@ dissect_dtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
dbc6ab |
/* first try to dispatch off the cached version
|
|
|
dbc6ab |
* known to be associated with the conversation
|
|
|
dbc6ab |
*/
|
|
|
dbc6ab |
- switch(*conv_version) {
|
|
|
dbc6ab |
+ switch(session->version) {
|
|
|
dbc6ab |
case SSL_VER_DTLS:
|
|
|
dbc6ab |
offset = dissect_dtls_record(tvb, pinfo, dtls_tree,
|
|
|
dbc6ab |
- offset, conv_version,
|
|
|
dbc6ab |
+ offset, session,
|
|
|
dbc6ab |
ssl_session);
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
case SSL_VER_DTLS1DOT2:
|
|
|
dbc6ab |
offset = dissect_dtls_record(tvb, pinfo, dtls_tree,
|
|
|
dbc6ab |
- offset, conv_version,
|
|
|
dbc6ab |
+ offset, session,
|
|
|
dbc6ab |
ssl_session);
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
@@ -510,7 +510,7 @@ dissect_dtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
/* looks like dtls */
|
|
|
dbc6ab |
offset = dissect_dtls_record(tvb, pinfo, dtls_tree,
|
|
|
dbc6ab |
- offset, conv_version,
|
|
|
dbc6ab |
+ offset, session,
|
|
|
dbc6ab |
ssl_session);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
else
|
|
|
dbc6ab |
@@ -622,7 +622,7 @@ decrypt_dtls_record(tvbuff_t *tvb, packet_info *pinfo, guint32 offset,
|
|
|
dbc6ab |
decoder = ssl->client;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- if (!decoder && ssl->cipher != 0x0001 && ssl->cipher != 0x0002) {
|
|
|
dbc6ab |
+ if (!decoder && ssl->session.cipher != 0x0001 && ssl->session.cipher != 0x0002) {
|
|
|
dbc6ab |
ssl_debug_printf("decrypt_dtls_record: no decoder available\n");
|
|
|
dbc6ab |
return ret;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
@@ -650,7 +650,7 @@ decrypt_dtls_record(tvbuff_t *tvb, packet_info *pinfo, guint32 offset,
|
|
|
dbc6ab |
&dtls_compressed_data, &dtls_decrypted_data, &dtls_decrypted_data_avail) == 0)
|
|
|
dbc6ab |
ret = 1;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
- else if (ssl->cipher == 0x0001 || ssl->cipher == 0x0002) {
|
|
|
dbc6ab |
+ else if (ssl->session.cipher == 0x0001 || ssl->session.cipher == 0x0002) {
|
|
|
dbc6ab |
/* Non-encrypting cipher RSA-NULL-MD5 or RSA-NULL-SHA */
|
|
|
dbc6ab |
memcpy(dtls_decrypted_data.data, tvb_get_ptr(tvb, offset, record_length), record_length);
|
|
|
dbc6ab |
dtls_decrypted_data_avail = dtls_decrypted_data.data_len = record_length;
|
|
|
dbc6ab |
@@ -677,7 +677,7 @@ decrypt_dtls_record(tvbuff_t *tvb, packet_info *pinfo, guint32 offset,
|
|
|
dbc6ab |
static gint
|
|
|
dbc6ab |
dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint *conv_version,
|
|
|
dbc6ab |
+ SslSession *session,
|
|
|
dbc6ab |
SslDecryptSession* ssl)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
|
|
|
dbc6ab |
@@ -812,14 +812,14 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
* structure and print the column version
|
|
|
dbc6ab |
*/
|
|
|
dbc6ab |
next_byte = tvb_get_guint8(tvb, offset);
|
|
|
dbc6ab |
- if (*conv_version == SSL_VER_UNKNOWN
|
|
|
dbc6ab |
+ if (session->version == SSL_VER_UNKNOWN
|
|
|
dbc6ab |
&& dtls_is_authoritative_version_message(content_type, next_byte))
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
if (version == DTLSV1DOT0_VERSION ||
|
|
|
dbc6ab |
version == DTLSV1DOT0_VERSION_NOT)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- *conv_version = SSL_VER_DTLS;
|
|
|
dbc6ab |
+ session->version = SSL_VER_DTLS;
|
|
|
dbc6ab |
if (ssl) {
|
|
|
dbc6ab |
ssl->version_netorder = version;
|
|
|
dbc6ab |
ssl->state |= SSL_VERSION;
|
|
|
dbc6ab |
@@ -829,7 +829,7 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
if (version == DTLSV1DOT2_VERSION)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- *conv_version = SSL_VER_DTLS1DOT2;
|
|
|
dbc6ab |
+ session->version = SSL_VER_DTLS1DOT2;
|
|
|
dbc6ab |
if (ssl) {
|
|
|
dbc6ab |
ssl->version_netorder = version;
|
|
|
dbc6ab |
ssl->state |= SSL_VERSION;
|
|
|
dbc6ab |
@@ -867,7 +867,7 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
case SSL_ID_CHG_CIPHER_SPEC:
|
|
|
dbc6ab |
col_append_str(pinfo->cinfo, COL_INFO, "Change Cipher Spec");
|
|
|
dbc6ab |
dissect_dtls_change_cipher_spec(tvb, dtls_record_tree,
|
|
|
dbc6ab |
- offset, conv_version, content_type);
|
|
|
dbc6ab |
+ offset, session, content_type);
|
|
|
dbc6ab |
if (ssl) ssl_change_cipher(ssl, ssl_packet_from_server(ssl, dtls_associations, pinfo));
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
case SSL_ID_ALERT:
|
|
|
dbc6ab |
@@ -882,12 +882,10 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
/* try to retrieve and use decrypted alert record, if any. */
|
|
|
dbc6ab |
decrypted = ssl_get_record_info(tvb, proto_dtls, pinfo, offset);
|
|
|
dbc6ab |
if (decrypted) {
|
|
|
dbc6ab |
- dissect_dtls_alert(decrypted, pinfo, dtls_record_tree, 0,
|
|
|
dbc6ab |
- conv_version);
|
|
|
dbc6ab |
+ dissect_dtls_alert(decrypted, pinfo, dtls_record_tree, 0, session);
|
|
|
dbc6ab |
add_new_data_source(pinfo, decrypted, "Decrypted SSL record");
|
|
|
dbc6ab |
} else {
|
|
|
dbc6ab |
- dissect_dtls_alert(tvb, pinfo, dtls_record_tree, offset,
|
|
|
dbc6ab |
- conv_version);
|
|
|
dbc6ab |
+ dissect_dtls_alert(tvb, pinfo, dtls_record_tree, offset, session);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
@@ -908,11 +906,11 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
decrypted = ssl_get_record_info(tvb, proto_dtls, pinfo, offset);
|
|
|
dbc6ab |
if (decrypted) {
|
|
|
dbc6ab |
dissect_dtls_handshake(decrypted, pinfo, dtls_record_tree, 0,
|
|
|
dbc6ab |
- tvb_length(decrypted), conv_version, ssl, content_type);
|
|
|
dbc6ab |
+ tvb_length(decrypted), session, ssl, content_type);
|
|
|
dbc6ab |
add_new_data_source(pinfo, decrypted, "Decrypted SSL record");
|
|
|
dbc6ab |
} else {
|
|
|
dbc6ab |
dissect_dtls_handshake(tvb, pinfo, dtls_record_tree, offset,
|
|
|
dbc6ab |
- record_length, conv_version, ssl, content_type);
|
|
|
dbc6ab |
+ record_length, session, ssl, content_type);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
@@ -935,7 +933,7 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
|
|
|
dbc6ab |
proto_item_set_text(dtls_record_tree,
|
|
|
dbc6ab |
"%s Record Layer: %s Protocol: %s",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
val_to_str_const(content_type, ssl_31_content_type, "unknown"),
|
|
|
dbc6ab |
association?association->info:"Application Data");
|
|
|
dbc6ab |
|
|
|
dbc6ab |
@@ -988,11 +986,11 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
decrypted = ssl_get_record_info(tvb, proto_dtls, pinfo, offset);
|
|
|
dbc6ab |
if (decrypted) {
|
|
|
dbc6ab |
dissect_dtls_heartbeat(decrypted, pinfo, dtls_record_tree, 0,
|
|
|
dbc6ab |
- conv_version, record_length);
|
|
|
dbc6ab |
+ session, record_length);
|
|
|
dbc6ab |
add_new_data_source(pinfo, decrypted, "Decrypted SSL record");
|
|
|
dbc6ab |
} else {
|
|
|
dbc6ab |
dissect_dtls_heartbeat(tvb, pinfo, dtls_record_tree, offset,
|
|
|
dbc6ab |
- conv_version, record_length);
|
|
|
dbc6ab |
+ session, record_length);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
@@ -1011,7 +1009,7 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
dissect_dtls_change_cipher_spec(tvbuff_t *tvb,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint* conv_version, guint8 content_type)
|
|
|
dbc6ab |
+ SslSession *session, guint8 content_type)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
/*
|
|
|
dbc6ab |
* struct {
|
|
|
dbc6ab |
@@ -1023,7 +1021,7 @@ dissect_dtls_change_cipher_spec(tvbuff_t *tvb,
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
proto_item_set_text(tree,
|
|
|
dbc6ab |
"%s Record Layer: %s Protocol: Change Cipher Spec",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
val_to_str_const(content_type, ssl_31_content_type, "unknown"));
|
|
|
dbc6ab |
proto_tree_add_item(tree, hf_dtls_change_cipher_spec, tvb,
|
|
|
dbc6ab |
offset, 1, ENC_NA);
|
|
|
dbc6ab |
@@ -1034,7 +1032,7 @@ dissect_dtls_change_cipher_spec(tvbuff_t *tvb,
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
dissect_dtls_alert(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint* conv_version)
|
|
|
dbc6ab |
+ SslSession *session)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
/* struct {
|
|
|
dbc6ab |
* AlertLevel level;
|
|
|
dbc6ab |
@@ -1087,7 +1085,7 @@ dissect_dtls_alert(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
proto_item_set_text(tree, "%s Record Layer: Alert "
|
|
|
dbc6ab |
"(Level: %s, Description: %s)",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
level, desc);
|
|
|
dbc6ab |
proto_tree_add_item(ssl_alert_tree, hf_dtls_alert_message_level,
|
|
|
dbc6ab |
tvb, offset++, 1, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
@@ -1099,7 +1097,7 @@ dissect_dtls_alert(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
proto_item_set_text(tree,
|
|
|
dbc6ab |
"%s Record Layer: Encrypted Alert",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
proto_item_set_text(ssl_alert_tree,
|
|
|
dbc6ab |
"Alert Message: Encrypted Alert");
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
@@ -1111,7 +1109,7 @@ dissect_dtls_alert(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
dissect_dtls_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint32 record_length, guint *conv_version,
|
|
|
dbc6ab |
+ guint32 record_length, SslSession *session,
|
|
|
dbc6ab |
SslDecryptSession* ssl, guint8 content_type)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
/* struct {
|
|
|
dbc6ab |
@@ -1338,7 +1336,7 @@ dissect_dtls_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
if (first_iteration)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
proto_item_set_text(tree, "%s Record Layer: %s Protocol: %s%s",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
val_to_str_const(content_type, ssl_31_content_type, "unknown"),
|
|
|
dbc6ab |
(msg_type_str!=NULL) ? msg_type_str :
|
|
|
dbc6ab |
"Encrypted Handshake Message",
|
|
|
dbc6ab |
@@ -1347,7 +1345,7 @@ dissect_dtls_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
else
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
proto_item_set_text(tree, "%s Record Layer: %s Protocol: %s%s",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
val_to_str_const(content_type, ssl_31_content_type, "unknown"),
|
|
|
dbc6ab |
"Multiple Handshake Messages",
|
|
|
dbc6ab |
(frag_str!=NULL) ? frag_str : "");
|
|
|
dbc6ab |
@@ -1489,8 +1487,7 @@ dissect_dtls_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
case SSL_HND_FINISHED:
|
|
|
dbc6ab |
- dissect_dtls_hnd_finished(sub_tvb, ssl_hand_tree,
|
|
|
dbc6ab |
- 0, conv_version);
|
|
|
dbc6ab |
+ dissect_dtls_hnd_finished(sub_tvb, ssl_hand_tree, 0, session);
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
@@ -1502,7 +1499,7 @@ dissect_dtls_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
dissect_dtls_heartbeat(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint* conv_version, guint32 record_length)
|
|
|
dbc6ab |
+ SslSession *session, guint32 record_length)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
/* struct {
|
|
|
dbc6ab |
* HeartbeatMessageType type;
|
|
|
dbc6ab |
@@ -1549,7 +1546,7 @@ dissect_dtls_heartbeat(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
if (type && (payload_length <= record_length - 16 - 3)) {
|
|
|
dbc6ab |
proto_item_set_text(tree, "%s Record Layer: Heartbeat "
|
|
|
dbc6ab |
"%s",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
type);
|
|
|
dbc6ab |
proto_tree_add_item(dtls_heartbeat_tree, hf_dtls_heartbeat_message_type,
|
|
|
dbc6ab |
tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
@@ -1571,7 +1568,7 @@ dissect_dtls_heartbeat(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
} else {
|
|
|
dbc6ab |
proto_item_set_text(tree,
|
|
|
dbc6ab |
"%s Record Layer: Encrypted Heartbeat",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
proto_item_set_text(dtls_heartbeat_tree,
|
|
|
dbc6ab |
"Encrypted Heartbeat Message");
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
@@ -1933,15 +1930,15 @@ dissect_dtls_hnd_srv_hello(tvbuff_t *tvb,
|
|
|
dbc6ab |
/* PAOLO: handle session cipher suite */
|
|
|
dbc6ab |
if (ssl) {
|
|
|
dbc6ab |
/* store selected cipher suite for decryption */
|
|
|
dbc6ab |
- ssl->cipher = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
- if (ssl_find_cipher(ssl->cipher,&ssl->cipher_suite) < 0) {
|
|
|
dbc6ab |
- ssl_debug_printf("dissect_dtls_hnd_srv_hello can't find cipher suite %X\n", ssl->cipher);
|
|
|
dbc6ab |
+ ssl->session.cipher = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
+ if (ssl_find_cipher(ssl->session.cipher,&ssl->cipher_suite) < 0) {
|
|
|
dbc6ab |
+ ssl_debug_printf("dissect_dtls_hnd_srv_hello can't find cipher suite %X\n", ssl->session.cipher);
|
|
|
dbc6ab |
goto no_cipher;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
ssl->state |= SSL_CIPHER;
|
|
|
dbc6ab |
ssl_debug_printf("dissect_dtls_hnd_srv_hello found cipher %X, state %X\n",
|
|
|
dbc6ab |
- ssl->cipher, ssl->state);
|
|
|
dbc6ab |
+ ssl->session.cipher, ssl->state);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* if we have restored a session now we can have enough material
|
|
|
dbc6ab |
* to build session key, check it out*/
|
|
|
dbc6ab |
@@ -1963,7 +1960,7 @@ dissect_dtls_hnd_srv_hello(tvbuff_t *tvb,
|
|
|
dbc6ab |
no_cipher:
|
|
|
dbc6ab |
if (ssl) {
|
|
|
dbc6ab |
/* store selected compression method for decompression */
|
|
|
dbc6ab |
- ssl->compression = tvb_get_guint8(tvb, offset+2);
|
|
|
dbc6ab |
+ ssl->session.compression = tvb_get_guint8(tvb, offset+2);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
if (!tree)
|
|
|
dbc6ab |
return offset;
|
|
|
dbc6ab |
@@ -2223,7 +2220,7 @@ dissect_dtls_hnd_cert_req(tvbuff_t *tvb,
|
|
|
dbc6ab |
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
dissect_dtls_hnd_finished(tvbuff_t *tvb, proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint* conv_version)
|
|
|
dbc6ab |
+ SslSession *session)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
/*
|
|
|
dbc6ab |
* struct {
|
|
|
dbc6ab |
@@ -2237,7 +2234,7 @@ dissect_dtls_hnd_finished(tvbuff_t *tvb, proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
return;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- switch(*conv_version) {
|
|
|
dbc6ab |
+ switch(session->version) {
|
|
|
dbc6ab |
case SSL_VER_DTLS:
|
|
|
dbc6ab |
proto_tree_add_item(tree, hf_dtls_handshake_finished,
|
|
|
dbc6ab |
tvb, offset, 12, ENC_NA);
|
|
|
dbc6ab |
diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c
|
|
|
dbc6ab |
index 68681f5..efb170a 100644
|
|
|
dbc6ab |
--- a/epan/dissectors/packet-ssl-utils.c
|
|
|
dbc6ab |
+++ b/epan/dissectors/packet-ssl-utils.c
|
|
|
dbc6ab |
@@ -2358,13 +2358,13 @@ ssl_generate_keyring_material(SslDecryptSession*ssl_session)
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* create both client and server ciphers*/
|
|
|
dbc6ab |
ssl_debug_printf("ssl_generate_keyring_material ssl_create_decoder(client)\n");
|
|
|
dbc6ab |
- ssl_session->client_new = ssl_create_decoder(&ssl_session->cipher_suite, ssl_session->compression, c_mk, c_wk, c_iv);
|
|
|
dbc6ab |
+ ssl_session->client_new = ssl_create_decoder(&ssl_session->cipher_suite, ssl_session->session.compression, c_mk, c_wk, c_iv);
|
|
|
dbc6ab |
if (!ssl_session->client_new) {
|
|
|
dbc6ab |
ssl_debug_printf("ssl_generate_keyring_material can't init client decoder\n");
|
|
|
dbc6ab |
goto fail;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
ssl_debug_printf("ssl_generate_keyring_material ssl_create_decoder(server)\n");
|
|
|
dbc6ab |
- ssl_session->server_new = ssl_create_decoder(&ssl_session->cipher_suite, ssl_session->compression, s_mk, s_wk, s_iv);
|
|
|
dbc6ab |
+ ssl_session->server_new = ssl_create_decoder(&ssl_session->cipher_suite, ssl_session->session.compression, s_mk, s_wk, s_iv);
|
|
|
dbc6ab |
if (!ssl_session->server_new) {
|
|
|
dbc6ab |
ssl_debug_printf("ssl_generate_keyring_material can't init client decoder\n");
|
|
|
dbc6ab |
goto fail;
|
|
|
dbc6ab |
diff --git a/epan/dissectors/packet-ssl-utils.h b/epan/dissectors/packet-ssl-utils.h
|
|
|
dbc6ab |
index ccac6ae..1ba1598 100644
|
|
|
dbc6ab |
--- a/epan/dissectors/packet-ssl-utils.h
|
|
|
dbc6ab |
+++ b/epan/dissectors/packet-ssl-utils.h
|
|
|
dbc6ab |
@@ -304,6 +304,12 @@ typedef struct {
|
|
|
dbc6ab |
SslRecordInfo* handshake_data;
|
|
|
dbc6ab |
} SslPacketInfo;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
+typedef struct _SslSession {
|
|
|
dbc6ab |
+ gint cipher;
|
|
|
dbc6ab |
+ gint compression;
|
|
|
dbc6ab |
+ guint32 version;
|
|
|
dbc6ab |
+} SslSession;
|
|
|
dbc6ab |
+
|
|
|
dbc6ab |
typedef struct _SslDecryptSession {
|
|
|
dbc6ab |
guchar _master_secret[48];
|
|
|
dbc6ab |
guchar _session_id[256];
|
|
|
dbc6ab |
@@ -320,8 +326,6 @@ typedef struct _SslDecryptSession {
|
|
|
dbc6ab |
guchar _client_data_for_iv[24];
|
|
|
dbc6ab |
StringInfo client_data_for_iv;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- gint cipher;
|
|
|
dbc6ab |
- gint compression;
|
|
|
dbc6ab |
gint state;
|
|
|
dbc6ab |
SslCipherSuite cipher_suite;
|
|
|
dbc6ab |
SslDecoder *server;
|
|
|
dbc6ab |
@@ -330,9 +334,9 @@ typedef struct _SslDecryptSession {
|
|
|
dbc6ab |
SslDecoder *client_new;
|
|
|
dbc6ab |
SSL_PRIVATE_KEY* private_key;
|
|
|
dbc6ab |
SSL_PSK_KEY* psk;
|
|
|
dbc6ab |
- guint32 version;
|
|
|
dbc6ab |
guint16 version_netorder;
|
|
|
dbc6ab |
StringInfo app_data_segment;
|
|
|
dbc6ab |
+ SslSession session;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
address srv_addr;
|
|
|
dbc6ab |
port_type srv_ptype;
|
|
|
dbc6ab |
diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c
|
|
|
dbc6ab |
index b50ca22..6f22158 100644
|
|
|
dbc6ab |
--- a/epan/dissectors/packet-ssl.c
|
|
|
dbc6ab |
+++ b/epan/dissectors/packet-ssl.c
|
|
|
dbc6ab |
@@ -507,7 +507,7 @@ ssl_association_info(void)
|
|
|
dbc6ab |
/* record layer dissector */
|
|
|
dbc6ab |
static gint dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint *conv_version, guint conv_cipher,
|
|
|
dbc6ab |
+ SslSession *session,
|
|
|
dbc6ab |
gboolean *need_desegmentation,
|
|
|
dbc6ab |
SslDecryptSession *conv_data,
|
|
|
dbc6ab |
const gboolean first_record_in_frame);
|
|
|
dbc6ab |
@@ -516,24 +516,23 @@ static gint dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
static void dissect_ssl3_change_cipher_spec(tvbuff_t *tvb,
|
|
|
dbc6ab |
proto_tree *tree,
|
|
|
dbc6ab |
guint32 offset,
|
|
|
dbc6ab |
- guint *conv_version, const guint8 content_type);
|
|
|
dbc6ab |
+ SslSession *session, const guint8 content_type);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* alert message dissector */
|
|
|
dbc6ab |
static void dissect_ssl3_alert(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint *conv_version);
|
|
|
dbc6ab |
+ SslSession *session);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* handshake protocol dissector */
|
|
|
dbc6ab |
static void dissect_ssl3_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint32 record_length,
|
|
|
dbc6ab |
- guint *conv_version, guint conv_cipher,
|
|
|
dbc6ab |
+ guint32 record_length, SslSession *session,
|
|
|
dbc6ab |
SslDecryptSession *conv_data, const guint8 content_type);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* heartbeat message dissector */
|
|
|
dbc6ab |
static void dissect_ssl3_heartbeat(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint *conv_version, guint32 record_length);
|
|
|
dbc6ab |
+ SslSession *session, guint32 record_length);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* hello extension dissector */
|
|
|
dbc6ab |
static gint dissect_ssl3_hnd_hello_ext_elliptic_curves(tvbuff_t *tvb,
|
|
|
dbc6ab |
@@ -574,20 +573,22 @@ static void dissect_ssl3_hnd_cert(tvbuff_t *tvb,
|
|
|
dbc6ab |
static void dissect_ssl3_hnd_cert_req(tvbuff_t *tvb,
|
|
|
dbc6ab |
proto_tree *tree,
|
|
|
dbc6ab |
guint32 offset, packet_info *pinfo,
|
|
|
dbc6ab |
- const guint *conv_version);
|
|
|
dbc6ab |
+ SslSession *session);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
static void dissect_ssl3_hnd_srv_keyex_ecdh(tvbuff_t *tvb,
|
|
|
dbc6ab |
- proto_tree *tree,
|
|
|
dbc6ab |
- guint32 offset, guint32 length);
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
+ proto_tree *tree,
|
|
|
dbc6ab |
+ guint32 offset, guint32 length,
|
|
|
dbc6ab |
+ SslSession *session);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
-static void dissect_ssl3_hnd_srv_keyex_dh(tvbuff_t *tvb,
|
|
|
dbc6ab |
- proto_tree *tree,
|
|
|
dbc6ab |
- guint32 offset, guint32 length);
|
|
|
dbc6ab |
+static void dissect_ssl3_hnd_srv_keyex_dhe(tvbuff_t *tvb,
|
|
|
dbc6ab |
+ proto_tree *tree,
|
|
|
dbc6ab |
+ guint32 offset, guint32 length,
|
|
|
dbc6ab |
+ SslSession *session);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
static void dissect_ssl3_hnd_srv_keyex_rsa(tvbuff_t *tvb,
|
|
|
dbc6ab |
proto_tree *tree,
|
|
|
dbc6ab |
- guint32 offset, guint32 length);
|
|
|
dbc6ab |
+ guint32 offset, guint32 length,
|
|
|
dbc6ab |
+ SslSession *session);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
static void dissect_ssl3_hnd_cli_keyex_ecdh(tvbuff_t *tvb,
|
|
|
dbc6ab |
proto_tree *tree,
|
|
|
dbc6ab |
@@ -605,7 +606,7 @@ static void dissect_ssl3_hnd_cli_keyex_rsa(tvbuff_t *tvb,
|
|
|
dbc6ab |
static void dissect_ssl3_hnd_finished(tvbuff_t *tvb,
|
|
|
dbc6ab |
proto_tree *tree,
|
|
|
dbc6ab |
const guint32 offset,
|
|
|
dbc6ab |
- const guint *conv_version);
|
|
|
dbc6ab |
+ SslSession *session);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
static void dissect_ssl3_hnd_cert_status(tvbuff_t *tvb,
|
|
|
dbc6ab |
proto_tree *tree,
|
|
|
dbc6ab |
@@ -620,7 +621,7 @@ static void dissect_ssl3_hnd_cert_status(tvbuff_t *tvb,
|
|
|
dbc6ab |
/* record layer dissector */
|
|
|
dbc6ab |
static gint dissect_ssl2_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint *conv_version,
|
|
|
dbc6ab |
+ SslSession *session,
|
|
|
dbc6ab |
gboolean *need_desegmentation,
|
|
|
dbc6ab |
SslDecryptSession *ssl, gboolean first_record_in_frame);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
@@ -701,8 +702,7 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
dbc6ab |
gboolean first_record_in_frame;
|
|
|
dbc6ab |
gboolean need_desegmentation;
|
|
|
dbc6ab |
SslDecryptSession *ssl_session;
|
|
|
dbc6ab |
- guint *conv_version;
|
|
|
dbc6ab |
- guint conv_cipher;
|
|
|
dbc6ab |
+ SslSession *session;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
ti = NULL;
|
|
|
dbc6ab |
ssl_tree = NULL;
|
|
|
dbc6ab |
@@ -736,11 +736,10 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
dbc6ab |
else {
|
|
|
dbc6ab |
ssl_session = (SslDecryptSession *)se_alloc0(sizeof(SslDecryptSession));
|
|
|
dbc6ab |
ssl_session_init(ssl_session);
|
|
|
dbc6ab |
- ssl_session->version = SSL_VER_UNKNOWN;
|
|
|
dbc6ab |
+ ssl_session->session.version = SSL_VER_UNKNOWN;
|
|
|
dbc6ab |
conversation_add_proto_data(conversation, proto_ssl, ssl_session);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
- conv_version =& ssl_session->version;
|
|
|
dbc6ab |
- conv_cipher = ssl_session->cipher;
|
|
|
dbc6ab |
+ session = &ssl_session->session;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* try decryption only the first time we see this packet
|
|
|
dbc6ab |
* (to keep cipher synchronized) */
|
|
|
dbc6ab |
@@ -789,11 +788,11 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
dbc6ab |
/* first try to dispatch off the cached version
|
|
|
dbc6ab |
* known to be associated with the conversation
|
|
|
dbc6ab |
*/
|
|
|
dbc6ab |
- switch (*conv_version) {
|
|
|
dbc6ab |
+ switch (session->version) {
|
|
|
dbc6ab |
case SSL_VER_SSLv2:
|
|
|
dbc6ab |
case SSL_VER_PCT:
|
|
|
dbc6ab |
offset = dissect_ssl2_record(tvb, pinfo, ssl_tree,
|
|
|
dbc6ab |
- offset, conv_version,
|
|
|
dbc6ab |
+ offset, session,
|
|
|
dbc6ab |
&need_desegmentation,
|
|
|
dbc6ab |
ssl_session,
|
|
|
dbc6ab |
first_record_in_frame);
|
|
|
dbc6ab |
@@ -810,7 +809,7 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
dbc6ab |
if (ssl_is_v2_client_hello(tvb, offset))
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
offset = dissect_ssl2_record(tvb, pinfo, ssl_tree,
|
|
|
dbc6ab |
- offset, conv_version,
|
|
|
dbc6ab |
+ offset, session,
|
|
|
dbc6ab |
&need_desegmentation,
|
|
|
dbc6ab |
ssl_session,
|
|
|
dbc6ab |
first_record_in_frame);
|
|
|
dbc6ab |
@@ -818,8 +817,7 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
dbc6ab |
else
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
offset = dissect_ssl3_record(tvb, pinfo, ssl_tree,
|
|
|
dbc6ab |
- offset, conv_version,
|
|
|
dbc6ab |
- conv_cipher,
|
|
|
dbc6ab |
+ offset, session,
|
|
|
dbc6ab |
&need_desegmentation,
|
|
|
dbc6ab |
ssl_session,
|
|
|
dbc6ab |
first_record_in_frame);
|
|
|
dbc6ab |
@@ -834,7 +832,7 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
/* looks like sslv2 or pct client hello */
|
|
|
dbc6ab |
offset = dissect_ssl2_record(tvb, pinfo, ssl_tree,
|
|
|
dbc6ab |
- offset, conv_version,
|
|
|
dbc6ab |
+ offset, session,
|
|
|
dbc6ab |
&need_desegmentation,
|
|
|
dbc6ab |
ssl_session,
|
|
|
dbc6ab |
first_record_in_frame);
|
|
|
dbc6ab |
@@ -843,8 +841,7 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
/* looks like sslv3 or tls */
|
|
|
dbc6ab |
offset = dissect_ssl3_record(tvb, pinfo, ssl_tree,
|
|
|
dbc6ab |
- offset, conv_version,
|
|
|
dbc6ab |
- conv_cipher,
|
|
|
dbc6ab |
+ offset, session,
|
|
|
dbc6ab |
&need_desegmentation,
|
|
|
dbc6ab |
ssl_session,
|
|
|
dbc6ab |
first_record_in_frame);
|
|
|
dbc6ab |
@@ -867,7 +864,7 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* Set the protocol column */
|
|
|
dbc6ab |
col_set_str(pinfo->cinfo, COL_PROTOCOL,
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
@@ -1434,8 +1431,7 @@ dissect_ssl_payload(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *t
|
|
|
dbc6ab |
*********************************************************************/
|
|
|
dbc6ab |
static gint
|
|
|
dbc6ab |
dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
- proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint *conv_version, guint conv_cipher,
|
|
|
dbc6ab |
+ proto_tree *tree, guint32 offset, SslSession *session,
|
|
|
dbc6ab |
gboolean *need_desegmentation,
|
|
|
dbc6ab |
SslDecryptSession *ssl, const gboolean first_record_in_frame)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
@@ -1473,7 +1469,7 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
available_bytes = tvb_length_remaining(tvb, offset);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* TLS 1.0/1.1 just ignores unknown records - RFC 2246 chapter 6. The TLS Record Protocol */
|
|
|
dbc6ab |
- if ((*conv_version==SSL_VER_TLS || *conv_version==SSL_VER_TLSv1DOT1 || *conv_version==SSL_VER_TLSv1DOT2) &&
|
|
|
dbc6ab |
+ if ((session->version==SSL_VER_TLS || session->version==SSL_VER_TLSv1DOT1 || session->version==SSL_VER_TLSv1DOT2) &&
|
|
|
dbc6ab |
(available_bytes >=1 ) && !ssl_is_valid_content_type(tvb_get_guint8(tvb, offset))) {
|
|
|
dbc6ab |
proto_tree_add_text(tree, tvb, offset, available_bytes, "Ignored Unknown Record");
|
|
|
dbc6ab |
/* on second and subsequent records per frame
|
|
|
dbc6ab |
@@ -1483,7 +1479,7 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
col_append_str(pinfo->cinfo, COL_INFO, ", ");
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
col_append_str(pinfo->cinfo, COL_INFO, "Ignored Unknown Record");
|
|
|
dbc6ab |
- col_set_str(pinfo->cinfo, COL_PROTOCOL, val_to_str_const(*conv_version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, val_to_str_const(session->version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
return offset + available_bytes;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
@@ -1568,7 +1564,7 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* Set the protocol column */
|
|
|
dbc6ab |
col_set_str(pinfo->cinfo, COL_PROTOCOL,
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
|
|
|
dbc6ab |
return offset + 5 + record_length;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
@@ -1614,51 +1610,51 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
* structure and print the column version
|
|
|
dbc6ab |
*/
|
|
|
dbc6ab |
next_byte = tvb_get_guint8(tvb, offset);
|
|
|
dbc6ab |
- if (*conv_version == SSL_VER_UNKNOWN
|
|
|
dbc6ab |
+ if (session->version == SSL_VER_UNKNOWN
|
|
|
dbc6ab |
&& ssl_is_authoritative_version_message(content_type, next_byte))
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
if (version == SSLV3_VERSION)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
- *conv_version = SSL_VER_SSLv3;
|
|
|
dbc6ab |
+ session->version = SSL_VER_SSLv3;
|
|
|
dbc6ab |
if (ssl) {
|
|
|
dbc6ab |
ssl->version_netorder = version;
|
|
|
dbc6ab |
ssl->state |= SSL_VERSION;
|
|
|
dbc6ab |
ssl_debug_printf("dissect_ssl3_record found version 0x%04X -> state 0x%02X\n", ssl->version_netorder, ssl->state);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
- /*ssl_set_conv_version(pinfo, ssl->version);*/
|
|
|
dbc6ab |
+ /*ssl_set_conv_version(pinfo, ssl->session.version);*/
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
else if (version == TLSV1_VERSION)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- *conv_version = SSL_VER_TLS;
|
|
|
dbc6ab |
+ session->version = SSL_VER_TLS;
|
|
|
dbc6ab |
if (ssl) {
|
|
|
dbc6ab |
ssl->version_netorder = version;
|
|
|
dbc6ab |
ssl->state |= SSL_VERSION;
|
|
|
dbc6ab |
ssl_debug_printf("dissect_ssl3_record found version 0x%04X(TLS 1.0) -> state 0x%02X\n", ssl->version_netorder, ssl->state);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
- /*ssl_set_conv_version(pinfo, ssl->version);*/
|
|
|
dbc6ab |
+ /*ssl_set_conv_version(pinfo, ssl->session.version);*/
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
else if (version == TLSV1DOT1_VERSION)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- *conv_version = SSL_VER_TLSv1DOT1;
|
|
|
dbc6ab |
+ session->version = SSL_VER_TLSv1DOT1;
|
|
|
dbc6ab |
if (ssl) {
|
|
|
dbc6ab |
ssl->version_netorder = version;
|
|
|
dbc6ab |
ssl->state |= SSL_VERSION;
|
|
|
dbc6ab |
ssl_debug_printf("dissect_ssl3_record found version 0x%04X(TLS 1.1) -> state 0x%02X\n", ssl->version_netorder, ssl->state);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
- /*ssl_set_conv_version(pinfo, ssl->version);*/
|
|
|
dbc6ab |
+ /*ssl_set_conv_version(pinfo, ssl->session.version);*/
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
else if (version == TLSV1DOT2_VERSION)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- *conv_version = SSL_VER_TLSv1DOT2;
|
|
|
dbc6ab |
+ session->version = SSL_VER_TLSv1DOT2;
|
|
|
dbc6ab |
if (ssl) {
|
|
|
dbc6ab |
ssl->version_netorder = version;
|
|
|
dbc6ab |
ssl->state |= SSL_VERSION;
|
|
|
dbc6ab |
ssl_debug_printf("dissect_ssl3_record found version 0x%04X(TLS 1.2) -> state 0x%02X\n", ssl->version_netorder, ssl->state);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
- /*ssl_set_conv_version(pinfo, ssl->version);*/
|
|
|
dbc6ab |
+ /*ssl_set_conv_version(pinfo, ssl->session.version);*/
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
@@ -1670,7 +1666,7 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
col_set_str(pinfo->cinfo, COL_PROTOCOL,
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/*
|
|
|
dbc6ab |
* now dissect the next layer
|
|
|
dbc6ab |
@@ -1685,7 +1681,7 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
ssl_debug_printf("dissect_ssl3_change_cipher_spec\n");
|
|
|
dbc6ab |
col_append_str(pinfo->cinfo, COL_INFO, "Change Cipher Spec");
|
|
|
dbc6ab |
dissect_ssl3_change_cipher_spec(tvb, ssl_record_tree,
|
|
|
dbc6ab |
- offset, conv_version, content_type);
|
|
|
dbc6ab |
+ offset, session, content_type);
|
|
|
dbc6ab |
if (ssl) ssl_change_cipher(ssl, ssl_packet_from_server(ssl, ssl_associations, pinfo));
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
case SSL_ID_ALERT:
|
|
|
dbc6ab |
@@ -1701,9 +1697,9 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
decrypted = ssl_get_record_info(tvb, proto_ssl, pinfo, offset);
|
|
|
dbc6ab |
if (decrypted) {
|
|
|
dbc6ab |
add_new_data_source(pinfo, decrypted, "Decrypted SSL record");
|
|
|
dbc6ab |
- dissect_ssl3_alert(decrypted, pinfo, ssl_record_tree, 0, conv_version);
|
|
|
dbc6ab |
+ dissect_ssl3_alert(decrypted, pinfo, ssl_record_tree, 0, session);
|
|
|
dbc6ab |
} else {
|
|
|
dbc6ab |
- dissect_ssl3_alert(tvb, pinfo, ssl_record_tree, offset, conv_version);
|
|
|
dbc6ab |
+ dissect_ssl3_alert(tvb, pinfo, ssl_record_tree, offset, session);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
@@ -1726,10 +1722,11 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
/* add desegmented data to the data source list */
|
|
|
dbc6ab |
add_new_data_source(pinfo, decrypted, "Decrypted SSL record");
|
|
|
dbc6ab |
dissect_ssl3_handshake(decrypted, pinfo, ssl_record_tree, 0,
|
|
|
dbc6ab |
- tvb_length(decrypted), conv_version, conv_cipher, ssl, content_type);
|
|
|
dbc6ab |
+ tvb_length(decrypted), session,
|
|
|
dbc6ab |
+ ssl, content_type);
|
|
|
dbc6ab |
} else {
|
|
|
dbc6ab |
dissect_ssl3_handshake(tvb, pinfo, ssl_record_tree, offset,
|
|
|
dbc6ab |
- record_length, conv_version, conv_cipher, ssl, content_type);
|
|
|
dbc6ab |
+ record_length, session, ssl, content_type);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
@@ -1755,7 +1752,7 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
|
|
|
dbc6ab |
proto_item_set_text(ssl_record_tree,
|
|
|
dbc6ab |
"%s Record Layer: %s Protocol: %s",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
val_to_str_const(content_type, ssl_31_content_type, "unknown"),
|
|
|
dbc6ab |
association?association->info:"Application Data");
|
|
|
dbc6ab |
|
|
|
dbc6ab |
@@ -1778,9 +1775,9 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
decrypted = ssl_get_record_info(tvb, proto_ssl, pinfo, offset);
|
|
|
dbc6ab |
if (decrypted) {
|
|
|
dbc6ab |
add_new_data_source(pinfo, decrypted, "Decrypted SSL record");
|
|
|
dbc6ab |
- dissect_ssl3_heartbeat(decrypted, pinfo, ssl_record_tree, 0, conv_version, record_length);
|
|
|
dbc6ab |
+ dissect_ssl3_heartbeat(decrypted, pinfo, ssl_record_tree, 0, session, record_length);
|
|
|
dbc6ab |
} else {
|
|
|
dbc6ab |
- dissect_ssl3_heartbeat(tvb, pinfo, ssl_record_tree, offset, conv_version, record_length);
|
|
|
dbc6ab |
+ dissect_ssl3_heartbeat(tvb, pinfo, ssl_record_tree, offset, session, record_length);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
@@ -1799,7 +1796,7 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
dissect_ssl3_change_cipher_spec(tvbuff_t *tvb,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint *conv_version, const guint8 content_type)
|
|
|
dbc6ab |
+ SslSession *session, const guint8 content_type)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
/*
|
|
|
dbc6ab |
* struct {
|
|
|
dbc6ab |
@@ -1811,7 +1808,7 @@ dissect_ssl3_change_cipher_spec(tvbuff_t *tvb,
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
proto_item_set_text(tree,
|
|
|
dbc6ab |
"%s Record Layer: %s Protocol: Change Cipher Spec",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
val_to_str_const(content_type, ssl_31_content_type, "unknown"));
|
|
|
dbc6ab |
proto_tree_add_item(tree, hf_ssl_change_cipher_spec, tvb,
|
|
|
dbc6ab |
offset++, 1, ENC_NA);
|
|
|
dbc6ab |
@@ -1822,7 +1819,7 @@ dissect_ssl3_change_cipher_spec(tvbuff_t *tvb,
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
dissect_ssl3_alert(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint *conv_version)
|
|
|
dbc6ab |
+ SslSession *session)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
/* struct {
|
|
|
dbc6ab |
* AlertLevel level;
|
|
|
dbc6ab |
@@ -1872,7 +1869,7 @@ dissect_ssl3_alert(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
proto_item_set_text(tree, "%s Record Layer: Alert "
|
|
|
dbc6ab |
"(Level: %s, Description: %s)",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
level, desc);
|
|
|
dbc6ab |
proto_tree_add_item(ssl_alert_tree, hf_ssl_alert_message_level,
|
|
|
dbc6ab |
tvb, offset++, 1, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
@@ -1884,7 +1881,7 @@ dissect_ssl3_alert(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
proto_item_set_text(tree,
|
|
|
dbc6ab |
"%s Record Layer: Encrypted Alert",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
proto_item_set_text(ssl_alert_tree,
|
|
|
dbc6ab |
"Alert Message: Encrypted Alert");
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
@@ -1896,7 +1893,7 @@ dissect_ssl3_alert(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
dissect_ssl3_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint32 record_length, guint *conv_version, guint conv_cipher,
|
|
|
dbc6ab |
+ guint32 record_length, SslSession *session,
|
|
|
dbc6ab |
SslDecryptSession *ssl, const guint8 content_type)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
/* struct {
|
|
|
dbc6ab |
@@ -1981,7 +1978,7 @@ dissect_ssl3_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
if (first_iteration)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
proto_item_set_text(tree, "%s Record Layer: %s Protocol: %s",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
val_to_str_const(content_type, ssl_31_content_type, "unknown"),
|
|
|
dbc6ab |
(msg_type_str!=NULL) ? msg_type_str :
|
|
|
dbc6ab |
"Encrypted Handshake Message");
|
|
|
dbc6ab |
@@ -1989,7 +1986,7 @@ dissect_ssl3_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
else
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
proto_item_set_text(tree, "%s Record Layer: %s Protocol: %s",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
val_to_str_const(content_type, ssl_31_content_type, "unknown"),
|
|
|
dbc6ab |
"Multiple Handshake Messages");
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
@@ -2048,15 +2045,15 @@ dissect_ssl3_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
case SSL_HND_SERVER_KEY_EXCHG: {
|
|
|
dbc6ab |
- switch (ssl_get_keyex_alg(conv_cipher)) {
|
|
|
dbc6ab |
+ switch (ssl_get_keyex_alg(session->cipher)) {
|
|
|
dbc6ab |
case KEX_DH:
|
|
|
dbc6ab |
- dissect_ssl3_hnd_srv_keyex_dh(tvb, ssl_hand_tree, offset, length);
|
|
|
dbc6ab |
+ dissect_ssl3_hnd_srv_keyex_dhe(tvb, ssl_hand_tree, offset, length, session);
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
case KEX_RSA:
|
|
|
dbc6ab |
- dissect_ssl3_hnd_srv_keyex_rsa(tvb, ssl_hand_tree, offset, length);
|
|
|
dbc6ab |
+ dissect_ssl3_hnd_srv_keyex_rsa(tvb, ssl_hand_tree, offset, length, session);
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
case KEX_ECDH:
|
|
|
dbc6ab |
- dissect_ssl3_hnd_srv_keyex_ecdh(tvb, ssl_hand_tree, offset, length);
|
|
|
dbc6ab |
+ dissect_ssl3_hnd_srv_keyex_ecdh(tvb, ssl_hand_tree, offset, length, session);
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
default:
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
@@ -2065,7 +2062,7 @@ dissect_ssl3_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
case SSL_HND_CERT_REQUEST:
|
|
|
dbc6ab |
- dissect_ssl3_hnd_cert_req(tvb, ssl_hand_tree, offset, pinfo, conv_version);
|
|
|
dbc6ab |
+ dissect_ssl3_hnd_cert_req(tvb, ssl_hand_tree, offset, pinfo, session);
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
case SSL_HND_SVR_HELLO_DONE:
|
|
|
dbc6ab |
@@ -2077,7 +2074,7 @@ dissect_ssl3_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
case SSL_HND_CLIENT_KEY_EXCHG:
|
|
|
dbc6ab |
- switch (ssl_get_keyex_alg(conv_cipher)) {
|
|
|
dbc6ab |
+ switch (ssl_get_keyex_alg(session->cipher)) {
|
|
|
dbc6ab |
case KEX_DH:
|
|
|
dbc6ab |
dissect_ssl3_hnd_cli_keyex_dh(tvb, ssl_hand_tree, offset, length);
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
@@ -2098,7 +2095,7 @@ dissect_ssl3_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
if (!ssl)
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- cipher_num = ssl->cipher;
|
|
|
dbc6ab |
+ cipher_num = ssl->session.cipher;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
if (cipher_num == 0x8a || cipher_num == 0x8b || cipher_num == 0x8c || cipher_num == 0x8d)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
@@ -2174,7 +2171,7 @@ dissect_ssl3_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
* (it's the encrypted len and should be equal to record len - 2)
|
|
|
dbc6ab |
* in case of rsa1024 that would be 128 + 2 = 130; for psk not necessary
|
|
|
dbc6ab |
*/
|
|
|
dbc6ab |
- if (ssl->cipher_suite.kex==KEX_RSA && (ssl->version == SSL_VER_TLS||ssl->version == SSL_VER_TLSv1DOT1||ssl->version == SSL_VER_TLSv1DOT2))
|
|
|
dbc6ab |
+ if (ssl->cipher_suite.kex==KEX_RSA && (ssl->session.version == SSL_VER_TLS||ssl->session.version == SSL_VER_TLSv1DOT1||ssl->session.version == SSL_VER_TLSv1DOT2))
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
encrlen = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
skip = 2;
|
|
|
dbc6ab |
@@ -2214,8 +2211,7 @@ dissect_ssl3_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
case SSL_HND_FINISHED:
|
|
|
dbc6ab |
- dissect_ssl3_hnd_finished(tvb, ssl_hand_tree,
|
|
|
dbc6ab |
- offset, conv_version);
|
|
|
dbc6ab |
+ dissect_ssl3_hnd_finished(tvb, ssl_hand_tree, offset, session);
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
case SSL_HND_CERT_STATUS:
|
|
|
dbc6ab |
@@ -2236,7 +2232,7 @@ dissect_ssl3_handshake(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
dissect_ssl3_heartbeat(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset,
|
|
|
dbc6ab |
- guint *conv_version, guint32 record_length)
|
|
|
dbc6ab |
+ SslSession *session, guint32 record_length)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
/* struct {
|
|
|
dbc6ab |
* HeartbeatMessageType type;
|
|
|
dbc6ab |
@@ -2283,7 +2279,7 @@ dissect_ssl3_heartbeat(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
if (type && (payload_length <= record_length - 16 - 3)) {
|
|
|
dbc6ab |
proto_item_set_text(tree, "%s Record Layer: Heartbeat "
|
|
|
dbc6ab |
"%s",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"),
|
|
|
dbc6ab |
type);
|
|
|
dbc6ab |
proto_tree_add_item(tls_heartbeat_tree, hf_ssl_heartbeat_message_type,
|
|
|
dbc6ab |
tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
@@ -2305,7 +2301,7 @@ dissect_ssl3_heartbeat(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
dbc6ab |
} else {
|
|
|
dbc6ab |
proto_item_set_text(tree,
|
|
|
dbc6ab |
"%s Record Layer: Encrypted Heartbeat",
|
|
|
dbc6ab |
- val_to_str_const(*conv_version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
+ val_to_str_const(session->version, ssl_version_short_names, "SSL"));
|
|
|
dbc6ab |
proto_item_set_text(tls_heartbeat_tree,
|
|
|
dbc6ab |
"Encrypted Heartbeat Message");
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
@@ -2840,15 +2836,15 @@ dissect_ssl3_hnd_srv_hello(tvbuff_t *tvb,
|
|
|
dbc6ab |
/* PAOLO: handle session cipher suite */
|
|
|
dbc6ab |
if (ssl) {
|
|
|
dbc6ab |
/* store selected cipher suite for decryption */
|
|
|
dbc6ab |
- ssl->cipher = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
- if (ssl_find_cipher(ssl->cipher,&ssl->cipher_suite) < 0) {
|
|
|
dbc6ab |
- ssl_debug_printf("dissect_ssl3_hnd_srv_hello can't find cipher suite 0x%X\n", ssl->cipher);
|
|
|
dbc6ab |
+ ssl->session.cipher = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
+ if (ssl_find_cipher(ssl->session.cipher,&ssl->cipher_suite) < 0) {
|
|
|
dbc6ab |
+ ssl_debug_printf("dissect_ssl3_hnd_srv_hello can't find cipher suite 0x%X\n", ssl->session.cipher);
|
|
|
dbc6ab |
goto no_cipher;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
ssl->state |= SSL_CIPHER;
|
|
|
dbc6ab |
ssl_debug_printf("dissect_ssl3_hnd_srv_hello found CIPHER 0x%04X -> state 0x%02X\n",
|
|
|
dbc6ab |
- ssl->cipher, ssl->state);
|
|
|
dbc6ab |
+ ssl->session.cipher, ssl->state);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* if we have restored a session now we can have enough material
|
|
|
dbc6ab |
* to build session key, check it out*/
|
|
|
dbc6ab |
@@ -2867,7 +2863,7 @@ no_cipher:
|
|
|
dbc6ab |
|
|
|
dbc6ab |
if (ssl) {
|
|
|
dbc6ab |
/* store selected compression method for decryption */
|
|
|
dbc6ab |
- ssl->compression = tvb_get_guint8(tvb, offset);
|
|
|
dbc6ab |
+ ssl->session.compression = tvb_get_guint8(tvb, offset);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
/* and the server-selected compression method */
|
|
|
dbc6ab |
proto_tree_add_item(tree, hf_ssl_handshake_comp_method,
|
|
|
dbc6ab |
@@ -2975,7 +2971,7 @@ dissect_ssl3_hnd_cert(tvbuff_t *tvb,
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
dissect_ssl3_hnd_cert_req(tvbuff_t *tvb,
|
|
|
dbc6ab |
proto_tree *tree, guint32 offset, packet_info *pinfo,
|
|
|
dbc6ab |
- const guint *conv_version)
|
|
|
dbc6ab |
+ SslSession *session)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
/*
|
|
|
dbc6ab |
* enum {
|
|
|
dbc6ab |
@@ -3066,7 +3062,7 @@ dissect_ssl3_hnd_cert_req(tvbuff_t *tvb,
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- switch (*conv_version) {
|
|
|
dbc6ab |
+ switch (session->version) {
|
|
|
dbc6ab |
case SSL_VER_TLSv1DOT2:
|
|
|
dbc6ab |
sh_alg_length = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
proto_tree_add_uint(tree, hf_ssl_handshake_sig_hash_alg_len,
|
|
|
dbc6ab |
@@ -3170,74 +3166,77 @@ dissect_ssl3_hnd_cert_req(tvbuff_t *tvb,
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
+dissect_ssl3_hnd_srv_keyex_sig(tvbuff_t *tvb, proto_tree *tree,
|
|
|
dbc6ab |
+ guint32 offset, SslSession *session)
|
|
|
dbc6ab |
+{
|
|
|
dbc6ab |
+ gint sig_len;
|
|
|
dbc6ab |
+ proto_item *ti_algo;
|
|
|
dbc6ab |
+ proto_tree *ssl_algo_tree;
|
|
|
dbc6ab |
+
|
|
|
dbc6ab |
+ switch (session->version) {
|
|
|
dbc6ab |
+ case SSL_VER_TLSv1DOT2:
|
|
|
dbc6ab |
+ case SSL_VER_DTLS1DOT2:
|
|
|
dbc6ab |
+ ti_algo = proto_tree_add_item(tree, hf_ssl_handshake_sig_hash_alg, tvb,
|
|
|
dbc6ab |
+ offset, 2, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
+ ssl_algo_tree = proto_item_add_subtree(ti_algo, ett_ssl_sig_hash_alg);
|
|
|
dbc6ab |
+
|
|
|
dbc6ab |
+ /* SignatureAndHashAlgorithm { hash, signature } */
|
|
|
dbc6ab |
+ proto_tree_add_item(ssl_algo_tree, hf_ssl_handshake_sig_hash_hash, tvb,
|
|
|
dbc6ab |
+ offset, 1, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
+ proto_tree_add_item(ssl_algo_tree, hf_ssl_handshake_sig_hash_sig, tvb,
|
|
|
dbc6ab |
+ offset + 1, 1, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
+ offset += 2;
|
|
|
dbc6ab |
+ break;
|
|
|
dbc6ab |
+
|
|
|
dbc6ab |
+ default:
|
|
|
dbc6ab |
+ break;
|
|
|
dbc6ab |
+ }
|
|
|
dbc6ab |
+
|
|
|
dbc6ab |
+ /* Sig */
|
|
|
dbc6ab |
+ sig_len = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
+ proto_tree_add_item(tree, hf_ssl_handshake_server_keyex_sig_len, tvb,
|
|
|
dbc6ab |
+ offset, 2, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
+ proto_tree_add_item(tree, hf_ssl_handshake_server_keyex_sig, tvb,
|
|
|
dbc6ab |
+ offset + 2, sig_len, ENC_NA);
|
|
|
dbc6ab |
+}
|
|
|
dbc6ab |
+
|
|
|
dbc6ab |
+static void
|
|
|
dbc6ab |
dissect_ssl3_hnd_srv_keyex_ecdh(tvbuff_t *tvb, proto_tree *tree,
|
|
|
dbc6ab |
- guint32 offset, guint32 length)
|
|
|
dbc6ab |
+ guint32 offset, guint32 length,
|
|
|
dbc6ab |
+ SslSession *session)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
- gint curve_type, curve_type_offset;
|
|
|
dbc6ab |
- gint named_curve, named_curve_offset;
|
|
|
dbc6ab |
- gint point_len, point_len_offset;
|
|
|
dbc6ab |
- gint sig_len, sig_len_offset;
|
|
|
dbc6ab |
+ gint curve_type;
|
|
|
dbc6ab |
+ gint point_len;
|
|
|
dbc6ab |
proto_item *ti_ecdh;
|
|
|
dbc6ab |
proto_tree *ssl_ecdh_tree;
|
|
|
dbc6ab |
- guint32 orig_offset;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- orig_offset = offset;
|
|
|
dbc6ab |
+ ti_ecdh = proto_tree_add_text(tree, tvb, offset, length,
|
|
|
dbc6ab |
+ "EC Diffie-Hellman Server Params");
|
|
|
dbc6ab |
+ ssl_ecdh_tree = proto_item_add_subtree(ti_ecdh, ett_ssl_keyex_params);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- curve_type_offset = offset;
|
|
|
dbc6ab |
+ /* curve_type */
|
|
|
dbc6ab |
curve_type = tvb_get_guint8(tvb, offset);
|
|
|
dbc6ab |
+ proto_tree_add_item(ssl_ecdh_tree, hf_ssl_handshake_server_keyex_curve_type, tvb,
|
|
|
dbc6ab |
+ offset, 1, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
+ offset++;
|
|
|
dbc6ab |
if (curve_type != 3)
|
|
|
dbc6ab |
return; /* only named_curves are supported */
|
|
|
dbc6ab |
- offset += 1;
|
|
|
dbc6ab |
- if ((offset - orig_offset) > length) {
|
|
|
dbc6ab |
- return;
|
|
|
dbc6ab |
- }
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- named_curve_offset = offset;
|
|
|
dbc6ab |
- named_curve = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
+ /* case curve_type == named_curve; namedcurve */
|
|
|
dbc6ab |
+ proto_tree_add_item(ssl_ecdh_tree, hf_ssl_handshake_server_keyex_named_curve, tvb,
|
|
|
dbc6ab |
+ offset, 2, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
offset += 2;
|
|
|
dbc6ab |
- if ((offset - orig_offset) > length) {
|
|
|
dbc6ab |
- return;
|
|
|
dbc6ab |
- }
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- point_len_offset = offset;
|
|
|
dbc6ab |
+ /* point */
|
|
|
dbc6ab |
point_len = tvb_get_guint8(tvb, offset);
|
|
|
dbc6ab |
- if ((offset + point_len - orig_offset) > length) {
|
|
|
dbc6ab |
- return;
|
|
|
dbc6ab |
- }
|
|
|
dbc6ab |
+ proto_tree_add_item(ssl_ecdh_tree, hf_ssl_handshake_server_keyex_point_len, tvb,
|
|
|
dbc6ab |
+ offset, 1, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
+ proto_tree_add_item(ssl_ecdh_tree, hf_ssl_handshake_server_keyex_point, tvb,
|
|
|
dbc6ab |
+ offset + 1, point_len, ENC_NA);
|
|
|
dbc6ab |
offset += 1 + point_len;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- sig_len_offset = offset;
|
|
|
dbc6ab |
- sig_len = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
- offset += 2 + sig_len;
|
|
|
dbc6ab |
- if ((offset - orig_offset) != length) {
|
|
|
dbc6ab |
- /* Lengths don't line up (wasn't what we expected?) */
|
|
|
dbc6ab |
- return;
|
|
|
dbc6ab |
- }
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- ti_ecdh = proto_tree_add_text(tree, tvb, orig_offset,
|
|
|
dbc6ab |
- (offset - orig_offset), "EC Diffie-Hellman Server Params");
|
|
|
dbc6ab |
- ssl_ecdh_tree = proto_item_add_subtree(ti_ecdh, ett_ssl_keyex_params);
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- /* curve_type */
|
|
|
dbc6ab |
- proto_tree_add_uint(ssl_ecdh_tree, hf_ssl_handshake_server_keyex_curve_type,
|
|
|
dbc6ab |
- tvb, curve_type_offset, 1, curve_type);
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- /* named_curve */
|
|
|
dbc6ab |
- proto_tree_add_uint(ssl_ecdh_tree, hf_ssl_handshake_server_keyex_named_curve,
|
|
|
dbc6ab |
- tvb, named_curve_offset, 2, named_curve);
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- /* point */
|
|
|
dbc6ab |
- proto_tree_add_uint(ssl_ecdh_tree, hf_ssl_handshake_server_keyex_point_len,
|
|
|
dbc6ab |
- tvb, point_len_offset, 1, point_len);
|
|
|
dbc6ab |
- proto_tree_add_item(ssl_ecdh_tree, hf_ssl_handshake_server_keyex_point,
|
|
|
dbc6ab |
- tvb, point_len_offset+1, point_len, ENC_NA);
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- /* Sig */
|
|
|
dbc6ab |
- proto_tree_add_uint(ssl_ecdh_tree, hf_ssl_handshake_server_keyex_sig_len,
|
|
|
dbc6ab |
- tvb, sig_len_offset, 2, sig_len);
|
|
|
dbc6ab |
- proto_tree_add_item(ssl_ecdh_tree, hf_ssl_handshake_server_keyex_sig,
|
|
|
dbc6ab |
- tvb, sig_len_offset + 2, sig_len, ENC_NA);
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
+ /* signature */
|
|
|
dbc6ab |
+ dissect_ssl3_hnd_srv_keyex_sig(tvb, ssl_ecdh_tree, offset, session);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
@@ -3271,139 +3270,80 @@ dissect_ssl3_hnd_cli_keyex_ecdh(tvbuff_t *tvb, proto_tree *tree,
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
-dissect_ssl3_hnd_srv_keyex_dh(tvbuff_t *tvb, proto_tree *tree,
|
|
|
dbc6ab |
- guint32 offset, guint32 length)
|
|
|
dbc6ab |
+dissect_ssl3_hnd_srv_keyex_dhe(tvbuff_t *tvb, proto_tree *tree,
|
|
|
dbc6ab |
+ guint32 offset, guint32 length,
|
|
|
dbc6ab |
+ SslSession *session)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
- gint p_len, p_len_offset;
|
|
|
dbc6ab |
- gint g_len, g_len_offset;
|
|
|
dbc6ab |
- gint ys_len, ys_len_offset;
|
|
|
dbc6ab |
- gint sig_len, sig_len_offset;
|
|
|
dbc6ab |
+ gint p_len, g_len, ys_len;
|
|
|
dbc6ab |
proto_item *ti_dh;
|
|
|
dbc6ab |
proto_tree *ssl_dh_tree;
|
|
|
dbc6ab |
- guint32 orig_offset;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- orig_offset = offset;
|
|
|
dbc6ab |
+ ti_dh = proto_tree_add_text(tree, tvb, offset, length,
|
|
|
dbc6ab |
+ "Diffie-Hellman Server Params");
|
|
|
dbc6ab |
+ ssl_dh_tree = proto_item_add_subtree(ti_dh, ett_ssl_keyex_params);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- p_len_offset = offset;
|
|
|
dbc6ab |
+ /* p */
|
|
|
dbc6ab |
p_len = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
+ proto_tree_add_item(ssl_dh_tree, hf_ssl_handshake_server_keyex_p_len, tvb,
|
|
|
dbc6ab |
+ offset, 2, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
+ proto_tree_add_item(ssl_dh_tree, hf_ssl_handshake_server_keyex_p, tvb,
|
|
|
dbc6ab |
+ offset + 2, p_len, ENC_NA);
|
|
|
dbc6ab |
offset += 2 + p_len;
|
|
|
dbc6ab |
- if ((offset - orig_offset) > length) {
|
|
|
dbc6ab |
- return;
|
|
|
dbc6ab |
- }
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- g_len_offset = offset;
|
|
|
dbc6ab |
+ /* g */
|
|
|
dbc6ab |
g_len = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
+ proto_tree_add_item(ssl_dh_tree, hf_ssl_handshake_server_keyex_g_len, tvb,
|
|
|
dbc6ab |
+ offset, 2, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
+ proto_tree_add_item(ssl_dh_tree, hf_ssl_handshake_server_keyex_g, tvb,
|
|
|
dbc6ab |
+ offset + 2, g_len, ENC_NA);
|
|
|
dbc6ab |
offset += 2 + g_len;
|
|
|
dbc6ab |
- if ((offset - orig_offset) > length) {
|
|
|
dbc6ab |
- return;
|
|
|
dbc6ab |
- }
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- ys_len_offset = offset;
|
|
|
dbc6ab |
+ /* Ys */
|
|
|
dbc6ab |
ys_len = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
+ proto_tree_add_uint(ssl_dh_tree, hf_ssl_handshake_server_keyex_ys_len, tvb,
|
|
|
dbc6ab |
+ offset, 2, ys_len);
|
|
|
dbc6ab |
+ proto_tree_add_item(ssl_dh_tree, hf_ssl_handshake_server_keyex_ys, tvb,
|
|
|
dbc6ab |
+ offset + 2, ys_len, ENC_NA);
|
|
|
dbc6ab |
offset += 2 + ys_len;
|
|
|
dbc6ab |
- if ((offset - orig_offset) > length) {
|
|
|
dbc6ab |
- return;
|
|
|
dbc6ab |
- }
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- sig_len_offset = offset;
|
|
|
dbc6ab |
- sig_len = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
- offset += 2 + sig_len;
|
|
|
dbc6ab |
- if ((offset - orig_offset) != length) {
|
|
|
dbc6ab |
- /* Lengths don't line up (wasn't what we expected?) */
|
|
|
dbc6ab |
- return;
|
|
|
dbc6ab |
- }
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- ti_dh = proto_tree_add_text(tree, tvb, orig_offset,
|
|
|
dbc6ab |
- (offset - orig_offset), "Diffie-Hellman Server Params");
|
|
|
dbc6ab |
- ssl_dh_tree = proto_item_add_subtree(ti_dh, ett_ssl_keyex_params);
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- /* p */
|
|
|
dbc6ab |
- proto_tree_add_uint(ssl_dh_tree, hf_ssl_handshake_server_keyex_p_len,
|
|
|
dbc6ab |
- tvb, p_len_offset, 2, p_len);
|
|
|
dbc6ab |
- proto_tree_add_item(ssl_dh_tree, hf_ssl_handshake_server_keyex_p,
|
|
|
dbc6ab |
- tvb, p_len_offset + 2, p_len, ENC_NA);
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- /* g */
|
|
|
dbc6ab |
- proto_tree_add_uint(ssl_dh_tree, hf_ssl_handshake_server_keyex_g_len,
|
|
|
dbc6ab |
- tvb, g_len_offset, 2, g_len);
|
|
|
dbc6ab |
- proto_tree_add_item(ssl_dh_tree, hf_ssl_handshake_server_keyex_g,
|
|
|
dbc6ab |
- tvb, g_len_offset + 2, g_len, ENC_NA);
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- /* Ys */
|
|
|
dbc6ab |
- proto_tree_add_uint(ssl_dh_tree, hf_ssl_handshake_server_keyex_ys_len,
|
|
|
dbc6ab |
- tvb, ys_len_offset, 2, ys_len);
|
|
|
dbc6ab |
- proto_tree_add_item(ssl_dh_tree, hf_ssl_handshake_server_keyex_ys,
|
|
|
dbc6ab |
- tvb, ys_len_offset + 2, ys_len, ENC_NA);
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- /* Sig */
|
|
|
dbc6ab |
- proto_tree_add_uint(ssl_dh_tree, hf_ssl_handshake_server_keyex_sig_len,
|
|
|
dbc6ab |
- tvb, sig_len_offset, 2, sig_len);
|
|
|
dbc6ab |
- proto_tree_add_item(ssl_dh_tree, hf_ssl_handshake_server_keyex_sig,
|
|
|
dbc6ab |
- tvb, sig_len_offset + 2, sig_len, ENC_NA);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
+ /* signature */
|
|
|
dbc6ab |
+ dissect_ssl3_hnd_srv_keyex_sig(tvb, ssl_dh_tree, offset, session);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* Only used in RSA-EXPORT cipher suites */
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
dissect_ssl3_hnd_srv_keyex_rsa(tvbuff_t *tvb, proto_tree *tree,
|
|
|
dbc6ab |
- guint32 offset, guint32 length)
|
|
|
dbc6ab |
+ guint32 offset, guint32 length,
|
|
|
dbc6ab |
+ SslSession *session)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
- gint modulus_len, modulus_len_offset;
|
|
|
dbc6ab |
- gint exponent_len, exponent_len_offset;
|
|
|
dbc6ab |
- gint sig_len, sig_len_offset;
|
|
|
dbc6ab |
+ gint modulus_len, exponent_len;
|
|
|
dbc6ab |
proto_item *ti_rsa;
|
|
|
dbc6ab |
proto_tree *ssl_rsa_tree;
|
|
|
dbc6ab |
- guint32 orig_offset;
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- orig_offset = offset;
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- modulus_len_offset = offset;
|
|
|
dbc6ab |
- modulus_len = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
- offset += 2 + modulus_len;
|
|
|
dbc6ab |
- if ((offset - orig_offset) > length) {
|
|
|
dbc6ab |
- return;
|
|
|
dbc6ab |
- }
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- exponent_len_offset = offset;
|
|
|
dbc6ab |
- exponent_len = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
- offset += 2 + exponent_len;
|
|
|
dbc6ab |
- if ((offset - orig_offset) > length) {
|
|
|
dbc6ab |
- return;
|
|
|
dbc6ab |
- }
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- sig_len_offset = offset;
|
|
|
dbc6ab |
- sig_len = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
- offset += 2 + sig_len;
|
|
|
dbc6ab |
- if ((offset - orig_offset) != length) {
|
|
|
dbc6ab |
- /* Lengths don't line up (wasn't what we expected?) */
|
|
|
dbc6ab |
- return;
|
|
|
dbc6ab |
- }
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- ti_rsa = proto_tree_add_text(tree, tvb, orig_offset,
|
|
|
dbc6ab |
- (offset - orig_offset), "RSA-EXPORT Server Params");
|
|
|
dbc6ab |
+ ti_rsa = proto_tree_add_text(tree, tvb, offset, length,
|
|
|
dbc6ab |
+ "RSA_EXPORT Server Params");
|
|
|
dbc6ab |
ssl_rsa_tree = proto_item_add_subtree(ti_rsa, ett_ssl_keyex_params);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* modulus */
|
|
|
dbc6ab |
- proto_tree_add_uint(ssl_rsa_tree, hf_ssl_handshake_server_keyex_modulus_len,
|
|
|
dbc6ab |
- tvb, modulus_len_offset, 2, modulus_len);
|
|
|
dbc6ab |
+ modulus_len = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
+ proto_tree_add_item(ssl_rsa_tree, hf_ssl_handshake_server_keyex_modulus_len,
|
|
|
dbc6ab |
+ tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
proto_tree_add_item(ssl_rsa_tree, hf_ssl_handshake_server_keyex_modulus,
|
|
|
dbc6ab |
- tvb, modulus_len_offset + 2, modulus_len, ENC_NA);
|
|
|
dbc6ab |
+ tvb, offset + 2, modulus_len, ENC_NA);
|
|
|
dbc6ab |
+ offset += 2 + modulus_len;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* exponent */
|
|
|
dbc6ab |
- proto_tree_add_uint(ssl_rsa_tree, hf_ssl_handshake_server_keyex_exponent_len,
|
|
|
dbc6ab |
- tvb, exponent_len_offset, 2, exponent_len);
|
|
|
dbc6ab |
+ exponent_len = tvb_get_ntohs(tvb, offset);
|
|
|
dbc6ab |
+ proto_tree_add_item(ssl_rsa_tree, hf_ssl_handshake_server_keyex_exponent_len,
|
|
|
dbc6ab |
+ tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
proto_tree_add_item(ssl_rsa_tree, hf_ssl_handshake_server_keyex_exponent,
|
|
|
dbc6ab |
- tvb, exponent_len_offset + 2, exponent_len, ENC_NA);
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
- /* Sig */
|
|
|
dbc6ab |
- proto_tree_add_uint(ssl_rsa_tree, hf_ssl_handshake_server_keyex_sig_len,
|
|
|
dbc6ab |
- tvb, sig_len_offset, 2, sig_len);
|
|
|
dbc6ab |
- proto_tree_add_item(ssl_rsa_tree, hf_ssl_handshake_server_keyex_sig,
|
|
|
dbc6ab |
- tvb, sig_len_offset + 2, sig_len, ENC_NA);
|
|
|
dbc6ab |
+ tvb, offset + 2, exponent_len, ENC_NA);
|
|
|
dbc6ab |
+ offset += 2 + exponent_len;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
+ /* signature */
|
|
|
dbc6ab |
+ dissect_ssl3_hnd_srv_keyex_sig(tvb, ssl_rsa_tree, offset, session);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
-
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
dissect_ssl3_hnd_cli_keyex_dh(tvbuff_t *tvb, proto_tree *tree,
|
|
|
dbc6ab |
guint32 offset, guint32 length)
|
|
|
dbc6ab |
@@ -3468,7 +3408,7 @@ dissect_ssl3_hnd_cli_keyex_rsa(tvbuff_t *tvb, proto_tree *tree,
|
|
|
dbc6ab |
static void
|
|
|
dbc6ab |
dissect_ssl3_hnd_finished(tvbuff_t *tvb,
|
|
|
dbc6ab |
proto_tree *tree, const guint32 offset,
|
|
|
dbc6ab |
- const guint *conv_version)
|
|
|
dbc6ab |
+ SslSession *session)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
/* For TLS:
|
|
|
dbc6ab |
* struct {
|
|
|
dbc6ab |
@@ -3488,7 +3428,7 @@ dissect_ssl3_hnd_finished(tvbuff_t *tvb,
|
|
|
dbc6ab |
return;
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- switch (*conv_version) {
|
|
|
dbc6ab |
+ switch (session->version) {
|
|
|
dbc6ab |
case SSL_VER_TLS:
|
|
|
dbc6ab |
case SSL_VER_TLSv1DOT1:
|
|
|
dbc6ab |
case SSL_VER_TLSv1DOT2:
|
|
|
dbc6ab |
@@ -3568,7 +3508,7 @@ dissect_ssl3_hnd_cert_status(tvbuff_t *tvb, proto_tree *tree,
|
|
|
dbc6ab |
/* record layer dissector */
|
|
|
dbc6ab |
static gint
|
|
|
dbc6ab |
dissect_ssl2_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
dbc6ab |
- guint32 offset, guint *conv_version,
|
|
|
dbc6ab |
+ guint32 offset, SslSession *session,
|
|
|
dbc6ab |
gboolean *need_desegmentation,
|
|
|
dbc6ab |
SslDecryptSession *ssl, gboolean first_record_in_frame)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
@@ -3684,19 +3624,19 @@ dissect_ssl2_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
dbc6ab |
/* if we get a server_hello or later handshake in v2, then set
|
|
|
dbc6ab |
* this to sslv2
|
|
|
dbc6ab |
*/
|
|
|
dbc6ab |
- if (*conv_version == SSL_VER_UNKNOWN)
|
|
|
dbc6ab |
+ if (session->version == SSL_VER_UNKNOWN)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
if (ssl_looks_like_valid_pct_handshake(tvb,
|
|
|
dbc6ab |
(initial_offset +
|
|
|
dbc6ab |
record_length_length),
|
|
|
dbc6ab |
record_length)) {
|
|
|
dbc6ab |
- *conv_version = SSL_VER_PCT;
|
|
|
dbc6ab |
- /*ssl_set_conv_version(pinfo, ssl->version);*/
|
|
|
dbc6ab |
+ session->version = SSL_VER_PCT;
|
|
|
dbc6ab |
+ /*ssl_set_conv_version(pinfo, ssl->session.version);*/
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
else if (msg_type >= 2 && msg_type <= 8)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
- *conv_version = SSL_VER_SSLv2;
|
|
|
dbc6ab |
- /*ssl_set_conv_version(pinfo, ssl->version);*/
|
|
|
dbc6ab |
+ session->version = SSL_VER_SSLv2;
|
|
|
dbc6ab |
+ /*ssl_set_conv_version(pinfo, ssl->session.version);*/
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
@@ -3705,20 +3645,20 @@ dissect_ssl2_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
dbc6ab |
* (e.g., on a client hello)
|
|
|
dbc6ab |
*/
|
|
|
dbc6ab |
col_set_str(pinfo->cinfo, COL_PROTOCOL,
|
|
|
dbc6ab |
- (*conv_version == SSL_VER_PCT) ? "PCT" : "SSLv2");
|
|
|
dbc6ab |
+ (session->version == SSL_VER_PCT) ? "PCT" : "SSLv2");
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* see if the msg_type is valid; if not the payload is
|
|
|
dbc6ab |
* probably encrypted, so note that fact and bail
|
|
|
dbc6ab |
*/
|
|
|
dbc6ab |
msg_type_str = try_val_to_str(msg_type,
|
|
|
dbc6ab |
- (*conv_version == SSL_VER_PCT)
|
|
|
dbc6ab |
+ (session->version == SSL_VER_PCT)
|
|
|
dbc6ab |
? pct_msg_types : ssl_20_msg_types);
|
|
|
dbc6ab |
if (!msg_type_str
|
|
|
dbc6ab |
- || ((*conv_version != SSL_VER_PCT) &&
|
|
|
dbc6ab |
+ || ((session->version != SSL_VER_PCT) &&
|
|
|
dbc6ab |
!ssl_looks_like_valid_v2_handshake(tvb, initial_offset
|
|
|
dbc6ab |
+ record_length_length,
|
|
|
dbc6ab |
record_length))
|
|
|
dbc6ab |
- || ((*conv_version == SSL_VER_PCT) &&
|
|
|
dbc6ab |
+ || ((session->version == SSL_VER_PCT) &&
|
|
|
dbc6ab |
!ssl_looks_like_valid_pct_handshake(tvb, initial_offset
|
|
|
dbc6ab |
+ record_length_length,
|
|
|
dbc6ab |
record_length)))
|
|
|
dbc6ab |
@@ -3726,7 +3666,7 @@ dissect_ssl2_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
dbc6ab |
if (ssl_record_tree)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
proto_item_set_text(ssl_record_tree, "%s Record Layer: %s",
|
|
|
dbc6ab |
- (*conv_version == SSL_VER_PCT)
|
|
|
dbc6ab |
+ (session->version == SSL_VER_PCT)
|
|
|
dbc6ab |
? "PCT" : "SSLv2",
|
|
|
dbc6ab |
"Encrypted Data");
|
|
|
dbc6ab |
|
|
|
dbc6ab |
@@ -3751,7 +3691,7 @@ dissect_ssl2_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
dbc6ab |
if (ssl_record_tree)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
proto_item_set_text(ssl_record_tree, "%s Record Layer: %s",
|
|
|
dbc6ab |
- (*conv_version == SSL_VER_PCT)
|
|
|
dbc6ab |
+ (session->version == SSL_VER_PCT)
|
|
|
dbc6ab |
? "PCT" : "SSLv2",
|
|
|
dbc6ab |
msg_type_str);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
@@ -3804,13 +3744,13 @@ dissect_ssl2_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
dbc6ab |
if (ssl_record_tree)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
proto_tree_add_item(ssl_record_tree,
|
|
|
dbc6ab |
- (*conv_version == SSL_VER_PCT)
|
|
|
dbc6ab |
+ (session->version == SSL_VER_PCT)
|
|
|
dbc6ab |
? hf_pct_msg_type : hf_ssl2_msg_type,
|
|
|
dbc6ab |
tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
offset += 1; /* move past msg_type byte */
|
|
|
dbc6ab |
|
|
|
dbc6ab |
- if (*conv_version != SSL_VER_PCT)
|
|
|
dbc6ab |
+ if (session->version != SSL_VER_PCT)
|
|
|
dbc6ab |
{
|
|
|
dbc6ab |
/* dissect the message (only handle client hello right now) */
|
|
|
dbc6ab |
switch (msg_type) {
|
|
|
dbc6ab |
@@ -4580,7 +4520,7 @@ void ssl_set_master_secret(guint32 frame_num, address *addr_srv, address *addr_c
|
|
|
dbc6ab |
} else {
|
|
|
dbc6ab |
ssl = (SslDecryptSession *)se_alloc0(sizeof(SslDecryptSession));
|
|
|
dbc6ab |
ssl_session_init(ssl);
|
|
|
dbc6ab |
- ssl->version = SSL_VER_UNKNOWN;
|
|
|
dbc6ab |
+ ssl->session.version = SSL_VER_UNKNOWN;
|
|
|
dbc6ab |
conversation_add_proto_data(conversation, proto_ssl, ssl);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|
|
|
dbc6ab |
@@ -4589,31 +4529,31 @@ void ssl_set_master_secret(guint32 frame_num, address *addr_srv, address *addr_c
|
|
|
dbc6ab |
ssl_set_server(ssl, addr_srv, ptype, port_srv);
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* version */
|
|
|
dbc6ab |
- if ((ssl->version==SSL_VER_UNKNOWN) && (version!=SSL_VER_UNKNOWN)) {
|
|
|
dbc6ab |
+ if ((ssl->session.version==SSL_VER_UNKNOWN) && (version!=SSL_VER_UNKNOWN)) {
|
|
|
dbc6ab |
switch (version) {
|
|
|
dbc6ab |
case SSL_VER_SSLv3:
|
|
|
dbc6ab |
- ssl->version = SSL_VER_SSLv3;
|
|
|
dbc6ab |
+ ssl->session.version = SSL_VER_SSLv3;
|
|
|
dbc6ab |
ssl->version_netorder = SSLV3_VERSION;
|
|
|
dbc6ab |
ssl->state |= SSL_VERSION;
|
|
|
dbc6ab |
ssl_debug_printf("ssl_set_master_secret set version 0x%04X -> state 0x%02X\n", ssl->version_netorder, ssl->state);
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
case SSL_VER_TLS:
|
|
|
dbc6ab |
- ssl->version = SSL_VER_TLS;
|
|
|
dbc6ab |
+ ssl->session.version = SSL_VER_TLS;
|
|
|
dbc6ab |
ssl->version_netorder = TLSV1_VERSION;
|
|
|
dbc6ab |
ssl->state |= SSL_VERSION;
|
|
|
dbc6ab |
ssl_debug_printf("ssl_set_master_secret set version 0x%04X -> state 0x%02X\n", ssl->version_netorder, ssl->state);
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
case SSL_VER_TLSv1DOT1:
|
|
|
dbc6ab |
- ssl->version = SSL_VER_TLSv1DOT1;
|
|
|
dbc6ab |
+ ssl->session.version = SSL_VER_TLSv1DOT1;
|
|
|
dbc6ab |
ssl->version_netorder = TLSV1DOT1_VERSION;
|
|
|
dbc6ab |
ssl->state |= SSL_VERSION;
|
|
|
dbc6ab |
ssl_debug_printf("ssl_set_master_secret set version 0x%04X -> state 0x%02X\n", ssl->version_netorder, ssl->state);
|
|
|
dbc6ab |
break;
|
|
|
dbc6ab |
|
|
|
dbc6ab |
case SSL_VER_TLSv1DOT2:
|
|
|
dbc6ab |
- ssl->version = SSL_VER_TLSv1DOT2;
|
|
|
dbc6ab |
+ ssl->session.version = SSL_VER_TLSv1DOT2;
|
|
|
dbc6ab |
ssl->version_netorder = TLSV1DOT2_VERSION;
|
|
|
dbc6ab |
ssl->state |= SSL_VERSION;
|
|
|
dbc6ab |
ssl_debug_printf("ssl_set_master_secret set version 0x%04X -> state 0x%02X\n", ssl->version_netorder, ssl->state);
|
|
|
dbc6ab |
@@ -4623,12 +4563,12 @@ void ssl_set_master_secret(guint32 frame_num, address *addr_srv, address *addr_c
|
|
|
dbc6ab |
|
|
|
dbc6ab |
/* cipher */
|
|
|
dbc6ab |
if (cipher > 0) {
|
|
|
dbc6ab |
- ssl->cipher = cipher;
|
|
|
dbc6ab |
- if (ssl_find_cipher(ssl->cipher,&ssl->cipher_suite) < 0) {
|
|
|
dbc6ab |
- ssl_debug_printf("ssl_set_master_secret can't find cipher suite 0x%X\n", ssl->cipher);
|
|
|
dbc6ab |
+ ssl->session.cipher = cipher;
|
|
|
dbc6ab |
+ if (ssl_find_cipher(ssl->session.cipher,&ssl->cipher_suite) < 0) {
|
|
|
dbc6ab |
+ ssl_debug_printf("ssl_set_master_secret can't find cipher suite 0x%X\n", ssl->session.cipher);
|
|
|
dbc6ab |
} else {
|
|
|
dbc6ab |
ssl->state |= SSL_CIPHER;
|
|
|
dbc6ab |
- ssl_debug_printf("ssl_set_master_secret set CIPHER 0x%04X -> state 0x%02X\n", ssl->cipher, ssl->state);
|
|
|
dbc6ab |
+ ssl_debug_printf("ssl_set_master_secret set CIPHER 0x%04X -> state 0x%02X\n", ssl->session.cipher, ssl->state);
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
}
|
|
|
dbc6ab |
|