Commit Graph

324 Commits

Author SHA1 Message Date
Jeff Morriss 64b5ae0892 automake: separate crypt C and header files.
Only pass the C files files to checkAPIs (to match cmake and to allow
checkAPIs to pass this directory).

Change-Id: I305aeaaf1882061bad166957ae83383a0f35dfb7
Reviewed-on: https://code.wireshark.org/review/18513
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-28 13:43:49 +00:00
Peter Wu 534787e402 cmake: make WERROR_COMMON_FLAGS a normal string
Instead of checking for the boolean "FALSE", just set an empty string.
This avoids the need to check for WERROR_COMMON_FLAGS before using it.

The transformation is the same for all files, remove
"if (WERROR_COMMON_FLAGS)" and "endif()", reindent and add quotes (since
we have a string here and not a list).

Modelines have been added where missing.

Change-Id: I0ab05ae507c51fa77336d49a99a226399cc81b92
Reviewed-on: https://code.wireshark.org/review/17997
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Tested-by: Dario Lombardo <lomato@gmail.com>
2016-09-30 20:08:02 +00:00
João Valverde 640382c743 CMake: Allow setting per target compiler warnings
Setting our compiler warning flags in CMAKE_C_FLAGS does not allow
using different flags per target.

Allow for that possibility by setting the internal WS_WARNINGS_{C,CXX}_FLAGS
and using the COMPILE_OPTIONS property to set them.

This change is just setting mechanism and there should be no difference
in generated warnings.

The check_X_compiler_flag cmake test is changed to test each flag individually.
We need a list, not a space separated string, and the aggregate test is not
significant.

Change-Id: I59fc5cd7e130c7a5e001c598e3df3e13f83a6a25
Reviewed-on: https://code.wireshark.org/review/17150
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-08-23 21:33:09 +00:00
Gerald Combs 0b9f2fca53 Enable airpdcap debugging explicitly.
Enable airpdcap debugging with explicitly with AIRPDCAP_DEBUG instead
of _DEBUG. _DEBUG might be defined automatically by Visual C++ depending
on your build type and the extra output breaks the decryption tests.

Change-Id: If6d918beb4d91233b07a3bc7b6f2f7e1849171f0
Reviewed-on: https://code.wireshark.org/review/16755
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-07-29 00:12:09 +00:00
Michael Mann 9a73978ba5 Move airpdcap's print_debug_line() to airpdcap_debug.h
It saves a little on file pollution and the g_warning call isn't
bothered in the header file.

Change-Id: Ia9bdd96d9d93bbba6811769c4e6e1ed9124c2e5a
Reviewed-on: https://code.wireshark.org/review/16698
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>
2016-07-26 18:06:33 +00:00
João Valverde a16d401b25 Remove Makefile.common files
Now that nmake build system has been removed they are not needed anymore.

Change-Id: I88075f955bb4349185859c1af4be22e53de5850f
Reviewed-on: https://code.wireshark.org/review/16050
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-06-30 11:04:17 +00:00
Pascal Quantin 6baa1b544c Remove Nmake build system
Change-Id: I3bd474f3cda9667dec66426b5729449953df3e61
Reviewed-on: https://code.wireshark.org/review/15777
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
2016-06-15 19:21:57 +00:00
Michael Mann 9b0b20b8d5 Make sure EAPOL body is big enough for a EAPOL_RSN_KEY.
A pointer to a EAPOL_RSN_KEY is set on the packet presuming the
whole EAPOL_RSN_KEY is there.  That's not always the case for
fuzzed/malicious captures.

Bug: 11585
Change-Id: Ib94b8aceef444c7820e43b969596efdb8dbecccd
Reviewed-on: https://code.wireshark.org/review/15540
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>
2016-05-23 08:04:46 +00:00
Michael Mann b6d838eebf Sanity check eapol_len in AirPDcapDecryptWPABroadcastKey
Bug: 12175
Change-Id: Iaf977ba48f8668bf8095800a115ff9a3472dd893
Reviewed-on: https://code.wireshark.org/review/15326
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Peter Wu <peter@lekensteyn.nl>
2016-05-10 15:20:49 +00:00
Graham Bloice 2e23b506c7 Add checkAPI calls to CMake.
This generates a top level target, checkAPI, that is
excluded from the ALL build target, so must be run separately.

On Windows using a Visual Studio generator, call
msbuild /p:Configuration=RelWithDebInfo checkAPI.vcxproj

Change-Id: I44a57c564dcfc75499463b942436f4b920a82478
Reviewed-on: https://code.wireshark.org/review/14873
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2016-05-02 12:01:24 +00:00
João Valverde bfe5e10043 Add CMakeListsCustom.txt.example to distribution
Change-Id: I81cebd467692d4193772ca0814fb82c06658006e
Reviewed-on: https://code.wireshark.org/review/14312
Reviewed-by: João Valverde <j@v6e.pt>
2016-03-03 06:27:42 +00:00
João Valverde 4fca153089 Add missing cmake custom source includes
Change-Id: Ib1c1632a3e9fe1088a9a1da9870a81b1f846cf95
Reviewed-on: https://code.wireshark.org/review/14291
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-03-03 03:45:58 +00:00
João Valverde 6b54fbf3bf CMake: Add more structure to libwireshark build
Smaller epan/CMakeLists.txt is easier to work with and this structure
is well suited to CMake. It should make it easier to manage and configure
each epan module differently if necessary.

Change-Id: Ia649db3b7dcd405aa43dbdba3288699d5e375229
Reviewed-on: https://code.wireshark.org/review/14068
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: João Valverde <j@v6e.pt>
2016-03-01 19:23:39 +00:00
João Valverde f0fb79d534 autotools: Use pkg-config autoconf macros for GLib/GTK
Remove mostly obsolete aclocal macros. Make GTK build flags a strict superset
of GLib flags. Use GTK build variables for GTK GUI and GLib elsewhere. Add
dependency flags explicitly instead of using WS_CPPFLAGS.

Some minor improvements and fixes for missing/unnecessary variables (no impact
on our test builds).

Change-Id: I3e1f067a875f79d6516c1fa7af986f17a7a6b671
Reviewed-on: https://code.wireshark.org/review/14005
Reviewed-by: João Valverde <j@v6e.pt>
2016-02-21 07:51:55 +00:00
Cedric Izoard 6991149557 [airpdcap] Add support to decrypt TDLS traffic
- When scanning for keys, check for TDLS action frames
  (need to have TLDS response or confirm to derive the key)
- When deriving PTK, also check MIC to ensure the key has been correctly
  computed.
- As SA is between two STAs (and not STA and AP), store highest MAC
  address in sa.bssid, and the other one in sa.sta
  => Add new function (AirPDcapGetSaAddress) that will check for TDLS
  case.
