summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-ssl.c
AgeCommit message (Collapse)AuthorFilesLines
2017-01-28(D)TLS: fix type of record sequence numberTLS13Peter Wu1-2/+3
The record sequence number is 64-bit, not 32-bit. This applies to all SSLv3/TLS/DTLS versions. Without this fix, after about four million records, the wrong MAC is calculated (for TLS 1.2) or decryption will fail (for TLS 1.3). Change-Id: I05e5e8bc4229ac443a1b06c5fe984fb885eab1ca
2017-01-28ssl: add expert info for unexpected messages in TLS 1.3Peter Wu1-2/+14
This will also avoid invoking ssl_finalize_decryption which will not be used for TLS 1.3. Change-Id: I958508276488764ad1a82e6412504bcd72f3b995 Ping-Bug: 12779
2017-01-28(D)TLS: consolidate and simplify decrypted records handlingPeter Wu1-92/+66
Previously there was a distinction between decrypted handshake Application Data records ("Decrypted SSL data") and some others (like Alerts, Handshake and Heartbeat, "Decrypted SSL record"). Remove this distinction and always decrypt the payload before passing it on and always display a data sources for decrypted contents ("Decrypted SSL"). This is prepatory work for TLS 1.3 support where the content type is located in the encrypted record, having the record decryption in one place makes it easier to adapt. Change-Id: I92c51c7f9e87e5c93231d28c39a8e896f5afd1ef Ping-Bug: 12779 Reviewed-on: https://code.wireshark.org/review/19789 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-01-13SSL: fix compilation without libgcrypt or gnutlsPascal Quantin1-0/+2
Change-Id: I785db404969f89a3f90eddbda5542ee6b676ddb8 Reviewed-on: https://code.wireshark.org/review/19623 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2017-01-12uat: add a reset callback.Dario Lombardo1-0/+8
This function will free the resources allocated by the caller. Change-Id: Ib486c14e4fd3c321662fb71f7fd06733ce9a64a4 Reviewed-on: https://code.wireshark.org/review/19375 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-31Dissectors don't need a journey of self discovery.Michael Mann1-2/+1
They already know who they are when they register themselves. Saving the handle then to avoid finding it later. Not sure if this will increase unnecessary register_dissector functions (instead of using create_dissector_handle in proto_reg_handoff function) when other dissectors copy/paste, but it should make startup time a few microseconds better. Change-Id: I3839be791b32b84887ac51a6a65fb5733e9f1f43 Reviewed-on: https://code.wireshark.org/review/19481 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-12-06DTLS: add support for use_srtp extension (RFC 5764)Peter Wu1-1/+1
Decryption support will be added later. Tested with dtls-srtp-ws-sip.pcapng from the linked bug. Change-Id: Ida1a2da754ef9aef16ad15ff64455b6f8e703ffd Ping-Bug: 13193 Reviewed-on: https://code.wireshark.org/review/18996 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-11-30ssl,dtls: add expert info for overly large record lengthsPeter Wu1-1/+5
All TLS and DTLS RFCs (and SSLv3) limit the record length to 2^14, so add expert info if this is exceeded. Spotted in the wild via https://ask.wireshark.org/questions/57641/tls12-record-length-gt-16k-valid Tested with a synthetic pcap having length 2^14+1 using Python: from scapy.all import IP, TCP, UDP, wrpcap len_plus_frag = b'\x40\x01' + 0x4001 * b'\0' wrpcap('bad-record-length.pcap', [ IP()/TCP(sport=2000, dport=443)/(b'\x17\x03\x03' + len_plus_frag), IP()/UDP(sport=2000, dport=853)/(b'\x17\xfe\xfd' + 8*b'\0' + len_plus_frag) ]) Change-Id: I5eac48775333d8d222e013a24a6d06da79892b77 Reviewed-on: https://code.wireshark.org/review/18959 Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Petri-Dish: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-10-07TLS(1.3): Add Hello Retry Request (6) extensionAlexis La Goutte1-0/+5
Add also special case on hello key_share extension Ping-Bug: 12779 Change-Id: Ib8e2dd060f322c2404a8afa9b8cb70de7c2c65b7 Reviewed-on: https://code.wireshark.org/review/18093 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-03ssl: use ws_strtou function.Dario Lombardo1-3/+5
Change-Id: I947dc83e3b1b853873b5158f234e44ef933c3bcc Reviewed-on: https://code.wireshark.org/review/17982 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-09-16ssl-utils: remove block and key sizes from cipher suites tablePeter Wu1-1/+1
There was an implicit dependency between the block size in the cipher suites table and the size expected by Libgcrypt. Just remove the block size from the table and rely on the value from Libgcrypt to avoid the risk of mismatching values (which could lead to a buffer overflow). While at it, remove the size of the key ("bits") and the size of key material ("eff_bits") too. Move the key material sizes for export ciphers away from the table and use byte quantities instead of bits. Additionally, this fixes an issue where 8 bytes of uninitialized stack memory is written to the SSL debug log for stream ciphers like RC4. The size of the Write Key is also corrected for export ciphers, now it prints the actual (restricted) number of bytes that are used. Change-Id: I71d3c83ece0f02b2e11e45455dc08c41740836be Reviewed-on: https://code.wireshark.org/review/17714 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-09-09ssl: set protocol column to "TLS" when possiblePeter Wu1-25/+24
The protocol version from a SSL/TLS record contains the minimum supported SSL/TLS version and is the best guess for Client Hello handshake messages if no authorative version is available. By considering the version from the conversation for the initial col_set_str call, we can also remove some other calls down the road. Change-Id: I4be25f5c9057ffd0abcea7280d826867c135fed7 Reviewed-on: https://code.wireshark.org/review/17490 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: Peter Wu <peter@lekensteyn.nl>
2016-09-06ssl: really fix session resumption expert infoPeter Wu1-2/+7
In a two-pass dissection with renegotiated sessions, the is_session_resumed flag is not updated according to the current protocol flow. Fix this by performing detection of abbreviated handshakes in all cases, do not limit it to the decryption stage (where ssl != NULL). Reset the resumption assumption after the first ChangeCipherSpec (normally from the server side, but explicitly add this in case client packets somehow arrive earlier in the capture). This should not have a functional effect on normal TLS captures with Session Tickets. Bug: 12793 Change-Id: I1eb2a8262b4e359b8c1d3d0a1e004a9e856bec8c Reviewed-on: https://code.wireshark.org/review/17483 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-09-04ssl,http: rename http-over-ssl to http-over-tlsPeter Wu1-1/+1
This name is displayed in the SSL prototcol tree (Application Data Protocol: http-over-tls), rename to avoid possible user confusion. Modify the SSL dissector such that both "http" and "http-over-tls" invoke the same dissector function. Change-Id: I2d52890a8ec8fa88b6390b133a11df607a5ec3dc Reviewed-on: https://code.wireshark.org/review/17481 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-08-31Don't do any Decode As stuff for dissector tables not used with Decode As.Guy Harris1-1/+1
Have all dissector tables have a "supports Decode As" flag, which defaults to FALSE, and which is set to TRUE if a register_decode_as() refers to it. When adding a dissector to a dissector table with a given key, only add it for Decode As if the dissector table supports it. For non-FT_STRING dissector tables, always check for multiple entries for the same protocol with different dissectors, and report an error if we found them. This means there's no need for the creator of a dissector table to specify whether duplicates of that sort should be allowed - we always do the check when registering something for "Decode As" (in a non-FT_STRING dissector table), and just don't bother registering anything for "Decode As" if the dissector table doesn't support "Decode As", so there's no check done for those dissector tables. Change-Id: I4a1fdea3bddc2af27a65cfbca23edc99b26c0eed Reviewed-on: https://code.wireshark.org/review/17402 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-30Support Decode As for {SSL,TLS}-over-TCP.Guy Harris1-0/+41
We register dissectors for "Decode As" for {SSL,TLS}-over-TCP, so we should actually set up the "Decode As" stuff for it. Change-Id: I2a738667efdec1007069df74885a4fe8fc3fcbab Reviewed-on: https://code.wireshark.org/review/17400 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-27ssl-utils: ensure that the cipher suite matches decoderPeter Wu1-2/+3
When the cipher suite for the current decryption session is changed via a Server Hello, it should not change the cipher suite field of the decoder. Otherwise there is a mismatch between the cipher suite and the capabilities of the decoder. Fix this issue by making the decoder hold a pointer to the (constant) SslCipherSuite structure rather than making a copy (and have the decoder point to that data). I also considered resetting the decoder once the cipher suite changes in the Server Hello, but that breaks renegotiation. Bug: 12665 Change-Id: Ieff38a535cd111d95933ec383378643b6fbab7bf Reviewed-on: https://code.wireshark.org/review/16674 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-07-18Use follow_record_t in SSL follow stream.Jeff Morriss1-10/+14
... rather than a structure (SslDecryptedRecord) which looks (mostly) like a follow_record_t. (The biggest different is the former carries its data in a StringInfo while the latter uses a GByteArray.) With this change following SSL no longer needs its own special code. This also fixes a crash after saving a followed SSL stream (in the Qt UI). Bug: 12616 Change-Id: Ibdb2b85f8a6a30712743a5da420be1e6b78f5b92 Reviewed-on: https://code.wireshark.org/review/16516 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-06-29Provide new interface for Export PDU.Michael Mann1-6/+2
Rather than have a bitmask for each desired field, have a dissector provide a list of structures that represent data that goes into the PDU. Change-Id: I125190cbaee489ebffb7d9f5d8bc6f3be2d06353 Reviewed-on: https://code.wireshark.org/review/16122 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-15Allow control of individual columns to be (un)writable.Michael Mann1-5/+2
Most protocols just want to limit COL_INFO or COL_PROTOCOL so give that level of granularity. Bug: 12144 Bug: 5117 Bug: 11144 Change-Id: I8de9b7d2c69e90d3fbfc0a52c2bd78c3de58e2f8 Reviewed-on: https://code.wireshark.org/review/15894 Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-06*_stdup_printf -> strdup for "single string only" formatting.Michael Mann1-1/+1
Done for performance improvements. This could probably be done in checkAPIs.pl, but this was just a quick manual check with grepping. Change-Id: I91ff102cb528bb00fa2f65489de53890e7e46f2d Reviewed-on: https://code.wireshark.org/review/15751 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
2016-06-05Resolve false positive ERROR: NO ARRAY found in ei array entriesJim Young1-1/+1
The enhanced checkhf.pl in https://code.wireshark.org/review/#/c/15717/ validates ei items in addition to href items. This patch addresses the false positive ERRORS reported by the enhanced checkhf.pl for a "cosmetic" issue (missing space after { in ei array entries). Change-Id: I87876ce2cfa4b0e11cb22f457bd9ab025d939e5c Reviewed-on: https://code.wireshark.org/review/15739 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-03-20Fix incorrect table being used to store Session TicketsAdam Schwalm1-1/+1
A regression was introduced at f4580ac9edc8b5351 where an additional hash table was introduced to store TLS Session Tickets separately from Session IDs. However, the New Session Ticket dissector was still storing the the Session Ticket in the ID table, causing lookups to fail. Change-Id: Iff49202f50afb8cb6ef62c774f6155682b8e48a6 Reviewed-on: https://code.wireshark.org/review/14499 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-03-17Associate dissector tables and heuristic subdissector lists with a protocol.Michael Mann1-2/+2
This will make it easier to determine protocol dependencies. Some LLC OUI dissector tables didn't have an associated protocol, so they were left without one (-1 used) Change-Id: I6339f16476510ef3f393d6fb5d8946419bfb4b7d Reviewed-on: https://code.wireshark.org/review/14446 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-25Move the proto data stuff out of frame_data.[ch].Guy Harris1-0/+2
It's not tied to the frame_data structure any more, so it belongs by itself. Clean up some #includes while we're at it; in particular, frame_data.h doesn't use anything related to tvbuffs, so don't have it gratuitiously include tvbuff.h. Change-Id: Ic32922d4a3840bac47007c5d4c546b8842245e0c Reviewed-on: https://code.wireshark.org/review/13518 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-24Add the packet number to the packet_info structure, and use it.Guy Harris1-6/+6
That removes most of the uses of the frame number field in the frame_data structure. Change-Id: Ie22e4533e87f8360d7c0a61ca6ffb796cc233f22 Reviewed-on: https://code.wireshark.org/review/13509 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-23Add more fields to packet_info structure and use them.Guy Harris1-1/+1
Add fields for the absolute time stamp (and another field for a presence flag for the absolute time stamp) and the packet encapsulation for the packet. This lets us remove the field for the packet encapsulation in the frame_data structure; do so. Change-Id: Ifb910a9a192414e2a53086f3f7b97f39ed36aa39 Reviewed-on: https://code.wireshark.org/review/13499 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-21Add missing const qualifiers for packet-ssl.c [-Wcast-qual]João Valverde1-2/+2
Change-Id: Idb7e3e1be3f876d5953b7dc667c7bc3feceff331 Reviewed-on: https://code.wireshark.org/review/13438 Reviewed-by: João Valverde <j@v6e.pt>
2016-01-18SSL : Fix Branch condition evaluates to a garbage value found by ClangAlexis La Goutte1-1/+1
Change-Id: I06150ce2d42285de0cb150f787f10942d1d7d4c0 Reviewed-on: https://code.wireshark.org/review/13404 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-01-16ssl: fix app_data handle detectionPeter Wu1-2/+7
When desegmentation is disabled (as is done with the SSL Decryption (master secret)" test), the app_data dissection is ignored because the app_data dissector it not yet known. Fix this by continuing when the port-based dissector is known (as was done before). Also add avoid setting a "(null)" protocol in the tree when the app_handle is not set (because the encrypted data is not decrypted for example, or when the heuristics dissector fails to set a protocol). Fixes regression since v2.1.0rc0-1501-g50dc0e8 ("ssl: improve interaction with heuristics subdissectors"). Change-Id: I65c1d4705dec8f6fea8b7ac02151fab9dc6152d6 Reviewed-on: https://code.wireshark.org/review/13312 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-15ssl: avoid duplicate PDU dissectionsPeter Wu1-4/+30
When a single frame contains multiple SSL segments and the higher-level PDU requests desegmentation, then each segment will trigger a dissection, resulting in a new tree for each. This seems to happen because the SSL dissector tries to complete a reassembly whenever a segment is found in the last frame. When doing the second pass, the fully reassembled segment is known and as a result the payload dissector is called for all SSL segments in a single frame. Fix this by checking whether the end of the segment covers the whole reassembled data. Another workaround is added to avoid "[SSL segment of a reassembled PDU]" in the Info column when desegmentation finishes. Also fix the SSL version in the Protocol column when a segment is part of a reassembled PDU. Bug: 11079 Change-Id: I9ae0c8ae5c56ed0dd7b071dec8bcc87e838a068d Reviewed-on: https://code.wireshark.org/review/12307 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-14ssl: improve interaction with heuristics subdissectorsPeter Wu1-35/+66
Do not call heuristics dissectors when the SSL application data protocol is known (via STARTTLS or via an earlier packet in session). When the protocol is *not* known, first try heuristics on the initial payload. If a match is found, it can then override the protocol that would otherwise be used due to a port number match. The HTTP2 dissector is adjusted to take advantage of that such that HTTP2 on non-standard ports still get detected as HTTP2. Also save dissector registration to avoid the http2 dissector from showing up as "(null)". Now HTTP2 is really shown as "http2" and not "http" in the "Application Data Protocol"! The CredSSP dissector is untested and not modified as I don't know if the whole stream will be SSL. Tested with fix-ssl.pcap and a http2 capture (from bug 11331) wrapped in SSL (without ALPN). Change-Id: I134e2d4ac22287bc0a5aeadb1e38cb4059fa108b Reviewed-on: https://code.wireshark.org/review/13179 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-12Refactor "Follow Stream" functionality on all GUI interfaces.Michael Mann1-0/+63
Create a "registration" system for Follow functionality so most of the work can be abstracted into a dissector and GUI can just be responsible for "display". This also removes the global variables in follow.c to open up multithreading possibilities. TCP, UDP and HTTP all have the same "tap interface" for Follow functionality (passing a tvb with byte data to "follow"). SSL still has it's own behavior, so Follow structures have to take that into account. TShark through the Follow registration now has support for HTTP. The only thing possibly missing is dynamic menu generation to further reduce explicit knowledge of Follow "type" (and rely on registration) Bug: 11988 Change-Id: I559d9ee1312406ad0986d4dce9fa67ea2103b339 Reviewed-on: https://code.wireshark.org/review/13161 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-08Fix a lot of typos and misspellingsmoshekaplan1-2/+2
Change-Id: I8512cfa1d424f82a873a0e0e1d22c7b075fdd7f3 Reviewed-on: https://code.wireshark.org/review/13069 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>
2016-01-03Pass SslPacketInfo structure directly to SSL tap instead of having listeners ↵Michael Mann1-2/+2
get it themselves anyway. Change-Id: I3817d12e473b67e26159e1562a08169e91f51d46 Reviewed-on: https://code.wireshark.org/review/13019 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-12-17ssl: Fix heartbeat message length.Stig Bjørlykke1-1/+1
The length of the "Heartbeat Message" element is equal to the record length. Change-Id: I10010442db1615b61bad5f525aad4d49a4c8de29 Reviewed-on: https://code.wireshark.org/review/12678 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-12-11ssl: fix SSLv2 Client Hello dissectionPeter Wu1-85/+82
Regression introduced with v1.99.4rc0-112-gf0855e0 ("Remove proto_tree_add_text from packet-ssl.c"). While SSL decryption is not needed on the second pass, the items still have to be added. Bug: 11851 Change-Id: Iccb43f2ccff19bbe6d998fb08600b226ac054825 Reviewed-on: https://code.wireshark.org/review/12510 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-09new_register_dissector -> register_dissector for dissector directory.Michael Mann1-1/+1
Change-Id: Ie39ef054a4a942687bd079f3a4d8c2cc55d5f22c Reviewed-on: https://code.wireshark.org/review/12485 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-16ssl,dtls: use ProtocolVersion from Server HelloPeter Wu1-35/+3
A DTLS capture from Jitsi Videobridge for Windows x64 (v519) using a (patched?) BouncyCastle 1.51.0 exposed the odd behavior where the ProtocolVersion from the record layer was always fixed to DTLSv1.2 while the server agrees to use DTLSv1.0. This resulted in a Malformed packet dissection of the ServerKeyExchange message which mistakenly expects a SignatureAndHash field. Fix this by using the protocol version from the ServerHello. Keep the fallback in case a capture starts in the middle of a SSL conversation. (Also display "DTLS" instead of "SSL" when the version is not yet determined for DTLS packets.) Bug: 11709 Change-Id: I0719977e3b2208da1960121b01dc109fa76bfcb6 Reviewed-on: https://code.wireshark.org/review/11821 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-11-16ssl,dtls: use a single field to track ProtocolVersionPeter Wu1-108/+36
The SslSession struct contains a "version" field for displaying purposes in the protocol column while the SslDecryptSession struct has a "version_netorder" field for use in TLS hash functions (for secrets calculations). As these are strongly associated with each other, remove the version_netorder field and its associated constants, let the SslSession version field store this value instead. All SSL_VER_* are renamed to appropriate *_VERSION macros (via search & replace), SSL_VER_UNKNOWN is kept though. The PCT and SSLv2 protocols had no wire value (*_VERSION), so SSL_VER_PCT and SSL_VER_SSLv2 are assigned with some arbitrary values. Warning: external plugins using the ssl_set_master_secret function must now pass the wire version (TLSV1_VERSION) instead of the (now removed) internal macros (SSL_VER_TLSv1). Change-Id: Icd8ef15adae9c62eb21eab1c3b812166e451936f Reviewed-on: https://code.wireshark.org/review/11820 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-11-07Create real dissector tables for SSL and DTLS to use.Michael Mann1-66/+55
Since ssl_dissector_[add|delete] only take TCP dissectors, remove the parameter and just use it within the "internal" ssl_association_add call. Change-Id: I0fdf941389934c20cbacf910250e17520614e706 Reviewed-on: https://code.wireshark.org/review/11591 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-07ssl: add expert info for session resumptionPeter Wu1-39/+5
Add expert info to the Change Cipher Spec tree when session resumption is detected. This can be used as hint that decryption using a RSA key file will not succeed because of missing key material. The name of this expert info is "ssl.resumed" or "dtls.resumed" and the expert info message is "This session reuses previously negotiated keys (Session resumption)". Change-Id: I4a83edb13417631c97d6cfc4a57e2086bd217878 Reviewed-on: https://code.wireshark.org/review/11583 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-04Don't include "file.h" if you don't need it.Guy Harris1-0/+1
It ends up dragging in libwireshark headers, which programs not linking with libwireshark shouldn't do. In particular, including <epan/address.h> causes some functions that refer to libwireshark functions to be defined if the compiler doesn't handle "static inline" the way GCC does, and you end up requiring libwireshark even though you shouldn't require it. Move plurality() to wsutil/str_util.h, so that non-libwireshark code can get it without include epan/packet.h. Fix includes as necessary. Change-Id: Ie4819719da4c2b349f61445112aa419e99b977d3 Reviewed-on: https://code.wireshark.org/review/11545 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-10-29ssl-utils: add versions to ssl debug logPeter Wu1-1/+0
Add Wireshark/GnuTLS/Libgcrypt versions to the debug log file. Remove ssl_lib_init since it didn't do anything useful (the debug file was not open yet so it would write... nothing). Match more (EC)DH(E) cipher suites and try to improve the message. Add the human-readable name besides numeric cipher suite IDs. Change-Id: I84a33d270f91e90efc55371475b231b483fd24c9 Reviewed-on: https://code.wireshark.org/review/11403 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-27[ssl] dissect handshake messages even if we have no treeMartin Kaiser1-25/+18
this is to make sure that all expert info we see in the main window will also appear in the expert info window the sample capture from bug 11561 shows this problem: without this patch, the expert info with severity 'error' don't show up in the expert info window Change-Id: Ia71ae7e248f57bf1344cf722ac57e74c517828d5 Reviewed-on: https://code.wireshark.org/review/11246 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-26Clean up more unnecessary use of the 'volatile' key word.Jeff Morriss1-2/+2
Change-Id: I3e72fddc6ed380780d7e2e1c8df87e580138188d Reviewed-on: https://code.wireshark.org/review/11271 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-16ssl-utils: allow gcrypt without GnuTLS, improve structurePeter Wu1-6/+5
Fix distinction between HAVE_LIBGNUTLS and HAVE_LIBGCRYPT. If GnuTLS is unavailable, then the only missing feature is decryption using an RSA private key file. Regardless of GnuTLS, allow SSL decryption (e.g. using a SSL key log file or a PSK configured via preferences). This change has no functional effect when GnuTLS and gcrypt are both available (or not). Additionally, decryption is possible if only libgcrypt is available. Further changes to make ssl-utils more maintainable and documented: - Group related functions, add markers and documentation. The following functions are moved (with no further modifications): - ssl_data_realloc, ssl_data_copy: related to StringInfo. - ssl_change_cipher, ssl_create_flow: related to the decryption of a session. - ssl_decompress_record: related to Record Decompression. - ssl_lib_init: moved to an arbitrary place. - ssl_set_server: moved closer to ssl_packet_from_server. - ssl_is_valid_content_type, ssl_is_valid_handshake_type: move closer to dissection code. - ssl_dissect_hnd_hello_ext_status_request, ssl_dissect_hnd_hello_ext_status_request_v2, ssl_dissect_hnd_hello_ext_elliptic_curves, ssl_dissect_hnd_hello_ext_ec_point_formats: move to TLS extensions. - Remove unused forward declaration of _gcry_rsa_decrypt. - ssl-packet-utils.h: - Remove ssl_equal, ssl_hash. These are only used in packet-ssl-utils.c. - ssl_private_key_equal, ssl_private_key_hash, ssl_common_register_options: inline when decryption is not possible. - Remove ws_symbol_export.h, enable SSL debug log when libgcrypt is compiled in (instead of depending on GnuTLS). - Move/merge stub code when GnuTLS or libgcrypt are not available: - ssl_find_cipher: move. - ssl_cipher_setiv: move. - ssl_generate_pre_master_secret, ssl_generate_keyring_material: move. Compile-tested all combinations: - no GnuTLS, no libgcrypt: CentOS 6. - no GnuTLS, has libgcrypt: CentOS 6. Passes all decryption tests except for the ones that need a RSA private key file. - has GnuTLS, no libgcrypt: Arch Linux. - has GnuTLS, has libgcrypt: Arch Linux. The decryption tests pass. (GnuTLS support is useless without gcrypt, but included for completeness.) Change-Id: I727248937331f8788de8ed78248bb33296206096 Reviewed-on: https://code.wireshark.org/review/11052 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-10-15ssl: detect very small heartbeat sizePeter Wu1-34/+40
Heartbeat requests with large payload sizes would not be detected because the record length is smaller than the type, length and MAC, resulting in an integer overflow. This patch corrects that issue by moving the term to payload_length which is at most 0xffff. While a record length smaller than 19 should be considered as unencrypted, this was not obvious from the integer overflow in `payload_length <= record_length - 16 - 3`. Explicitly check for that condition although it makes no difference in the end. When the payload + padding does not fit in the record, assume malicious intent (Heartbleed) and do not display a padding. Instead display an export info item. Remove if(tree) due to the addition of expert info. Tested with small-hb.pcap from the linked bugreport. Bug: 9983 Change-Id: I26b164632ecd6bdb49e78bbcb9b163f635c94628 Reviewed-on: https://code.wireshark.org/review/1105 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-10-14[ssl handshake] remove unnecessary if (tree) checksMartin Kaiser1-37/+28
Change-Id: I0c4530fb739d6d1672a624d2b8c1accea99f6fdc Reviewed-on: https://code.wireshark.org/review/10985 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-10-07ssl-utils: load RSA keys based on their modulus+exponentPeter Wu1-5/+3
Load RSA private keys based on their public key instead of relying on the user to specify a valid address and port mapping. This is more reliable and prepares for simplification of the SSL Keys dialog. After this change, the "address" part of the UAT dialog will be ignored when loading the private key. The port+protocol mapping is still imported, but should probably be removed too. Change-Id: I4d7a2bfcf63d17e66e336ef770759f20510fc176 Reviewed-on: https://code.wireshark.org/review/10766 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>