| 1 | /* |
| 2 | * Copyright (C) 2018-2022 Joseph Benden <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation; either version 2 of the |
| 7 | * License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but |
| 10 | * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied |
| 11 | * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and |
| 12 | * NON-INFRINGEMENT. See the GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
| 17 | * MA 02110-1301, USA. |
| 18 | * |
| 19 | * In addition, as a special exception, the copyright holders give |
| 20 | * permission to link the code of portions of this program with the |
| 21 | * OpenSSL library under certain conditions as described in each |
| 22 | * individual source file, and distribute linked combinations |
| 23 | * including the two. |
| 24 | * You must obey the GNU General Public License in all respects |
| 25 | * for all of the code used other than OpenSSL. If you modify |
| 26 | * file(s) with this exception, you may extend this exception to your |
| 27 | * version of the file(s), but you are not obligated to do so. If you |
| 28 | * do not wish to do so, delete this exception statement from your |
| 29 | * version. If you delete this exception statement from all source |
| 30 | * files in the program, then also delete it here. |
| 31 | */ |
| 32 | |
| 33 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:420:9`! |
| 34 | #include "config.h"cxx . . $ `<file>/config.h`/ |
| 35 | #endif |
| 36 | |
| 37 | #include <err.h> |
| 38 | #include <limits.h> |
| 39 | #define _GNU_SOURCEcxx . . $ `lib/ce-wpa/crypto_engine.c:39:9`! |
| 40 | #include <string.h> |
| 41 | #include <stdint.h> |
| 42 | |
| 43 | #include "aircrack-ng/crypto/crypto.h"cxx . . $ `<file>/include/aircrack-ng/crypto/crypto.h`/ |
| 44 | #include "aircrack-ng/ce-wpa/simd-intrinsics.h"cxx . . $ `<file>/include/aircrack-ng/ce-wpa/simd-intrinsics.h`/ |
| 45 | #include "aircrack-ng/ce-wpa/wpapsk.h"cxx . . $ `<file>/include/aircrack-ng/ce-wpa/wpapsk.h`/ |
| 46 | #include "aircrack-ng/cpu/trampoline.h"cxx . . $ `<file>/include/aircrack-ng/cpu/trampoline.h`/ |
| 47 | #include "aircrack-ng/ce-wpa/crypto_engine.h"cxx . . $ `<file>/include/aircrack-ng/ce-wpa/crypto_engine.h`/ |
| 48 | |
| 49 | // #define XDEBUG |
| 50 | |
| 51 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! int ac_crypto_engine_supported_featurescxx . . $ ac_crypto_engine_supported_features(b126dc7c1de90089).(void) |
| 52 | { |
| 53 | #if defined(JOHN_AVX512F) |
| 54 | return SIMD_SUPPORTS_AVX512F; |
| 55 | #elif defined(JOHN_AVX2cxx . . $ `<built-in>:422:9`!) |
| 56 | return SIMD_SUPPORTS_AVX2cxx . . $ `include/aircrack-ng/cpu/trampoline.h:30:9`!; |
| 57 | #elif defined(JOHN_AVXcxx . . $ `include/aircrack-ng/ce-wpa/arch.h:183:9`!) |
| 58 | return SIMD_SUPPORTS_AVXcxx . . $ `include/aircrack-ng/cpu/trampoline.h:29:9`!; |
| 59 | #elif defined(JOHN_SSE2cxx . . $ `<built-in>:413:9`!) |
| 60 | return SIMD_SUPPORTS_SSE2cxx . . $ `include/aircrack-ng/cpu/trampoline.h:28:9`!; |
| 61 | #elif defined(JOHN_NEON) |
| 62 | return SIMD_SUPPORTS_NEON; |
| 63 | #elif defined(JOHN_ASIMD) |
| 64 | return SIMD_SUPPORTS_ASIMD; |
| 65 | #elif defined(JOHN_POWER8) |
| 66 | return SIMD_SUPPORTS_POWER8; |
| 67 | #elif defined(JOHN_ALTIVEC) |
| 68 | return SIMD_SUPPORTS_ALTIVEC; |
| 69 | #else |
| 70 | return SIMD_SUPPORTS_NONEcxx . . $ `include/aircrack-ng/cpu/trampoline.h:26:9`!; |
| 71 | #endif |
| 72 | } |
| 73 | |
| 74 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! int ac_crypto_engine_simd_widthcxx . . $ ac_crypto_engine_simd_width(b126dc7c1de90089).(void) |
| 75 | { |
| 76 | #ifdef SIMD_COEF_32cxx . . $ `include/aircrack-ng/ce-wpa/memory.h:71:9`! |
| 77 | return SIMD_COEF_32cxx . . $ `include/aircrack-ng/ce-wpa/memory.h:71:9`!; |
| 78 | #else |
| 79 | return 1; |
| 80 | #endif |
| 81 | } |
| 82 | |
| 83 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! int ac_crypto_engine_initcxx . . $ ac_crypto_engine_init(3959a6aa6bd15829).(ac_crypto_engine_tcxx . . $ ac_crypto_engine_t# * engine) |
| 84 | { |
| 85 | assertcxx . . $ `/usr/include/assert.h:118:11`!(engine != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 86 | #ifdef XDEBUG |
| 87 | fprintf(stderr, "ac_crypto_engine_init(%p)\n", engine); |
| 88 | #endif |
| 89 | |
| 90 | init_atoicxx . . $ init_atoi(49f6e7a06ebc5aa8).(); |
| 91 | |
| 92 | engine->essidcxx . . $ ac_crypto_engine#essid. = mem_calloc_aligncxx . . $ `include/aircrack-ng/ce-wpa/memory.h:143:9`!(1, ESSID_LENGTHcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:63:9`! + 1, MEM_ALIGN_SIMDcxx . . $ `include/aircrack-ng/ce-wpa/pseudo_intrinsics.h:677:9`!); |
| 93 | |
| 94 | engine->essid_lengthcxx . . $ ac_crypto_engine#essid_length. = 0; |
| 95 | |
| 96 | for (int i = 0; i < MAX_THREADScxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:42:9`!; ++i) engine->thread_datacxx . . $ ac_crypto_engine#thread_data.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 97 | |
| 98 | return 0; |
| 99 | } |
| 100 | |
| 101 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! void ac_crypto_engine_destroycxx . . $ ac_crypto_engine_destroy(dd79bce08bd8e151).(ac_crypto_engine_tcxx . . $ ac_crypto_engine_t# * engine) |
| 102 | { |
| 103 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(engine != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 104 | #ifdef XDEBUG |
| 105 | fprintf(stderr, "ac_crypto_engine_destroy(%p)\n", engine); |
| 106 | #endif |
| 107 | |
| 108 | MEM_FREEcxx . . $ `include/aircrack-ng/ce-wpa/memory.h:169:9`!(engine->essid); |
| 109 | } |
| 110 | |
| 111 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! void ac_crypto_engine_set_essidcxx . . $ ac_crypto_engine_set_essid(55e51be6a9e40113).(ac_crypto_engine_tcxx . . $ ac_crypto_engine_t# * engine, |
| 112 | const uint8_tcxx . . $ uint8_t# * essid) |
| 113 | { |
| 114 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(engine != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 115 | #ifdef XDEBUG |
| 116 | fprintf(stderr, "ac_crypto_engine_set_essid(%p, %s)\n", engine, essid); |
| 117 | #endif |
| 118 | memccpycxx . . $ memccpy(cd742cbb03f31031).(engine->essidcxx . . $ ac_crypto_engine#essid., essid, 0, ESSID_LENGTHcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:63:9`!); |
| 119 | engine->essid_lengthcxx . . $ ac_crypto_engine#essid_length. = (uint32_tcxx . . $ uint32_t#) strlencxx . . $ strlen(751346f8406fd082).((char *) essid); |
| 120 | } |
| 121 | |
| 122 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! int ac_crypto_engine_thread_initcxx . . $ ac_crypto_engine_thread_init(577dd6cac3ecdff5).(ac_crypto_engine_tcxx . . $ ac_crypto_engine_t# * engine, |
| 123 | int threadid) |
| 124 | { |
| 125 | assertcxx . . $ `/usr/include/assert.h:118:11`!(engine != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 126 | #ifdef XDEBUG |
| 127 | fprintf(stderr, "ac_crypto_engine_thread_init(%p, %d)\n", engine, threadid); |
| 128 | #endif |
| 129 | |
| 130 | // allocate per-thread data. |
| 131 | engine->thread_datacxx . . $ ac_crypto_engine#thread_data.[threadid] = mem_calloc_aligncxx . . $ ac_crypto_engine_perthread#( |
| 132 | 1, sizeof(struct ac_crypto_engine_perthread), MEM_ALIGN_SIMDcxx . . $ `include/aircrack-ng/ce-wpa/pseudo_intrinsics.h:677:9`!); |
| 133 | |
| 134 | return 0; |
| 135 | } |
| 136 | |
| 137 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! void ac_crypto_engine_thread_destroycxx . . $ ac_crypto_engine_thread_destroy(2021de5ef609ca5b).(ac_crypto_engine_tcxx . . $ ac_crypto_engine_t# * engine, |
| 138 | int threadid) |
| 139 | { |
| 140 | assertcxx . . $ `/usr/include/assert.h:118:11`!(engine != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 141 | #ifdef XDEBUG |
| 142 | fprintf( |
| 143 | stderr, "ac_crypto_engine_thread_destroy(%p, %d)\n", engine, threadid); |
| 144 | #endif |
| 145 | |
| 146 | if (engine->thread_datacxx . . $ ac_crypto_engine#thread_data.[threadid] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 147 | { |
| 148 | MEM_FREEcxx . . $ ac_crypto_engine#thread_data.(engine->thread_data[threadid]); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! uint8_tcxx . . $ uint8_t# * |
| 153 | ac_crypto_engine_get_pmkcxx . . $ ac_crypto_engine_get_pmk(ec015ae828f5691c).(ac_crypto_engine_tcxx . . $ ac_crypto_engine_t# * engine, int threadid, int index) |
| 154 | { |
| 155 | return (uint8_tcxx . . $ uint8_t# *) engine->thread_datacxx . . $ ac_crypto_engine#thread_data.[threadid]->pmkcxx . . $ ac_crypto_engine_perthread#pmk. |
| 156 | + (sizeof(wpapsk_hashcxx . . $ wpapsk_hash#) * index); |
| 157 | } |
| 158 | |
| 159 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! uint8_tcxx . . $ uint8_t# * |
| 160 | ac_crypto_engine_get_ptkcxx . . $ ac_crypto_engine_get_ptk(ec015ae828f5691c).(ac_crypto_engine_tcxx . . $ ac_crypto_engine_t# * engine, int threadid, int index) |
| 161 | { |
| 162 | return (uint8_tcxx . . $ uint8_t# *) engine->thread_datacxx . . $ ac_crypto_engine#thread_data.[threadid]->ptkcxx . . $ ac_crypto_engine_perthread#ptk. + (20 * index); |
| 163 | } |
| 164 | |
| 165 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! void ac_crypto_engine_calc_pkecxx . . $ ac_crypto_engine_calc_pke(e209136555778074).(ac_crypto_engine_tcxx . . $ ac_crypto_engine_t# * engine, |
| 166 | const uint8_tcxx . . $ uint8_t# bssid[6], |
| 167 | const uint8_tcxx . . $ uint8_t# stmac[6], |
| 168 | const uint8_tcxx . . $ uint8_t# anonce[32], |
| 169 | const uint8_tcxx . . $ uint8_t# snonce[32], |
| 170 | int threadid) |
| 171 | { |
| 172 | uint8_tcxx . . $ uint8_t# * pke = engine->thread_datacxx . . $ ac_crypto_engine#thread_data.[threadid]->pkecxx . . $ ac_crypto_engine_perthread#pke.; |
| 173 | |
| 174 | assertcxx . . $ `/usr/include/assert.h:118:11`!(pke != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); //-V547 |
| 175 | |
| 176 | /* pre-compute the key expansion buffer */ |
| 177 | memcpycxx . . $ memcpy(cc817cb175f282d).(pke, "Pairwise key expansion", 23); |
| 178 | if (memcmpcxx . . $ memcmp(36f949851efa3055).(stmac, bssid, 6) < 0) |
| 179 | { |
| 180 | memcpycxx . . $ memcpy(cc817cb175f282d).(pke + 23, stmac, 6); |
| 181 | memcpycxx . . $ memcpy(cc817cb175f282d).(pke + 29, bssid, 6); |
| 182 | } |
| 183 | else |
| 184 | { |
| 185 | memcpycxx . . $ memcpy(cc817cb175f282d).(pke + 23, bssid, 6); |
| 186 | memcpycxx . . $ memcpy(cc817cb175f282d).(pke + 29, stmac, 6); |
| 187 | } |
| 188 | if (memcmpcxx . . $ memcmp(36f949851efa3055).(snonce, anonce, 32) < 0) |
| 189 | { |
| 190 | memcpycxx . . $ memcpy(cc817cb175f282d).(pke + 35, snonce, 32); |
| 191 | memcpycxx . . $ memcpy(cc817cb175f282d).(pke + 67, anonce, 32); |
| 192 | } |
| 193 | else |
| 194 | { |
| 195 | memcpycxx . . $ memcpy(cc817cb175f282d).(pke + 35, anonce, 32); |
| 196 | memcpycxx . . $ memcpy(cc817cb175f282d).(pke + 67, snonce, 32); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | /* derive the PMK from the passphrase and the essid */ |
| 201 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! void ac_crypto_engine_calc_one_pmkcxx . . $ ac_crypto_engine_calc_one_pmk(b5dafdefd2c2aef3).(const uint8_tcxx . . $ uint8_t# * key, |
| 202 | const uint8_tcxx . . $ uint8_t# * essid_pre, |
| 203 | uint32_tcxx . . $ uint32_t# essid_pre_len, |
| 204 | uint8_tcxx . . $ uint8_t# pmk[static PMK_LENcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:65:9`!]) |
| 205 | { |
| 206 | if (KDF_PBKDF2_SHA1cxx . . $ KDF_PBKDF2_SHA1(b8f0182cdeb05973).(key, essid_pre, essid_pre_len, 4096, pmk, PMK_LENcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:65:9`!) != 0) |
| 207 | errxcxx . . $ errx(53ecd36ad8a4a0a2).(1, "Failed to compute PBKDF2 HMAC-SHA1"); |
| 208 | } |
| 209 | |
| 210 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! void ac_crypto_engine_calc_pmkcxx . . $ ac_crypto_engine_calc_pmk(2dd2f4b506657261).( |
| 211 | ac_crypto_engine_tcxx . . $ ac_crypto_engine_t# * engine, |
| 212 | const wpapsk_passwordcxx . . $ wpapsk_password# key[MAX_KEYS_PER_CRYPT_SUPPORTEDcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:87:9`!], |
| 213 | const int nparallel, |
| 214 | const int threadid) |
| 215 | { |
| 216 | wpapsk_hashcxx . . $ wpapsk_hash# * pmk = engine->thread_datacxx . . $ ac_crypto_engine#thread_data.[threadid]->pmkcxx . . $ ac_crypto_engine_perthread#pmk.; |
| 217 | |
| 218 | // PMK calculation |
| 219 | #ifdef SIMD_COREcxx . . $ `<built-in>:421:9`! |
| 220 | if (nparallel >= 4) |
| 221 | { |
| 222 | init_wpapskcxx . . $ init_wpapsk(cb83f2ff776551c4).(engine, key, nparallel, threadid); |
| 223 | } |
| 224 | else |
| 225 | #endif |
| 226 | for (int j = 0; j < nparallel; ++j) |
| 227 | { |
| 228 | #ifdef XDEBUG |
| 229 | printf("%lu: Trying: %s\n", pthread_self(), (char *) key[j].v); |
| 230 | #endif |
| 231 | ac_crypto_engine_calc_one_pmkcxx . . $ ac_crypto_engine_calc_one_pmk(b5dafdefd2c2aef3).(key[j].vcxx . . $ $anonymous_type_52ac32f0646012be_0#v., |
| 232 | (uint8_tcxx . . $ uint8_t# *) engine->essidcxx . . $ ac_crypto_engine#essid., |
| 233 | engine->essid_lengthcxx . . $ ac_crypto_engine#essid_length., |
| 234 | (uint8_tcxx . . $ uint8_t# *) (&pmk[j])); |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! void ac_crypto_engine_calc_ptkcxx . . $ ac_crypto_engine_calc_ptk(7072774f18c6680c).(ac_crypto_engine_tcxx . . $ ac_crypto_engine_t# * engine, |
| 239 | const uint8_tcxx . . $ uint8_t# keyver, |
| 240 | int vectorIdx, |
| 241 | int threadid) |
| 242 | { |
| 243 | uint8_tcxx . . $ uint8_t# data[64 + 12]; |
| 244 | |
| 245 | uint8_tcxx . . $ uint8_t# * ptk = engine->thread_datacxx . . $ ac_crypto_engine#thread_data.[threadid]->ptkcxx . . $ ac_crypto_engine_perthread#ptk.; |
| 246 | wpapsk_hashcxx . . $ wpapsk_hash# * pmk = engine->thread_datacxx . . $ ac_crypto_engine#thread_data.[threadid]->pmkcxx . . $ ac_crypto_engine_perthread#pmk.; |
| 247 | uint8_tcxx . . $ uint8_t# * pke = &engine->thread_datacxx . . $ ac_crypto_engine#thread_data.[threadid]->pkecxx . . $ ac_crypto_engine_perthread#pke.[23]; |
| 248 | |
| 249 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(data, 0, sizeof(data)); |
| 250 | memcpycxx . . $ memcpy(cc817cb175f282d).(data, pke, ETH_ALENcxx . . $ `include/aircrack-ng/crypto/crypto.h:77:9`!); |
| 251 | memcpycxx . . $ memcpy(cc817cb175f282d).(data + ETH_ALENcxx . . $ `include/aircrack-ng/crypto/crypto.h:77:9`!, pke + ETH_ALENcxx . . $ `include/aircrack-ng/crypto/crypto.h:77:9`!, ETH_ALENcxx . . $ `include/aircrack-ng/crypto/crypto.h:77:9`!); |
| 252 | memcpycxx . . $ memcpy(cc817cb175f282d).(data + 2 * ETH_ALENcxx . . $ `include/aircrack-ng/crypto/crypto.h:77:9`!, pke + 35 - 23, 64); //-V512 |
| 253 | |
| 254 | if (keyver < 3) |
| 255 | { |
| 256 | SHA1_PRFcxx . . $ SHA1_PRF(b702a5cd4c733de9).((const uint8_tcxx . . $ uint8_t# *) (&pmk[vectorIdx]), |
| 257 | 32, |
| 258 | (const uint8_tcxx . . $ uint8_t# *) "Pairwise key expansion", |
| 259 | data, |
| 260 | 76, |
| 261 | &ptk[vectorIdx], |
| 262 | 4 * DIGEST_SHA1_MAC_LENcxx . . $ `include/aircrack-ng/crypto/sha1.h:72:9`!); |
| 263 | } |
| 264 | else |
| 265 | { |
| 266 | Digest_SHA256_PRF_Bitscxx . . $ Digest_SHA256_PRF_Bits(26c7e4f84f8d3d60).((const uint8_tcxx . . $ uint8_t# *) (&pmk[vectorIdx]), |
| 267 | 32, |
| 268 | (const uint8_tcxx . . $ uint8_t# *) "Pairwise key expansion", |
| 269 | data, |
| 270 | 76, |
| 271 | ptk, |
| 272 | 48 * CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`!); |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! void ac_crypto_engine_calc_miccxx . . $ ac_crypto_engine_calc_mic(6dc4199d9fc7ce2d).(ac_crypto_engine_tcxx . . $ ac_crypto_engine_t# * engine, |
| 277 | const uint8_tcxx . . $ uint8_t# eapol[256], |
| 278 | const uint32_tcxx . . $ uint32_t# eapol_size, |
| 279 | uint8_tcxx . . $ uint8_t# mic[MAX_KEYS_PER_CRYPT_SUPPORTEDcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:87:9`!] |
| 280 | [20], |
| 281 | const uint8_tcxx . . $ uint8_t# keyver, |
| 282 | const int vectorIdx, |
| 283 | const int threadid) |
| 284 | { |
| 285 | uint8_tcxx . . $ uint8_t# * ptk = engine->thread_datacxx . . $ ac_crypto_engine#thread_data.[threadid]->ptkcxx . . $ ac_crypto_engine_perthread#ptk.; |
| 286 | |
| 287 | if (keyver == 1) |
| 288 | MAC_HMAC_MD5cxx . . $ MAC_HMAC_MD5(31978f7f0f9137e4).(16, &ptk[vectorIdx], eapol_size, eapol, mic[vectorIdx]); |
| 289 | else if (keyver == 2) |
| 290 | MAC_HMAC_SHA1cxx . . $ MAC_HMAC_SHA1(31978f7f0f9137e4).(16, &ptk[vectorIdx], eapol_size, eapol, mic[vectorIdx]); |
| 291 | else if (keyver == 3) |
| 292 | { |
| 293 | const uint8_tcxx . . $ uint8_t# * addr[4]; |
| 294 | size_t len[4]; |
| 295 | |
| 296 | addr[0] = eapol; |
| 297 | len[0] = eapol_size; |
| 298 | MAC_OMAC1_AES_Vectorcxx . . $ MAC_OMAC1_AES_Vector(2564766a35c3f83a).( |
| 299 | 16, ptk, 1, addr, len, (uint8_tcxx . . $ uint8_t# *) &mic[vectorIdx]); |
| 300 | } |
| 301 | else |
| 302 | { |
| 303 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unsupported key version %d encountered.\n", keyver); |
| 304 | if (keyver == 0) fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "May be WPA3 - not yet supported.\n"); |
| 305 | abortcxx . . $ abort(8df32a62017fbbf6).(); |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! int ac_crypto_engine_wpa_crackcxx . . $ ac_crypto_engine_wpa_crack(ff48121e8727e033).( |
| 310 | ac_crypto_engine_tcxx . . $ ac_crypto_engine_t# * engine, |
| 311 | const wpapsk_passwordcxx . . $ wpapsk_password# key[MAX_KEYS_PER_CRYPT_SUPPORTEDcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:87:9`!], |
| 312 | const uint8_tcxx . . $ uint8_t# eapol[256], |
| 313 | const uint32_tcxx . . $ uint32_t# eapol_size, |
| 314 | uint8_tcxx . . $ uint8_t# mic[MAX_KEYS_PER_CRYPT_SUPPORTEDcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:87:9`!][20], |
| 315 | const uint8_tcxx . . $ uint8_t# keyver, |
| 316 | const uint8_tcxx . . $ uint8_t# cmpmic[20], |
| 317 | const int nparallel, |
| 318 | const int threadid) |
| 319 | { |
| 320 | ac_crypto_engine_calc_pmkcxx . . $ ac_crypto_engine_calc_pmk(2dd2f4b506657261).(engine, key, nparallel, threadid); |
| 321 | |
| 322 | for (int j = 0; j < nparallel; ++j) |
| 323 | { |
| 324 | /* compute the pairwise transient key and the frame MIC */ |
| 325 | |
| 326 | ac_crypto_engine_calc_ptkcxx . . $ ac_crypto_engine_calc_ptk(7072774f18c6680c).(engine, keyver, j, threadid); |
| 327 | |
| 328 | ac_crypto_engine_calc_miccxx . . $ ac_crypto_engine_calc_mic(6dc4199d9fc7ce2d).( |
| 329 | engine, eapol, eapol_size, mic, keyver, j, threadid); |
| 330 | |
| 331 | /* did we successfully crack it? */ |
| 332 | if (memcmpcxx . . $ memcmp(36f949851efa3055).(mic[j], cmpmic, 16) == 0) //-V512 |
| 333 | { |
| 334 | return j; |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | return -1; |
| 339 | } |
| 340 | |
| 341 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! void ac_crypto_engine_set_pmkid_saltcxx . . $ ac_crypto_engine_set_pmkid_salt(dfbc61f1e981dd16).(ac_crypto_engine_tcxx . . $ ac_crypto_engine_t# * engine, |
| 342 | const uint8_tcxx . . $ uint8_t# bssid[6], |
| 343 | const uint8_tcxx . . $ uint8_t# stmac[6], |
| 344 | int threadid) |
| 345 | { |
| 346 | uint8_tcxx . . $ uint8_t# * pke = engine->thread_datacxx . . $ ac_crypto_engine#thread_data.[threadid]->pkecxx . . $ ac_crypto_engine_perthread#pke.; |
| 347 | |
| 348 | assertcxx . . $ `/usr/include/assert.h:118:11`!(pke != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); //-V547 |
| 349 | |
| 350 | /* pre-compute the PMKID salt buffer */ |
| 351 | memcpycxx . . $ memcpy(cc817cb175f282d).(pke, "PMK Name", 8); |
| 352 | memcpycxx . . $ memcpy(cc817cb175f282d).(pke + 8, bssid, 6); |
| 353 | memcpycxx . . $ memcpy(cc817cb175f282d).(pke + 14, stmac, 6); |
| 354 | } |
| 355 | |
| 356 | EXPORTcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:50:9`! int ac_crypto_engine_wpa_pmkid_crackcxx . . $ ac_crypto_engine_wpa_pmkid_crack(b1a438703a79cebf).( |
| 357 | ac_crypto_engine_tcxx . . $ ac_crypto_engine_t# * engine, |
| 358 | const wpapsk_passwordcxx . . $ wpapsk_password# key[MAX_KEYS_PER_CRYPT_SUPPORTEDcxx . . $ `include/aircrack-ng/ce-wpa/crypto_engine.h:87:9`!], |
| 359 | const uint8_tcxx . . $ uint8_t# pmkid[32], |
| 360 | const int nparallel, |
| 361 | const int threadid) |
| 362 | { |
| 363 | ac_crypto_engine_calc_pmkcxx . . $ ac_crypto_engine_calc_pmk(2dd2f4b506657261).(engine, key, nparallel, threadid); |
| 364 | |
| 365 | uint8_tcxx . . $ uint8_t# * pke = engine->thread_datacxx . . $ ac_crypto_engine#thread_data.[threadid]->pkecxx . . $ ac_crypto_engine_perthread#pke.; |
| 366 | wpapsk_hashcxx . . $ wpapsk_hash# * pmk = engine->thread_datacxx . . $ ac_crypto_engine#thread_data.[threadid]->pmkcxx . . $ ac_crypto_engine_perthread#pmk.; |
| 367 | uint8_tcxx . . $ uint8_t# l_pmkid[DIGEST_SHA1_MAC_LENcxx . . $ `include/aircrack-ng/crypto/sha1.h:72:9`!]; |
| 368 | |
| 369 | for (int j = 0; j < nparallel; ++j) |
| 370 | { |
| 371 | MAC_HMAC_SHA1cxx . . $ MAC_HMAC_SHA1(31978f7f0f9137e4).(32, (const uint8_tcxx . . $ uint8_t# *) &pmk[j], 20, pke, l_pmkid); |
| 372 | |
| 373 | /* did we successfully crack it? */ |
| 374 | if (memcmpcxx . . $ memcmp(36f949851efa3055).(l_pmkid, pmkid, 16) == 0) //-V512 |
| 375 | { |
| 376 | return j; |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | return -1; |
| 381 | } |