- Add test in decryption suite

Bug: 11312
Change-Id: Ieccb6a23a0ffbf3b705dac9b67c856ae2d3eeca9
Reviewed-on: https://code.wireshark.org/review/13664
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-04 04:54:30 +00:00
João Valverde 265a41e14d autotools: Don't use "user variables" to set build flags
GNU coding standards recommend against it and automake is designed
around it.

This allows overriding the global build flags using AM_CFLAGS, etc.,
or per object flags, something that is difficult or impossible currently
because of automake precedence rules.

Change-Id: I3f1ea12e560af5a46b2f04b342b1882bbf123f12
Reviewed-on: https://code.wireshark.org/review/13455
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-01-28 18:13:48 +00:00
Alexander Wetzel 6425ba961d IEEE802.11: fix EAPOL key frame detection
Use eapol key data length to differentiate between #2 and #4.
This should work around ieee802.11 client implementation errors.

Windows is setting the Secure Bit on #2 when rekeying and Bug 11994
has a sample capture with the Nonce set in #4 and are so both
violating the spec.

Bug: 11994
Change-Id: Ia9e9c68d08dae042cfa7fd9517892db211b0a00f
Reviewed-on: https://code.wireshark.org/review/13299
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-01-16 11:38:44 +00:00
Cedric Izoard b4a1985cef [airpcap] Fix parsing of GTK
- When parsing key data for GTK, check both the IE ID (0xdd) and OUI-type (00-0F-AC 1)
as key data may contains more that one IE with ID (0xdd) and GTK KDE is not always the first one

- Determine key type (TKIP/CCMP) based on actual key length and not size of the whole key_data part

- Remove arbitrary limit on size of key_data

