aboutsummaryrefslogtreecommitdiffstats
path: root/epan/crypt
AgeCommit message (Collapse)AuthorFilesLines
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>
2015-05-10new_key is used only for TKIP keys; set it only in that part of the code.Guy Harris1-6/+7
Change-Id: I64424731e4d5f94c7b69436b5318b67a14471171 Reviewed-on: https://code.wireshark.org/review/8372 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-10Allocate the unwrapped key in AES_unwrap().Guy Harris3-13/+14
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-09Define the SHA-1 digest length in wsutil/sha1.h and use it.Guy Harris1-10/+8
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-08airpdcap: ensure that buffer put on stack is big enough to hold the result ↵Pascal Quantin1-2/+2
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-08IEEE 802.11: 802.1X (WPA-EAP) rekeying supportdeagol3-174/+64
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-03-11Fix buffer overflow in 802.11 decryptionPeter Wu1-2/+5
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 3f8fbb734915aaf74eb006898e8fabb007afbf48 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-01-18Remove some apparently-unnecessary includes of emem.h.Guy Harris1-1/+0
Change-Id: Id50ce3e707056cca8f30052f05c451ce431b39b5 Reviewed-on: https://code.wireshark.org/review/6632 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-16Remove the last two true calls to se_alloc.Michael Mann1-1/+26
(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-11Replace some "low hanging fruit" uses of emem.Michael Mann1-3/+9
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-09Fix airpdcap debugging code.Gerald Combs1-6/+8
Change-Id: Ied1094dd3c6ad176fea830c0857ba43e09d3cb10 Reviewed-on: https://code.wireshark.org/review/6457 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-01-08bytes_to_ep_str -> bytes_to_strMichael Mann2-3/+10
Change-Id: Ifcda8328dedec0ef4104c3a124d6246f99493750 Reviewed-on: https://code.wireshark.org/review/6389 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-02Add '*.nativecodeanalysis.xml' to 'clean' targetsBill Meier1-1/+1
Change-Id: I90dbf0b31fc737150a01533763a7869b34c68cb6 Reviewed-on: https://code.wireshark.org/review/6220 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-08-11Guard against buffer overflow when copying group key bytes intoDom Gifford1-14/+17
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-08Fix support for decrypting 802.11 broadcast messages.Dom Gifford1-13/+41
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-04-25Support out-of-source checkapiStig Bjørlykke1-1/+2
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-03-31Continue to remove $Id$ from top of fileAlexis La Goutte1-2/+0
(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-31Continue to remove $Id$ from top of fileAlexis La Goutte3-5/+0
(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-05Fix some code remove by 296591399f90a9d89be958d91047aa724a77ee6dAlexis La Goutte1-0/+1
(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-04Remove all $Id$ from top of fileAlexis La Goutte13-26/+0
(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-02-25Remove trailing whitespaceBill Meier2-2/+2
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>
2013-12-19Rename a couple of to_str functions to have ep_ in the name. This makes itEvan Huus2-2/+2
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-11-29Rename some of pint.h macros to match common style (bits number on the end).Jakub Zawadzki2-6/+6
pntohs -> pntoh16 pntohl -> pntoh32 pletohs -> pletoh16 pletohl -> pletoh32 phtons -> phton16 phtonl -> phton32 svn path=/trunk/; revision=53652
2013-11-10Fix compilation under Linux (Ubuntu)Alexis La Goutte1-10/+10
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-10Move prototype of bytes_to_str, bytes_to_str_punct to correct header.Jakub Zawadzki1-0/+1
svn path=/trunk/; revision=53214
2013-08-10Fix (-W)documentation error found by ClangAlexis La Goutte1-2/+2
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-02LIBGCRYPT_CFLAGS is not set in Windows builds, use GNUTLS_CFLAGS instead.Jeff Morriss1-2/+1
svn path=/trunk/; revision=51108
2013-08-01Include LIBGCRYPT_CFLAGS in wsutil (but not in epan/crypt).Jeff Morriss1-1/+1
svn path=/trunk/; revision=51103
2013-08-01Move a bunch of the crypt modules and pint.h into wsutil.Jeff Morriss20-3282/+11
This means wsutil now links against libcrypt. Protect a bunch of the crypt header files from multiple inclusion. svn path=/trunk/; revision=51100
2013-04-14Update some of the old FSF addresses caught by the new licensecheck buildbotEvan Huus6-6/+6
step. svn path=/trunk/; revision=48848
2013-03-15Bugfix Decryption Key Management dialog, bug 8446 ↵Michael Mann1-6/+5
(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-12From David Arnold:Jaap Keuter1-3/+3
Replace use of INCLUDES with AM_CPPFLAGS in all Makefiles to placate recent autotools. svn path=/trunk/; revision=48261
2013-03-02From beroset:Anders Broman2-4/+4
remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 svn path=/trunk/; revision=48006