Commit Graph

221 Commits

Author SHA1 Message Date
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
Evan Huus a6415ece0a Rename a couple of to_str functions to have ep_ in the name. This makes it
obvious that the returned string is ephemeral, and opens up the original names
in the API for versions that take a wmem pool (and thus can work in any scope).

svn path=/trunk/; revision=54249
2013-12-19 15:49:09 +00:00
Alexis La Goutte 5c7c8e3886 From Peter Wu via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9546
PSK stream does not get decrypted with other TLS streams

Fix PSK decryption with keylog file

Session IDs may be empty (length zero). Currently, these sessions are
still stored in the session cache which is quite useless as is is very
likely that multiple TLS streams have no Session ID in their Hello
messages. This causes the wrong premaster secret to be restored when the
ClientHello is dissected (via dissect_ssl3_hnd_hello_common).

In the PSK case, this will prevent the SSL keylog file from being
consulted. When processing the ClientKeyExchange, the
ssl_generate_pre_master_secret function is called to set the pre-master
key... but this does not happen when ssl.psk is not available. In this
case, the PMK that was restored in ClientHello is used. This results in
faulty dissection.

RSA does not have this problem because it always tries to use the
private server key (and falls back to the keylog file).

This fix prevents empty session IDs from being stored with a PMK,
making the dissector use the keylog file for PSK.

svn path=/trunk/; revision=54122
2013-12-15 16:16:54 +00:00
Alexis La Goutte 719cc1ea30 From Hauke Mehrtens via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9499
DLTS: add cipher version for OpenSSL pre 0.9.8f

OpenSSL pre 0.9.8f uses the TLS version 0x0100 and is not completely
compatible with DTLS 1.0 or 1.2. One difference is that the encrypted
pre master from TLS 1.0 does not have an own length, which is needed by
TLS and DTLS 1.0, this makes decrypting impossible. This patch makes it
possible for the code to distinguish between this OpenSSL version and
real DTLS 1.0, because they are not using the same code any more. This
is needed to fix the snakeoil-dtls test.

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

svn path=/trunk/; revision=54043
2013-12-13 14:06:18 +00:00
Alexis La Goutte ec32b614f6 From Peter Wu
ssl-utils: remove SIG, rename mode and formatting

The changes seem huge, but actually involve a few structural changes
that do not change functionality, but aim to make maintenance easier and
lines shorter. The following changes were made:

 1. Remove the "sig" field and `SIG_*` constants as they are not used
    anywhere.
 2. Convert `SSL_CIPHER_MODE_*` macros to an enum, change the type in
    SslCipherSuite, change the field terminator in cipher_suites and
    drop the `SSL_CIPHER_` prefix to make it shorter.
 3. Add whitespace to align the cipher suites and convert the numbers to
    hex to match common usage (e.g. IANA docs). Done with the awk script
    below.

AWK script that takes the lines with `,KEX_` and applies changes (3):

    #!/usr/bin/gawk -f
    BEGIN { FS="[, {]+" }
    {
        split($0, c, "}, *");
        comment="";if(c[2])comment="   "c[2];
        sub("}", "", $10); # comment }
        printf("    {0x%04X,%-12s%-16s%2d,%3d,%3d,%-11s %-22s},%s\n",
               strtonum($2),
               $3 ",", # Key exchange
               # $4 is SIG_ - remove
               $5 ",", # Cipher
               $6, # blocksize
               $7, # keysize
               $8, # export keysize
               $9 ",", # Digest
               $10, # mode
               comment);
    }

Signed-off-by: Peter Wu <lekensteyn@gmail.com>

svn path=/trunk/; revision=54039
2013-12-13 11:30:24 +00:00
Anders Broman 453f98cb72 #if 0 unused function.
svn path=/trunk/; revision=53931
2013-12-11 06:29:17 +00:00
Anders Broman 07c5bb3480 - Forward declaration of register functions.
svn path=/trunk/; revision=53930
2013-12-11 06:10:45 +00:00
Martin Kaiser 8aebe15965 fix compilation without GNUTLS and libgcrypt
move from_hex_char() and from_hex() outside ifdef gnutls
add dummy ssl_generate_pre_master_secret()

this should fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9529

svn path=/trunk/; revision=53884
2013-12-09 17:51:48 +00:00
Michael Mann 6c5a93d7d1 Fix invalid read and correct PSK upper bound. Bug 9512 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9512)
From Peter Wu.

svn path=/trunk/; revision=53843
2013-12-08 02:12:48 +00:00
Michael Mann 21ca76a3ad dtls: fix buffer overflow in mac check. Bug 9512 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9512)
From Hauke Mehrtens

svn path=/trunk/; revision=53842
2013-12-08 01:52:02 +00:00
Michael Mann 0f05597ab1 DTLS decryption enhancements. Bug 9499 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9499)
From Hauke Mehrtens

1. dtls: set ssl_set_server() in DTLS dissector so wireshark knows if this is client or server
2. SSL: add decrypt support for CCM and CCM_8 Ciphers per rfc 6655
3. dtls: add psk decrypt support

svn path=/trunk/; revision=53836
2013-12-08 00:58:06 +00:00
Michael Mann 9b7fb8a811 Create the ability to have packet scoped "proto" data. Bug 9470 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9470)
I'm not sold on the name or module the proto_data functions live in, but I believe the function arguments are solid and gives us the most flexibility for the future.  And search/replace of a function name is easy enough to do.

The big driving force for getting this in sooner rather than later is the saved memory on ethernet packets (and IP packets soon), that used to have file_scope() proto data when all it needed was packet_scope() data (technically packet_info->pool scoped), strictly for Decode As.

All dissectors that use p_add_proto_data() only for Decode As functionality have been converted to using packet_scope().  All other dissectors were converted to using file_scope() which was the original scope for "proto" data.

svn path=/trunk/; revision=53520
2013-11-23 02:20:13 +00:00