Bug: 11973
Change-Id: I8f71fe970c07a092131eada2be3936c12a61cdd5
Reviewed-on: https://code.wireshark.org/review/13182
Reviewed-by: Michael Mann <mmann78@netscape.net>
Tested-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-14 05:24:01 +00:00
Cedric Izoard e48882fd0c [airpcap] Decrypt protected management frames (802.11w)
Enable decryption of Protected Management Frames by:
 - Authorizing decryption for robust management frame (i.e. management
   frame that may be encrypted): deauth, disassoc and action
   (Note: Assume all action frames are robust even if it is not the case)
 - Updating initialization of Additional Authentication Data (AAD)
   (don't filter-out subtype) and construct nonce (set mgmt flag) for
   management frames

Bug: 11995
Change-Id: I7c34a021e4c49111b85d217c9272d24d0e29ecb2
Reviewed-on: https://code.wireshark.org/review/13232
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-13 03:44:26 +00:00
Guy Harris a3e80157c8 g_malloc the decrypted key in AES_unwrap(), but always free it.
It doesn't need to exist after AirPDcapDecryptWPABroadcastKey() returns.

Change-Id: Ifaf08dfb285be3cf54429f7b77d44565962d4450
Reviewed-on: https://code.wireshark.org/review/12808
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-21 20:56:13 +00:00
Guy Harris 6ede7d4ba3 g_mallocate the encrypted key, but free it in all paths out of the function.
It doesn't need to persist after the function returns.

Change-Id: Ic601a6ef6a0aa0f22f9c8b9a1c586cec95093f27
Reviewed-on: https://code.wireshark.org/review/12805
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-21 20:45:06 +00:00
Martin Kaiser 5f2f6a395a [airpdcap rijndael] use packet scoped wmem memory in AES_unwrap()
at the moment, AirPDcapDecryptWPABroadcastKey() does not free the buffer
allocated by AES_unwrap() if there's an error while parsing the returned data

this could be fixed by adding more g_free() calls or by using wmem
memory

Change-Id: I332968da2186fbd17cbb7708082fa701dcab668e
Reviewed-on: https://code.wireshark.org/review/12744
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-21 05:24:56 +00:00
Martin Kaiser 83f2818118 [airpdcap] check the length of the WPA broadcast key we calculated
return an error if our key is shorter than the key type required for the
encryption method we detected

this check prevents an out-of-bounds memory access when the key is copied

Bug: 11826
Change-Id: Ic779b5d87aa97a3b2d2b2c92ce12d0fff4a85adc
Reviewed-on: https://code.wireshark.org/review/12743
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-21 05:10:17 +00:00
Martin Kaiser fa24207d34 [aidpdcap] use packet scoped wmem memory for szEncryptedKey
to make sure that AirPDcapDecryptWPABroadcastKey() does not leak memory
when it returns an error

Change-Id: I01dc8dc0d6cc1e72e9784a262e35e24844e35dbc
Reviewed-on: https://code.wireshark.org/review/12745
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-21 05:07:33 +00:00
Martin Kaiser 49d612df06 [AES_unwrap] initialize the output array with 0s
for cipher_len==56, some bytes of the output array are not written

An alternative approach would be to add a check for cipher_len.
I understand from RFC 3394 that the AES key wrap algorithm works on
multiples of 64bits and has no upper limit, we couldn't easily reject 56
bytes cipher_len.

Bug: 11527
Change-Id: Ie82357bbe5512de391813dd55098df7a16bda9ae
Reviewed-on: https://code.wireshark.org/review/12741
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2015-12-20 15:23:46 +00:00
Stig Bjørlykke 9779ae3817 Removed some remaining svn Id tags
Change-Id: I7ffbf59099132cde55995bde991d1c6a5dd224b0
Reviewed-on: https://code.wireshark.org/review/12330
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-12-01 14:41:25 +00:00
Peter Wu 40b283181c Add boundary check for 802.11 decryption
Fixed stack-based buffer overflow when the frame length exceeds 8KB.

Bug: 11790
Change-Id: I20db8901765a7660e587057e955d4fb5a8645574
Reviewed-on: https://code.wireshark.org/review/12237
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-11-28 09:47:28 +00:00
Alexander Wetzel 9cd66b270c WPA (IEEE802.11) decryption function cleanups
- Updated AirPDcapPacketProcess function description
 - Try to return better error codes
 - Remove broken/useless return of keys from AirPDcapRsna4WHandshake

Change-Id: I1e4e0a76f6d1307e11c0466f17935dd7030561e1
Reviewed-on: https://code.wireshark.org/review/12033
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-11-25 21:00:59 +00:00
Evan Huus c3025544b6 Misc minor issues caught by cppcheck
All trivial (unused variables, duplicate `break`s, etc).

Change-Id: Idbfffae4f6c0b0119a90ae5849de2ed7a1180c9b
Reviewed-on: https://code.wireshark.org/review/11886
Petri-Dish: Evan Huus <eapache@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-11-17 04:18:37 +00:00
Alexis La Goutte 5c1b132fe8 airpdcap_system.(h) fix parameter 'mngHandshake/mngDecrypt' not found in the function declaration [-Wdocumentation]
Change-Id: I0d0c1a3dde14d9817aef28352081dfbfbac6c9fb
Reviewed-on: https://code.wireshark.org/review/11774
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-14 13:31:12 +00:00
Gerald Combs 18b8f48bc1 Fix compilation when _DEBUG is defined.
CMake's Visual C++ generator creates projects that compile with the
Debug configuration by default, which defines _DEBUG. Fix DEBUG_DUMP's
declaration so that we compile in that case.

While we're here note that the "airpd" prefix isn't limited to AirPcap,
so we might want to change it accordingly.

Change-Id: I5476f28c63020f0f66ee9128731bc4b3dc720765
Reviewed-on: https://code.wireshark.org/review/11787
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-13 07:46:32 +00:00
Alexander Wetzel cb3dd958af WPA/WPA2 decoding fixes and improvements
- start decoding when we have eapol1+2 packets
  Do not insist on a complete captured handshake, decode what we can.

- more robust way to detect eapol #2 packets
  At least Win 10 is violating the spec on rekey by setting the secure
  bit in #2. Unpatched version shows and handles #2 as #4, breaking
  decoding after rekey.

- fixed eapol rekey key handling
  Inital patch (see https://code.wireshark.org/review/8268)
  is adding redundant keys, since it scans all the time
  and not only once.

- ignore tailing garbage after eapol sections in frame
  See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9065#c8

Included testcase to test decode for incomplete handshakes and eapol2
packets with secure bit set on rekey.

Ping-Bug: 9065
Change-Id: Id775088db9b5aaa80da9efdeed6902d024b5c0cd
Reviewed-on: https://code.wireshark.org/review/11484
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: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-11-09 11:28:14 +00:00
Peter Wu a7ab4af2ab airpdcap: add free_key_string function, fix memleaks
Do not leak the key and SSID. Note that there are still some leaks in
the GTK UI related to get_wireshark_keys(), but I did not track them
down.

Caught by LeakSanitizer.

Change-Id: I639166e6ea457605d6ae0ebd58e56d7594a7b7db
Reviewed-on: https://code.wireshark.org/review/10860
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>
2015-10-09 14:35:41 +00:00
Pascal Quantin 44d17c7844 airpdcap: fix WEP decryption
Using memcpy with overlapping buffers is not safe; use memmove instead

Bug: 11549
Change-Id: I8e15eb0af38d325a5e67e8748008126ac5994588
Reviewed-on: https://code.wireshark.org/review/10652
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-09-25 20:02:24 +00:00
Guy Harris f25b8c6784 Move some stuff into the only code path where it's used.
AirPDCapPacketProcess() really does two different things; some of the
stuff it does in both code paths only needs to be done in one code path.
Make it so.

Change-Id: Idb231d729150781f323e88ed375c983a3afd2577
Reviewed-on: https://code.wireshark.org/review/10439
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-09-08 05:03:56 +00:00
Guy Harris 44a0bafd15 Don't try to decrypt with an AES key shorter than 128 bits.
AES keys must be at least 128 bits; AES_unwrap returns a null pointer if
handed a too-short key, and we then just dereference that null pointer
and crash.  Just give up with a too-short key.

Bug: 11507
Change-Id: Id1cf0a43c608597a11ff9df40f3654e6ff30619d
Reviewed-on: https://code.wireshark.org/review/10422
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-09-08 00:46:41 +00:00
Guy Harris 4f1b8d7433 Add a bounds check.
AirPDcapStoreSa() was assuming that ctx->first_free_index would always
be within the ctx->sa array; nothing guarantees that.  Fail if it's past
the end of the array; that means there *are* no free indices.

Change-Id: I73145ea3f3dda1b3800a41fa3a2b01ac344dcbfc
Reviewed-on: https://code.wireshark.org/review/9634
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-14 18:50:33 +00:00
Pascal Quantin 99d56fb0f8 airpdcap: fix V512 warning reported by PVS-Studio
A call of the 'memcpy' function will lead to the '& tmp_key' buffer becoming out of range.

Change-Id: I615a6c3e0dab8cfc2d240b6b39cff387e0689f35
Reviewed-on: https://code.wireshark.org/review/8796
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-06-07 13:07:33 +00:00
Pascal Quantin 1ec868eddd Fix a few issues reported by PVS-Studio
See http://www.viva64.com/en/b/0328/ for details

Change-Id: Ic9ddfd690b49401c96cb8a4a277c671f9824be31
Reviewed-on: https://code.wireshark.org/review/8775
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-06-05 21:15:37 +00:00
Pascal Quantin 040641dc59 Copy PTK key in its dedicated array, and not at the address of the array
While we are at it, put back some debug logs that were removed in g1439eb6 (otherwise msgbuf is no more initialized)

Change-Id: Ie34c4f2e638bc3ee77a0565446de37a15385dc0d
Reviewed-on: https://code.wireshark.org/review/8389
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-05-10 19:48:52 +00:00
Guy Harris 19aaa18b2c Don't initialize a variable that's unused before we later set it.
Change-Id: I944cac044a8b091cbe5d85cd63a8c698a82b8559
Reviewed-on: https://code.wireshark.org/review/8388
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-10 18:03:57 +00:00
Guy Harris 7d4e0c73a3 Pick array sizes based on what they're supposed to hold.
In AirPDcapRsnaPwd2PskStep(), digest[] holds an SSID plus 4 bytes of
count, so the size is MAX_SSID_LENGTH plus 4, and digest1[] holds an
SHA-1 digest, so the size is SHA1_DIGEST_LEN.

That makes it a bit clearer why those are the sizes.

Change-Id: I58ed6643f57675375f7f369470d600382323315f
Reviewed-on: https://code.wireshark.org/review/8387
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-10 18:01:05 +00:00
Guy Harris be8f9c4cf3 Add some bounds checks.
Change-Id: I5b0405f814d439c1d5ce329a817475102be483af
Reviewed-on: https://code.wireshark.org/review/8373
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-10 06:53:53 +00:00
Guy Harris dac8015454 new_key is used only for TKIP keys; set it only in that part of the code.
Change-Id: I64424731e4d5f94c7b69436b5318b67a14471171
Reviewed-on: https://code.wireshark.org/review/8372
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-10 02:31:17 +00:00
Guy Harris 1507b4a417 Allocate the unwrapped key in AES_unwrap().
Have it allocate the buffer for the unwrapped key and return a pointer
to it, rather than having it be handed a buffer for that key.

That makes it a bit easier to validate, in AES_unwrap, that we don't
write past the end of the buffer.

Change-Id: Id02852c23054b3ed33eeeb383e7aa6cf12d02ed9
Reviewed-on: https://code.wireshark.org/review/8371
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-10 02:18:24 +00:00
Guy Harris acf7985f73 Define the SHA-1 digest length in wsutil/sha1.h and use it.
Hopefully that'll make it a little easier to make sure that we're not
overflowing arrays.

Change-Id: I770df045ef9a45fd486c1271ea424b3334bb39d2
Reviewed-on: https://code.wireshark.org/review/8370
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-09 23:36:11 +00:00
Pascal Quantin db3412051f airpdcap: ensure that buffer put on stack is big enough to hold the result of AirPDcapRsnaPwd2PskStep()
g1439eb6 changed AIRPDCAP_WPA_PSK_LEN from 64 bytes to 32 bytes, leading to a stack corruption in AirPDcapRsnaPwd2Psk() function

Change-Id: Ibf51f6749715055cd84906a144214ed44c85256b
Reviewed-on: https://code.wireshark.org/review/8358
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-05-08 19:21:54 +00:00
deagol 1439eb6778 IEEE 802.11: 802.1X (WPA-EAP) rekeying support
This patch extends the existing decryption support for WPA to also
handle rekeys by checking each decrypted packet for a 4-way-handshake.

Rekeys can be used for WPA-PSK, but are more common with WPA-Enterprise
(WPA-EAP).

For decrypting WPA-EAP secured packets the user must provide all used PMK's
of the connection (aka PSK's) as WPA-PSK 32 byte hex values to wireshark
via the existing interface.
(The capture must have all 4-way-handshakes included also, starting with
the first unencrypted one.)

Every decrypted unicast packet will habe the used PMK and TK shown in the
CCMP/TKIP section below the key index in the GUI. Group packets will display the
GTK instead.

Additionally this fixes a small issue with group rekey handling, so every packet
can be selected in the GUI in random order, removing the need to manually find
the correct group keying packets prior to that.

It was tested primary with WPA-CCMP, but TKIP is also working.

One section in the code touch bluetooth 802.1X support. It should do
exactly the same, but will now also examine all decypted packets for rekeys.

Ping-Bug: 11172
Change-Id: I19d055581fce6268df888da63485a48326046748
Reviewed-on: https://code.wireshark.org/review/8268
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-05-08 04:27:49 +00:00
Peter Wu b5d062ba57 Fix buffer overflow in 802.11 decryption
The sha1 function outputs a multiple of 20 bytes while the ptk buffer
has only a size of 64 bytes. Follow the hint in 802.11i-2004, page 164
and use an output buffer of 80 octets.

Noticed when running Wireshark with ASAN, on exit it would try to free a
"next" pointer which was filled with sha1 garbage. It probably got
triggered via 3f8fbb7349 which made
AirPDcap responsible for managing its own memory.

Bug: 10849
Change-Id: I10c1b9c2e224e5571d746c01fc389f86d25994a1
Reviewed-on: https://code.wireshark.org/review/7645
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-03-11 22:47:40 +00:00
Guy Harris 233dc643a6 Remove some apparently-unnecessary includes of emem.h.
Change-Id: Id50ce3e707056cca8f30052f05c451ce431b39b5
Reviewed-on: https://code.wireshark.org/review/6632
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18 19:36:36 +00:00
Michael Mann 3f8fbb7349 Remove the last two true calls to se_alloc.
(The other calls are just wrapped in macros)

Change-Id: I6a029dddf7742ba95510ec24cec30553461e48c6
Reviewed-on: https://code.wireshark.org/review/6558
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-16 00:38:36 +00:00
Michael Mann f5c4d06dba Replace some "low hanging fruit" uses of emem.
Most of the remaining ep_ uses are grouped with specific functionality.

Change-Id: I8fa64a17acc6bcdcf6891b2d28715ac0c58f1a4a
Reviewed-on: https://code.wireshark.org/review/6484
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-11 00:27:57 +00:00
Gerald Combs a81f0d1b38 Fix airpdcap debugging code.
Change-Id: Ied1094dd3c6ad176fea830c0857ba43e09d3cb10
Reviewed-on: https://code.wireshark.org/review/6457
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-01-09 22:17:16 +00:00
Michael Mann 4a5ca5c76e bytes_to_ep_str -> bytes_to_str
Change-Id: Ifcda8328dedec0ef4104c3a124d6246f99493750
Reviewed-on: https://code.wireshark.org/review/6389
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-08 05:43:51 +00:00
Bill Meier 5c529c95c5 Add '*.nativecodeanalysis.xml' to 'clean' targets
Change-Id: I90dbf0b31fc737150a01533763a7869b34c68cb6
Reviewed-on: https://code.wireshark.org/review/6220
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-01-02 01:45:16 +00:00
Dom Gifford f022e15494 Guard against buffer overflow when copying group key bytes into
security association structure.

Change-Id: I2f573a0626bab44aaca1ac6716bf5ac3d6a9b7ed
Reviewed-on: https://code.wireshark.org/review/3553
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-08-11 16:50:36 +00:00
Dom Gifford 8da72cd43d Fix support for decrypting 802.11 broadcast messages.
A little bit of guess work is involved as the group key can use a
different cipher to the pairwise key, and we are trying to do this
purely based on the EAPOL messages with no prior knowledge of the
associate request. We try to guess the cipher based on the lengths.

Bug:8734
Change-Id: I4c456b45939c00a9d1122406891f704fa037349c
Reviewed-on: https://code.wireshark.org/review/3183
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-08-08 14:17:11 +00:00
Stig Bjørlykke bd38b3152d Support out-of-source checkapi
Always call $(top_srcdir)/tools/checkAPIs.pl with -sourcedir=$(srcdir)
from Makefile.am to allow out-of-source 'make checkapi'.

Change-Id: I60d7e0079984a8ededdacf4517a0738486fa7973
Reviewed-on: https://code.wireshark.org/review/1294
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-25 04:23:46 +00:00
Alexis La Goutte 7d77d753c6 Continue to remove $Id$ from top of file
(Using sed :sed -i '/^\/\* \$Id\$ \*\//,+0 d') ( /* $Id */ )

Change-Id: I46e928d7f2a307c35876ed5d34cb6b7cccfcd6e9
Reviewed-on: https://code.wireshark.org/review/886
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-31 18:49:26 +00:00
Alexis La Goutte 757aa33220 Continue to remove $Id$ from top of file
(Using sed : sed -i '/^\# \$Id\$/,+1 d') (start with dash)

Change-Id: Ia4b5a6c2302f6a531f6a86c1ec3a2f8205c8c2dd
Reviewed-on: https://code.wireshark.org/review/881
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-31 18:48:06 +00:00
Alexis La Goutte abc6fb24fa Fix some code remove by 296591399f
(Copyright or info about file...)

Change-Id: I90ba8b1c3ec8406b0c3365a69a8555837fc4bbb1
Reviewed-on: https://code.wireshark.org/review/515
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-03-05 09:25:47 +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
Bill Meier 11b5c15fdb Remove trailing whitespace
Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0
Reviewed-on: https://code.wireshark.org/review/385
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-25 20:46:49 +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
Jakub Zawadzki 5ac6474c94 Rename some of pint.h macros to match common style (bits number on the end).
pntohs  -> pntoh16
   pntohl  -> pntoh32
   pletohs -> pletoh16
   pletohl -> pletoh32
   phtons  -> phton16
   phtonl  -> phton32


svn path=/trunk/; revision=53652
2013-11-29 18:59:06 +00:00
Alexis La Goutte 90c2945adb Fix compilation under Linux (Ubuntu)
airpdcap.c:470:18: error: declaration of 'address' shadows a global declaration [-Werror=shadow]
airpdcap.c:611:18: error: declaration of 'address' shadows a global declaration [-Werror=shadow]

svn path=/trunk/; revision=53216
2013-11-10 10:45:29 +00:00
Jakub Zawadzki 7b64bcf0b8 Move prototype of bytes_to_str, bytes_to_str_punct to correct header.
svn path=/trunk/; revision=53214
2013-11-10 09:44:02 +00:00
Alexis La Goutte 2c3468da11 Fix (-W)documentation error found by Clang
airpdcap.c:131:11: error: parameter 'password' not found in the function declaration [-Werror,-Wdocumentation]
 * @param password [IN] pointer to a password (sequence of between 8 and
          ^~~~~~~~
airpdcap.c:154:11: error: parameter 'password' not found in the function declaration [-Werror,-Wdocumentation]
 * @param password [IN] pointer to a password (sequence of between 8 and
          ^~~~~~~~

svn path=/trunk/; revision=51254
2013-08-10 21:28:01 +00:00
Jeff Morriss 95b4443aeb LIBGCRYPT_CFLAGS is not set in Windows builds, use GNUTLS_CFLAGS instead.
svn path=/trunk/; revision=51108
2013-08-02 00:52:13 +00:00
Jeff Morriss 9d0bcc9d09 Include LIBGCRYPT_CFLAGS in wsutil (but not in epan/crypt).
svn path=/trunk/; revision=51103
2013-08-01 23:56:09 +00:00
Jeff Morriss 2df54da6e2 Move a bunch of the crypt modules and pint.h into wsutil.
This means wsutil now links against libcrypt.

Protect a bunch of the crypt header files from multiple inclusion.

svn path=/trunk/; revision=51100
2013-08-01 23:34:47 +00:00
Evan Huus 5afbf48723 Update some of the old FSF addresses caught by the new licensecheck buildbot
step.

svn path=/trunk/; revision=48848
2013-04-14 18:55:28 +00:00
Michael Mann 3a48e7e1e2 Bugfix Decryption Key Management dialog, bug 8446 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8446)
Needed to convert use of old IEEE802.11 preference strings to UAT.  Since UAT is self-contained within its own file, the entire preference file doesn't need to be rewritten/saved when UAT values are changed.

svn path=/trunk/; revision=48308
2013-03-15 01:31:53 +00:00
Jaap Keuter 827eb58b04 From David Arnold:
Replace use of INCLUDES with AM_CPPFLAGS in all Makefiles to placate recent autotools.

svn path=/trunk/; revision=48261
2013-03-12 06:53:39 +00:00
Anders Broman c5ee81098c From beroset:
remove C++ incompatibilities

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

svn path=/trunk/; revision=48006
2013-03-02 12:10:56 +00:00
Balint Reczey 1ebdb2e521 Export libwireshark symbols using WS_DLL_PUBLIC define
Also remove old WS_VAR_IMPORT define and related Makefile magic
everywhere in the project.

svn path=/trunk/; revision=47992
2013-03-01 23:53:11 +00:00
Bill Meier a6e56df8b6 it's ==> its & its ==> it's as needed.
svn path=/trunk/; revision=47898
2013-02-26 02:38:52 +00:00
Martin Kaiser 38a73a32f3 include the wsutil/wsgcrypt.h instead of including gcrypt.h directly
svn path=/trunk/; revision=47802
2013-02-21 18:23:29 +00:00
Michael Mann b76078d210 Bugfix crash caused by AirPDcap decryption. Bug 8177 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8177)
svn path=/trunk/; revision=47314
2013-01-27 15:28:55 +00:00
Evan Huus 50efee619e Make airpcap's print_debug_line take const arguments so that it compiles
on newer GCC's when _DEBUG is #defined.

Found while investigating
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8177

svn path=/trunk/; revision=47309
2013-01-26 21:21:25 +00:00
Michael Mann 86d690880f replace "unsigned" datatype with "guint". Some mpeg files needed "unsigned int" instead.
bugs 7825-7827 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7825)

svn path=/trunk/; revision=46928
2013-01-04 05:22:43 +00:00
Anders Broman a6b7e3fba5 From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
airpdcap: For FromDS and ToDS both set use magic

All 802.11 data frames on the AMP link shall be sent with ToDS and FromDS
bits in the Frame Control field both set to one. Currently for this packets
we get different associations for the same EAPOL sequence since addr2 and
addr1 change.

svn path=/trunk/; revision=45923
2012-11-05 11:55:39 +00:00
Anders Broman 45953625a5 From Andrei Emeltchenko:
Add 802.11 AMP LLC/SNAP header

Add LLC/SNAP header specified in BLUETOOTH SPECIFICATION Version 4.0 [Vol 5]
802.11 Protocol Adaptation Layer Functional Specification.
The SNAP header composed of the OUI of the Bluetooth SIG and the protocol
identifier given in spec mentioned shall be used to distinguish AMP 4-way handshake
messages from external security traffic. Decode this traffic as 802.1X authentication.

Part of
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7633

svn path=/trunk/; revision=45920
2012-11-05 10:02:07 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Jeff Morriss 4c0b20f3bb (Attempt to) fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7411 :
Use LIBGCRYPT_CFLAGS if we have it.

svn path=/trunk/; revision=44758
2012-09-03 19:53:35 +00:00
Anders Broman 1a8065acdc From Chris Elston:
Split md5_hmac for incremental use 

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

svn path=/trunk/; revision=44710
2012-08-31 09:29:34 +00:00
Anders Broman f32baca6e1 From Chris Elston:
Split sha1_hmac for incremental use.

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

svn path=/trunk/; revision=44709
2012-08-31 09:25:36 +00:00
Chris Maynard cc3c9ba3e5 Allow wpa-psk decryption keys to be successfully entered.
Problems reported on ask.wireshark.org here:
1) http://ask.wireshark.org/questions/13951/invalid-key-format-wireshark-182
2) http://ask.wireshark.org/questions/13688/error-updating-record-invalid-key-format

