Commit graph

232 commits

Author SHA1 Message Date
Guy Harris
4f1d20abae proto_tree_add_uint() takes a value, not an encoding, as an argument.
Change-Id: Ie2c0523e32b54cd13506501d98215934a8d1304e
Reviewed-on: https://code.wireshark.org/review/2611
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-24 06:57:32 +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
46ecf18fbd Use address_to_str(NULL, ...) for strings allocated outside dissectors.
ep_address_to_str() doesn't crash if called outside packet scope, but
it's still not correct to use outside packet scope.  Use
address_to_str(NULL, ...) to allocate those strings, and then explicitly
free them when we're done; exceptions don't get thrown between the
allocate and free, so there's no risk of a leak.

Change-Id: Iea2af93b0757e648d399e2ba64249224eb7e9e3c
Reviewed-on: https://code.wireshark.org/review/2438
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-19 18:58:49 +00:00
Michael Mann
b0bc4d5535 Revert "Fixup: ep_address_to_str -> address_to_str"
Most (all?) of these functions are being called within GUI, so they can't have packet_scope, which is why they weren't already converted (I made this mistake once already)

This reverts commit 7fea55a054.

Change-Id: I4bf29b206e5e1f5daefcec131309a8f6e78e1eb1
Reviewed-on: https://code.wireshark.org/review/2428
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-19 18:26:57 +00:00
Guy Harris
54819e5699 ssl_parse_key_list() gets called from the UI, so don't use packet scope.
Instead, explicitly allocate and free the address string.

Using packet scope was causing test failures.

Change-Id: Ie18d2da44d2eec8a92a6a86b0ba883a5525f49cd
Reviewed-on: https://code.wireshark.org/review/2387
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-18 17:03:22 +00:00
Dario Lombardo
7fea55a054 Fixup: ep_address_to_str -> address_to_str
Change-Id: Id49ba07e32a71357b50b32de7cecfd80e412d508
Reviewed-on: https://code.wireshark.org/review/2379
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18 14:22:02 +00:00
Evan Huus
e46c1af0f0 Remove emem from ssl utils, use glib instead.
No exceptions can be thrown when loading a key from a file, so it's safe.

Change-Id: I14ee8569bb516fcb45b72f07f76d28ef4b32065c
Reviewed-on: https://code.wireshark.org/review/2243
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-16 15:20:35 +00:00
Marc Bevand
3bf635b0cc Update TLS extensions
Add better reference to IANA list of all extensions.
Add newer "channel_id" extension (0x7550) as used by current Chrome versions.

Change-Id: Ia5b2515c557fbaf42d320ede918120f83b2e02dd
Reviewed-on: https://code.wireshark.org/review/1924
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-06-02 21:16:35 +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
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
Alexis La Goutte
57e380af36 SSL/TLS: Add Padding Extension (20)
http://tools.ietf.org/html/draft-agl-tls-padding-03

Change-Id: I181718edf5b5f297aaf2e247524dfce069c90cce
Reviewed-on: https://code.wireshark.org/review/1703
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-20 19:15:37 +00:00
AndersBroman
3157bf6ba5 isprint() -> g_ascii_isprint()
Change-Id: Ia586ef8ce500d5fc7578c52014206fa7a7eaea41
Reviewed-on: https://code.wireshark.org/review/1624
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-13 16:14:07 +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
Pascal Quantin
7929d9acf9 SSL: fix compilation without GnuTLS and Gcrypt
Change-Id: Ic783f9ac2b7abcbace67ce48239b0506ac237267
Reviewed-on: https://code.wireshark.org/review/1381
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-04-27 10:36:36 +00:00
Peter Wu
720f504dd6 ssl: support any address/port combi for priv key
Both "any port" and "any address" are supported separatedly, but not the
combination of both. This also has the effect that the combination of
any address with the special keyword "start_tls" did not work.

Fix this by checking for a private key with the combination of any
address and port.

Change-Id: Icb49d6728f032a05007dcb7ac73ec0528778441a
Reviewed-on: https://code.wireshark.org/review/1368
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-26 15:36:17 +00:00
Peter Wu
4250dfd3f5 ssl: return early if no private keys are found
There is no need to check for private keys if there are none. In
addition, print the number of keys for debugging purposes.

Change-Id: Idc9d650e0bf087c0f647dba4e5bd4920b4f6e228
Reviewed-on: https://code.wireshark.org/review/1367
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-26 15:35:43 +00:00
Peter Wu
7805e5a495 ssl: Reduce chance of hash-collisions SSL private keys
The wildcard address contains all zeroes, resulting in the same hash
for 0.0.0.0 and ::. Not really problematic, but it does not sound
great either.

Change-Id: I099128973a1bd8bb5c88d0abcab3ea4ecc3a96c9
Reviewed-on: https://code.wireshark.org/review/1366
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-26 15:34:46 +00:00
Peter Wu
c7cbdb4f22 Change ssl_find_private_key to void
No caller checks its return value (which is always 0).

