libwifi 0.0.3
An 802.11 Frame Parsing and Generation library in C
security.c
Go to the documentation of this file.
1/* Copyright 2021 The libwifi Authors
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#include "security.h"
17#include "../../core/misc/byteswap.h"
18
19#include <errno.h>
20#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
23
32int libwifi_get_rsn_info(struct libwifi_rsn_info *info, const unsigned char *tag_data,
33 const unsigned char *tag_end) {
34 memset(info, 0, sizeof(struct libwifi_rsn_info));
35
36 // Create a pointer we can manipulate from the tag data
37 unsigned char *data = (unsigned char *) tag_data;
38
39 // Handle the RSN Version
40 memcpy(&info->rsn_version, data, sizeof(info->rsn_version));
41 data += sizeof(info->rsn_version);
42
43 // Handle the RSN Group Cipher Suites
44 memcpy(&info->group_cipher_suite, data, sizeof(struct libwifi_cipher_suite));
45 data += sizeof(struct libwifi_cipher_suite);
46
47 // Bounds check and handle the RSN Pairwise Ciphers
48 if (data > tag_end) {
49 return -EINVAL;
50 }
51 if ((data + sizeof(uint16_t)) > tag_end) {
52 return -EINVAL;
53 }
54 uint16_t suite_count = *data;
55 if (suite_count > LIBWIFI_MAX_CIPHER_SUITES) {
56 suite_count = LIBWIFI_MAX_CIPHER_SUITES;
57 }
58 data += sizeof(suite_count);
59 if ((((suite_count * sizeof(struct libwifi_cipher_suite)) + data)) > tag_end) {
60 return -EINVAL;
61 }
62 info->num_pairwise_cipher_suites = suite_count;
63
64 // Iterate through the found Pairwise Ciphers, adding them each time
65 struct wifi_cipher_suite *cur_cipher_suite = NULL;
66 for (int i = 0; i < suite_count; ++i) {
67 if (data > tag_end) {
68 return -EINVAL;
69 }
70 cur_cipher_suite = (struct wifi_cipher_suite *) data;
71 memcpy(&info->pairwise_cipher_suites[i], cur_cipher_suite, sizeof(struct libwifi_cipher_suite));
73 data += sizeof(struct libwifi_cipher_suite);
74 }
75
76 // Bounds check and handle the RSN Authentication Key Management Suites
77 if ((data + sizeof(suite_count)) > tag_end) {
78 return -EINVAL;
79 }
80 suite_count = *data;
81 if (suite_count > LIBWIFI_MAX_CIPHER_SUITES) {
82 suite_count = LIBWIFI_MAX_CIPHER_SUITES;
83 }
84 data += sizeof(suite_count);
85 if ((((suite_count * sizeof(struct libwifi_cipher_suite)) + data)) > tag_end) {
86 return -EINVAL;
87 }
88 info->num_auth_key_mgmt_suites = suite_count;
89
90 // Iterate through the found Auth Key Management Suites, adding them each time
91 for (int i = 0; i < suite_count; ++i) {
92 if (data > tag_end) {
93 return -EINVAL;
94 }
95 cur_cipher_suite = (struct wifi_cipher_suite *) data;
96 memcpy(&info->auth_key_mgmt_suites[i], cur_cipher_suite, sizeof(struct libwifi_cipher_suite));
98 data += sizeof(struct libwifi_cipher_suite);
99 }
100
101 // Bounds check and handle the RSN Capabilities field
102 if (data > tag_end) {
103 return -EINVAL;
104 }
105 memcpy(&info->rsn_capabilities, data, sizeof(info->rsn_capabilities));
106
107 return 0;
108}
109
123void libwifi_enumerate_rsn_suites(struct libwifi_rsn_info *rsn_info, struct libwifi_bss *bss) {
124 switch (rsn_info->group_cipher_suite.suite_type) {
127 break;
130 break;
133 break;
136 break;
139 break;
142 break;
145 break;
148 break;
151 break;
154 break;
157 break;
160 break;
163 break;
164 default:
165 break;
166 }
167
168 for (int i = 0; i < rsn_info->num_pairwise_cipher_suites; ++i) {
169 if ((memcmp(rsn_info->pairwise_cipher_suites[i].oui, CIPHER_SUITE_OUI, 3) == 0)) {
170 switch (rsn_info->pairwise_cipher_suites[i].suite_type) {
173 break;
176 break;
179 break;
182 break;
185 break;
188 break;
191 break;
194 break;
197 break;
200 break;
203 break;
206 break;
207 default:
208 break;
209 }
210 }
211 }
212
213 for (int i = 0; i < rsn_info->num_auth_key_mgmt_suites; ++i) {
214 if (memcmp(rsn_info->auth_key_mgmt_suites[i].oui, CIPHER_SUITE_OUI, 3) == 0) {
215 switch (rsn_info->auth_key_mgmt_suites[i].suite_type) {
217 bss->encryption_info |= WPA2;
219 break;
220 case AKM_SUITE_1X:
221 bss->encryption_info |= WPA2;
223 break;
224 case AKM_SUITE_PSK:
225 bss->encryption_info |= WPA2;
227 break;
228 case AKM_SUITE_1X_FT:
229 bss->encryption_info |= WPA2;
231 break;
232 case AKM_SUITE_PSK_FT:
233 bss->encryption_info |= WPA2;
235 break;
237 bss->encryption_info |= WPA2;
239 break;
241 bss->encryption_info |= WPA2;
243 break;
244 case AKM_SUITE_TDLS:
245 bss->encryption_info |= WPA2;
247 break;
248 case AKM_SUITE_SAE:
249 bss->encryption_info |= WPA3;
251 break;
252 case AKM_SUITE_SAE_FT:
253 bss->encryption_info |= WPA3;
255 break;
257 bss->encryption_info |= WPA3;
259 break;
261 bss->encryption_info |= WPA3;
263 break;
265 bss->encryption_info |= WPA3;
267 break;
269 bss->encryption_info |= WPA3;
271 break;
273 bss->encryption_info |= WPA2;
275 break;
277 bss->encryption_info |= WPA3;
279 break;
281 bss->encryption_info |= WPA2;
283 break;
285 bss->encryption_info |= WPA3;
287 break;
288 case AKM_SUITE_OWE:
289 bss->encryption_info |= WPA3;
291 break;
293 bss->encryption_info |= WPA3;
295 break;
296 case AKM_PSK_SHA384:
297 bss->encryption_info |= WPA3;
299 break;
300 default:
301 break;
302 }
303 }
304 }
305}
306
315int libwifi_get_wpa_info(struct libwifi_wpa_info *info, const unsigned char *tag_data,
316 const unsigned char *tag_end) {
317 memset(info, 0, sizeof(struct libwifi_wpa_info));
318
319 // Create a pointer we can manipulate from the tag data
320 unsigned char *data = ((unsigned char *) tag_data);
321
322 // Handle the WPA Version
323 memcpy(&info->wpa_version, data, sizeof(info->wpa_version));
324 data += sizeof(info->wpa_version);
325
326 // Handle the WPA Multicast Cipher Suite
327 memcpy(&info->multicast_cipher_suite, data, sizeof(struct libwifi_cipher_suite));
328 data += sizeof(struct libwifi_cipher_suite);
329
330 // Bounds check and handle the WPA Unicast Cipher Suites
331 if (data > tag_end) {
332 return -EINVAL;
333 }
334 if ((data + sizeof(uint16_t)) > tag_end) {
335 return -EINVAL;
336 }
337 uint16_t suite_count = *data;
338 if (suite_count > LIBWIFI_MAX_CIPHER_SUITES) {
339 suite_count = LIBWIFI_MAX_CIPHER_SUITES;
340 }
341 data += sizeof(suite_count);
342 if ((((suite_count * sizeof(struct libwifi_cipher_suite)) + data)) > tag_end) {
343 return -EINVAL;
344 }
345 info->num_unicast_cipher_suites = suite_count;
346
347 // Iterate through the found Unicast Ciphers, adding them each time
348 struct wifi_cipher_suite *cur_cipher_suite = NULL;
349 for (int i = 0; i < suite_count; ++i) {
350 if (data > tag_end) {
351 return -EINVAL;
352 }
353 cur_cipher_suite = (struct wifi_cipher_suite *) data;
354 memcpy(&info->unicast_cipher_suites[i], cur_cipher_suite, sizeof(struct libwifi_cipher_suite));
356 data += sizeof(struct libwifi_cipher_suite);
357 }
358
359 // Bounds check and handle the WPA Authentication Key Management Suites
360 if ((data + sizeof(suite_count)) > tag_end) {
361 return -EINVAL;
362 }
363 suite_count = *data;
364 if (suite_count > LIBWIFI_MAX_CIPHER_SUITES) {
365 suite_count = LIBWIFI_MAX_CIPHER_SUITES;
366 }
367 data += sizeof(suite_count);
368 if ((((suite_count * sizeof(struct libwifi_cipher_suite)) + data)) > tag_end) {
369 return -EINVAL;
370 }
371 info->num_auth_key_mgmt_suites = suite_count;
372
373 // Iterate through the found Auth Key Management Suites, adding them each time
374 for (int i = 0; i < suite_count; ++i) {
375 if (data > tag_end) {
376 return -EINVAL;
377 }
378 cur_cipher_suite = (struct wifi_cipher_suite *) data;
379 memcpy(&info->auth_key_mgmt_suites[i], cur_cipher_suite, sizeof(struct libwifi_cipher_suite));
381 data += sizeof(struct libwifi_cipher_suite);
382 }
383
384 return 0;
385}
386
399void libwifi_enumerate_wpa_suites(struct libwifi_wpa_info *wpa_info, struct libwifi_bss *bss) {
400 switch (wpa_info->multicast_cipher_suite.suite_type) {
403 break;
406 break;
409 break;
412 break;
413 default:
414 break;
415 }
416
417 for (int i = 0; i < wpa_info->num_unicast_cipher_suites; ++i) {
418 if ((memcmp(wpa_info->unicast_cipher_suites[i].oui, MICROSOFT_OUI, 3) == 0)) {
419 switch (wpa_info->unicast_cipher_suites[i].suite_type) {
422 break;
425 break;
428 break;
431 break;
434 break;
435 default:
436 break;
437 }
438 }
439 }
440
441 for (int i = 0; i < wpa_info->num_auth_key_mgmt_suites; ++i) {
442 if (memcmp(wpa_info->auth_key_mgmt_suites[i].oui, MICROSOFT_OUI, 3) == 0) {
443 switch (wpa_info->auth_key_mgmt_suites[i].suite_type) {
445 bss->encryption_info |= WPA;
447 break;
448 case AKM_SUITE_1X:
449 bss->encryption_info |= WPA;
451 break;
452 case AKM_SUITE_PSK:
453 bss->encryption_info |= WPA;
455 break;
456 case AKM_SUITE_1X_FT:
457 bss->encryption_info |= WPA;
459 break;
460 case AKM_SUITE_PSK_FT:
461 bss->encryption_info |= WPA;
463 break;
464 }
465 }
466 }
467}
468
469void libwifi_get_security_type(struct libwifi_bss *bss, char *buf) {
470 memset(buf, 0, LIBWIFI_SECURITY_BUF_LEN);
471
472 int offset = 0;
473 int append = 0;
474
475 if (bss->encryption_info == 0) {
476 snprintf(buf, LIBWIFI_SECURITY_BUF_LEN, "None");
477 return;
478 }
479
480 if (bss->encryption_info & WPA3) {
481 _libwifi_add_sec_item(buf, &offset, &append, "WPA3");
482 }
483 if (bss->encryption_info & WPA2) {
484 _libwifi_add_sec_item(buf, &offset, &append, "WPA2");
485 }
486 if (bss->encryption_info & WPA) {
487 _libwifi_add_sec_item(buf, &offset, &append, "WPA");
488 }
489 if (bss->encryption_info & WEP) {
490 _libwifi_add_sec_item(buf, &offset, &append, "WEP");
491 }
492}
493
494void libwifi_get_group_ciphers(struct libwifi_bss *bss, char *buf) {
495 memset(buf, 0, LIBWIFI_SECURITY_BUF_LEN);
496
497 int offset = 0;
498 int append = 0;
499
500 if (bss->encryption_info == 0) {
501 snprintf(buf + offset, LIBWIFI_SECURITY_BUF_LEN, "None");
502 return;
503 }
504
506 _libwifi_add_sec_item(buf, &offset, &append, "WEP40");
507 }
509 _libwifi_add_sec_item(buf, &offset, &append, "TKIP");
510 }
512 _libwifi_add_sec_item(buf, &offset, &append, "RESERVED");
513 }
515 _libwifi_add_sec_item(buf, &offset, &append, "CCMP128");
516 }
518 _libwifi_add_sec_item(buf, &offset, &append, "WEP104");
519 }
521 _libwifi_add_sec_item(buf, &offset, &append, "BIP_CMAC128");
522 }
524 _libwifi_add_sec_item(buf, &offset, &append, "NOT_ALLOWED");
525 }
527 _libwifi_add_sec_item(buf, &offset, &append, "GCMP128");
528 }
530 _libwifi_add_sec_item(buf, &offset, &append, "GCMP256");
531 }
533 _libwifi_add_sec_item(buf, &offset, &append, "CCMP256");
534 }
536 _libwifi_add_sec_item(buf, &offset, &append, "BIP_GMAC128");
537 }
539 _libwifi_add_sec_item(buf, &offset, &append, "BIP_GMAC256");
540 }
542 _libwifi_add_sec_item(buf, &offset, &append, "BIP_CMAC256");
543 }
544}
545
546void libwifi_get_pairwise_ciphers(struct libwifi_bss *bss, char *buf) {
547 memset(buf, 0, LIBWIFI_SECURITY_BUF_LEN);
548
549 int offset = 0;
550 int append = 0;
551
552 if (bss->encryption_info == 0) {
553 snprintf(buf + offset, LIBWIFI_SECURITY_BUF_LEN, "None");
554 return;
555 }
556
558 _libwifi_add_sec_item(buf, &offset, &append, "GROUP");
559 }
561 _libwifi_add_sec_item(buf, &offset, &append, "WEP40");
562 }
564 _libwifi_add_sec_item(buf, &offset, &append, "TKIP");
565 }
567 _libwifi_add_sec_item(buf, &offset, &append, "RESERVED");
568 }
570 _libwifi_add_sec_item(buf, &offset, &append, "CCMP128");
571 }
573 _libwifi_add_sec_item(buf, &offset, &append, "WEP104");
574 }
576 _libwifi_add_sec_item(buf, &offset, &append, "BIP_CMAC128");
577 }
579 _libwifi_add_sec_item(buf, &offset, &append, "NOT_ALLOWED");
580 }
582 _libwifi_add_sec_item(buf, &offset, &append, "GCMP128");
583 }
585 _libwifi_add_sec_item(buf, &offset, &append, "GCMP256");
586 }
588 _libwifi_add_sec_item(buf, &offset, &append, "CCMP256");
589 }
591 _libwifi_add_sec_item(buf, &offset, &append, "BIP_GMAC128");
592 }
594 _libwifi_add_sec_item(buf, &offset, &append, "BIP_GMAC256");
595 }
597 _libwifi_add_sec_item(buf, &offset, &append, "BIP_CMAC256");
598 }
599}
600
601void libwifi_get_auth_key_suites(struct libwifi_bss *bss, char *buf) {
602 memset(buf, 0, LIBWIFI_SECURITY_BUF_LEN);
603
604 int offset = 0;
605 int append = 0;
606
607 if (bss->encryption_info == 0) {
608 snprintf(buf + offset, LIBWIFI_SECURITY_BUF_LEN, "None");
609 return;
610 }
611
613 _libwifi_add_sec_item(buf, &offset, &append, "RESERVED");
614 }
616 _libwifi_add_sec_item(buf, &offset, &append, "802.1X");
617 }
619 _libwifi_add_sec_item(buf, &offset, &append, "PSK");
620 }
622 _libwifi_add_sec_item(buf, &offset, &append, "802.1X_FT");
623 }
625 _libwifi_add_sec_item(buf, &offset, &append, "PSK_FT");
626 }
628 _libwifi_add_sec_item(buf, &offset, &append, "802.1X_SHA256");
629 }
631 _libwifi_add_sec_item(buf, &offset, &append, "PSK_SHA256");
632 }
634 _libwifi_add_sec_item(buf, &offset, &append, "TDLS");
635 }
637 _libwifi_add_sec_item(buf, &offset, &append, "SAE");
638 }
640 _libwifi_add_sec_item(buf, &offset, &append, "SAE_FT");
641 }
643 _libwifi_add_sec_item(buf, &offset, &append, "AP_PEER");
644 }
646 _libwifi_add_sec_item(buf, &offset, &append, "802.1X_SUITEB_SHA256");
647 }
649 _libwifi_add_sec_item(buf, &offset, &append, "802.1X_SUITEB_SHA384");
650 }
652 _libwifi_add_sec_item(buf, &offset, &append, "802.1X_FT_SHA384");
653 }
655 _libwifi_add_sec_item(buf, &offset, &append, "FILS_SHA256");
656 }
658 _libwifi_add_sec_item(buf, &offset, &append, "FILS_SHA384");
659 }
661 _libwifi_add_sec_item(buf, &offset, &append, "FILS_SHA256_FT");
662 }
664 _libwifi_add_sec_item(buf, &offset, &append, "FILS_SHA384_FT");
665 }
667 _libwifi_add_sec_item(buf, &offset, &append, "OWE");
668 }
670 _libwifi_add_sec_item(buf, &offset, &append, "PSK_SHA384_FT");
671 }
673 _libwifi_add_sec_item(buf, &offset, &append, "PSK_SHA384");
674 }
675}
676
677void _libwifi_add_sec_item(char *buf, int *offset, int *append, char *item) {
678 if (*append) {
679 snprintf(buf + *offset, LIBWIFI_SECURITY_BUF_LEN, ", ");
680 *offset += strlen(", ");
681 }
682 snprintf(buf + *offset, LIBWIFI_SECURITY_BUF_LEN, "%s", item);
683 *offset += strlen(item);
684 *append = 1;
685}
#define LIBWIFI_AKM_SUITE_1X_FT_SHA384
Definition: security.h:136
#define AKM_SUITE_1X_FT_SHA384
Definition: security.h:69
#define AKM_SUITE_PSK_SHA256
Definition: security.h:62
#define CIPHER_SUITE_RESERVED
Definition: security.h:43
#define AKM_SUITE_1X_FT
Definition: security.h:59
#define AKM_SUITE_PSK_FT
Definition: security.h:60
#define LIBWIFI_GROUP_CIPHER_SUITE_RESERVED
Definition: security.h:94
#define LIBWIFI_GROUP_CIPHER_SUITE_CCMP128
Definition: security.h:95
#define CIPHER_SUITE_WEP40
Definition: security.h:41
#define LIBWIFI_AKM_SUITE_1X_FT
Definition: security.h:126
#define AKM_SUITE_SAE
Definition: security.h:64
#define LIBWIFI_PAIRWISE_CIPHER_SUITE_RESERVED
Definition: security.h:110
#define CIPHER_SUITE_BIP_CMAC256
Definition: security.h:53
#define LIBWIFI_PAIRWISE_CIPHER_SUITE_BIP_CMAC128
Definition: security.h:113
#define CIPHER_SUITE_GCMP256
Definition: security.h:49
#define AKM_SUITE_1X
Definition: security.h:57
#define LIBWIFI_AKM_SUITE_OWE
Definition: security.h:141
#define LIBWIFI_GROUP_CIPHER_SUITE_GCMP256
Definition: security.h:100
#define LIBWIFI_AKM_SUITE_FILS_SHA384_FT
Definition: security.h:140
#define CIPHER_SUITE_WEP104
Definition: security.h:45
#define WEP
Definition: security.h:86
#define LIBWIFI_PAIRWISE_CIPHER_SUITE_TKIP
Definition: security.h:109
#define CIPHER_SUITE_OUI
Definition: security.h:32
#define LIBWIFI_PAIRWISE_CIPHER_SUITE_GCMP256
Definition: security.h:116
#define LIBWIFI_GROUP_CIPHER_SUITE_CCMP256
Definition: security.h:101
#define LIBWIFI_AKM_SUITE_1X_SUITEB_SHA256
Definition: security.h:134
#define LIBWIFI_MAX_CIPHER_SUITES
Definition: security.h:28
#define LIBWIFI_AKM_SUITE_FILS_SHA256_FT
Definition: security.h:139
#define WPA
Definition: security.h:87
#define LIBWIFI_GROUP_CIPHER_SUITE_TKIP
Definition: security.h:93
#define CIPHER_SUITE_NOTALLOWED
Definition: security.h:47
#define LIBWIFI_GROUP_CIPHER_SUITE_WEP104
Definition: security.h:96
#define AKM_SUITE_TDLS
Definition: security.h:63
#define AKM_SUITE_1X_SUITEB_SHA256
Definition: security.h:67
#define LIBWIFI_PAIRWISE_SUITE_GROUP
Definition: security.h:107
#define LIBWIFI_AKM_SUITE_PSK
Definition: security.h:125
#define AKM_PSK_SHA384_FT
Definition: security.h:75
#define AKM_PSK_SHA384
Definition: security.h:76
#define AKM_SUITE_OWE
Definition: security.h:74
#define LIBWIFI_AKM_SUITE_1X_SHA256
Definition: security.h:128
#define LIBWIFI_PAIRWISE_CIPHER_SUITE_BIP_GMAC256
Definition: security.h:119
#define LIBWIFI_AKM_SUITE_PSK_SHA256
Definition: security.h:129
#define CIPHER_SUITE_BIP_CMAC128
Definition: security.h:46
#define AKM_SUITE_FILS_SHA384
Definition: security.h:71
#define WPA2
Definition: security.h:88
#define CIPHER_SUITE_CCMP128
Definition: security.h:44
#define LIBWIFI_GROUP_CIPHER_SUITE_BIP_CMAC256
Definition: security.h:104
#define LIBWIFI_AKM_SUITE_1X_SUITEB_SHA384
Definition: security.h:135
#define LIBWIFI_PAIRWISE_CIPHER_SUITE_NOTALLOWED
Definition: security.h:114
#define CIPHER_SUITE_CCMP256
Definition: security.h:50
#define LIBWIFI_PAIRWISE_CIPHER_SUITE_CCMP256
Definition: security.h:117
#define AKM_SUITE_1X_SUITEB_SHA384
Definition: security.h:68
#define LIBWIFI_AKM_SUITE_FILS_SHA256
Definition: security.h:137
#define LIBWIFI_PAIRWISE_CIPHER_SUITE_WEP40
Definition: security.h:108
#define CIPHER_SUITE_BIP_GMAC256
Definition: security.h:52
#define CIPHER_SUITE_TKIP
Definition: security.h:42
#define AKM_SUITE_PSK
Definition: security.h:58
#define LIBWIFI_PAIRWISE_CIPHER_SUITE_BIP_CMAC256
Definition: security.h:120
#define AKM_SUITE_SAE_FT
Definition: security.h:65
#define LIBWIFI_GROUP_CIPHER_SUITE_BIP_GMAC128
Definition: security.h:102
#define AKM_SUITE_AP_PEER
Definition: security.h:66
#define CIPHER_SUITE_GROUP
Definition: security.h:40
#define LIBWIFI_AKM_SUITE_SAE_FT
Definition: security.h:132
#define LIBWIFI_AKM_SUITE_SAE
Definition: security.h:131
#define LIBWIFI_AKM_SUITE_AP_PEER
Definition: security.h:133
#define WPA3
Definition: security.h:89
#define LIBWIFI_GROUP_CIPHER_SUITE_WEP40
Definition: security.h:92
#define LIBWIFI_AKM_SUITE_FILS_SHA384
Definition: security.h:138
#define LIBWIFI_AKM_SUITE_RESERVED
Definition: security.h:123
#define LIBWIFI_AKM_SUITE_TDLS
Definition: security.h:130
#define LIBWIFI_PAIRWISE_CIPHER_SUITE_GCMP128
Definition: security.h:115
#define LIBWIFI_AKM_SUITE_1X
Definition: security.h:124
#define AKM_SUITE_FILS_SHA384_FT
Definition: security.h:73
#define LIBWIFI_AKM_PSK_SHA384
Definition: security.h:143
#define CIPHER_SUITE_BIP_GMAC128
Definition: security.h:51
#define LIBWIFI_GROUP_CIPHER_SUITE_BIP_CMAC128
Definition: security.h:97
#define LIBWIFI_GROUP_CIPHER_SUITE_NOTALLOWED
Definition: security.h:98
#define AKM_SUITE_RESERVED
Definition: security.h:56
#define LIBWIFI_PAIRWISE_CIPHER_SUITE_WEP104
Definition: security.h:112
#define LIBWIFI_PAIRWISE_CIPHER_SUITE_CCMP128
Definition: security.h:111
#define AKM_SUITE_FILS_SHA256_FT
Definition: security.h:72
#define LIBWIFI_AKM_PSK_SHA384_FT
Definition: security.h:142
#define AKM_SUITE_FILS_SHA256
Definition: security.h:70
#define MICROSOFT_OUI
Definition: security.h:31
#define LIBWIFI_AKM_SUITE_PSK_FT
Definition: security.h:127
#define AKM_SUITE_1X_SHA256
Definition: security.h:61
#define LIBWIFI_GROUP_CIPHER_SUITE_BIP_GMAC256
Definition: security.h:103
#define LIBWIFI_GROUP_CIPHER_SUITE_GCMP128
Definition: security.h:99
#define CIPHER_SUITE_GCMP128
Definition: security.h:48
#define LIBWIFI_PAIRWISE_CIPHER_SUITE_BIP_GMAC128
Definition: security.h:118
#define LIBWIFI_SECURITY_BUF_LEN
Definition: security.h:24
void _libwifi_add_sec_item(char *buf, int *offset, int *append, char *item)
Internal function for adding a formatted string to a buffer for use with libwifi_get_* security funct...
Definition: security.c:677
void libwifi_get_group_ciphers(struct libwifi_bss *bss, char *buf)
Enumerate the group ciphers (CCMP, GCMP128, etc) in a given libwifi_bss, formatted into the given buf...
Definition: security.c:494
void libwifi_enumerate_rsn_suites(struct libwifi_rsn_info *rsn_info, struct libwifi_bss *bss)
This function will enumerate over a supplied struct libwifi_rsn_info and write the following into a s...
Definition: security.c:123
void libwifi_get_security_type(struct libwifi_bss *bss, char *buf)
Enumerate the security types (WEP, WPA, WPA2, WPA3, etc) in a given libwifi_bss, formatted into the g...
Definition: security.c:469
int libwifi_get_wpa_info(struct libwifi_wpa_info *info, const unsigned char *tag_data, const unsigned char *tag_end)
Similar to libwifi_get_rsn_info, WPA Information is supplied via the raw tag data.
Definition: security.c:315
int libwifi_get_rsn_info(struct libwifi_rsn_info *info, const unsigned char *tag_data, const unsigned char *tag_end)
RSN Information is supplied via the raw tag data.
Definition: security.c:32
void libwifi_get_pairwise_ciphers(struct libwifi_bss *bss, char *buf)
Enumerate the pairwise ciphers (GROUP, CCMP, BIP_CMAC128, etc) in a given libwifi_bss,...
Definition: security.c:546
void libwifi_get_auth_key_suites(struct libwifi_bss *bss, char *buf)
Enumerate the auth key management suites in a given libwifi_bss, formatted into the given buffer.
Definition: security.c:601
void libwifi_enumerate_wpa_suites(struct libwifi_wpa_info *wpa_info, struct libwifi_bss *bss)
Similarly to libwifi_enumerate_wpa_suites, this function will enumerate over a supplied struct libwif...
Definition: security.c:399
uint64_t encryption_info
Definition: common.h:52
libwifi Representation of a WPA or RSN cipher suite ┌────────────────────────┬────────────┐ │ OUI │ S...
Definition: security.h:172
unsigned char oui[3]
Definition: security.h:173
libwifi Representation of a 802.11 RSN Information Element ┌───────────────────────────────────┐ │ Ve...
Definition: security.h:220
uint16_t rsn_capabilities
Definition: security.h:227
int num_pairwise_cipher_suites
Definition: security.h:223
int num_auth_key_mgmt_suites
Definition: security.h:225
struct libwifi_cipher_suite auth_key_mgmt_suites[LIBWIFI_MAX_CIPHER_SUITES]
Definition: security.h:226
struct libwifi_cipher_suite pairwise_cipher_suites[LIBWIFI_MAX_CIPHER_SUITES]
Definition: security.h:224
struct libwifi_cipher_suite group_cipher_suite
Definition: security.h:222
uint16_t rsn_version
Definition: security.h:221
libwifi Representation of a Microsoft WPA Information Element ┌───────────────────────────────────┐ │...
Definition: security.h:193
struct libwifi_cipher_suite unicast_cipher_suites[LIBWIFI_MAX_CIPHER_SUITES]
Definition: security.h:197
struct libwifi_cipher_suite multicast_cipher_suite
Definition: security.h:195
uint16_t num_unicast_cipher_suites
Definition: security.h:196
struct libwifi_cipher_suite auth_key_mgmt_suites[LIBWIFI_MAX_CIPHER_SUITES]
Definition: security.h:199
uint16_t num_auth_key_mgmt_suites
Definition: security.h:198
uint16_t wpa_version
Definition: security.h:194