#BACKPORT (to 1.8)

svn path=/trunk/; revision=44694
2012-08-29 16:15:01 +00:00
Jeff Morriss 1c1db865f6 Don't define HAVE_UMTS_KASUMI to anything unless we actually have it.
Use #ifdef HAVE_UMTS_KASUMI instead of #if HAVE_UMTS_KASUMI

Put $Id$ tag in kasumi.h

svn path=/trunk/; revision=44398
2012-08-09 19:33:36 +00:00
Pascal Quantin 23c35e6d14 Small fixes:
- put back return NULL in line 947 that got removed in r44384: it is mandatory to avoid accessing non initialized variables. Change rlc_channel_assign a bit to fix what was the root cause of this removal (I guess)
- put back add_channel_info in dissect_rlc_am (removed by error?)
- fix some typo errors
- fix indentation a bit

svn path=/trunk/; revision=44393
2012-08-09 18:26:08 +00:00
Anders Broman dff5959253 Add Custom.common to dist.
svn path=/trunk/; revision=44387
2012-08-09 17:12:38 +00:00
Anders Broman efa02ebb7a From Jacob Nordgren and Rishie Sharma:
FP: fixed so hsdsch type 1 also uses communication context id 

Added experimental conditional decryption support.

svn path=/trunk/; revision=44384
2012-08-09 16:42:31 +00:00
Evan Huus a234b68ff0 Fix some system header files that were #included with "" instead of <>.
They made cppcheck unhappy.

