18#ifndef __VSF_WIFI_CRYPTO_H__
19#define __VSF_WIFI_CRYPTO_H__
25#if VSF_USE_WIFI == ENABLED && VSF_WIFI_USE_WPA == ENABLED
36#define VSF_WIFI_PMK_LEN 32
37#define VSF_WIFI_PTK_LEN 48
38#define VSF_WIFI_KCK_LEN 16
39#define VSF_WIFI_KEK_LEN 16
40#define VSF_WIFI_TK_LEN 16
41#define VSF_WIFI_NONCE_LEN 32
42#define VSF_WIFI_MIC_LEN 16
43#define VSF_WIFI_CCMP_NONCE_LEN 13
44#define VSF_WIFI_CCMP_MIC_LEN 8
vsf_err_t
Definition __type.h:42
unsigned short uint16_t
Definition stdint.h:7
unsigned char uint8_t
Definition stdint.h:5
vsf_err_t vsf_wifi_ccmp_encrypt(const uint8_t tk[16], const uint8_t *aad, uint16_t aad_len, const uint8_t nonce[13], const uint8_t *plain, uint16_t plain_len, uint8_t *cipher, uint8_t mic[8])
CCMP encrypt: AES-CCM with L=2, M=8. Produces cipher (== plain_len) and an 8-byte MIC....
Definition vsf_wifi_crypto.c:225
vsf_err_t vsf_wifi_pbkdf2_pmk(const char *passphrase, const uint8_t *ssid, uint16_t ssid_len, uint8_t pmk[32])
Derive the PMK from a passphrase using PBKDF2-HMAC-SHA1 (4096 rounds). salt = SSID,...
Definition vsf_wifi_crypto.c:52
vsf_err_t vsf_wifi_ccmp_decrypt(const uint8_t tk[16], const uint8_t *aad, uint16_t aad_len, const uint8_t nonce[13], const uint8_t *cipher, uint16_t cipher_len, uint8_t *plain, const uint8_t mic[8])
CCMP decrypt + authenticate. Returns VSF_ERR_FAIL if the MIC check fails (forged / corrupted frame).
Definition vsf_wifi_crypto.c:251
vsf_err_t vsf_wifi_aes_unwrap(const uint8_t *kek, uint16_t kek_len, const uint8_t *in, uint16_t in_len, uint8_t *out)
AES key unwrap (RFC 3394), used to recover the GTK from EAPOL-Key M3. in_len must be a multiple of 8 ...
Definition vsf_wifi_crypto.c:158
vsf_err_t vsf_wifi_prf_ptk(const uint8_t pmk[32], const uint8_t aa[6], const uint8_t spa[6], const uint8_t anonce[32], const uint8_t snonce[32], uint8_t ptk[48])
Derive the 384-bit PTK using PRF-384 (HMAC-SHA1). label = "Pairwise key expansion",...
Definition vsf_wifi_crypto.c:80
vsf_err_t vsf_wifi_crypto_selftest(void)
Run the built-in crypto self-test against IEEE 802.11i / RFC test vectors. Returns VSF_ERR_NONE if al...
Definition vsf_wifi_crypto.c:285
vsf_err_t vsf_wifi_eapol_mic(const uint8_t kck[16], const uint8_t *eapol, uint16_t eapol_len, uint8_t mic[16])
Compute the EAPOL-Key MIC (key descriptor version 2 = HMAC-SHA1 truncated to 16 bytes)....
Definition vsf_wifi_crypto.c:136