aboutsummaryrefslogtreecommitdiffstats
path: root/epan/crypt
AgeCommit message (Collapse)AuthorFilesLines
2017-09-15epan: Avoid possible misuse of comma operator warningStig Bjørlykke1-1/+2
Change-Id: I73044cd71d21b5eef2e8350cf034f7801e169c16 Reviewed-on: https://code.wireshark.org/review/23552 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2017-06-11Fix airpdcap compilation on SunPetr Sumbera1-0/+4
Bug: 13786 Change-Id: Iaa3890610768605b5c579aaddc73124b9f85bdd9 Reviewed-on: https://code.wireshark.org/review/22074 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-21Code in epan/crypt may require gcrypt, so include LIBGCRYPT_FLAGS.Guy Harris1-1/+1
Change-Id: I7f6745eb39bae6ae37a63178bcd60c75fd9e9de2 Reviewed-on: https://code.wireshark.org/review/21268 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-03-03Fix compilation with old libcrypt versions.Guy Harris1-1/+13
Change-Id: If9c0631435e5380d3f158ebe6578adaf65a429bb Reviewed-on: https://code.wireshark.org/review/20351 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-03-02Rewrite dissectors to use Libgcrypt functions.Erik de Jong3-101/+147
As discussed on the mailinglist, rewriting dissectors to use Libgcrypt functions as Libgcrypt will be mandatory after change 20030. Removal of following functions: - crypt_md4 - crypt_rc4* - aes_cmac_encrypt_* - md5_* - sha1_* - sha256_* Further candidates: - aes_* - rijndael_* - ... Added functions: - ws_hmac_buffer Added const macros: - HASH_MD5_LENGTH - HASH_SHA1_LENGTH Changes on epan/crypt/* verified with captures from https://wiki.wireshark.org/HowToDecrypt802.11 Changes on packet-snmp.c and packet-radius.c verified with captures from https://wiki.wireshark.org/SampleCapture Changes on packet-tacacs.c verified with capture from http://ccie-in-3-months.blogspot.nl/2009/04/decoding-login-credentials-regardless.html Change-Id: Iea6ba2bf207cf0f1bf2117068fb1abcfeaafaa46 Link: https://www.wireshark.org/lists/wireshark-dev/201702/msg00011.html Reviewed-on: https://code.wireshark.org/review/20095 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-01-31Add wmem allocator parameter to format_uriMichael Mann1-2/+5
Change-Id: Ic6de84a37b501e9c62a7d37071b2b081a1a1dd50 Reviewed-on: https://code.wireshark.org/review/19885 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-04Squelch a casting-away-constness warning.Guy Harris1-2/+2
Change-Id: I77ca8ffd38baf812ef20b9611f59cd70ae37d392 Reviewed-on: https://code.wireshark.org/review/19062 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-10-28automake: separate crypt C and header files.Jeff Morriss1-4/+10
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-09-30cmake: make WERROR_COMMON_FLAGS a normal stringPeter Wu1-7/+5
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-08-23CMake: Allow setting per target compiler warningsJoão Valverde1-0/+1
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-07-29Enable airpdcap debugging explicitly.Gerald Combs2-11/+13
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-26Move airpdcap's print_debug_line() to airpdcap_debug.hMichael Mann4-59/+6
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-06-30Remove Makefile.common filesJoão Valverde2-55/+25
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-15Remove Nmake build systemPascal Quantin2-31/+0
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-05-23Make sure EAPOL body is big enough for a EAPOL_RSN_KEY.Michael Mann1-1/+1
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-10Sanity check eapol_len in AirPDcapDecryptWPABroadcastKeyMichael Mann1-1/+3
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-02Add checkAPI calls to CMake.Graham Bloice1-0/+9
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-03-03Add CMakeListsCustom.txt.example to distributionJoão Valverde1-1/+2
Change-Id: I81cebd467692d4193772ca0814fb82c06658006e Reviewed-on: https://code.wireshark.org/review/14312 Reviewed-by: João Valverde <j@v6e.pt>
2016-03-03Add missing cmake custom source includesJoão Valverde2-0/+27
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-01CMake: Add more structure to libwireshark buildJoão Valverde2-1/+67
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-02-21autotools: Use pkg-config autoconf macros for GLib/GTKJoão Valverde1-0/+2
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-04[airpdcap] Add support to decrypt TDLS trafficCedric Izoard1-33/+273
- 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-01-28autotools: Don't use "user variables" to set build flagsJoão Valverde1-7/+1
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-16IEEE802.11: fix EAPOL key frame detectionAlexander Wetzel2-15/+2
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-14[airpcap] Fix parsing of GTKCedric Izoard1-54/+44
- 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-13[airpcap] Decrypt protected management frames (802.11w)Cedric Izoard3-11/+49
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>
2015-12-21g_malloc the decrypted key in AES_unwrap(), but always free it.Guy Harris2-2/+5
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-21g_mallocate the encrypted key, but free it in all paths out of the function.Guy Harris1-2/+7
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[airpdcap rijndael] use packet scoped wmem memory in AES_unwrap()Martin Kaiser2-6/+2
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[airpdcap] check the length of the WPA broadcast key we calculatedMartin Kaiser1-0/+4
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[aidpdcap] use packet scoped wmem memory for szEncryptedKeyMartin Kaiser1-2/+1
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-20[AES_unwrap] initialize the output array with 0sMartin Kaiser1-1/+1
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-01Removed some remaining svn Id tagsStig Bjørlykke1-4/+3
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-11-28Add boundary check for 802.11 decryptionPeter Wu2-1/+7
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-25WPA (IEEE802.11) decryption function cleanupsAlexander Wetzel2-56/+44
- 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-17Misc minor issues caught by cppcheckEvan Huus1-1/+0
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-14airpdcap_system.(h) fix parameter 'mngHandshake/mngDecrypt' not found in the ↵Alexis La Goutte1-4/+3
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-13Fix compilation when _DEBUG is defined.Gerald Combs2-3/+10
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-09WPA/WPA2 decoding fixes and improvementsAlexander Wetzel4-201/+182
- 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-10-09airpdcap: add free_key_string function, fix memleaksPeter Wu2-1/+20
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-09-25airpdcap: fix WEP decryptionPascal Quantin1-1/+1
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-08Move some stuff into the only code path where it's used.Guy Harris1-11/+11
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-08Don't try to decrypt with an AES key shorter than 128 bits.Guy Harris1-0/+5
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-07-14Add a bounds check.Guy Harris1-0/+4
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-06-07airpdcap: fix V512 warning reported by PVS-StudioPascal Quantin1-1/+1
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-05Fix a few issues reported by PVS-StudioPascal Quantin1-1/+1
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-05-10Copy PTK key in its dedicated array, and not at the address of the arrayPascal Quantin1-3/+19
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-10Don't initialize a variable that's unused before we later set it.Guy Harris1-1/+1
Change-Id: I944cac044a8b091cbe5d85cd63a8c698a82b8559 Reviewed-on: https://code.wireshark.org/review/8388 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-10Pick array sizes based on what they're supposed to hold.Guy Harris1-4/+9
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-10Add some bounds checks.Guy Harris1-0/+5
Change-Id: I5b0405f814d439c1d5ce329a817475102be483af Reviewed-on: https://code.wireshark.org/review/8373 Reviewed-by: Guy Harris <guy@alum.mit.edu>