svn path=/trunk/; revision=43779
2012-07-18 02:47:56 +00:00
Jakub Zawadzki b18e880040 Update FSF address - part II.
svn path=/trunk/; revision=43538
2012-06-28 23:18:38 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Guy Harris faa13e5072 Neither C90 nor C99 explicitly guarantee that a memcpy() call with a
null source argument and a zero count will work; in practice, they
probably will (with a zero count, there's nothing to fetch from the
source),  but the Clang static analyzer still warns about it.

svn path=/trunk/; revision=42305
2012-04-28 02:25:15 +00:00
Jeff Morriss 75c3c92f19 Add a "-build" argument to checkAPIs.pl. Use that argument when building
from makefiles (and thus from the buildbot).

The intention is to be able to tell when a human is running the tool so we
can provide more code-review guidance.

As a starter, enable the "too many proto_tree_add_text() calls" check when
a human is running the tool.

svn path=/trunk/; revision=41943
2012-04-04 20:46:49 +00:00
Anders Broman 84370fffcb Add *.sbr files to the clean target.
svn path=/trunk/; revision=40762
2012-01-29 20:21:30 +00:00
Balint Reczey 26503be7dc fix compile errors found by dumpabi target
svn path=/trunk/; revision=40595
2012-01-19 22:55:37 +00:00
Jörg Mayer 1d7f73360e The last commit failed to check in the deleted files
svn path=/trunk/; revision=40512
2012-01-15 12:30:52 +00:00
Jörg Mayer 2097912587 Rename crypt-xxx to xxx
svn path=/trunk/; revision=40511
2012-01-15 12:29:44 +00:00
Jörg Mayer c710b63e26 Maybe adding $(GNUTLS_CFLAGS) will fix the build problem.
svn path=/trunk/; revision=40502
2012-01-14 15:46:25 +00:00
Jörg Mayer 6197143d6c Ed Beroset <beroset@mindspring.com> via bug 5531
The ANSI C12.22 protocol is a smart grid protocol for utility meters, including
gas, water and electric.  The dissector implemented in the patch file includes
full support for all EPSEM (Extended Protocol Specification for Electricity
Metering) services and includes a full implementation of the C12.22 security
modes.

