aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dtls.c
AgeCommit message (Collapse)AuthorFilesLines
2019-07-26HTTPS (almost) everywhere.Guy Harris1-1/+1
Change all wireshark.org URLs to use https. Fix some broken links while we're at it. Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c Reviewed-on: https://code.wireshark.org/review/34089 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-06-11decode_as: remove the "title" member from decode_as_tMartin Kaiser1-1/+1
The title of a decode_as_t was used by the GTK UI. It's no longer required for Qt. Change-Id: Ibd9d4acbe9cad2c1af520340d04e550326a97ebe Reviewed-on: https://code.wireshark.org/review/33557 Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-05-15TLS: fix DISSECTOR_ASSERT for zero-length records fragmentsPeter Wu1-1/+1
When decrypt_ssl3_record is called with a record length of zero, it will pass NULL to ssl_data_set because tvb_get_ptr(..., 0) yields NULL. That triggers a DISSECTOR_ASSERT. Fix this and add expert info while at it. Bug: 15780 Change-Id: I727b511aa48b6e1aeb20a441d1eb9d3627a74413 Reviewed-on: https://code.wireshark.org/review/33203 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-01-17DTLS: add DSB support, use the key log file from the TLS dissectorPeter Wu1-14/+8
The DTLS and TLS dissectors already share code for parsing the key log file contents but the actual key material was stored separately. As implementations (like GnuTLS) write the TLS and DTLS secrets to the same file (specified by the SSLKEYLOGFILE environment variable), it seems reasonable to combine them. This also enables use of the pcapng Decryption Secrets Block for decryption of DTLS traces. The dtls.keylog_file preference has become obsolete and can no longer be used (this was not tested anyway). A new test was added based on dtls12-aes128ccm8.pcap, the master secret was extracted using the tls.debug_file preference. Bug: 15252 Change-Id: Idfd52c251da966fe111dea37bc3fb143d968f744 Reviewed-on: https://code.wireshark.org/review/31577 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-12-27Try to squeeze some bytes out of the frame_data structure.Guy Harris1-1/+1
Make the time stamp precision a 4-bit bitfield, so, when combined with the other bitfields, we have 32 bits. That means we put the flags at the same structure level as the time stamp precision, so they can be combined; that gets rid of an extra "flags." for references to the flags. Put the two pointers next to each other, and after a multiple of 8 bytes worth of other fields, so that there's no padding before or between them. It's still not down to 64 bytes, which is the next lower power of 2, so there's more work to do. Change-Id: I6f3e9d9f6f48137bbee8f100c152d2c42adb8fbe Reviewed-on: https://code.wireshark.org/review/31213 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-01TLS: really delay key lookup until it is necessaryPeter Wu1-2/+2
Even if the certificate has a RSA public key, be sure to lookup the key only if it is an actual RSA key exchange. Move the hashtable to the secrets module to enable reuse. Change-Id: I39010831079d3b65d5d4368ec97d02491c1615a5 Reviewed-on: https://code.wireshark.org/review/30854 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-29(D)TLS: defer RSA private key lookup until it is really neededPeter Wu1-16/+26
RSA private keys can only be used for decrypting TLS sessions with a full handshake that use the RSA key exchange. However currently the RSA private key is always looked up even if it cannot be used (for example, due to an (EC)DHE cipher or due to a resumed session). Defer lookup of these private keys and make some more code conditional on the availability of GnuTLS at compile time since future changes switch to GnuTLS for RSA decryption. Change-Id: I31dfd6cdfbd733818c798b1fb0e895cf5a987c5a Reviewed-on: https://code.wireshark.org/review/30831 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-30TLS: Add compress_certificate Handshaketype (25)Alexis La Goutte1-0/+1
See https://tools.ietf.org/html/draft-ietf-tls-certificate-compression-03 the value is TEMPORARY registered to IANA (registered 2018-05-23, expires 2019-05-23 Change-Id: I5a91ad4f1366cd7f0fa077677f227a66591494b6 Reviewed-on: https://code.wireshark.org/review/29796 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-25Rename packet-ssl* to packet-tls*Gerald Combs1-4/+4
Rename packet-ssl{,-utils}.[ch] to packet-tls{,-utils}.[ch]. Change-Id: I4732162ec131ddf0734b3dd191ccc9e48a76ce06 Reviewed-on: https://code.wireshark.org/review/29659 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-15Add support for aliases to dissector tables.Gerald Combs1-1/+1
Add register_dissector_table_alias, similar proto_register_alias. Add aliases for ssl.port, and ssl.handshake.extensions_alpn_str, and dtls.handshake.extensions_alpn_str. Change-Id: I87c3215e2872883ed0f581557e08c84f2dba12a0 Reviewed-on: https://code.wireshark.org/review/29652 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-09-13Start renaming SSL to TLS.Gerald Combs1-1/+1
Rename the "ssl" protocol to "tls" and add an "ssl" alias. Prefer "TLS" over "SSL" in user interface text and in the documentation. Fix the test_tls_master_secret test while we're here. Bug: 14922 Change-Id: Iab6ba2c7c4c0f8f6dd0f6d5d90fac5e9486612f8 Reviewed-on: https://code.wireshark.org/review/29649 Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-08-27DTLS: use col_append_sep_(f)str() functionsPascal Quantin1-31/+12
Change-Id: I0e9b55d79d99c63d8486a0f3d1ee24579e930772 Reviewed-on: https://code.wireshark.org/review/29300 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-22ssl: dtls: Fix small memory leaksVasil Velichkov1-4/+4
Use g_strsplit/g_strfreev instead of wmem_strsplit/wmem_free because in wmem_strutil.h the wmem_strsplit is documented not to be used with a NULL allocator. The wmem_free does not free the string elements in contrast to g_strfreev. Change-Id: Ia207d5df5b8b7edd4ba77071292761ae4819fb12 Reviewed-on: https://code.wireshark.org/review/28796 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-05-27Have a dissector table for SSL/TLS/DTLS ALPN protocol IDs.Guy Harris1-0/+4
Have dissectors register with their protocol ID string in that table, rather than having a table in epan/dissectors/packet-ssl-utils.c that has to be updated for new protocols. Have a table of protocol ID string prefixes, to handle the case of protocols such as SPDY and HTTP2 drafts, where multiple protocol IDs are used for different versions. Change-Id: I363d04895a88e779fbbca7dc8e1f31aa1970a31a Reviewed-on: https://code.wireshark.org/review/27836 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-08dtls: Remove period from Version blurbStig Bjørlykke1-1/+1
Change-Id: I5e50554daf25d2b2e71795c28e393f08d117ad6f Reviewed-on: https://code.wireshark.org/review/27396 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-03-15(D)TLS: restrict ssl.ignore_ssl_mac_failed preference to sslPeter Wu1-1/+1
In preparation for TLS 1.3 early data trial decryption, give the caller of "ssl_decrypt_record" control over skipping integrity check failures. As a side-effect, this will avoid a ssl preference from affecting DTLS. If desired, a DTLS-specific preference can be added at a later point. Change-Id: Ib84a127b4dab524902edeb2d335d069db0304ded Ping-Bug: 12779 Reviewed-on: https://code.wireshark.org/review/26473 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-02-12dissectors: use SPDX identifiers.Dario Lombardo1-13/+1
Change-Id: I92c94448e6641716d03158a5f332c8b53709423a Reviewed-on: https://code.wireshark.org/review/25756 Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-26TLS13: update for draft -22 (Server Hello, HRR, CCS, NST)Peter Wu1-1/+4
Draft -22 moved the server version to an extension and makes HRR look like a SH. SH is now interpreted as TLS 1.2. Detecting TLS 1.3/HRR requires scanning SH extensions before parsing the message, so do that. Changes: - Add draft 22 version identifier. - Recognize special Server Hello magic for HRR. - Dissect SupportedVersions for SH/HRR, rename the field to match spec. - Recognise new Server Hello format (including legacy fields). - Move version detection up to handshake message dissection to allow HRR (disguised as SH) to be detected as such. DTLS does not have HRR and fragmentation makes it harder, so use its version as usual. - Ignore ChangeCipherSpec again for draft 22 (do not add expert info). - Allow NST ticket_nonce to be empty. Change-Id: I9d5f7dba173e1b5c901bf9a6917c65520ee60a2f Ping-Bug: 12779 Reviewed-on: https://code.wireshark.org/review/24340 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-24DTLS: fix decryption with EMS and client authPeter Wu1-16/+22
Similar to the TLS fix in v2.5.0rc0-1805-gd790c524b4, ensure that the correct master secret is calculated when extended_master_secret is enabled with client auth and a decrypted RSA premaster secret. Bug: 14243 Change-Id: I3d8cecef0f0cc3ec73537053489adc2d0d45c947 Reviewed-on: https://code.wireshark.org/review/24564 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-04TLS: enable OCSP status dissection for TLS 1.3 and DTLSPeter Wu1-1/+4
In TLS 1.2, the "certificate_status" extension in the CH would result in a response in the CertificateStatus handshake message. In TLS 1.3, the response appears in a SH extension instead. Refactor the code to use ssl_add_vector and hook it up with SH extensions dissection. Do not stop dissection on a non-empty Responder ID list. Remove misleading "CertificateStatus" tree item, it only covered the "OCSPResponse" vector, now its two children (just OCSP Response Length and the OCSP Response tree) are displayed directly. Enable DTLS support, the spec does not forbid it and there is a user: https://mta.openssl.org/pipermail/openssl-users/2016-August/004306.html Tested with tls-sct.pcap (bug 13372) which now shows one tree item less and tls13-18-cert-sct-ocsp.pcap (bug 12779) which now dissects the OCSP response in the Certificate Extensions. Change-Id: I2ccde84cb1e3bcb1bc47676eadc5cb542248cd92 Ping-Bug: 12779 Reviewed-on: https://code.wireshark.org/review/23819 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-09-10ssl: fix subdissection with multiple TLS records per packetPeter Wu1-8/+12
Decrypted TLS records must be stored in a single SslPacketInfo or else plaintext will go missing (in Follow SSL or when subdissectors need reassembly). As this structure is currently keyed by the layer number (pinfo->curr_layer_num) which is changed by call_dissector, it must be copied and propagated before calling subdissectors. Change-Id: Ic42ba6c0854154272058f9bf9796e06ad7f94bfd Fixes: v2.3.0rc0-3740-ge1f84f985e ("Fix Decode As for protocols that may use tunneling.") Bug: 13885 Reviewed-on: https://code.wireshark.org/review/23190 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>
2017-07-16ssl,dtls: make some fields in RSA keys dialog optionalPeter Wu1-5/+6
The IP address has been unused since 2.0. The port/protocol fields have become unnecessary since 2.4 with the introduction of Decode As. Do not require the user to specify these fields if they just want to set the RSA key file. In a future version, these three fields will be completely removed. Change-Id: Iefc5a8778aa1122b76b707018c00b6ec429dc107 Reviewed-on: https://code.wireshark.org/review/22640 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-06-05Move RSA key loading and decryption functions to wsutilAhmad Fatoum1-1/+2
Loading PEM and PKCS#11 keys was being done in static functions in packet-ssl-utils.c. These were moved to wsutil, with prototypes in a new <wsutil/rsa.h> header. This adds gnutls as optional dependency to wsutil. The RSA decryption helper was also moved and is now provided in <wsutil/wsgcrypt.h>. This allows more dissectors to access this functionality. Change-Id: I6cfbbf5203f2881c82bad721747834ccd76e2033 Reviewed-on: https://code.wireshark.org/review/21941 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>
2017-06-02Fix Decode As for protocols that may use tunneling.Irene Ruengeler1-5/+43
Dissectors that rely on pinfo structure information may have the data overwritten if the data is tunneled. Address it by using proto data that is based on pinfo->curr_layer_num. Bug: 13746 Change-Id: I1c29f26a3c49f368876f0e96908705bc9c099ce1 Reviewed-on: https://code.wireshark.org/review/21559 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-05-29Fix up dissector tables' UI names.Jeff Morriss1-1/+1
This was inspired by using the Decode-As UI to decode Field "SSL TCP Dissector" Value (port) XXX as YYY. "SSL Port" makes more sense as the UI name. Change-Id: Id6398a5dc79e32bddc4f1bfcf0a468ae1364808f Reviewed-on: https://code.wireshark.org/review/19573 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-05-14ssl,dtls: fix message hash for extended_master_secretPeter Wu1-2/+36
The handshake_messages for extended master secret start at Client Hello and end at ClientKeyExchange. Previously all handshake messages in a record would be hashed, possibly covering those after CKE. Now it will hash each handshake message separately. For DTLS, the CH and HVR messages must also be ignored. Additionally, DTLS needs special treatment to merge multiple fragments. Bug: 13704 Change-Id: I0c8f19b4c352c0195848ded319b6991d76542720 Reviewed-on: https://code.wireshark.org/review/21625 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: Alexis La Goutte <alexis.lagoutte@gmail.com>
2017-04-17Qt: Provide both file save and open preferencesAhmad Fatoum1-1/+1
This is a breaking change. prefs_register_filename_preference hasn't been differentiating between files to be saved and ones to be opened. On GTK, a neutral dialog is used, so no problems there. On Qt, a save dialog has been always used, even in dissectors that were reading configuration files without modification. prefs_register_filename_preference now takes an argument to indicate whether UI could be a save dialog with a warning on overwriting a file, or whether it's a general purpose open file dialog. Qt now does this. Previously no warning was shown on overwriting a file, so it may be used for opening files too without irritating the user. This has been changed, as non-destructive reads should now use the open dialog. Dissectors were changed accordingly. Change-Id: I9087fefa5ee7ca58de0775d4fe2c0fdcfa3a3018 Reviewed-on: https://code.wireshark.org/review/21086 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-03-18TLS13: update end_of_early_data to draft -19Peter Wu1-0/+1
It changed from an alert to a handshake message. Change-Id: Ic24776e612a291153290543ba1ec8680d9d74264 Ping-Bug: 12779 Reviewed-on: https://code.wireshark.org/review/20586 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>
2017-03-14DTLS: Cookie formatting fix for HVRRobert Cragie1-21/+17
Cookie format for HelloVerifyRequest inconsistent with that in ClientHello. Changed to be consistent. Change-Id: I79809ebc4bd4a1c5b43b44a21f58ad5b5d5a1bcf Reviewed-on: https://code.wireshark.org/review/20544 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-02-16ssl-utils: refactor DigitallySignedPeter Wu1-2/+2
Refactor DigitallySigned dissection to return the length and make it accept a version integer instead of Session pointer. Hopefully this makes it easier to use the routine for SCT dissection in X.509 certs. While at it, convert it to use ssl_add_vector. Change-Id: I64afecc65ff597fda50d208d8f96ca0b97bfcbde Reviewed-on: https://code.wireshark.org/review/20111 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-02-15TLS13: dissect NewSessionTicket and CertificateRequest extensionsPeter Wu1-3/+3
Process NewSessionTicket and CertificateRequest extensions for TLS 1.3. CertificateExtension in draft -18 is replaced by Extension in the next draft, so anticipate for that and start decoding this extensions vector. Rename ssl_dissect_hnd_hello_ext to reflect extended functionality. (Certificate Extensions SCT is still not dissected though, but at least OCSP (status_request(_v2)) is supported now.) Change-Id: I3cae58dbde600e82598b3c2f8e29e92e38cd1db1 Ping-Bug: 12779 Reviewed-on: https://code.wireshark.org/review/20104 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-02-15ssl,dtls: fix wrong expert info for overly large recordsPeter Wu1-5/+3
The plaintext length is limited to 2^14, but the actual record length (TLSCiphertext) may be larger due to expansion from compression and the cipher (like AEAD auth tags). The wrong check led to false expert infos. Change-Id: I3a56f1b0af05ecc1d97c4f1f0bcf35ff4d0fad42 Fixes: v2.3.0rc0-1584-gff0371e898 ("ssl,dtls: add expert info for overly large record lengths") Reviewed-on: https://code.wireshark.org/review/20099 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-02-13Make Libgcrypt a mandatory dependencyPeter Wu1-7/+3
Removed all guards for HAVE_LIBGCRYPT, change autotools and CMake to error out if it is not available. Update release notes, developer documentation and README with the new status. Clarify relation with GnuTLS in macosx-setup.sh. Install Libgcrypt via brew script. Motivation for this change is that many dissectors depend on Libgcrypt and having it optional increases the maintenance burden (there have been several compile issues in the past due to the optional status). Furthermore, wsutil has crypto code that can be replaced by Libgcrypt. Change-Id: Idf0021b8c4cd5db70b8766f7dcc2a8b3acbf042f Link: https://www.wireshark.org/lists/wireshark-dev/201702/msg00011.html Reviewed-on: https://code.wireshark.org/review/20030 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-02-11TLS13: add Key Update dissectionPeter Wu1-0/+1
Actual decryption support will be added later. Ping-Bug: 12779 Change-Id: I3ff1f243fd0bd1467e84d8a6a5433c1fe71bbebf Reviewed-on: https://code.wireshark.org/review/20012 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-02-11ssl-utils: add length validation for Certificate handshake messagePeter Wu1-1/+1
This also introduces a new macro, "G_MAXUINT24" as symbol for 2^24-1 (this name does not exist in GLib and uncommon in Google). Change-Id: If000f41f6286161e3a7697357fc33ae16c1e11db Reviewed-on: https://code.wireshark.org/review/20003 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-02-11TLS13: fix length of Finished messagePeter Wu1-1/+1
Select the full message instead of just the first 12 bytes (as was the case in previous TLS versions. No check is added since it is too much work for little gain (it would require looking up the hash length for the cipher suite). Change-Id: Iea13d5abe6a7e55b04fabacfa8919a02acd8517d Reviewed-on: https://code.wireshark.org/review/20011 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-02-07TLS13: update NewSessionTicket dissectionPeter Wu1-2/+2
The new ticket_age_add field resulted in a dissector exception. With this fixed, the tls13-18-picotls-earlydata.pcap capture can now be fully decrypted. Also add validation for the ticket length (using ssl_add_vector). Change-Id: I167038f682b47b2d1da020a8f241daaf7af22017 Ping-Bug: 12779 Reviewed-on: https://code.wireshark.org/review/19992 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>
2017-02-06(D)TLS: simplify SignatureAndHashAlgorithm dissectionPeter Wu1-1/+1
Merge the length parsing into the SignatureAndHashAlgorithm vector parsing. Remove extra expert info which are replaced by the generic ones. Tested with a mutated pcap where the signature length field is off by one (too large = expert error, too small = expert warning, as expected). Change-Id: I43350352ae00eb42bbe5c2ee81289fb592b88f86 Reviewed-on: https://code.wireshark.org/review/19933 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2017-02-02dtls: Support Decode As for selecting appdata dissectorPeter Wu1-1/+41
Being able to override (set) the application data dissector without hacks (RSA keys dialog) would be nice. Modelled after v2.3.0rc0-481-gafa2605e43 ("Support Decode As for {SSL,TLS}-over-TCP.") Change-Id: Ic4c5ca55e8f20ad599c41c1df58b24f3bced2281 Reviewed-on: https://code.wireshark.org/review/19869 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-02-01dtls: avoid possible NULL derefPeter Wu1-9/+3
"decoder->flow" could result in a NULL pointer dereference if a null cipher was in use (caught by Clang static analyzer). Answering the questions: - DTLS records fragments do not need to be reassembled, thus there is no flow. The Handshake messages have their own fragment_offset field and thus there is no need to maintain an extra flow. - Actually one datagram can contain multiple records (RFC 6347, 4.1.1), but this is not implemented yet. The key can however not be "0" though, it must match the offsets from ssl_get_record_info. Fixes: v2.3.0rc0-2152-g77404250d5 ("(D)TLS: consolidate and simplify decrypted records handling") Change-Id: Iac367a68a2936559cd5d557f877c5598114cadca Reviewed-on: https://code.wireshark.org/review/19892 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>
2017-01-31TLS13: add Encrypted ExtensionsPeter Wu1-0/+1
See https://tools.ietf.org/html/draft-ietf-tls-tls13-18#section-4.3.1 Change-Id: I35e049d991be4c242ef2b84db3a322c6a13d2f96 Ping-Bug: 12779 Reviewed-on: https://code.wireshark.org/review/19860 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> 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>
2017-01-31ssl-utils: refactor AEAD decryption handlingPeter Wu1-4/+5
The current ssl_decrypt_record is hard to understand due to mixing CBC concepts (MAC, padding) with AEAD. Extract the AEAD functionality and use better variable naming. The "Plaintext" debug print now includes just the plaintext (the auth tag is stripped). A write_iv.data_len check is added just to be sure and more prep work is done for auth tag validation and TLS 1.3 support. Tested against the (D)TLS AEAD tests on Libgcrypt 1.4.5 (CentOS 6), 1.6.5 (Ubuntu 14.04), 1.7.6 (Arch Linux). Compile-tested w/o Libgcrypt. Change-Id: I94dd2fd70e1281d85c954abfe523f7483d9ac68b Reviewed-on: https://code.wireshark.org/review/19852 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-31dtls: fallback to data dissector if nothing took care of itPeter Wu1-5/+6
Also unconditionally show the encrypted appdata record, matching the SSL dissector. Now the bytes are always linked to a field. Change-Id: Ie65cd5fc6620d53da46a94cdb1972863702b452c Reviewed-on: https://code.wireshark.org/review/19868 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-01-29(D)TLS: fix type of record sequence numberPeter Wu1-2/+2
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 Reviewed-on: https://code.wireshark.org/review/19824 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>
2017-01-29Register reassembly tablesMichael Mann1-2/+2
Register all reassembly tables with a central unit, allowing the central unit to have the callback that initializes and destroys the reassembly tables, rather than have dissectors do it individually. Change-Id: Ic92619c06fb5ba6f1c3012f613cae14982e101d4 Reviewed-on: https://code.wireshark.org/review/19834 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-28TLS: fix decryption of renegotiated sessionsPeter Wu1-3/+0
Renegotiated sessions may interleave application data with handshake records. These handshake records should however not be included in the flow associated with the application data. This fixes a regression in the previous patch, now the "1.12 Step: SSL Decryption (renegotiation)" test passes again. Also remove duplicate DTLS data sources for decrypted records. Change-Id: I46d416ffba11a7c25c5a682b3b53f06d10d4ab79 Fixes: v2.3.0rc0-2152-g77404250d5 ("(D)TLS: consolidate and simplify decrypted records handling") Reviewed-on: https://code.wireshark.org/review/19822 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: Alexis La Goutte <alexis.lagoutte@gmail.com>
2017-01-28(D)TLS: consolidate and simplify decrypted records handlingPeter Wu1-74/+44
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-12uat: fix build error without libgcrypt/gnutlsDario Lombardo1-0/+2
Change-Id: I00fea4d2e8c4d7fc8fc54627ced21796d40b854a Reviewed-on: https://code.wireshark.org/review/19616 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>
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-3/+2
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>