diff options
author | Peter Wu <peter@lekensteyn.nl> | 2019-08-15 01:30:00 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2019-08-19 04:16:56 +0000 |
commit | 9ad4f907e836665e609958b0aa953595faee388d (patch) | |
tree | c591d6191c1d82d4459d79094fd3e9e29b37c4e2 /epan | |
parent | e5a052fb392d0c508eaedf2bcce9ea3dc1a9342b (diff) |
TLS: add mechanism to set the TLS appdata protocol
For use by EAP-TTLS which embeds TLS.
Change-Id: I4770d03f912dd75f92878dd74ad830ebb7eb1431
Reviewed-on: https://code.wireshark.org/review/34311
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-tls-utils.c | 20 | ||||
-rw-r--r-- | epan/dissectors/packet-tls-utils.h | 27 |
2 files changed, 37 insertions, 10 deletions
diff --git a/epan/dissectors/packet-tls-utils.c b/epan/dissectors/packet-tls-utils.c index d8b953afe7..eb23c6c1f6 100644 --- a/epan/dissectors/packet-tls-utils.c +++ b/epan/dissectors/packet-tls-utils.c @@ -4441,6 +4441,22 @@ static void ssl_reset_session(SslSession *session, SslDecryptSession *ssl, gbool } } +void +tls_set_appdata_dissector(dissector_handle_t tls_handle, packet_info *pinfo, + dissector_handle_t app_handle) +{ + conversation_t *conversation; + SslSession *session; + + /* Ignore if the TLS or other dissector is disabled. */ + if (!tls_handle || !app_handle) + return; + + conversation = find_or_create_conversation(pinfo); + session = &ssl_get_session(conversation, tls_handle)->session; + session->app_handle = app_handle; +} + static guint32 ssl_starttls(dissector_handle_t tls_handle, packet_info *pinfo, dissector_handle_t app_handle, guint32 last_nontls_frame) @@ -4477,9 +4493,9 @@ ssl_starttls(dissector_handle_t tls_handle, packet_info *pinfo, /* TLS starts after this frame. */ session->last_nontls_frame = last_nontls_frame; return 0; -} /* }}} */ +} -/* ssl_starttls_ack: mark future frames as encrypted. {{{ */ +/* ssl_starttls_ack: mark future frames as encrypted. */ guint32 ssl_starttls_ack(dissector_handle_t tls_handle, packet_info *pinfo, dissector_handle_t app_handle) diff --git a/epan/dissectors/packet-tls-utils.h b/epan/dissectors/packet-tls-utils.h index b5d30c2288..449b80bbbc 100644 --- a/epan/dissectors/packet-tls-utils.h +++ b/epan/dissectors/packet-tls-utils.h @@ -509,38 +509,49 @@ gchar* ssl_association_info(const char* dissector_table_name, const char* table_ /** Retrieve a SslSession, creating it if it did not already exist. * @param conversation The SSL conversation. - * @param ssl_handle The dissector handle for SSL or DTLS. + * @param tls_handle The dissector handle for SSL or DTLS. */ extern SslDecryptSession * -ssl_get_session(conversation_t *conversation, dissector_handle_t ssl_handle); +ssl_get_session(conversation_t *conversation, dissector_handle_t tls_handle); /** Set server address and port */ extern void ssl_set_server(SslSession *session, address *addr, port_type ptype, guint32 port); +/** Sets the application data protocol dissector. Intended to be called by + * protocols that encapsulate TLS instead of switching to it using STARTTLS. + * @param tls_handle The dissector handle for TLS or DTLS. + * @param pinfo Packet Info. + * @param app_handle Dissector handle for the protocol inside the decrypted + * Application Data record. + */ +WS_DLL_PUBLIC void +tls_set_appdata_dissector(dissector_handle_t tls_handle, packet_info *pinfo, + dissector_handle_t app_handle); + /** Marks this packet as the last one before switching to SSL that is supposed * to encapsulate this protocol. - * @param ssl_handle The dissector handle for SSL or DTLS. + * @param tls_handle The dissector handle for SSL or DTLS. * @param pinfo Packet Info. * @param app_handle Dissector handle for the protocol inside the decrypted * Application Data record. - * @return 0 for the first STARTTLS acknowledgement (success) or if ssl_handle + * @return 0 for the first STARTTLS acknowledgement (success) or if tls_handle * is NULL. >0 if STARTTLS was started before. */ WS_DLL_PUBLIC guint32 -ssl_starttls_ack(dissector_handle_t ssl_handle, packet_info *pinfo, +ssl_starttls_ack(dissector_handle_t tls_handle, packet_info *pinfo, dissector_handle_t app_handle); /** Marks this packet as belonging to an SSL conversation started with STARTTLS. - * @param ssl_handle The dissector handle for SSL or DTLS. + * @param tls_handle The dissector handle for SSL or DTLS. * @param pinfo Packet Info. * @param app_handle Dissector handle for the protocol inside the decrypted * Application Data record. - * @return 0 for the first STARTTLS acknowledgement (success) or if ssl_handle + * @return 0 for the first STARTTLS acknowledgement (success) or if tls_handle * is NULL. >0 if STARTTLS was started before. */ WS_DLL_PUBLIC guint32 -ssl_starttls_post_ack(dissector_handle_t ssl_handle, packet_info *pinfo, +ssl_starttls_post_ack(dissector_handle_t tls_handle, packet_info *pinfo, dissector_handle_t app_handle); extern dissector_handle_t |