[...]

To decrypt the attached sample file, you need to set up the key table in the
preferences to include key 0 with a value of 6624C7E23034E4036FE5CB3A8B5DAB44.

Me: Fixes for:

[ 64%] Building C object epan/CMakeFiles/epan.dir/dissectors/packet-c1222.c.o            
../../asn1/c1222/packet-c1222-template.c: In function ‘dissect_epsem’:                   
../../asn1/c1222/packet-c1222-template.c:860:15: error: variable ‘ft’ set but not used [-Werror=unused-but-set-variable]

[  5%] Building C object epan/CMakeFiles/epan.dir/dissectors/packet-c1222.c.o
../../asn1/c1222/packet-c1222-template.c:103:19: error: ‘c1222_flags’ defined but not used [-Werror=unused-variable]



svn path=/trunk/; revision=40500
2012-01-14 15:22:10 +00:00
Gerald Combs 9dc580af2a More C++ updates.
svn path=/trunk/; revision=40377
2012-01-04 21:26:51 +00:00
Bill Meier 781129806f Fix ex "modeline" so it works;
See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5748

svn path=/trunk/; revision=39081
2011-09-21 17:49:11 +00:00
Anders Broman c7c6bbf831 Move airpcap_wep.c to /wsutil
svn path=/trunk/; revision=38969
2011-09-12 08:23:15 +00:00
Stig Bjørlykke 84b3c5da84 Make lookup functions for accessing crc32c_table and crc32_ccitt_table.
svn path=/trunk/; revision=38817
2011-08-31 11:47:27 +00:00
Stig Bjørlykke 5359494b1f Second try to move crc routines to libwsutil.
This time keep the tvb routines in epan.

Now we can use common crc routines outside epan.

svn path=/trunk/; revision=38810
2011-08-31 09:00:54 +00:00
Stig Bjørlykke 71f903b956 Revert r38800, as the crc routines contains some tvb functions.
svn path=/trunk/; revision=38803
2011-08-30 14:17:40 +00:00
Stig Bjørlykke 4132d40e50 Move all crc routines to libwsutil.
This way we can use the crc routines in wiretap.

svn path=/trunk/; revision=38800
2011-08-30 13:46:42 +00:00
Jörg Mayer c15ff441c6 Replace deprecated glib functions.
In order to compile the whole project with -DG_DISABLE_DEPRECATED
the mate plugin needs to replace its usage of GMemChunk.
All other places should be clean.

svn path=/trunk/; revision=38392
2011-08-07 18:15:45 +00:00
Anders Broman 639e59a9f9 From Michael Mann:
Removed "key prefix" need within GUI so it's a little more intuitive (because
that's what this bug is complaining about).  Slight backwards compatibility
issue with UAT (because key prefix was in previous keys), but all development 
(including fix for BUG 1123 that created UAT) has just been on SVN and not
released.

Also adjusted AirPCap (airpcap_loader.c) to account for the lack of "key
prefix".

