Skip to content

Commit

Permalink
Merge branch 'feat/wifi_crypto_funcs_cleanup' into 'master'
Browse files Browse the repository at this point in the history
Cleanup of wifi crypto funcs within wifi libs

See merge request espressif/esp-idf!30698
  • Loading branch information
jack0c committed Sep 23, 2024
2 parents 8da1b8b + 52bcdb9 commit d076f0a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 63 deletions.
20 changes: 1 addition & 19 deletions components/esp_wifi/include/esp_wifi_crypto_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,33 +395,15 @@ typedef uint32_t (*esp_crc32_le_t)(uint32_t crc, uint8_t const *buf, uint32_t le
typedef struct wpa_crypto_funcs_t {
uint32_t size; /**< The crypto callback function structure size */
uint32_t version; /**< The crypto callback function structure version */
esp_aes_wrap_t aes_wrap; /**< The AES wrap callback function used by esp_wifi */
esp_aes_unwrap_t aes_unwrap; /**< The AES unwrap callback function used by esp_wifi */
esp_hmac_sha256_vector_t hmac_sha256_vector; /**< The SHA256 callback function used by esp_wifi */
esp_sha256_prf_t sha256_prf; /**< The SHA256 PRF callback function used by esp_wifi */
esp_hmac_md5_t hmac_md5; /**< HMAC-MD5 callback function over data buffer (RFC 2104) */
esp_hmac_md5_vector_t hamc_md5_vector; /**< HMAC-MD5 callback function over data vector (RFC 2104) */
esp_hmac_sha1_t hmac_sha1; /**< HMAC-SHA1 callback function over data buffer (RFC 2104) */
esp_hmac_sha1_vector_t hmac_sha1_vector; /**< HMAC-SHA1 callback function over data vector (RFC 2104) */
esp_sha1_prf_t sha1_prf; /**< SHA1-based Pseudo-Random Function (PRF) (IEEE 802.11i, 8.5.1.1) callback function */
esp_sha1_vector_t sha1_vector; /**< SHA-1 hash callback function for data vector */
esp_pbkdf2_sha1_t pbkdf2_sha1; /**< SHA1-based key derivation function (PBKDF2) callback function for IEEE 802.11i */
esp_rc4_skip_t rc4_skip; /**< XOR RC4 stream callback function to given data with skip-stream-start */
esp_md5_vector_t md5_vector; /**< MD5 hash callback function for data vector */
esp_aes_encrypt_t aes_encrypt; /**< Encrypt one AES block callback function */
esp_aes_encrypt_init_t aes_encrypt_init; /**< Initialize AES callback function for encryption */
esp_aes_encrypt_deinit_t aes_encrypt_deinit; /**< Deinitialize AES encryption callback function */
esp_aes_decrypt_t aes_decrypt; /**< Decrypt one AES block callback function */
esp_aes_decrypt_init_t aes_decrypt_init; /**< Initialize AES callback function for decryption */
esp_aes_decrypt_deinit_t aes_decrypt_deinit; /**< Deinitialize AES decryption callback function */
esp_pbkdf2_sha1_t pbkdf2_sha1; /**< SHA1-based key derivation function (PBKDF2) callback function for IEEE 802.11 */
esp_aes_128_encrypt_t aes_128_encrypt; /**< The AES 128 encrypt callback function used by esp_wifi */
esp_aes_128_decrypt_t aes_128_decrypt; /**< The AES 128 decrypt callback function used by esp_wifi */
esp_omac1_aes_128_t omac1_aes_128; /**< One-Key CBC MAC (OMAC1) hash with AES-128 callback function for MIC computation */
esp_ccmp_decrypt_t ccmp_decrypt; /**< Decrypt data callback function using CCMP */
esp_ccmp_encrypt_t ccmp_encrypt; /**< Encrypt data callback function using CCMP */
esp_aes_gmac_t aes_gmac; /**< One-Key GMAC hash callback function with AES for MIC computation */
esp_sha256_vector_t sha256_vector; /**< SHA256 hash callback function for data vector */
esp_crc32_le_t crc32; /**< CRC32 value callback function in little endian */
} wpa_crypto_funcs_t;

/**
Expand Down
2 changes: 1 addition & 1 deletion components/esp_wifi/lib
Submodule lib updated 62 files
+ esp32/libcore.a
+ esp32/libespnow.a
+ esp32/libmesh.a
+ esp32/libnet80211.a
+ esp32/libpp.a
+ esp32/libsmartconfig.a
+ esp32/libwapi.a
+ esp32_host/libcore.a
+ esp32_host/libespnow.a
+ esp32_host/libmesh.a
+ esp32_host/libnet80211.a
+ esp32_host/libpp.a
+ esp32_host/libsmartconfig.a
+ esp32_host/libtarget.a
+ esp32_host/libwapi.a
+ esp32c2/libcore.a
+ esp32c2/libespnow.a
+ esp32c2/libnet80211.a
+ esp32c2/libpp.a
+ esp32c2/libsmartconfig.a
+ esp32c3/libcore.a
+ esp32c3/libespnow.a
+ esp32c3/libmesh.a
+ esp32c3/libnet80211.a
+ esp32c3/libpp.a
+ esp32c3/libsmartconfig.a
+ esp32c3/libwapi.a
+ esp32c5/libcore.a
+ esp32c5/libespnow.a
+ esp32c5/libmesh.a
+ esp32c5/libnet80211.a
+ esp32c5/libpp.a
+ esp32c5/libsmartconfig.a
+ esp32c5/libwapi.a
+ esp32c6/libcore.a
+ esp32c6/libespnow.a
+ esp32c6/libmesh.a
+ esp32c6/libnet80211.a
+ esp32c6/libpp.a
+ esp32c6/libsmartconfig.a
+ esp32c6/libwapi.a
+ esp32c61/libcore.a
+ esp32c61/libespnow.a
+ esp32c61/libmesh.a
+ esp32c61/libnet80211.a
+ esp32c61/libpp.a
+ esp32c61/libsmartconfig.a
+ esp32c61/libwapi.a
+ esp32s2/libcore.a
+ esp32s2/libespnow.a
+ esp32s2/libmesh.a
+ esp32s2/libnet80211.a
+ esp32s2/libpp.a
+ esp32s2/libsmartconfig.a
+ esp32s2/libwapi.a
+ esp32s3/libcore.a
+ esp32s3/libespnow.a
+ esp32s3/libmesh.a
+ esp32s3/libnet80211.a
+ esp32s3/libpp.a
+ esp32s3/libsmartconfig.a
+ esp32s3/libwapi.a
43 changes: 0 additions & 43 deletions components/wpa_supplicant/src/crypto/crypto_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,6 @@

#define DEFAULT_KEK_LEN 16

static int esp_aes_wrap(const u8 *kek, int n, const u8 *plain, u8 *cipher)
{
return aes_wrap(kek, DEFAULT_KEK_LEN, n, plain, cipher);
}

static int esp_aes_unwrap(const u8 *kek, int n, const u8 *cipher, u8 *plain)
{
return aes_unwrap(kek, DEFAULT_KEK_LEN, n, cipher, plain);
}

static void esp_aes_encrypt(void *ctx, const u8 *plain, u8 *crypt)
{
aes_encrypt(ctx, plain, crypt);
}

static void esp_aes_decrypt(void *ctx, const u8 *crypt, u8 *plain)
{
aes_decrypt(ctx, crypt, plain);
}

static int esp_aes_gmac(const u8 *key, size_t key_len, const u8 *iv, size_t iv_len,
const u8 *aad, size_t aad_len, u8 *tag)
{
Expand All @@ -47,11 +27,6 @@ static int esp_aes_gmac(const u8 *key, size_t key_len, const u8 *iv, size_t iv_l
#endif
}

static uint32_t esp_supp_crc32(uint32_t crc, uint8_t const *buf, uint32_t len)
{
return esp_rom_crc32_le(crc, buf, len);
}

/*
* This structure is used to set the cyrpto callback function for station to connect when in security mode.
* These functions either call MbedTLS API's if CONFIG_CRYPTO_MBEDTLS flag is set through Kconfig, or native
Expand All @@ -61,33 +36,15 @@ static uint32_t esp_supp_crc32(uint32_t crc, uint8_t const *buf, uint32_t len)
const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs = {
.size = sizeof(wpa_crypto_funcs_t),
.version = ESP_WIFI_CRYPTO_VERSION,
.aes_wrap = (esp_aes_wrap_t)esp_aes_wrap,
.aes_unwrap = (esp_aes_unwrap_t)esp_aes_unwrap,
.hmac_sha256_vector = (esp_hmac_sha256_vector_t)hmac_sha256_vector,
.sha256_prf = (esp_sha256_prf_t)sha256_prf,
.hmac_md5 = (esp_hmac_md5_t)hmac_md5,
.hamc_md5_vector = (esp_hmac_md5_vector_t)hmac_md5_vector,
.hmac_sha1 = (esp_hmac_sha1_t)hmac_sha1,
.hmac_sha1_vector = (esp_hmac_sha1_vector_t)hmac_sha1_vector,
.sha1_prf = (esp_sha1_prf_t)sha1_prf,
.sha1_vector = (esp_sha1_vector_t)sha1_vector,
.pbkdf2_sha1 = (esp_pbkdf2_sha1_t)pbkdf2_sha1,
.rc4_skip = (esp_rc4_skip_t)rc4_skip,
.md5_vector = (esp_md5_vector_t)md5_vector,
.aes_encrypt = (esp_aes_encrypt_t)esp_aes_encrypt,
.aes_encrypt_init = (esp_aes_encrypt_init_t)aes_encrypt_init,
.aes_encrypt_deinit = (esp_aes_encrypt_deinit_t)aes_encrypt_deinit,
.aes_decrypt = (esp_aes_decrypt_t)esp_aes_decrypt,
.aes_decrypt_init = (esp_aes_decrypt_init_t)aes_decrypt_init,
.aes_decrypt_deinit = (esp_aes_decrypt_deinit_t)aes_decrypt_deinit,
.aes_128_encrypt = (esp_aes_128_encrypt_t)aes_128_cbc_encrypt,
.aes_128_decrypt = (esp_aes_128_decrypt_t)aes_128_cbc_decrypt,
.omac1_aes_128 = (esp_omac1_aes_128_t)omac1_aes_128,
.ccmp_decrypt = (esp_ccmp_decrypt_t)ccmp_decrypt,
.ccmp_encrypt = (esp_ccmp_encrypt_t)ccmp_encrypt,
.aes_gmac = (esp_aes_gmac_t)esp_aes_gmac,
.sha256_vector = (esp_sha256_vector_t)sha256_vector,
.crc32 = (esp_crc32_le_t)esp_supp_crc32,
};

const mesh_crypto_funcs_t g_wifi_default_mesh_crypto_funcs = {
Expand Down

0 comments on commit d076f0a

Please sign in to comment.