003 File Manager
Current Path:
/usr/src/contrib/wpa/src/eap_common
usr
/
src
/
contrib
/
wpa
/
src
/
eap_common
/
📁
..
📄
chap.c
(602 B)
📄
chap.h
(388 B)
📄
eap_common.c
(7.31 KB)
📄
eap_common.h
(905 B)
📄
eap_defs.h
(3.43 KB)
📄
eap_eke_common.c
(16.75 KB)
📄
eap_eke_common.h
(3.47 KB)
📄
eap_fast_common.c
(7.19 KB)
📄
eap_fast_common.h
(2.87 KB)
📄
eap_gpsk_common.c
(14.28 KB)
📄
eap_gpsk_common.h
(2 KB)
📄
eap_ikev2_common.c
(2.78 KB)
📄
eap_ikev2_common.h
(832 B)
📄
eap_pax_common.c
(4.4 KB)
📄
eap_pax_common.h
(2.2 KB)
📄
eap_peap_common.c
(1.74 KB)
📄
eap_peap_common.h
(425 B)
📄
eap_psk_common.c
(1.52 KB)
📄
eap_psk_common.h
(1.72 KB)
📄
eap_pwd_common.c
(12.25 KB)
📄
eap_pwd_common.h
(2.62 KB)
📄
eap_sake_common.c
(10.64 KB)
📄
eap_sake_common.h
(2.41 KB)
📄
eap_sim_common.c
(31.96 KB)
📄
eap_sim_common.h
(7.62 KB)
📄
eap_teap_common.c
(20.43 KB)
📄
eap_teap_common.h
(5.67 KB)
📄
eap_tlv_common.h
(2.57 KB)
📄
eap_ttls.h
(1.58 KB)
📄
eap_wsc_common.c
(784 B)
📄
eap_wsc_common.h
(644 B)
📄
ikev2_common.c
(17.17 KB)
📄
ikev2_common.h
(8.11 KB)
Editing: eap_peap_common.c
/* * EAP-PEAP common routines * Copyright (c) 2008-2011, Jouni Malinen <j@w1.fi> * * This software may be distributed under the terms of the BSD license. * See README for more details. */ #include "includes.h" #include "common.h" #include "crypto/sha1.h" #include "eap_peap_common.h" int peap_prfplus(int version, const u8 *key, size_t key_len, const char *label, const u8 *seed, size_t seed_len, u8 *buf, size_t buf_len) { unsigned char counter = 0; size_t pos, plen; u8 hash[SHA1_MAC_LEN]; size_t label_len = os_strlen(label); u8 extra[2]; const unsigned char *addr[5]; size_t len[5]; addr[0] = hash; len[0] = 0; addr[1] = (unsigned char *) label; len[1] = label_len; addr[2] = seed; len[2] = seed_len; if (version == 0) { /* * PRF+(K, S, LEN) = T1 | T2 | ... | Tn * T1 = HMAC-SHA1(K, S | 0x01 | 0x00 | 0x00) * T2 = HMAC-SHA1(K, T1 | S | 0x02 | 0x00 | 0x00) * ... * Tn = HMAC-SHA1(K, Tn-1 | S | n | 0x00 | 0x00) */ extra[0] = 0; extra[1] = 0; addr[3] = &counter; len[3] = 1; addr[4] = extra; len[4] = 2; } else { /* * PRF (K,S,LEN) = T1 | T2 | T3 | T4 | ... where: * T1 = HMAC-SHA1(K, S | LEN | 0x01) * T2 = HMAC-SHA1 (K, T1 | S | LEN | 0x02) * T3 = HMAC-SHA1 (K, T2 | S | LEN | 0x03) * T4 = HMAC-SHA1 (K, T3 | S | LEN | 0x04) * ... */ extra[0] = buf_len & 0xff; addr[3] = extra; len[3] = 1; addr[4] = &counter; len[4] = 1; } pos = 0; while (pos < buf_len) { counter++; plen = buf_len - pos; if (hmac_sha1_vector(key, key_len, 5, addr, len, hash) < 0) return -1; if (plen >= SHA1_MAC_LEN) { os_memcpy(&buf[pos], hash, SHA1_MAC_LEN); pos += SHA1_MAC_LEN; } else { os_memcpy(&buf[pos], hash, plen); break; } len[0] = SHA1_MAC_LEN; } return 0; }
Upload File
Create Folder