Addressed some memory leaks/excess string creation.

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

svn path=/trunk/; revision=37888
2011-07-04 14:07:20 +00:00
Gerald Combs a5ddd187ca Fix Coverity CID 557.
svn path=/trunk/; revision=36526
2011-04-08 21:21:32 +00:00
Chris Maynard 4d4f0b839b Clear the entire contents of ctx at the end of md5_finish(). Fixes CID 712.
svn path=/trunk/; revision=36420
2011-03-31 15:41:23 +00:00
Bill Meier 6413294dae Add a comment re a "suspicious" sizeof() reported by Coverity Prevent.
(The report seems correct but I'm not altogether sure).

svn path=/trunk/; revision=36227
2011-03-21 17:34:58 +00:00
Guy Harris b4f663a29b On Windows, try putting __declspec(noreturn) in front of declarations of
routines that don't return.  (This requires that some files include
config.h to get WS_MSVC_NORETURN declared properly.)

svn path=/trunk/; revision=35989
2011-02-17 23:11:49 +00:00
Gerald Combs 69901e8eba Fix Visual C++ code analysis errors.
svn path=/trunk/; revision=35970
2011-02-16 22:57:36 +00:00
Bill Meier d3efa3ed9f A bit of Windows makefiles rework and cleanup:
- Define macros for certain CFLAGS in config.nmake iso of having defs in each makefile;
  a. -DHAVE_CONFIG_H and -D_U_="" are now part of a macro named STANDARD_CFLAGS;
  b. -WX has been replaced by WARNINGS_ARE_ERRORS (defined as -WX in config.nmake)
      (This allows disabling "Warnings as Errors" by just changing config.nmake)
  c. CVARSDLL definitions (not usage) have been removed from the various makefiles.
     XXX: It appears the usage of CVARSDLL can also be removed (not yet done) since:
     -DWIN32 and -DNULL=0 do not appear to be needed (any more);
     -D_MT and _D_DLL  are not needed since /MP causes these definitions.
  d. Define a macro WARNINGS_CFLAGS with additional specific compiler (level4) warnings to be enabled.
     E.G., 4295: array is too small to include a terminating null character
- config.nmake: reformat some long lines for readability;
- plugins\Makefile.nmake: clean-deps does nothing: remove it (and usage in top-level makefile);
- dissectors/Makefile.nmake: test to enable packet-rrc.obj target needs to include MSVC2010 ...

svn path=/trunk/; revision=35747
2011-02-02 01:19:53 +00:00
Jeff Morriss 19b2af1e70 Make some symbols static.
svn path=/trunk/; revision=35140
2010-12-06 23:20:21 +00:00
Jeff Morriss c755b2fd54 Oh yeah, there's a reason we don't put targets in Makefile.common: the first target in a makefile is what you get when you just run make (without a target). Revert 35073 and 35069.
svn path=/trunk/; revision=35075
2010-11-30 02:04:55 +00:00
Jeff Morriss f1c066bbee Move some checkapi targets into Makefile.common
svn path=/trunk/; revision=35073
2010-11-29 22:34:04 +00:00
Anders Broman a009cc0605 Doxygen changes.
svn path=/trunk/; revision=33990
2010-08-29 10:47:38 +00:00
Anders Broman a96e6b2047 Doxygen changes.
svn path=/trunk/; revision=33981
2010-08-28 19:27:19 +00:00
Anders Broman 1c2b3b0eb9 Fix a number of doxygen directives.
svn path=/trunk/; revision=33930
2010-08-26 15:24:49 +00:00
Anders Broman 48ac5f90ff - Try to fix a couple of doxygen comments.
- whitspace changes.

svn path=/trunk/; revision=33926
2010-08-26 06:46:30 +00:00
Guy Harris e646e71d0f Fix some compiler warnings.
svn path=/trunk/; revision=31969
2010-02-23 20:30:27 +00:00
Guy Harris b395a98305 Squelch a bunch of compiler warnings.
svn path=/trunk/; revision=31961
2010-02-23 04:35:23 +00:00
Jörg Mayer ec7380a6b1 Creatig static sublibs was not a good idea:
=========================================================================
 "du -s build" with sublibs:
 396868  build
 -----------------------------------
 "du -s build" without sublibs:
 197588  build/
 =========================================================================
 tshark with sublibs:
 -rwxr-xr-x 1 jmayer users 27399706 2009-10-11 08:39 tshark*
 -----------------------------------
 tshark without sublibs:
 -rwxr-xr-x 1 jmayer users  226748 2009-10-11 09:05 tshark*
 =========================================================================

So undo the following patches:

 ------------------------------------------------------------------------
 r30459 | krj | 2009-10-10 07:08:48 +0200 (Sa, 10 Okt 2009) | 1 line
 
 Sort subdirectories alphabetically
 ------------------------------------------------------------------------
 r30458 | krj | 2009-10-10 07:03:36 +0200 (Sa, 10 Okt 2009) | 1 line
 
 Add epan/dissectors/CMakeLists.txt which creates a static dissectors library
 ------------------------------------------------------------------------
 --> readd!! *** r30443 | krj | 2009-10-09 21:43:42 +0200 (Fr, 09 Okt 2009) | 1 line
 
 Rename DISSECTOR_ASM_UTILS to LIBWIRESHARK_ASM_FILES since these files belongs to ep
 an not dissectors
 ------------------------------------------------------------------------
 r30442 | krj | 2009-10-09 21:17:26 +0200 (Fr, 09 Okt 2009) | 1 line
 
 Add epan/ftypes/CMakeLists.txt which creates a static ftypes library
 ------------------------------------------------------------------------
 r30441 | krj | 2009-10-09 21:13:01 +0200 (Fr, 09 Okt 2009) | 1 line
 
 Add epan/dfilter/CMakeLists.txt which creates a static dfilter library
 ------------------------------------------------------------------------
 r30440 | krj | 2009-10-09 21:05:29 +0200 (Fr, 09 Okt 2009) | 1 line
 
 Add epan/crypt/CMakeLists.txt which creates a static crypt library
 ------------------------------------------------------------------------
 r30439 | krj | 2009-10-09 20:22:22 +0200 (Fr, 09 Okt 2009) | 1 line
 
 Add epan/crc/CMakeLists.txt which creates a static crc library
 ------------------------------------------------------------------------

To avoid merge problems, I needed to revert r30443 as well, will readd this
one in my next patch.

