Skip to content

Commit d076f0a

Browse files
committed
Merge branch 'feat/wifi_crypto_funcs_cleanup' into 'master'
Cleanup of wifi crypto funcs within wifi libs See merge request espressif/esp-idf!30698
2 parents 8da1b8b + 52bcdb9 commit d076f0a

File tree

3 files changed

+2
-63
lines changed

3 files changed

+2
-63
lines changed

components/esp_wifi/include/esp_wifi_crypto_types.h

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -395,33 +395,15 @@ typedef uint32_t (*esp_crc32_le_t)(uint32_t crc, uint8_t const *buf, uint32_t le
395395
typedef struct wpa_crypto_funcs_t {
396396
uint32_t size; /**< The crypto callback function structure size */
397397
uint32_t version; /**< The crypto callback function structure version */
398-
esp_aes_wrap_t aes_wrap; /**< The AES wrap callback function used by esp_wifi */
399-
esp_aes_unwrap_t aes_unwrap; /**< The AES unwrap callback function used by esp_wifi */
400398
esp_hmac_sha256_vector_t hmac_sha256_vector; /**< The SHA256 callback function used by esp_wifi */
401-
esp_sha256_prf_t sha256_prf; /**< The SHA256 PRF callback function used by esp_wifi */
402-
esp_hmac_md5_t hmac_md5; /**< HMAC-MD5 callback function over data buffer (RFC 2104) */
403-
esp_hmac_md5_vector_t hamc_md5_vector; /**< HMAC-MD5 callback function over data vector (RFC 2104) */
404-
esp_hmac_sha1_t hmac_sha1; /**< HMAC-SHA1 callback function over data buffer (RFC 2104) */
405-
esp_hmac_sha1_vector_t hmac_sha1_vector; /**< HMAC-SHA1 callback function over data vector (RFC 2104) */
406-
esp_sha1_prf_t sha1_prf; /**< SHA1-based Pseudo-Random Function (PRF) (IEEE 802.11i, 8.5.1.1) callback function */
407-
esp_sha1_vector_t sha1_vector; /**< SHA-1 hash callback function for data vector */
408-
esp_pbkdf2_sha1_t pbkdf2_sha1; /**< SHA1-based key derivation function (PBKDF2) callback function for IEEE 802.11i */
409-
esp_rc4_skip_t rc4_skip; /**< XOR RC4 stream callback function to given data with skip-stream-start */
410-
esp_md5_vector_t md5_vector; /**< MD5 hash callback function for data vector */
411-
esp_aes_encrypt_t aes_encrypt; /**< Encrypt one AES block callback function */
412-
esp_aes_encrypt_init_t aes_encrypt_init; /**< Initialize AES callback function for encryption */
413-
esp_aes_encrypt_deinit_t aes_encrypt_deinit; /**< Deinitialize AES encryption callback function */
414-
esp_aes_decrypt_t aes_decrypt; /**< Decrypt one AES block callback function */
415-
esp_aes_decrypt_init_t aes_decrypt_init; /**< Initialize AES callback function for decryption */
416-
esp_aes_decrypt_deinit_t aes_decrypt_deinit; /**< Deinitialize AES decryption callback function */
399+
esp_pbkdf2_sha1_t pbkdf2_sha1; /**< SHA1-based key derivation function (PBKDF2) callback function for IEEE 802.11 */
417400
esp_aes_128_encrypt_t aes_128_encrypt; /**< The AES 128 encrypt callback function used by esp_wifi */
418401
esp_aes_128_decrypt_t aes_128_decrypt; /**< The AES 128 decrypt callback function used by esp_wifi */
419402
esp_omac1_aes_128_t omac1_aes_128; /**< One-Key CBC MAC (OMAC1) hash with AES-128 callback function for MIC computation */
420403
esp_ccmp_decrypt_t ccmp_decrypt; /**< Decrypt data callback function using CCMP */
421404
esp_ccmp_encrypt_t ccmp_encrypt; /**< Encrypt data callback function using CCMP */
422405
esp_aes_gmac_t aes_gmac; /**< One-Key GMAC hash callback function with AES for MIC computation */
423406
esp_sha256_vector_t sha256_vector; /**< SHA256 hash callback function for data vector */
424-
esp_crc32_le_t crc32; /**< CRC32 value callback function in little endian */
425407
} wpa_crypto_funcs_t;
426408

427409
/**

components/wpa_supplicant/src/crypto/crypto_ops.c

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,6 @@
1717

1818
#define DEFAULT_KEK_LEN 16
1919

20-
static int esp_aes_wrap(const u8 *kek, int n, const u8 *plain, u8 *cipher)
21-
{
22-
return aes_wrap(kek, DEFAULT_KEK_LEN, n, plain, cipher);
23-
}
24-
25-
static int esp_aes_unwrap(const u8 *kek, int n, const u8 *cipher, u8 *plain)
26-
{
27-
return aes_unwrap(kek, DEFAULT_KEK_LEN, n, cipher, plain);
28-
}
29-
30-
static void esp_aes_encrypt(void *ctx, const u8 *plain, u8 *crypt)
31-
{
32-
aes_encrypt(ctx, plain, crypt);
33-
}
34-
35-
static void esp_aes_decrypt(void *ctx, const u8 *crypt, u8 *plain)
36-
{
37-
aes_decrypt(ctx, crypt, plain);
38-
}
39-
4020
static int esp_aes_gmac(const u8 *key, size_t key_len, const u8 *iv, size_t iv_len,
4121
const u8 *aad, size_t aad_len, u8 *tag)
4222
{
@@ -47,11 +27,6 @@ static int esp_aes_gmac(const u8 *key, size_t key_len, const u8 *iv, size_t iv_l
4727
#endif
4828
}
4929

50-
static uint32_t esp_supp_crc32(uint32_t crc, uint8_t const *buf, uint32_t len)
51-
{
52-
return esp_rom_crc32_le(crc, buf, len);
53-
}
54-
5530
/*
5631
* This structure is used to set the cyrpto callback function for station to connect when in security mode.
5732
* These functions either call MbedTLS API's if CONFIG_CRYPTO_MBEDTLS flag is set through Kconfig, or native
@@ -61,33 +36,15 @@ static uint32_t esp_supp_crc32(uint32_t crc, uint8_t const *buf, uint32_t len)
6136
const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs = {
6237
.size = sizeof(wpa_crypto_funcs_t),
6338
.version = ESP_WIFI_CRYPTO_VERSION,
64-
.aes_wrap = (esp_aes_wrap_t)esp_aes_wrap,
65-
.aes_unwrap = (esp_aes_unwrap_t)esp_aes_unwrap,
6639
.hmac_sha256_vector = (esp_hmac_sha256_vector_t)hmac_sha256_vector,
67-
.sha256_prf = (esp_sha256_prf_t)sha256_prf,
68-
.hmac_md5 = (esp_hmac_md5_t)hmac_md5,
69-
.hamc_md5_vector = (esp_hmac_md5_vector_t)hmac_md5_vector,
70-
.hmac_sha1 = (esp_hmac_sha1_t)hmac_sha1,
71-
.hmac_sha1_vector = (esp_hmac_sha1_vector_t)hmac_sha1_vector,
72-
.sha1_prf = (esp_sha1_prf_t)sha1_prf,
73-
.sha1_vector = (esp_sha1_vector_t)sha1_vector,
7440
.pbkdf2_sha1 = (esp_pbkdf2_sha1_t)pbkdf2_sha1,
75-
.rc4_skip = (esp_rc4_skip_t)rc4_skip,
76-
.md5_vector = (esp_md5_vector_t)md5_vector,
77-
.aes_encrypt = (esp_aes_encrypt_t)esp_aes_encrypt,
78-
.aes_encrypt_init = (esp_aes_encrypt_init_t)aes_encrypt_init,
79-
.aes_encrypt_deinit = (esp_aes_encrypt_deinit_t)aes_encrypt_deinit,
80-
.aes_decrypt = (esp_aes_decrypt_t)esp_aes_decrypt,
81-
.aes_decrypt_init = (esp_aes_decrypt_init_t)aes_decrypt_init,
82-
.aes_decrypt_deinit = (esp_aes_decrypt_deinit_t)aes_decrypt_deinit,
8341
.aes_128_encrypt = (esp_aes_128_encrypt_t)aes_128_cbc_encrypt,
8442
.aes_128_decrypt = (esp_aes_128_decrypt_t)aes_128_cbc_decrypt,
8543
.omac1_aes_128 = (esp_omac1_aes_128_t)omac1_aes_128,
8644
.ccmp_decrypt = (esp_ccmp_decrypt_t)ccmp_decrypt,
8745
.ccmp_encrypt = (esp_ccmp_encrypt_t)ccmp_encrypt,
8846
.aes_gmac = (esp_aes_gmac_t)esp_aes_gmac,
8947
.sha256_vector = (esp_sha256_vector_t)sha256_vector,
90-
.crc32 = (esp_crc32_le_t)esp_supp_crc32,
9148
};
9249

9350
const mesh_crypto_funcs_t g_wifi_default_mesh_crypto_funcs = {

0 commit comments

Comments
 (0)