Change-Id: I18461ee6e5d369722c8c2b2ea1e409423aa5d631
Reviewed-on: https://code.wireshark.org/review/1365
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-26 15:34:38 +00:00
Peter Wu
83fe3572c5 Fix reading keyfile for "any" IP address
The same file pointer is used for both IPv4 and IPv6.

Change-Id: I448ee10426882dcd5bcddf6b005ca1d07fe9572c
Reviewed-on: https://code.wireshark.org/review/1345
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-04-25 16:37:45 +00:00
Peter Wu
7435881cea Revert back to emem due to UAT use
Partially reverts "Convert SSL and TCP dissectors to wmem (with the
exception of UAT)." (960a461c8a).

ssl_load_pkcs12 is called in UAT context via
ssldecrypt_uat_fld_password_chk_cb and ssl_parse_key_list (dtls/ssl).

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10038

Change-Id: I22220fd128b17e273c5ed572a83edbfb8261bda9
Reviewed-on: https://code.wireshark.org/review/1344
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-04-25 15:30:06 +00:00
Stig Bjørlykke
b642a280cb Fix compilation if HAVE_LIBGNUTLS but not HAVE_LIBGCRYPT.
Also fixed a comment for a #endif for the same defines.

Change-Id: Icbbf619dbaeb1d4d154a5f1a8273f252d35c6981
Reviewed-on: https://code.wireshark.org/review/1070
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-04-11 14:07:39 +00:00
Pascal Quantin
828bb24226 Partly revert fdeed480bf
wmem_packet_scope() cannot be used outside of a packet treatment

Change-Id: I6e545bbb51f325b366288f17358f9d2347a7d7c4
Reviewed-on: https://code.wireshark.org/review/977
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-04-06 10:18:15 +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
Hauke Mehrtens
6ee4dde7d8 ssl-utils: add signed_certificate_timestamp tls hello extension
This extension is defined in RFC 6962.

Change-Id: I3aa7321c60baef59ccb59ded6b91f3e42c854bfa
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-on: https://code.wireshark.org/review/970
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-05 23:50:13 +00:00
Hauke Mehrtens
b903789b46 ssl-utils: add constants defined for draft-ietf-tls-oob-pubkey-11
This adds two tls hello extensions from
http://tools.ietf.org/html/draft-ietf-tls-oob-pubkey-11 which got
numbers assigned by the IANA in
https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml
In addition it also adds a new certificate type defined in the same
documents.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Change-Id: I3c52d9602f2f255a5700cc6a9954385ad0d7cae8
Reviewed-on: https://code.wireshark.org/review/969
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-05 23:40:24 +00:00
Hauke Mehrtens
bf190f26a4 ssl-utils: add named brainpool ecc curves
This adds detection for the named brainpool ecc curves defined in RFC7027.

Change-Id: I125ddbf74068888f4989781d274dbc74feb8b20c
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-on: https://code.wireshark.org/review/968
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-05 23:29:36 +00:00
Hauke Mehrtens
0af279a6f6 ssl-utils: add detection of Supplemental Data
This adds basic detection of Supplemental Data as defined in RFC4680.

Change-Id: I8dac99bf243a6bd176585d1fe70f82abcae70c7f
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-on: https://code.wireshark.org/review/967
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-05 23:19:50 +00:00
Hauke Mehrtens
d6fa45848c ssl-utils: add support for tls cipher suites from draft-mcgrew-tls-aes-ccm-ecc-08
This adds the new cipher suites from
http://tools.ietf.org/html/draft-mcgrew-tls-aes-ccm-ecc-08
They are defined by IANA in
https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-4

Change-Id: I1a1576567782abb93ae5b09efd4199cb1040d5d2
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-on: https://code.wireshark.org/review/966
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-05 22:31:23 +00:00
Alexis La Goutte
0973a321a9 Fix Argument with 'nonnull' attribute passed null found by Clang
Change-Id: Ie59c379a4f00c807ebc50c95eea2017f8cac0c69
Reviewed-on: https://code.wireshark.org/review/796
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-31 08:29:18 +00:00
Martin Kaiser
5af5f1699c fix the SSL decryption using the master secret
this was broken in 21aa7168c7

to be on the safe side, we assue that return value >= 0 means success,
< 0 means failure

Change-Id: I1d03000e6b6d70fac6bef8766d28990d953c8e27
Reviewed-on: https://code.wireshark.org/review/609
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2014-03-11 20:51:16 +00:00
Martin Kaiser
21aa7168c7 SSL/TLS payload decryption:
don't make private key and keylog file mutually exclusive

if we find a private key that does not match or is not usable for
getting the pre-master secret (e.g. because we're using an ephemeral
cipher suite), don't give up and exit with an error

continue reading the keylog file and search for our master secret there

Change-Id: I59fb460339e3e606a077b3a902fa1f9777b5e118
Reviewed-on: https://code.wireshark.org/review/590
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2014-03-10 19:14:43 +00:00
Hauke Mehrtens
5f165781f1 ssl: add more ciphers for decryption
This patch adds some more ciphers to the list of ciphers that can be
decrypted by wireshark. Most of them are PSK based ciphers. To do the a
actually decryption in most cases the TLS pre master secret or the
master secret is needed.