svn path=/trunk/; revision=30494
2009-10-11 07:28:26 +00:00
Kovarththanan Rajaratnam e4d4f81768 Add epan/crypt/CMakeLists.txt which creates a static crypt library
svn path=/trunk/; revision=30440
2009-10-09 19:05:29 +00:00
Guy Harris 3f8748951f Fix some LLP64 issues.
svn path=/trunk/; revision=30393
2009-10-07 22:36:33 +00:00
Gerald Combs 22dcdd3f9a WPA decryption fix from Greg Schwendimann via bug 3890:
I'm reasonably sure that I introduced this bug and I apologize for the problems
with my previous patch.  The problem is that I did not use all of the seen
keys,  I used all except the first key, which in a case of one key is none. 
The attached patch fixes the error.

svn path=/trunk/; revision=29843
2009-09-10 16:50:25 +00:00
Ronnie Sahlberg a3355a0949 Break the aes set ket/decrypt/encrypt out from airpdcap_raindoll into
its own crypt-aes.

change the integer types to glib style integers


this may/will be helpful if/when we implement our own version of 
kerberos 
aes decryption of dcerpc since the existing libraries can not (yet) 
handle when header signing is used.

we should implement our own decryption of this for cfx+aes just as we 
did for classic+arcfour





svn path=/trunk/; revision=29228
2009-07-29 10:01:14 +00:00
Bill Meier 3b4b7023b9 Fix some whitespace ....
svn path=/trunk/; revision=29184
2009-07-23 20:53:44 +00:00
Anders Broman 67d6f5976e Move th /MP flag setting to LOCAL_CFLAGS set in configure.nmake
for MSVC variant 2008 only. As suggested by Bill Meier.

svn path=/trunk/; revision=29114
2009-07-16 08:27:18 +00:00
Anders Broman 91caa01090 Add /MP flag to make use of multi cores.
svn path=/trunk/; revision=29104
2009-07-15 20:55:31 +00:00
Gerald Combs 8ca33644e7 From Greg Schwendimann via bug 3156:
Airpdcap does not allow for more than one key to be stored for a pair of nodes.
 This means that when a device associates more than once the previous keys are
lost.  This is ok for the first pass as the newest key is all that is needed
but when the user tries to click on a packet, to get the tree, which used a
previous key all that is seen is the encrypted data.  The attached patch stores
previous associations in a linked list and will try all known keys before
decided the packet can't be decrypted.  The list of keys is garbage collected
when a new capture is started.

svn path=/trunk/; revision=28449
2009-05-22 17:38:21 +00:00
Gerald Combs 1b60cf3846 Make some lengths size_t's.
svn path=/trunk/; revision=27942
2009-04-03 15:44:08 +00:00
Gerald Combs 5f1b7e8f27 More Win64 fixes.
svn path=/trunk/; revision=27707
2009-03-11 22:44:06 +00:00
Stig Bjørlykke c3b54a3378 Removed a "statement not reached" warning.
svn path=/trunk/; revision=26478
2008-10-16 13:35:35 +00:00
Gerald Combs b9fac8aa8a Fetch the key length using pntohs. Initialize and check its length.
svn path=/trunk/; revision=26115
2008-09-02 17:26:24 +00:00
Bill Meier afd857957a Fix a few Emacs "file variables" to have "safe" values.
That is: indent-tabs-mode: tabs --> indent-tabs-mode: t
Also: fix a typo: set-tabs-mode --> indent-tabs-mode

svn path=/trunk/; revision=26113
2008-09-02 11:17:03 +00:00
Gerald Combs ab689cc334 Add another buffer length check to group key decryption.
svn path=/trunk/; revision=26071
2008-08-25 15:26:15 +00:00
Gerald Combs f31f3f6d14 Fix a couple of crashes in WPA group key decryption.
svn path=/trunk/; revision=26070
2008-08-25 15:22:48 +00:00
Gerald Combs b5a8677250 Add WPA group key decryption from Brian Stormont, via bug 1420:
Although this patch successfully recognizes group keys and decrypts packets
properly using the group key, there is a limitation.  If an AP is using key
rotation, clicking on individual packets in a trace may not properly decrypt a
packet encrypted with a group key.  This is because the current structure used
in Wireshark only supports one active unicast and one active group key.  If a
new key has been seen, but you are looking at a packet encrypted with an older
key, it will not decrypt.  The summary lines, however, do show the packets
properly decrypted.

I've written up a much longer and more detailed explanation in a comment in the
code, along with a proposed idea for a solution, plus a clunky work-around in
the GUI when using the current code.

I also suspect there might still be a problem with decrypting TKIP groups keys
that are sent using WPA2 authentication.  In the most common operation, if you
are using WPA2, you'll also be using AES keys. It's not a common AP
configuration to use WPA2 with TKIP. In fact, most APs don't seem to support
it.  Since it is an uncommon setup, I haven't put aside the time to test this
patch against such an AP.   I do have access to an AP that supports this, so
when I have the time I'll test it and if needed, will submit another patch to
handle that odd-ball condition.

From me:

Remove the decrypt element of s_rijndael_ctx (which was unused, as indicated
in the comments).
Preserve the GPL licensing text in several files (which the patch shouldn't
have removed).
Remove changes that added whitespace.
Convert C++-style comments to C-style.
Update to include recent SVN changes (e.g. renaming variables named "index").
Remove extraneous printf's.
Define DEBUG_DUMP in airpdcap_debug.h.
Comment out some instances of DEBUG_DUMP.
Change malloc/free to g_malloc/g_free.
Use g_memdup instead of allocating and copying.
Use gint16 instead of INT16 in airpdcap_rijndael.c.
Add Brian to AUTHORS.


svn path=/trunk/; revision=25879
2008-07-30 22:32:21 +00:00
Guy Harris a04774395f Add Makefile.common files for epan/dfilter and epan/ftypes.
Add checkapi rules to Makefile.am files.

svn path=/trunk/; revision=25656
2008-07-02 01:44:30 +00:00
Guy Harris b6e20d89be Put printf into a separate "termoutput" API group. For most files,
check for it - but not for TShark plugins, as they are expected to
print to the standard output.

svn path=/trunk/; revision=25653
2008-07-01 21:13:32 +00:00
Guy Harris dc7ae72983 Fix another variable named "index".
svn path=/trunk/; revision=25581
2008-06-24 18:10:57 +00:00
Guy Harris 710ccf240c Rename a local variable in a macro to avoid collisions with regular
variables.

svn path=/trunk/; revision=25553
2008-06-23 21:08:58 +00:00
Guy Harris 11848b9efe Rename a variable to avoid collisions with the old V7 index() function,
still declared by <string.h> on some platforms (at least the way we
compile, with all sorts of non-ANSI C/non-POSIX stuff added).

svn path=/trunk/; revision=25551
2008-06-23 21:06:42 +00:00
Anders Broman 36d89bb79c Fix some of the Errors/warnings detected by checkapi.
svn path=/trunk/; revision=25368
2008-05-23 05:55:34 +00:00