Commit Graph

192 Commits

Author SHA1 Message Date
Guy Harris 170def9511 Fix escaping of strings in UATs.
Not only must characters that aren't printable ASCII characters be
escaped, backslashes must be escaped (as backslash is an escape
introducer) and double-quotes must be escaped (as double-quotes
encapsulate strings).

When constructing a string to hand to uat_load_str(), escape pathnames,
as they are likely to contain backslashes on Windows, could contain
backslashes on UN*X, and could contain quotes on UN*X and possibly
Windows.  (Arguably, we should escape all the string arguments

Bug: 11372
Change-Id: I594840327fa41895130903c3c612ba97d6c29df3
Reviewed-on: https://code.wireshark.org/review/9716
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-20 17:02:59 +00:00
Michael Mann 21e5a950ad Remove all preferences related to enabling/disabling heuristic dissectors.
The preferences are still supported for backwards compatibility, but the heuristic_protos file has final say on the "preference" to enable/disable a heuristic dissector.

Also add parameter to heur_dissector_add() for the "default" enable/disable of a heuristic dissector. With this parameter, a few more (presumably weak) heuristic dissectors have been "registered" but of course default to being disabled.

Change-Id: I51bebb2146ef3fbb8418d4f5c7f2cb2b58003a22
Reviewed-on: https://code.wireshark.org/review/9610
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-17 17:12:22 +00:00
Pascal Quantin 0801cd399f DTLS: fix compilation without libgcrypt or libgnutls
Change-Id: I571f1ddaaa9579af65d558afc7162493a7393703
Reviewed-on: https://code.wireshark.org/review/9661
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-07-16 17:29:33 +00:00
Pascal Quantin 79774329d7 Simply code for export of PDUs coming from heuristic dissectors
Let's use the newly introduced find_heur_dissector_by_unique_short_name() function

Change-Id: I5781b9b2f1ab679da07e97755b71840b4b3a9361
Reviewed-on: https://code.wireshark.org/review/9645
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-07-15 18:30:57 +00:00
Michael Mann be7d295fbf Add "user presentable" and "unique string ids" to heuristic table entries.
This allows better presentation of heuristic dissectors to the end user.

Change-Id: I2ff3985ab914e83c2989880cc0c7b9904045b3f6
Reviewed-on: https://code.wireshark.org/review/9602
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-12 03:14:38 +00:00
Peter Wu 3ad976896a ssl,dtls: split init/cleanup routines
Minor functional change: instead of an empty hash table, now the
ssl_session_hash and ssl_crandom_hash structures point will be set to
NULL when files are closed.

API change: drop the ssl_keylog_file parameter from ssl_common_init,
add a new ssl_common_cleanup parameter instead.

Change-Id: I65efe71f8347fe9685359f8ed70cfb9673712421
Reviewed-on: https://code.wireshark.org/review/9226
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-03 23:38:26 +00:00
Pascal Quantin cdc7d25004 Add ability to export PDUs for heuristic dissectors also
Change-Id: I1bf1aa9794f9b4f106edffd4986fc0b1014522fa
Reviewed-on: https://code.wireshark.org/review/9099
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-06-25 00:10:13 +00:00
Michael Mann c6b0a61ab3 Remove proto_tree_add_text from packet-ssl-utils.c
Change-Id: I64998e93e8d72faa76e0e7809abfd9ccae10ab36
Reviewed-on: https://code.wireshark.org/review/8653
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-05-26 15:14:23 +00:00
Andreas Schultz a596361228 DTLS: use addresses_ports_reassembly_table_functions
When capturing two consecutive DTLS session to the same server,
fragments for the second session report a error:

> [Reassembly error, protocol DTLS: New fragment overlaps old data (retransmission?)]

It turns out that the DTLS dissector uses the addresses_reassembly_table_functions
which takes only the IP addresses into account and not the ports.
Changing that to the addresses_ports_reassembly_table_functions
fixes the bogus error message.

Change-Id: If317314dca4b1d46e802bac54c07c89c7a73e24e
Reviewed-on: https://code.wireshark.org/review/7824
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-03-26 14:48:55 +00:00
Peter Wu 70d34eee2b ssl,dtls: fix CertificateVerify dissection for TLSv1.2
TLSv1.2 gained an additional SignatureAndHashAlgorithm field for fields
marked with the digitally-signed attribute. This was already implemented
before for ServerKeyExchange, let's reuse that.

Note that the SignatureAndHashAlgorithm tree and fields (hash algo,
signature algo) are repurposed in a different context, but since the
structure is the same it is kept like this.

By the way, add support for DTLSv1.2 too. RFC 6347 section 4.2.6
suggests that the implementation is the same (as far as the dissector is
concerned).

Also update the comments and remove the additional "Signature with
client's private key" subtree since the CertificateVerify message has no
other items.

Bug: 11045
Change-Id: I025901b85e607f04d60357ff14187cc13db2ae5d
Reviewed-on: https://code.wireshark.org/review/7650
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-03-12 12:48:00 +00:00
Michael Mann b7ef891af8 Replace tvb_get_ptr calls with a better API choice.
Just reduces the overall tvb_get_ptr usage count in the dissector directory.

Change-Id: I455dc4cc9b082ecccdd254a2e5121f3353b5a812
Reviewed-on: https://code.wireshark.org/review/7491
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-03-03 09:02:25 +00:00
Peter Wu 93ed72642b ssl,dtls,ssl-utils: Prepare for STARTTLS handling
All STARTTLS-like dissectors (protocols which can switch to SSL/TLS
after a protocol command) currently fail to get called after decryption.
The reason for this is that the port is not registered for SSL
dissection via ssl_dissector_add. Besides this, the MySQL dissector
breaks in the event of multiple segments because it does not properly
set desegmentation.

The call path TCP | App | SSL | App is a bad, error-prone pattern which
requires duplication of required functionality in dissectors. This patch
enables to bypass the App (TCP | SSL | App) by registering a SSL as
conversation dissector after a STARTTLS switch.

Logical overview of changes:

 - Move srv_addr, srv_ptype and srv_port to SslSession and adjust the
   users. This allows passing SslSession around which will never be null
   unlike SslDecryptSession. This is needed for looking up the packet
   direction (server or client) before calling a subdissector.
 - Add app_handle to store the dissector and last_nontls_frame the
   frame that initiated STARTTLS.
 - The same app_handle is now used to store the dissector handle from
   a ssl association.
 - Moved conversation data (SslDecryptSession) to ssl-utils to avoid
   code duplication. Merge ssl_session_init into it. The new
   ssl_session_get() is needed for STARTTLS frame/handle storage.
 - Introduce new "ssl_starttls_ack" function to signal the last non-TLS
   packet.
 - Ensure that match_uint is set before calling the conversation
   dissector. This ensures that dissectors using match_uint to check
   the direction of a packet (client vs. server) see the TCP port
   instead of the IP proto. At least the MySQL and SMTP dissectors
   require such special treatment.
 - Move epan/conversation.h outside HAVE_LIBGNUTLS, remove from dtls
   (as it is already included by ssl-utils).
 - Various comment/debug string updates. Remove outdated comment before
   SSL association lookup.

Besides setting match_uint and caching the app_handle, existing
dissectors should not be affected by this patch. Follow-up patches
will update existing dissectors to use the new ssl_starttls_ack
interface.

Bug: 9515
Change-Id: I795d16b6a901e672a5d89e922adc7e5bbcda0333
Reviewed-on: https://code.wireshark.org/review/6872
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-09 14:00:38 +00:00
Michael Mann 7967ef9510 Remove emem APIs from UAT functionality.
Change-Id: I009c09f25d170e5c9aaaef713eaacb3252817856
Reviewed-on: https://code.wireshark.org/review/6460
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-12 14:25:12 +00:00
Evan Huus 3a9869d81a Remove/replace ep_strsplit()
Change-Id: I4a803d83844d937804849b2ad3b067381c9b96d0
Reviewed-on: https://code.wireshark.org/review/6448
Petri-Dish: Evan Huus <eapache@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-10 01:56:08 +00:00
Stephen Fisher ae6df38436 packet-dtls.c still needs conversation.h
Change-Id: I1e6a55c41cbab74790880da2b3691cd7d82bc276
Reviewed-on: https://code.wireshark.org/review/6004
Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-12-23 00:23:31 +00:00
Martin Mathieson 596669f921 First batch of unincludes. Last attempt...
Change-Id: I3681462aeb98ca62ed3ec5eb226b2553317391a9
Reviewed-on: https://code.wireshark.org/review/5997
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-22 21:03:13 +00:00
Bill Meier b5d7b7ab6e Cleanup use of #includes in non-generated epan/dissector/*.c
Specifically:
- Set packet.h to be the first wireshark #include after
   config.h and "system" #includes.
   packet.h added as an #include in some cases when missing.
- Remove some #includes included (directly/indirectly) in
   packet.h. E.g., glib.h.
   (Done only for those files including packet.h).
- As needed, move "system" #includes to be after config.h and
   before wireshark #includes.
- Rework various #include file specifications for consistency.
- Misc.

Change-Id: Ifaa1a14b50b69fbad38ea4838a49dfe595c54c95
Reviewed-on: https://code.wireshark.org/review/5923
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-21 05:46:22 +00:00
Guy Harris 2b006ad30e Have a heur_dissector_list_t be an opaque handle.
This allows dissector lists to be looked up by name, so they can be
shared by multiple dissectors.

(This means that there's no "udplite" heuristic dissector list, but
there shouldn't be one - protocols can run atop UDP or UDPLite equally
well, and they share a port namespace and uint dissector table, so they
should share a heuristic dissector table as well.)

Change-Id: Ifb2d2c294938c06d348a159adea7a57db8d770a7
Reviewed-on: https://code.wireshark.org/review/5936
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-21 04:14:24 +00:00
Dave Tapuska 6dbb97da10 SSL: Implement Extended Master Secret
Store all handshake mesages in a buffer so that we can hash them
correctly when generating the master secret.

This change does not work correctly for DTLS retransmitted packets; that
are in the handshake as they will be hashed twice; which is bad. Looking
for ideas to implement this.

Bug: 10686
Change-Id: Ied01d4cc37b4270f325070a8d1630d3123577a0d
Reviewed-on: https://code.wireshark.org/review/5168
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-11-24 09:22:12 +00:00
Bill Meier 01b093c24d Add editor modelines; Adjust whitespace as needed.
Change-Id: I434da226c842298f4fb2a4335d06d51e164af2af
Reviewed-on: https://code.wireshark.org/review/4394
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-30 23:17:01 +00:00
Peter Wu a69a63f5d1 ssl: fix SSL keylog file live-capture use case
Patch "ssl,dtls: simplify keyfile handling" did not account for the use
case where packets are captured and decrypted on the fly using
SSLKEYLOGFILE.

This patch restores that functionality by reading additional lines from
the keylog file when needed (to preserve the benefit of not having to
read the full file) and by watching the open file for deletions.

"Deletion" is detected by comparing st_dev and st_ino. Since these may
be useless on Windows, the size is also checked.

Change-Id: Ieadaef1426a9270587293db28f4dda33b3d17334
Reviewed-on: https://code.wireshark.org/review/3190
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Evan Huus <eapache@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-07-31 11:09:07 +00:00
Peter Wu 7939d32ce2 ssl,dtls: simplify keyfile handling
Previously, the keylog file would be fully parsed when an encrypted
pre-master secret is encountered or in the ChangeCipherSpec stage. There
was also a lot of duplication in the key logfile parsing.

This patch simplifies the key logfile parsing by using regular
expressions. Rather than scanning the key logfile for a specific key,
do this scan once at ssl init and save the results to a hashtable. The
map for session ID/tickets to master keys already existed, another one
for client random to master key and encrypted pre-master to pre-master
was added. This could later also be wired to the "Export SSL Keys"
menu item for improved reliability (when no session ID or tickets are
available, the client random could be used).

The ssl_{save,restore}_session{,_ticket} functions have been converted
to a single function that looks up a key (sid / client random / encr.
pre-master) to a (pre-)master secret.

Other minor changes: return booleans for some functions that can only
fail/pass. Remove some functions from the ssl-utils header that have
become private a few commits ago. Remove some outstanding issues
from the comments in packet-ssl as they are already done, add myself
to the ssl-utils header.

These changes pass the test suite and the sample Session Ticket-enabled
capture from https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5963

On-the-fly decryption are broken with this patch since keylog files are
read once at the start of a capture. This will be solved in a future
patch.

Change-Id: Idb343abe161950b5f3ff61bee093d0f4ef9655bd
Reviewed-on: https://code.wireshark.org/review/3057
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Evan Huus <eapache@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-07-31 11:08:18 +00:00
Peter Wu fc983cfca2 ssl,dtls: move Finished dissection to ssl-utils
Change-Id: Ib4bd5712cb85cd2671f67fe035747b88d5b4f186
Reviewed-on: https://code.wireshark.org/review/3034
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Hauke Mehrtens <hauke@hauke-m.de>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-07-24 05:29:52 +00:00
Peter Wu 5e3b04449a ssl,dtls: move Session Ticket to ssl-utils
Changes:

 - dtls: also support saving session tickets.
 - Drop the length check and let proto_tree_add_item throw exceptions
   on length errors.
 - Use proto_tree_add_item instead of proto_tree_add_uint.
 - Drop "TLS" from header field descriptions, the RFC does not name it
   as such and DTLS can also use it (a draft is in progress that extends
   DTLS with Session Tickets,
   draft-hummen-dtls-extended-session-resumption-01).

Change-Id: I11195217368b7200821d11289b1c5870a1ffe637
Reviewed-on: https://code.wireshark.org/review/3029
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-23 20:50:38 +00:00
Peter Wu ee231c5263 ssl,dtls: move ClientHello to ssl-utils
Changes to ClientHello dissection:

 - Move ssl_find_private_key (and its pre-req, ssl_set_server) outside
   ssl_dissect_hnd_cli_hello. It has not really something to do with
   dissection, but state tracking and decoder param feeding.
 - dtls: add expert info for bad cipher suites len.
 - ssl: remove bad cipher suites len text label which is also
   available as expert info. Attach expert info to a the length proto
   item (which is converted to use add_item instead of add_uint).
 - Remove `if (tree || ssl)` since expert info seems not to apply
   otherwise (this also needs changes in common and handshake
   dissection).
 - ssl: remove tvb_ensure_bytes_exist so we can dissect more
   compression methods and cipher suites.
 - Since DTLS has an additional Cookie field which TLS does not have,
   pass these additional header fields through a struct whose type is
   defined in ssl-utils.

Change-Id: I41bef04c1c3353e582e30f561d1d246a744e1d60
Reviewed-on: https://code.wireshark.org/review/3021
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-23 17:09:01 +00:00
Peter Wu aa09feaf52 ssl,dtls: move ServerHello to ssl-utils
Changes to ServerHello:

 - Get rid of session parameter as the SslDecryptSession already
   provides a reference to SslSession. Done for the new
   ssl_dissect_hnd_srv_hello and ssl_dissect_hnd_hello_ext functions.
 - No need to generate the keyring here, decryption is only needed after
   ChangeCipherSpec and the keyring will be generated there provided
   that there are enough params (cipher, version, master-secret, etc.)
 - Get rid of labels and goto in favor of if/else.
 - DTLS: SSL_HAVE_SESSION_KEY is implicitly set when
   ssl_generate_keyring_material succeeds, no need to set it. Remove it.
 - Remove `if (tree || ssl)` since expert info seems not to apply
   otherwise (this also needs changes in common and handshake
   dissection). (Expert info from the TLS extensions, not the
   ServerHello itself.)

Other changes:

 - ClientHello: renamed some fields shared with ServerHello.

Change-Id: I466b905d990489e03250bac97bf9d862ff82ce6c
Reviewed-on: https://code.wireshark.org/review/3020
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-23 17:08:06 +00:00
Peter Wu 2c772e3825 ssl: move decoder init from ClientKeyExchange to ChangeCipherSpec
My previous change removed master-key retrieval in the Server Hello.
This broke decryption when ClientKeyExchange is missing. That was done
because decryption is only needed after ChangeCipherSpec.

This patch moves the remaining initialization in ClientKeyExchange to
ChangeCipherSpec. In theory this could fix decryption of DTLS traffic
when an abbreviated handshake is used (and thus keyring material is
never generated in ClientKeyExchange since it is not called).

It also avoids saving a session ticket with an empty key which can
happen when no RSA key is present, but the NewSessionTicket message
is received. This could lead to garbage decryption.

Change-Id: If0f475232c270b1d7b006c1f9af0e8d8098c6b65
Reviewed-on: https://code.wireshark.org/review/3019
Reviewed-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-15 23:07:10 +00:00
Peter Wu aecbb98365 ssl: unify common Hello dissection to ssl-utils
Based on DTLS code with changes merged from SSL. Changes:

 - Ignore large Session IDs, this was not harmful though since the
   backing storage was 256 bytes in size.
 - {ssl,dtls}.handshake.random: fixed description, it is not used like
   a SSLv2 random challenge.
 - dtls: also debug print client/server for random
 - SSL: the common dissector now returns an offset rather than dissected
   length.
 - dtls: display actual Session ID bytes in the UI rather than the text
   "Session ID (32 bytes)". The length field is already visible in the
   preceding field.

Also changed is the handling of key material generation. The SSL
dissector previously generated key material based on the Session ID,
Session Ticket or a key logfile. (DTLS did not have this functionality.)
As decryption is needed only after ChangeCipherSpec, I have removed it
from the ServerHello handling. This will break decryption when a
ClientKeyExchange message is missing, but it will be restored proper in
a next patch.

(By the way, there was an inverted if-condition bug in DTLS that could
break decryption by not restoring the master key matching a SID. This
is gone in the refactoring because the faulty code is removed.)

Change-Id: Ida3de88adefe3f7691f85936c496977426c4d96e
Reviewed-on: https://code.wireshark.org/review/3018
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-15 23:07:05 +00:00
Peter Wu 9e5e43ba44 dtls: fix faulty offsets and tvbuff references
This could lead to problems for fragmented DTLS packets.

Change-Id: I602c7e181ea3799a4a2e7bcfed05bfbb129f7df4
Reviewed-on: https://code.wireshark.org/review/3017
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-12 12:06:50 +00:00
Peter Wu 71ebdb67ad ssl: move CertificateRequest to ssl-utils
Except for field/expert_info names, a redundant subtree assignment,
a different !tree check, a type confusion in DTLS (proto_tree *ti),
a check against a different DTLS/TLS version and a (void) retval cast,
the functions are exactly the same. Extract them to ssl-utils.

Change-Id: I2ca7089fe2cd23212ef78656506cb53768f55927
Reviewed-on: https://code.wireshark.org/review/2986
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-07-11 04:36:51 +00:00
Peter Wu ba6d2e7cc8 ssl: move Certificate handshake dissection to ssl-utils
There are no dissection differences between DTLS and SSL, so move to
ssl-utils. While at it, skip dissection when the tree is NULL, remove
the plural from certificates length (the length is always larger than
ome), fix type of "ti" for dtls, get rid of "failsafe" subtree
assignment in ssl, get rid of tvb_ensure_bytes_exist in ssl.

Unrelated changes: fix param (tvb vs sub_tvb) for DTLS KeyExchange
handshake messages.

Change-Id: Iecaa45a7a601e55a52aa16180cf219a122fbe95a
Reviewed-on: https://code.wireshark.org/review/2985
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-07-11 04:35:40 +00:00
Peter Wu 7248c24afc ssl: add missing valid handshake types
The DTLS dissector duplicated a handshake types check, this has been
eliminated. Convert HandshakeType and ContentType to enums to get the
benefit of compiler-checked switch cases. Move these checks to
ssl-utils.

Two default cases could never be reached since the dissector returns
immediately on an invalid ContentType.

Also fixed misleading debugging messages.

Change-Id: I07a2062564e073004dcc0401cd82538e5659fa0c
Reviewed-on: https://code.wireshark.org/review/2978
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-07-11 04:32:15 +00:00
Peter Wu 1bf4efd850 ssl,dtls: convert from tvb_length
Every occurrence of tvb_length* has been converted to
tvb_reported_length* except some dtls lines.

Change-Id: I0faac315cdf5d17c0af18be177aacd076ff86cff
Reviewed-on: https://code.wireshark.org/review/2977
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-07-10 11:00:11 +00:00
Michael Mann 888f22de16 convert to proto_tree_add_subtree[_format]
Change-Id: I2ea1892b5963cc5578cbdd2b03029ca8424f2267
Reviewed-on: https://code.wireshark.org/review/2640
Tested-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-25 16:35:14 +00:00
Peter Wu e22d3c9b74 ssl: fix ClientKeyExchange, fix TLSv1.2 SKE for DH
Since DTLS and TLS do not differ in handling ClientKeyExchange and
ServerKeyExchange, its dissection got moved to ssl-utils. The code is
based on the SSL dissector, with header field names adjusted to the
DTLS ones (those got capitalized). Besides a version difference (for
signatures), the header field and function names, the DTLS and SSL code
are equal (this is verified).

This patch refactors the dissectors for DHE_RSA and ECDHE to make use of
a common function to dissect the signed_params field. All offset
tracking is also removed in favor of exception handling by the
proto_tree_add_item function. Occurrences of proto_tree_add_uint are
also replaced by proto_tree_add_item for simplicity.

After those changes, the SKE dissector for DH key exchanges is updated
to handle the mandatory signature field in TLSv1.2, using the newly
added function. (bug 9208)

Another bug occurred after the length check removal, pre-TLS and
OpenSSL's old DTLS implemenation do not include a vector length in
the CKE. This is now also fixed. (bug 10222)

Other minor changes: comments added/corrected, renamed
keyex_dh -> keyex_dhe (includes DHE_RSA and DHE_DSS).

Bug: 9208
Bug: 10222
Change-Id: I76e835d56a65c91facce46840d79c1c48ce8d5dd
Reviewed-on: https://code.wireshark.org/review/2542
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-23 23:31:40 +00:00
Guy Harris ce3d2ff3de Rename dissector_add_handle() to dissector_add_for_decode_as().
Hopefully that name makes it clear what the routiner's purpose is, and
will encourage people to use it rather than using dissector_add_uint()
with a bogus integer value.

Change-Id: Ic5be456d0ad40b176aab01712ab7b13aed5de2a8
Reviewed-on: https://code.wireshark.org/review/2483
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 16:43:56 +00:00
Michael Mann 14824e6adf Revert "Fixup: tvb_* -> tvb_captured"
https://www.wireshark.org/lists/wireshark-dev/201406/msg00131.html

This reverts commit 246fe2ca4c.

Change-Id: Ib24bae0198c13a84bd7f731bf4af921212109a8f
Reviewed-on: https://code.wireshark.org/review/2430
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-19 18:25:59 +00:00
Dario Lombardo 246fe2ca4c Fixup: tvb_* -> tvb_captured
Change-Id: I9209c1271967405c34c1b6fa43e1726a4d3a5a3f
Reviewed-on: https://code.wireshark.org/review/2377
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18 14:14:58 +00:00
Michael Mann 73217d9f3f tvb_new_subset -> tvb_new_subset_length when length parameters are equal.
tvb_new_subset -> tvb_new_subset_remaining it appears that's what the intention is.

Change-Id: I2334bbf3f10475b3c22391392fc8b6864454de2d
Reviewed-on: https://code.wireshark.org/review/1999
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-06-07 15:41:07 +00:00
Hauke Mehrtens a8e6d128ab ssl/dtls: add support for Raw Public keys
Instead of X.509 certificates now also Raw public keys are supported
and shown correctly.

This is described in this draft:
https://tools.ietf.org/html/draft-ietf-tls-oob-pubkey-11

Change-Id: Ibe7610aace31a19791b02e71ccd8d9ceb8cf979d
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-on: https://code.wireshark.org/review/1372
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-05-30 17:55:06 +00:00
Hauke Mehrtens 584b81372b ssl-utils: dissect the certificate type TLS extension
This analyses the certificate type extensions and then stores the
certificate type in the ssl session. This way we can later show the
certificate in the correct from.

This is described in this draft:
https://tools.ietf.org/html/draft-ietf-tls-oob-pubkey-11

Change-Id: Ifdda165807bc29f1fc138da000a9a538ecd18b6e
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-on: https://code.wireshark.org/review/1371
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-05-30 17:54:55 +00:00
Hauke Mehrtens 00251edd7d dtls: use SslSession
Use the struct SslSession instead of passing the tls version and cipher
to each function.

Change-Id: I95ad8cb5857794608f0f8db5c2dfd4b16e6578d5
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-on: https://code.wireshark.org/review/1820
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-05-30 14:20:10 +00:00
Hauke Mehrtens a7a4aa9a74 ssl: add SslSession structure
This structure is used to store information about a SSL session which
is not only needed for decrypting the session, but also to show nice
dissection information.

In an other patch I will add some more members to the struct because
the old way of passing them to the function does not scale.

Change-Id: I88e7f2896e0364a41d4538752dad291de83bfbca
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-on: https://code.wireshark.org/review/1819
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-05-30 14:19:59 +00:00
AndersBroman 2cfda31ff0 Change the signature of dissector_try_heuristic() to return hdtbl_entry
which can be used to call the found heuristic dissector on the next pass.

Introduce call_heur_dissector_direct() to be used to call a heuristic
dissector which accepted the frame on the first pass.

Change-Id: I524edd717b7d92b510bd60acfeea686d5f2b4582
Reviewed-on: https://code.wireshark.org/review/1697
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-21 20:17:29 +00:00
Hauke Mehrtens 338269fe41 ssl/dtls: add keyfile support to dtls
This moves the keyfile and psk options from the ssl code into ssl-utils
and then uses them also for dtls.

This is the last missing part for bug 9499 from my side.

Change-Id: Ie2fe5bc565eabe1e6ce62498c985b8a36e913b0f
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-on: https://code.wireshark.org/review/1369
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-27 18:00:21 +00:00
Hauke Mehrtens 3b76de7dc2 dtls: run dissector for decryption also on server hello extensions
The dissector only ran through the server hello extensions for the tree
and not in the ssl decryption pass. This resulted in
ssl_dissect_hnd_hello_ext() being always called with ssl == NULL. For
SSL this was also called with ssl != NULL.

Change-Id: I22f7b1089731124b3ca1a2b8515f307c4a021b7f
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-on: https://code.wireshark.org/review/1370
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-26 15:47:47 +00:00
Pascal Quantin ad33357e62 Exported PDU: add support for more than 32 tags
Change-Id: Idc9f105164919827a8a81c88b5a56de4fa25df0b
Reviewed-on: https://code.wireshark.org/review/1197
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-18 20:15:04 +00:00
Stig Bjørlykke 3f81af22e0 Improved TLS/DTLS Heartbeat Message handling.
Added an expert info for invalid payload length (heartbleed).

Change-Id: I9e09d1ae2b997091bbce2483c098dba7e6631859
Reviewed-on: https://code.wireshark.org/review/1067
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-11 12:29:54 +00:00
Michael Mann fdeed480bf Convert ep_address_to_str -> address_to_str(wmem_packet_scope, ...) for all dissectors
Change-Id: I7489e2fb3a1f2630ca17b0a5fe1aa873992f1061
Reviewed-on: https://code.wireshark.org/review/975
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-06 01:31:28 +00:00
Pascal Quantin 488f2a0974 Exported PDU: add support for data length on the wire
Change-Id: Iff14ec4d0297ec85f3597b33871fb0ab5256a597
Reviewed-on: https://code.wireshark.org/review/728
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-19 05:13:30 +00:00