In the changed lines just a comment with the name of the cipher was
added.

This was generated with the help of Peter Wu's generate-wireshark-cs
script from https://git.lekensteyn.nl/peter/wireshark-notes.git .

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

Change-Id: I347dc5a530380a04cc00418640f00bbda0db8de8
Reviewed-on: https://code.wireshark.org/review/558
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-08 13:36:58 +00:00
Martin Kaiser
aac1e0a06a add the (not yet official) TLS channel_id extension that's used by Chrome
Change-Id: Ib8779b0db790a78fff8bd1970a7240bbd8f49f75
Reviewed-on: https://code.wireshark.org/review/537
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-03-06 22:02:51 +00:00
Alexis La Goutte
296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Pascal Quantin
5fc9db83cf SSL: dynamically allocate session ticket storage area to avoid buffer overflow
Fixes bug 9825

Change-Id: I20ae65331ec11b2f6774054df4c026fd5fa76d3a
Reviewed-on: https://code.wireshark.org/review/447
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-03-03 15:36:21 +00:00
Alexis La Goutte
45c5c6c7ac Update list SSL Cipher suite : The Salsa20 Stream Cipher for Transport Layer Security
http://tools.ietf.org/html/draft-josefsson-salsa20-tls

Change-Id: I9a31dc0306f71cd57d9c6593ea1f0619398c65c0
Reviewed-on: https://code.wireshark.org/review/212
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-14 13:55:59 +00:00
Alexis La Goutte
225c524f1d Update list SSL Cipher suite : ChaCha20Poly1305 for TLS
http://tools.ietf.org/html/draft-agl-tls-chacha20poly1305

Used by Google Chrome and Google Web Server

Change-Id: I615a821962b5d25190a11c30e2b7717f1d285289
Reviewed-on: https://code.wireshark.org/review/211
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-14 13:55:48 +00:00
Alexis La Goutte
9f96c730d8 Fix indent (Remove tabs and use 4 spaces)
Change-Id: Ide85336be3dca4059619bb91707bfc49e25af63d
Reviewed-on: https://code.wireshark.org/review/108
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-04 13:05:07 +00:00
Anders Broman
f0fb43a621 From alexeyv:
Add decryption for resumed TLS sessions with a session ticket.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5963

svn path=/trunk/; revision=54860
2014-01-20 20:26:04 +00:00
Guy Harris
4a7636a6f8 Don't cast away constness.
svn path=/trunk/; revision=54768
2014-01-14 05:47:50 +00:00
Jakub Zawadzki
d28084d183 Move UAT xton() to wsutil library
Use ws_xton() in few more places.

svn path=/trunk/; revision=54642
2014-01-08 00:28:13 +00:00
Alexis La Goutte
68e7ccc5dc From Dirk via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9589
Enhance SSL dissector : fix ssl_private_decrypt()

rename and remove some variables

svn path=/trunk/; revision=54446
2013-12-24 15:16:02 +00:00
Alexis La Goutte
46d0f09bf5 From Dirk via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9589
Enhance SSL dissector : fix ssl_private_decrypt()

free all gcrypt resources

svn path=/trunk/; revision=54445
2013-12-24 15:15:52 +00:00
Alexis La Goutte
ee6d040ebf From Dirk via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9589
Enhance SSL dissector : fix ssl_private_decrypt()

free all gcrypt resources

svn path=/trunk/; revision=54444
2013-12-24 15:15:43 +00:00
Alexis La Goutte
ad5d1b9105 From Dirk via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9589
Enhance SSL dissector : fix ssl_private_decrypt()

initialize all variables

svn path=/trunk/; revision=54443
2013-12-24 15:15:29 +00:00
Alexis La Goutte
7c5dc6d566 From Dirk via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9589
Enhance SSL dissector : fix ssl_private_decrypt()

remove unused functions and a #define

svn path=/trunk/; revision=54442
2013-12-24 15:15:17 +00:00
Evan Huus
0ea5c80e1a Replace an ep-stack with a wmem stack. Running epan_init() no longer uses
any ephemeral memory.

svn path=/trunk/; revision=54434
2013-12-24 01:38:26 +00:00
Alexis La Goutte
7b75159f1e From Hauke Mehrtens via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9498
ssl: move TLS ext dissect code to packet-ssl-utils.c

This moves the code used to parse the TLS extension into packet-
ssl-utils.c and adds an architecture that this code could be used by
dtls in the next patch. This patch should not change anything in the
functionality.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

svn path=/trunk/; revision=54418
2013-12-23 20:42:28 +00:00
Evan Huus
9fba5a787e g_memmove has been removed in favour of normal memmove in the latest glib
versions, so do the same. Plain old memmove appears to be specified in C90, so
I'm not sure why they ever needed a compat function in the first place...

svn path=/trunk/; revision=54295
2013-12-20 14:35:34 +00:00