003 File Manager
Current Path:
/usr/src/contrib/wpa/src/crypto
usr
/
src
/
contrib
/
wpa
/
src
/
crypto
/
📁
..
📄
aes-cbc.c
(1.93 KB)
📄
aes-ccm.c
(4.92 KB)
📄
aes-ctr.c
(1.64 KB)
📄
aes-eax.c
(3.24 KB)
📄
aes-encblock.c
(704 B)
📄
aes-gcm.c
(6.47 KB)
📄
aes-internal-dec.c
(3.64 KB)
📄
aes-internal-enc.c
(2.66 KB)
📄
aes-internal.c
(41.23 KB)
📄
aes-omac1.c
(4.46 KB)
📄
aes-siv.c
(4.06 KB)
📄
aes-unwrap.c
(1.78 KB)
📄
aes-wrap.c
(1.62 KB)
📄
aes.h
(548 B)
📄
aes_i.h
(4.16 KB)
📄
aes_siv.h
(565 B)
📄
aes_wrap.h
(2.91 KB)
📄
crypto.h
(28.61 KB)
📄
crypto_gnutls.c
(11.42 KB)
📄
crypto_internal-cipher.c
(5.08 KB)
📄
crypto_internal-modexp.c
(2.95 KB)
📄
crypto_internal-rsa.c
(2.81 KB)
📄
crypto_internal.c
(6.84 KB)
📄
crypto_libtomcrypt.c
(15.07 KB)
📄
crypto_linux.c
(21.77 KB)
📄
crypto_module_tests.c
(61.19 KB)
📄
crypto_nettle.c
(9.7 KB)
📄
crypto_none.c
(461 B)
📄
crypto_openssl.c
(44.34 KB)
📄
crypto_wolfssl.c
(33.91 KB)
📄
des-internal.c
(14.83 KB)
📄
des_i.h
(709 B)
📄
dh_group5.c
(806 B)
📄
dh_group5.h
(556 B)
📄
dh_groups.c
(54.26 KB)
📄
dh_groups.h
(692 B)
📄
fips_prf_internal.c
(1.37 KB)
📄
fips_prf_openssl.c
(2.05 KB)
📄
fips_prf_wolfssl.c
(1.75 KB)
📄
md4-internal.c
(7.91 KB)
📄
md5-internal.c
(8.79 KB)
📄
md5.c
(2.64 KB)
📄
md5.h
(505 B)
📄
md5_i.h
(516 B)
📄
milenage.c
(9.5 KB)
📄
milenage.h
(1019 B)
📄
ms_funcs.c
(16.16 KB)
📄
ms_funcs.h
(2.41 KB)
📄
random.c
(11.66 KB)
📄
random.h
(855 B)
📄
rc4.c
(1009 B)
📄
sha1-internal.c
(8.93 KB)
📄
sha1-pbkdf2.c
(2.34 KB)
📄
sha1-prf.c
(1.58 KB)
📄
sha1-tlsprf.c
(2.69 KB)
📄
sha1-tprf.c
(1.75 KB)
📄
sha1.c
(2.69 KB)
📄
sha1.h
(1.03 KB)
📄
sha1_i.h
(590 B)
📄
sha256-internal.c
(6 KB)
📄
sha256-kdf.c
(2.08 KB)
📄
sha256-prf.c
(2.84 KB)
📄
sha256-tlsprf.c
(1.81 KB)
📄
sha256.c
(2.64 KB)
📄
sha256.h
(1.07 KB)
📄
sha256_i.h
(584 B)
📄
sha384-internal.c
(2.17 KB)
📄
sha384-kdf.c
(2.08 KB)
📄
sha384-prf.c
(2.85 KB)
📄
sha384.c
(2.63 KB)
📄
sha384.h
(949 B)
📄
sha384_i.h
(573 B)
📄
sha512-internal.c
(7.71 KB)
📄
sha512-kdf.c
(2.08 KB)
📄
sha512-prf.c
(2.85 KB)
📄
sha512.c
(2.63 KB)
📄
sha512.h
(949 B)
📄
sha512_i.h
(591 B)
📄
tls.h
(23.71 KB)
📄
tls_gnutls.c
(44.97 KB)
📄
tls_internal.c
(18.93 KB)
📄
tls_none.c
(3.9 KB)
📄
tls_openssl.c
(137.99 KB)
📄
tls_openssl.h
(477 B)
📄
tls_openssl_ocsp.c
(20.52 KB)
📄
tls_wolfssl.c
(51.88 KB)
Editing: sha256-prf.c
/* * SHA256-based PRF (IEEE 802.11r) * Copyright (c) 2003-2016, 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 "sha256.h" #include "crypto.h" /** * sha256_prf - SHA256-based Pseudo-Random Function (IEEE 802.11r, 8.5.1.5.2) * @key: Key for PRF * @key_len: Length of the key in bytes * @label: A unique label for each purpose of the PRF * @data: Extra data to bind into the key * @data_len: Length of the data * @buf: Buffer for the generated pseudo-random key * @buf_len: Number of bytes of key to generate * Returns: 0 on success, -1 on failure * * This function is used to derive new, cryptographically separate keys from a * given key. */ int sha256_prf(const u8 *key, size_t key_len, const char *label, const u8 *data, size_t data_len, u8 *buf, size_t buf_len) { return sha256_prf_bits(key, key_len, label, data, data_len, buf, buf_len * 8); } /** * sha256_prf_bits - IEEE Std 802.11-2012, 11.6.1.7.2 Key derivation function * @key: Key for KDF * @key_len: Length of the key in bytes * @label: A unique label for each purpose of the PRF * @data: Extra data to bind into the key * @data_len: Length of the data * @buf: Buffer for the generated pseudo-random key * @buf_len: Number of bits of key to generate * Returns: 0 on success, -1 on failure * * This function is used to derive new, cryptographically separate keys from a * given key. If the requested buf_len is not divisible by eight, the least * significant 1-7 bits of the last octet in the output are not part of the * requested output. */ int sha256_prf_bits(const u8 *key, size_t key_len, const char *label, const u8 *data, size_t data_len, u8 *buf, size_t buf_len_bits) { u16 counter = 1; size_t pos, plen; u8 hash[SHA256_MAC_LEN]; const u8 *addr[4]; size_t len[4]; u8 counter_le[2], length_le[2]; size_t buf_len = (buf_len_bits + 7) / 8; addr[0] = counter_le; len[0] = 2; addr[1] = (u8 *) label; len[1] = os_strlen(label); addr[2] = data; len[2] = data_len; addr[3] = length_le; len[3] = sizeof(length_le); WPA_PUT_LE16(length_le, buf_len_bits); pos = 0; while (pos < buf_len) { plen = buf_len - pos; WPA_PUT_LE16(counter_le, counter); if (plen >= SHA256_MAC_LEN) { if (hmac_sha256_vector(key, key_len, 4, addr, len, &buf[pos]) < 0) return -1; pos += SHA256_MAC_LEN; } else { if (hmac_sha256_vector(key, key_len, 4, addr, len, hash) < 0) return -1; os_memcpy(&buf[pos], hash, plen); pos += plen; break; } counter++; } /* * Mask out unused bits in the last octet if it does not use all the * bits. */ if (buf_len_bits % 8) { u8 mask = 0xff << (8 - buf_len_bits % 8); buf[pos - 1] &= mask; } forced_memzero(hash, sizeof(hash)); return 0; }
Upload File
Create Folder