diff --git a/pkg/esp32_sdk/patches/0001-compilation-avoid-multiple-definitions-of-macros.patch b/pkg/esp32_sdk/patches/0001-compilation-avoid-multiple-definitions-of-macros.patch new file mode 100644 index 0000000000..e26c26560f --- /dev/null +++ b/pkg/esp32_sdk/patches/0001-compilation-avoid-multiple-definitions-of-macros.patch @@ -0,0 +1,30 @@ +From b21ceb6f079a63d05552831d372de5d8bbda1173 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Mon, 20 Jan 2025 21:49:10 +0100 +Subject: [PATCH 01/28] compilation: avoid multiple definitions of macros + +--- + components/xtensa/include/xtensa/xtruntime-frames.h | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/components/xtensa/include/xtensa/xtruntime-frames.h b/components/xtensa/include/xtensa/xtruntime-frames.h +index b78095e0dd..4a5b4d356a 100644 +--- a/components/xtensa/include/xtensa/xtruntime-frames.h ++++ b/components/xtensa/include/xtensa/xtruntime-frames.h +@@ -29,6 +29,13 @@ + + #include + ++#ifdef STRUCT_BEGIN ++#undef STRUCT_BEGIN ++#undef STRUCT_FIELD ++#undef STRUCT_AFIELD ++#undef STRUCT_END ++#endif ++ + /* Macros that help define structures for both C and assembler: */ + #if defined(_ASMLANGUAGE) || defined(__ASSEMBLER__) + +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0002-wpa_supplicant-add-prefix-wpa_-to-crypto-functions.patch b/pkg/esp32_sdk/patches/0002-wpa_supplicant-add-prefix-wpa_-to-crypto-functions.patch new file mode 100644 index 0000000000..e6a0ad9da1 --- /dev/null +++ b/pkg/esp32_sdk/patches/0002-wpa_supplicant-add-prefix-wpa_-to-crypto-functions.patch @@ -0,0 +1,2981 @@ +From 28a7af35dd12aa6ab3b195cc62610124e39ff306 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 17:24:40 +0100 +Subject: [PATCH 02/28] wpa_supplicant: add prefix wpa_ to crypto functions + +Prefix `wpa_` added to crypto functions of `wpa_suppplicant` to avoid name conflicts with RIOT modules `crypto` and `hashes`. +--- + .../src/crypto/crypto_mbedtls.c | 28 ++++++------ + .../wpa_supplicant/src/ap/comeback_token.c | 6 +-- + components/wpa_supplicant/src/ap/wpa_auth.c | 6 +-- + components/wpa_supplicant/src/common/dpp.c | 14 +++--- + .../wpa_supplicant/src/common/dpp_crypto.c | 44 +++++++++---------- + components/wpa_supplicant/src/common/sae.c | 14 +++--- + components/wpa_supplicant/src/common/sae_pk.c | 6 +-- + .../wpa_supplicant/src/common/wpa_common.c | 40 ++++++++--------- + .../wpa_supplicant/src/crypto/aes-cbc.c | 12 ++--- + .../wpa_supplicant/src/crypto/aes-ccm.c | 26 +++++------ + .../wpa_supplicant/src/crypto/aes-ctr.c | 6 +-- + .../wpa_supplicant/src/crypto/aes-gcm.c | 12 ++--- + .../src/crypto/aes-internal-dec.c | 8 ++-- + .../src/crypto/aes-internal-enc.c | 8 ++-- + .../wpa_supplicant/src/crypto/aes-internal.c | 2 +- + .../wpa_supplicant/src/crypto/aes-omac1.c | 10 ++--- + .../wpa_supplicant/src/crypto/aes-unwrap.c | 6 +-- + .../wpa_supplicant/src/crypto/aes-wrap.c | 6 +-- + components/wpa_supplicant/src/crypto/aes.h | 12 ++--- + components/wpa_supplicant/src/crypto/aes_i.h | 2 +- + components/wpa_supplicant/src/crypto/crypto.h | 40 ++++++++--------- + .../src/crypto/crypto_internal-cipher.c | 14 +++--- + .../src/crypto/crypto_internal.c | 38 ++++++++-------- + .../wpa_supplicant/src/crypto/crypto_ops.c | 4 +- + .../wpa_supplicant/src/crypto/ms_funcs.c | 10 ++--- + .../wpa_supplicant/src/crypto/sha1-internal.c | 2 +- + .../wpa_supplicant/src/crypto/sha1-pbkdf2.c | 4 +- + .../wpa_supplicant/src/crypto/sha1-prf.c | 6 +-- + .../wpa_supplicant/src/crypto/sha1-tlsprf.c | 6 +-- + .../wpa_supplicant/src/crypto/sha1-tprf.c | 4 +- + components/wpa_supplicant/src/crypto/sha1.c | 12 ++--- + components/wpa_supplicant/src/crypto/sha1.h | 8 ++-- + .../src/crypto/sha256-internal.c | 24 +++++----- + .../wpa_supplicant/src/crypto/sha256-kdf.c | 6 +-- + .../wpa_supplicant/src/crypto/sha256-prf.c | 10 ++--- + .../wpa_supplicant/src/crypto/sha256-tlsprf.c | 6 +-- + components/wpa_supplicant/src/crypto/sha256.c | 12 ++--- + components/wpa_supplicant/src/crypto/sha256.h | 10 ++--- + .../wpa_supplicant/src/crypto/sha256_i.h | 6 +-- + .../src/crypto/sha384-internal.c | 18 ++++---- + .../wpa_supplicant/src/crypto/sha384-prf.c | 10 ++--- + .../wpa_supplicant/src/crypto/sha384-tlsprf.c | 6 +-- + components/wpa_supplicant/src/crypto/sha384.h | 10 ++--- + .../wpa_supplicant/src/crypto/sha384_i.h | 6 +-- + .../src/crypto/sha512-internal.c | 24 +++++----- + .../wpa_supplicant/src/crypto/sha512_i.h | 6 +-- + .../wpa_supplicant/src/eap_peer/eap_fast.c | 6 +-- + .../src/eap_peer/eap_fast_common.c | 6 +-- + .../wpa_supplicant/src/eap_peer/eap_peap.c | 4 +- + .../src/eap_peer/eap_peap_common.c | 2 +- + .../src/eap_server/eap_server.c | 16 +++---- + components/wpa_supplicant/src/rsn_supp/wpa.c | 6 +-- + components/wpa_supplicant/src/tls/pkcs5.c | 4 +- + .../src/tls/tlsv1_client_ocsp.c | 10 ++--- + .../src/tls/tlsv1_client_read.c | 4 +- + .../wpa_supplicant/src/tls/tlsv1_cred.c | 8 ++-- + components/wpa_supplicant/src/tls/x509v3.c | 8 ++-- + components/wpa_supplicant/src/utils/base64.c | 12 ++--- + components/wpa_supplicant/src/utils/base64.h | 14 +++--- + components/wpa_supplicant/src/utils/json.c | 4 +- + .../wpa_supplicant/src/wps/wps_attr_build.c | 6 +-- + .../wpa_supplicant/src/wps/wps_attr_process.c | 4 +- + .../wpa_supplicant/src/wps/wps_common.c | 10 ++--- + .../wpa_supplicant/src/wps/wps_enrollee.c | 10 ++--- + .../wpa_supplicant/src/wps/wps_registrar.c | 12 ++--- + 65 files changed, 358 insertions(+), 358 deletions(-) + +diff --git a/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls.c b/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls.c +index b2679a04ea..61d320d396 100644 +--- a/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls.c ++++ b/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls.c +@@ -84,25 +84,25 @@ cleanup: + + } + +-int sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len, ++int wpa_sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len, + u8 *mac) + { + return digest_vector(MBEDTLS_MD_SHA256, num_elem, addr, len, mac); + } + +-int sha384_vector(size_t num_elem, const u8 *addr[], const size_t *len, ++int wpa_sha384_vector(size_t num_elem, const u8 *addr[], const size_t *len, + u8 *mac) + { + return digest_vector(MBEDTLS_MD_SHA384, num_elem, addr, len, mac); + } + +-int sha512_vector(size_t num_elem, const u8 *addr[], const size_t *len, ++int wpa_sha512_vector(size_t num_elem, const u8 *addr[], const size_t *len, + u8 *mac) + { + return digest_vector(MBEDTLS_MD_SHA512, num_elem, addr, len, mac); + } + +-int sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac) ++int wpa_sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac) + { + return digest_vector(MBEDTLS_MD_SHA1, num_elem, addr, len, mac); + } +@@ -323,30 +323,30 @@ static int hmac_vector(mbedtls_md_type_t md_type, + return ret; + } + +-int hmac_sha384_vector(const u8 *key, size_t key_len, size_t num_elem, ++int wpa_hmac_sha384_vector(const u8 *key, size_t key_len, size_t num_elem, + const u8 *addr[], const size_t *len, u8 *mac) + { + return hmac_vector(MBEDTLS_MD_SHA384, key, key_len, num_elem, addr, + len, mac); + } + +-int hmac_sha384(const u8 *key, size_t key_len, const u8 *data, ++int wpa_hmac_sha384(const u8 *key, size_t key_len, const u8 *data, + size_t data_len, u8 *mac) + { +- return hmac_sha384_vector(key, key_len, 1, &data, &data_len, mac); ++ return wpa_hmac_sha384_vector(key, key_len, 1, &data, &data_len, mac); + } + +-int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, ++int wpa_hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, + const u8 *addr[], const size_t *len, u8 *mac) + { + return hmac_vector(MBEDTLS_MD_SHA256, key, key_len, num_elem, addr, + len, mac); + } + +-int hmac_sha256(const u8 *key, size_t key_len, const u8 *data, ++int wpa_hmac_sha256(const u8 *key, size_t key_len, const u8 *data, + size_t data_len, u8 *mac) + { +- return hmac_sha256_vector(key, key_len, 1, &data, &data_len, mac); ++ return wpa_hmac_sha256_vector(key, key_len, 1, &data, &data_len, mac); + } + + int hmac_md5_vector(const u8 *key, size_t key_len, size_t num_elem, +@@ -362,17 +362,17 @@ int hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len, + return hmac_md5_vector(key, key_len, 1, &data, &data_len, mac); + } + +-int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, ++int wpa_hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, + const u8 *addr[], const size_t *len, u8 *mac) + { + return hmac_vector(MBEDTLS_MD_SHA1, key, key_len, num_elem, addr, + len, mac); + } + +-int hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len, ++int wpa_hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len, + u8 *mac) + { +- return hmac_sha1_vector(key, key_len, 1, &data, &data_len, mac); ++ return wpa_hmac_sha1_vector(key, key_len, 1, &data, &data_len, mac); + } + + static void *aes_crypt_init(int mode, const u8 *key, size_t len) +@@ -416,7 +416,7 @@ void *aes_encrypt_init(const u8 *key, size_t len) + return aes_crypt_init(MBEDTLS_AES_ENCRYPT, key, len); + } + +-int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt) ++int wpa_aes_encrypt(void *ctx, const u8 *plain, u8 *crypt) + { + return aes_crypt(ctx, MBEDTLS_AES_ENCRYPT, plain, crypt); + } +diff --git a/components/wpa_supplicant/src/ap/comeback_token.c b/components/wpa_supplicant/src/ap/comeback_token.c +index f6693e8a51..22e826749a 100644 +--- a/components/wpa_supplicant/src/ap/comeback_token.c ++++ b/components/wpa_supplicant/src/ap/comeback_token.c +@@ -21,7 +21,7 @@ int comeback_token_hash(const u8 *comeback_key, const u8 *addr, u8 *idx) + { + u8 hash[SHA256_MAC_LEN]; + +- if (hmac_sha256(comeback_key, COMEBACK_KEY_SIZE, ++ if (wpa_hmac_sha256(comeback_key, COMEBACK_KEY_SIZE, + addr, ETH_ALEN, hash) < 0) + return -1; + *idx = hash[0]; +@@ -56,7 +56,7 @@ int check_comeback_token(const u8 *comeback_key, + len[0] = ETH_ALEN; + addrs[1] = token; + len[1] = 2; +- if (hmac_sha256_vector(comeback_key, COMEBACK_KEY_SIZE, ++ if (wpa_hmac_sha256_vector(comeback_key, COMEBACK_KEY_SIZE, + 2, addrs, len, mac) < 0 || + os_memcmp_const(token + 2, &mac[2], SHA256_MAC_LEN - 2) != 0) { + return -1; +@@ -129,7 +129,7 @@ auth_build_token_req(struct os_reltime *last_comeback_key_update, + len[0] = ETH_ALEN; + addrs[1] = idx; + len[1] = sizeof(idx); +- if (hmac_sha256_vector(comeback_key, COMEBACK_KEY_SIZE, ++ if (wpa_hmac_sha256_vector(comeback_key, COMEBACK_KEY_SIZE, + 2, addrs, len, token) < 0) { + wpabuf_free(buf); + return NULL; +diff --git a/components/wpa_supplicant/src/ap/wpa_auth.c b/components/wpa_supplicant/src/ap/wpa_auth.c +index 58748a85ff..dedd74f41b 100644 +--- a/components/wpa_supplicant/src/ap/wpa_auth.c ++++ b/components/wpa_supplicant/src/ap/wpa_auth.c +@@ -301,7 +301,7 @@ static int wpa_group_init_gmk_and_counter(struct wpa_authenticator *wpa_auth, + if (os_get_random(rkey, sizeof(rkey)) < 0) + return -1; + +- if (sha1_prf(rkey, sizeof(rkey), "Init Counter", buf, sizeof(buf), ++ if (wpa_sha1_prf(rkey, sizeof(rkey), "Init Counter", buf, sizeof(buf), + group->Counter, WPA_NONCE_LEN) < 0) + return -1; + wpa_hexdump_key(MSG_DEBUG, "Key Counter", +@@ -993,9 +993,9 @@ static int wpa_gmk_to_gtk(const u8 *gmk, const char *label, const u8 *addr, + ret = -1; + + #ifdef CONFIG_IEEE80211W +- sha256_prf(gmk, WPA_GMK_LEN, label, data, sizeof(data), gtk, gtk_len); ++ wpa_sha256_prf(gmk, WPA_GMK_LEN, label, data, sizeof(data), gtk, gtk_len); + #else /* CONFIG_IEEE80211W */ +- if (sha1_prf(gmk, WPA_GMK_LEN, label, data, sizeof(data), gtk, gtk_len) < 0) ++ if (wpa_sha1_prf(gmk, WPA_GMK_LEN, label, data, sizeof(data), gtk, gtk_len) < 0) + ret = -1; + #endif /* CONFIG_IEEE80211W */ + +diff --git a/components/wpa_supplicant/src/common/dpp.c b/components/wpa_supplicant/src/common/dpp.c +index 7fa67d10fa..b979870a54 100644 +--- a/components/wpa_supplicant/src/common/dpp.c ++++ b/components/wpa_supplicant/src/common/dpp.c +@@ -3246,7 +3246,7 @@ int dpp_get_config_obj_hash(char *signed1, size_t signed1_len, + len[1] = 1; + addr[2] = (unsigned char *)signed2; + len[2] = signed2_len; +- ret = sha256_vector(3, addr, len, hash); ++ ret = wpa_sha256_vector(3, addr, len, hash); + + return ret; + } +@@ -3358,11 +3358,11 @@ skip_groups: + json_value_sep(jws_prot_hdr); + json_add_string(jws_prot_hdr, "alg", curve->jws_alg); + json_end_object(jws_prot_hdr); +- signed1 = base64_url_encode(wpabuf_head(jws_prot_hdr), ++ signed1 = wpa_base64_url_encode(wpabuf_head(jws_prot_hdr), + wpabuf_len(jws_prot_hdr), + &signed1_len); + wpabuf_free(jws_prot_hdr); +- signed2 = base64_url_encode(wpabuf_head(dppcon), wpabuf_len(dppcon), ++ signed2 = wpa_base64_url_encode(wpabuf_head(dppcon), wpabuf_len(dppcon), + &signed2_len); + if (!signed1 || !signed2) + goto fail; +@@ -3389,7 +3389,7 @@ skip_groups: + signature_len = 2 * curve->prime_len; + wpa_hexdump(MSG_DEBUG, "DPP: signedConnector ECDSA signature (raw r,s)", + signature, signature_len); +- signed3 = base64_url_encode(signature, signature_len, &signed3_len); ++ signed3 = wpa_base64_url_encode(signature, signature_len, &signed3_len); + if (!signed3) + goto fail; + +@@ -4609,13 +4609,13 @@ dpp_keygen_configurator(const char *curve, u8 *privkey, + /* kid = SHA256(ANSI X9.63 uncompressed C-sign-key) */ + addr[0] = wpabuf_head(csign_pub); + len[0] = wpabuf_len(csign_pub); +- if (sha256_vector(1, addr, len, kid_hash) < 0) { ++ if (wpa_sha256_vector(1, addr, len, kid_hash) < 0) { + wpa_printf(MSG_DEBUG, + "DPP: Failed to derive kid for C-sign-key"); + goto fail; + } + +- conf->kid = base64_url_encode(kid_hash, sizeof(kid_hash), NULL); ++ conf->kid = wpa_base64_url_encode(kid_hash, sizeof(kid_hash), NULL); + if (!conf->kid) + goto fail; + out: +@@ -4771,7 +4771,7 @@ struct json_token * dpp_parse_own_connector(const char *own_connector) + wpa_printf(MSG_DEBUG, "DPP: Own connector is missing second dot (.)"); + return NULL; + } +- own_conn = base64_url_decode(pos, end - pos, &own_conn_len); ++ own_conn = wpa_base64_url_decode(pos, end - pos, &own_conn_len); + if (!own_conn) { + wpa_printf(MSG_DEBUG, + "DPP: Failed to base64url decode own signedConnectior JWS Payload"); +diff --git a/components/wpa_supplicant/src/common/dpp_crypto.c b/components/wpa_supplicant/src/common/dpp_crypto.c +index b95584e8e1..67eb811936 100644 +--- a/components/wpa_supplicant/src/common/dpp_crypto.c ++++ b/components/wpa_supplicant/src/common/dpp_crypto.c +@@ -90,12 +90,12 @@ int dpp_hash_vector(const struct dpp_curve_params *curve, + u8 *mac) + { + if (curve->hash_len == 32) +- return sha256_vector(num_elem, addr, len, mac); ++ return wpa_sha256_vector(num_elem, addr, len, mac); + #ifndef ESP_SUPPLICANT + if (curve->hash_len == 48) +- return sha384_vector(num_elem, addr, len, mac); ++ return wpa_sha384_vector(num_elem, addr, len, mac); + if (curve->hash_len == 64) +- return sha512_vector(num_elem, addr, len, mac); ++ return wpa_sha512_vector(num_elem, addr, len, mac); + #endif + return -1; + } +@@ -105,16 +105,16 @@ int dpp_hkdf_expand(size_t hash_len, const u8 *secret, size_t secret_len, + const char *label, u8 *out, size_t outlen) + { + if (hash_len == 32) +- return hmac_sha256_kdf(secret, secret_len, NULL, ++ return wpa_hmac_sha256_kdf(secret, secret_len, NULL, + (const u8 *) label, os_strlen(label), + out, outlen); + #ifndef ESP_SUPPLICANT + if (hash_len == 48) +- return hmac_sha384_kdf(secret, secret_len, NULL, ++ return wpa_hmac_sha384_kdf(secret, secret_len, NULL, + (const u8 *) label, os_strlen(label), + out, outlen); + if (hash_len == 64) +- return hmac_sha512_kdf(secret, secret_len, NULL, ++ return wpa_hmac_sha512_kdf(secret, secret_len, NULL, + (const u8 *) label, os_strlen(label), + out, outlen); + #endif +@@ -127,14 +127,14 @@ int dpp_hmac_vector(size_t hash_len, const u8 *key, size_t key_len, + u8 *mac) + { + if (hash_len == 32) +- return hmac_sha256_vector(key, key_len, num_elem, addr, len, ++ return wpa_hmac_sha256_vector(key, key_len, num_elem, addr, len, + mac); + #ifndef ESP_SUPPLICANT + if (hash_len == 48) +- return hmac_sha384_vector(key, key_len, num_elem, addr, len, ++ return wpa_hmac_sha384_vector(key, key_len, num_elem, addr, len, + mac); + if (hash_len == 64) +- return hmac_sha512_vector(key, key_len, num_elem, addr, len, ++ return wpa_hmac_sha512_vector(key, key_len, num_elem, addr, len, + mac); + #endif + return -1; +@@ -145,12 +145,12 @@ int dpp_hmac(size_t hash_len, const u8 *key, size_t key_len, + const u8 *data, size_t data_len, u8 *mac) + { + if (hash_len == 32) +- return hmac_sha256(key, key_len, data, data_len, mac); ++ return wpa_hmac_sha256(key, key_len, data, data_len, mac); + #ifndef ESP_SUPPLICANT + if (hash_len == 48) +- return hmac_sha384(key, key_len, data, data_len, mac); ++ return wpa_hmac_sha384(key, key_len, data, data_len, mac); + if (hash_len == 64) +- return hmac_sha512(key, key_len, data, data_len, mac); ++ return wpa_hmac_sha512(key, key_len, data, data_len, mac); + #endif + return -1; + } +@@ -226,7 +226,7 @@ int dpp_bi_pubkey_hash(struct dpp_bootstrap_info *bi, + + addr[0] = data; + len[0] = data_len; +- if (sha256_vector(1, addr, len, bi->pubkey_hash) < 0) ++ if (wpa_sha256_vector(1, addr, len, bi->pubkey_hash) < 0) + return -1; + wpa_hexdump(MSG_DEBUG, "DPP: Public key hash", + bi->pubkey_hash, SHA256_MAC_LEN); +@@ -235,7 +235,7 @@ int dpp_bi_pubkey_hash(struct dpp_bootstrap_info *bi, + len[0] = 5; + addr[1] = data; + len[1] = data_len; +- if (sha256_vector(2, addr, len, bi->pubkey_hash_chirp) < 0) ++ if (wpa_sha256_vector(2, addr, len, bi->pubkey_hash_chirp) < 0) + return -1; + wpa_hexdump(MSG_DEBUG, "DPP: Public key hash (chirp)", + bi->pubkey_hash_chirp, SHA256_MAC_LEN); +@@ -614,7 +614,7 @@ int dpp_check_pubkey_match(struct crypto_ec_key *pub, struct wpabuf *r_hash) + len[0] = wpabuf_len(uncomp); + wpa_hexdump(MSG_DEBUG, "DPP: Uncompressed public key", + addr[0], len[0]); +- res = sha256_vector(1, addr, len, hash); ++ res = wpa_sha256_vector(1, addr, len, hash); + wpabuf_free(uncomp); + if (res < 0) + return -1; +@@ -655,7 +655,7 @@ dpp_process_signed_connector(struct dpp_signed_connector_info *info, + ret = DPP_STATUS_INVALID_CONNECTOR; + goto fail; + } +- prot_hdr = base64_url_decode(pos, end - pos, &prot_hdr_len); ++ prot_hdr = wpa_base64_url_decode(pos, end - pos, &prot_hdr_len); + if (!prot_hdr) { + wpa_printf(MSG_DEBUG, + "DPP: Failed to base64url decode signedConnector JWS Protected Header"); +@@ -687,7 +687,7 @@ dpp_process_signed_connector(struct dpp_signed_connector_info *info, + goto fail; + } + signed_end = end - 1; +- info->payload = base64_url_decode(pos, end - pos, &info->payload_len); ++ info->payload = wpa_base64_url_decode(pos, end - pos, &info->payload_len); + if (!info->payload) { + wpa_printf(MSG_DEBUG, + "DPP: Failed to base64url decode signedConnector JWS Payload"); +@@ -698,7 +698,7 @@ dpp_process_signed_connector(struct dpp_signed_connector_info *info, + "DPP: signedConnector - JWS Payload", + (u8 *)info->payload, info->payload_len); + pos = end + 1; +- signature = base64_url_decode(pos, os_strlen(pos), &signature_len); ++ signature = wpa_base64_url_decode(pos, os_strlen(pos), &signature_len); + if (!signature) { + wpa_printf(MSG_DEBUG, + "DPP: Failed to base64url decode signedConnector signature"); +@@ -729,7 +729,7 @@ dpp_process_signed_connector(struct dpp_signed_connector_info *info, + } + + if (hash_func == CRYPTO_HASH_ALG_SHA256) { +- if ((sha256_vector(1, (const u8 **) &signed_start, &signed_len, hash)) != 0) { ++ if ((wpa_sha256_vector(1, (const u8 **) &signed_start, &signed_len, hash)) != 0) { + goto fail; + } + } else { +@@ -1115,7 +1115,7 @@ int dpp_derive_pmkid(const struct dpp_curve_params *curve, + } + wpa_hexdump(MSG_DEBUG, "DPP: PMKID hash payload 1", addr[0], len[0]); + wpa_hexdump(MSG_DEBUG, "DPP: PMKID hash payload 2", addr[1], len[1]); +- res = sha256_vector(2, addr, len, hash); ++ res = wpa_sha256_vector(2, addr, len, hash); + if (res < 0) + goto fail; + wpa_hexdump(MSG_DEBUG, "DPP: PMKID hash output", hash, SHA256_MAC_LEN); +@@ -1157,7 +1157,7 @@ char * dpp_corrupt_connector_signature(const char *connector) + + wpa_printf(MSG_DEBUG, "DPP: Original base64url encoded signature: %s", + pos); +- signature = base64_url_decode(pos, os_strlen(pos), &signature_len); ++ signature = wpa_base64_url_decode(pos, os_strlen(pos), &signature_len); + if (!signature || signature_len == 0) + goto fail; + wpa_hexdump(MSG_DEBUG, "DPP: Original Connector signature", +@@ -1165,7 +1165,7 @@ char * dpp_corrupt_connector_signature(const char *connector) + signature[signature_len - 1] ^= 0x01; + wpa_hexdump(MSG_DEBUG, "DPP: Corrupted Connector signature", + signature, signature_len); +- signed3 = base64_url_encode(signature, signature_len, &signed3_len); ++ signed3 = wpa_base64_url_encode(signature, signature_len, &signed3_len); + if (!signed3) + goto fail; + os_memcpy(pos, signed3, signed3_len); +diff --git a/components/wpa_supplicant/src/common/sae.c b/components/wpa_supplicant/src/common/sae.c +index 363aa0c4fe..afb2db7b0d 100644 +--- a/components/wpa_supplicant/src/common/sae.c ++++ b/components/wpa_supplicant/src/common/sae.c +@@ -146,7 +146,7 @@ static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed, + + /* pwd-value = KDF-z(pwd-seed, "SAE Hunting and Pecking", p) */ + bits = crypto_ec_prime_len_bits(sae->tmp->ec); +- if (sha256_prf_bits(pwd_seed, SHA256_MAC_LEN, "SAE Hunting and Pecking", ++ if (wpa_sha256_prf_bits(pwd_seed, SHA256_MAC_LEN, "SAE Hunting and Pecking", + prime, sae->tmp->prime_len, pwd_value, bits) < 0) + return ESP_FAIL; + if (bits % 8) +@@ -196,7 +196,7 @@ static int sae_test_pwd_seed_ffc(struct sae_data *sae, const u8 *pwd_seed, + wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-seed", pwd_seed, SHA256_MAC_LEN); + + /* pwd-value = KDF-z(pwd-seed, "SAE Hunting and Pecking", p) */ +- if (sha256_prf_bits(pwd_seed, SHA256_MAC_LEN, "SAE Hunting and Pecking", ++ if (wpa_sha256_prf_bits(pwd_seed, SHA256_MAC_LEN, "SAE Hunting and Pecking", + sae->tmp->dh->prime, sae->tmp->prime_len, pwd_value, + bits) < 0) + return ESP_FAIL; +@@ -350,7 +350,7 @@ static int sae_derive_pwe_ecc(struct sae_data *sae, const u8 *addr1, + wpa_printf(MSG_MSGDUMP, "SAE: counter = %03u", counter); + const_time_select_bin(found, stub_password, password, + password_len, tmp_password); +- if (hmac_sha256_vector(addrs, sizeof(addrs), 2, ++ if (wpa_hmac_sha256_vector(addrs, sizeof(addrs), 2, + addr, len, pwd_seed) < 0) + break; + +@@ -489,7 +489,7 @@ static int sae_derive_pwe_ffc(struct sae_data *sae, const u8 *addr1, + } + + wpa_printf(MSG_DEBUG, "SAE: counter = %02u", counter); +- if (hmac_sha256_vector(addrs, sizeof(addrs), 2, ++ if (wpa_hmac_sha256_vector(addrs, sizeof(addrs), 2, + addr, len, pwd_seed) < 0) + break; + res = sae_test_pwd_seed_ffc(sae, pwd_seed, pwe); +@@ -527,7 +527,7 @@ static int hkdf_extract(size_t hash_len, const u8 *salt, size_t salt_len, + u8 *prk) + { + if (hash_len == 32) +- return hmac_sha256_vector(salt, salt_len, num_elem, addr, len, ++ return wpa_hmac_sha256_vector(salt, salt_len, num_elem, addr, len, + prk); + return -1; + } +@@ -539,7 +539,7 @@ static int hkdf_expand(size_t hash_len, const u8 *prk, size_t prk_len, + size_t info_len = os_strlen(info); + + if (hash_len == 32) +- return hmac_sha256_kdf(prk, prk_len, NULL, ++ return wpa_hmac_sha256_kdf(prk, prk_len, NULL, + (const u8 *) info, info_len, + okm, okm_len); + return -1; +@@ -1455,7 +1455,7 @@ static int sae_kdf_hash(size_t hash_len, const u8 *k, const char *label, + u8 *out, size_t out_len) + { + if (hash_len == 32) +- return sha256_prf(k, hash_len, label, ++ return wpa_sha256_prf(k, hash_len, label, + context, context_len, out, out_len); + return -1; + } +diff --git a/components/wpa_supplicant/src/common/sae_pk.c b/components/wpa_supplicant/src/common/sae_pk.c +index 472ef03d2c..1baba9ff6c 100644 +--- a/components/wpa_supplicant/src/common/sae_pk.c ++++ b/components/wpa_supplicant/src/common/sae_pk.c +@@ -462,16 +462,16 @@ static size_t sae_group_2_hash_len(int group) + int sae_hash(size_t hash_len, const u8 *data, size_t len, u8 *hash) + { + if (hash_len == 32) { +- return sha256_vector(1, &data, &len, hash); ++ return wpa_sha256_vector(1, &data, &len, hash); + } + #ifdef CONFIG_SHA384 + if (hash_len == 48) { +- return sha384_vector(1, &data, &len, hash); ++ return wpa_sha384_vector(1, &data, &len, hash); + } + #endif /* CONFIG_SHA384 */ + #ifdef CONFIG_SHA512 + if (hash_len == 64) { +- return sha512_vector(1, &data, &len, hash); ++ return wpa_sha512_vector(1, &data, &len, hash); + } + #endif /* CONFIG_SHA512 */ + return -1; +diff --git a/components/wpa_supplicant/src/common/wpa_common.c b/components/wpa_supplicant/src/common/wpa_common.c +index faa0be573c..a8181a1e12 100644 +--- a/components/wpa_supplicant/src/common/wpa_common.c ++++ b/components/wpa_supplicant/src/common/wpa_common.c +@@ -705,7 +705,7 @@ void wpa_derive_pmk_r0(const u8 *xxkey, size_t xxkey_len, + os_memcpy(pos, s0kh_id, ETH_ALEN); + pos += ETH_ALEN; + +- sha256_prf(xxkey, xxkey_len, "FT-R0", buf, pos - buf, ++ wpa_sha256_prf(xxkey, xxkey_len, "FT-R0", buf, pos - buf, + r0_key_data, sizeof(r0_key_data)); + os_memcpy(pmk_r0, r0_key_data, PMK_LEN); + +@@ -717,7 +717,7 @@ void wpa_derive_pmk_r0(const u8 *xxkey, size_t xxkey_len, + addr[1] = r0_key_data + PMK_LEN; + len[1] = 16; + +- sha256_vector(2, addr, len, hash); ++ wpa_sha256_vector(2, addr, len, hash); + os_memcpy(pmk_r0_name, hash, WPA_PMK_NAME_LEN); + } + +@@ -747,7 +747,7 @@ void wpa_derive_pmk_r1_name(const u8 *pmk_r0_name, const u8 *r1kh_id, + addr[3] = s1kh_id; + len[3] = ETH_ALEN; + +- sha256_vector(4, addr, len, hash); ++ wpa_sha256_vector(4, addr, len, hash); + os_memcpy(pmk_r1_name, hash, WPA_PMK_NAME_LEN); + } + +@@ -771,7 +771,7 @@ void wpa_derive_pmk_r1(const u8 *pmk_r0, const u8 *pmk_r0_name, + os_memcpy(pos, s1kh_id, ETH_ALEN); + pos += ETH_ALEN; + +- sha256_prf(pmk_r0, PMK_LEN, "FT-R1", buf, pos - buf, pmk_r1, PMK_LEN); ++ wpa_sha256_prf(pmk_r0, PMK_LEN, "FT-R1", buf, pos - buf, pmk_r1, PMK_LEN); + + wpa_derive_pmk_r1_name(pmk_r0_name, r1kh_id, s1kh_id, pmk_r1_name); + } +@@ -813,7 +813,7 @@ int wpa_pmk_r1_to_ptk(const u8 *pmk_r1, const u8 *snonce, const u8 *anonce, + ptk->tk_len = wpa_cipher_key_len(cipher); + ptk_len = ptk->kck_len + ptk->kek_len + ptk->tk_len; + +- sha256_prf(pmk_r1, PMK_LEN, "FT-PTK", buf, pos - buf, tmp, ptk_len); ++ wpa_sha256_prf(pmk_r1, PMK_LEN, "FT-PTK", buf, pos - buf, tmp, ptk_len); + + /* + * PTKName = Truncate-128(SHA-256(PMKR1Name || "FT-PTKN" || SNonce || +@@ -832,7 +832,7 @@ int wpa_pmk_r1_to_ptk(const u8 *pmk_r1, const u8 *snonce, const u8 *anonce, + addr[5] = sta_addr; + len[5] = ETH_ALEN; + +- sha256_vector(6, addr, len, hash); ++ wpa_sha256_vector(6, addr, len, hash); + os_memcpy(ptk_name, hash, WPA_PMK_NAME_LEN); + + os_memcpy(ptk->kck, tmp, ptk->kck_len); +@@ -916,7 +916,7 @@ int wpa_eapol_key_mic(const u8 *key, size_t key_len, int akmp, int ver, + case WPA_KEY_INFO_TYPE_HMAC_MD5_RC4: + return hmac_md5(key, key_len, buf, len, mic); + case WPA_KEY_INFO_TYPE_HMAC_SHA1_AES: +- if (hmac_sha1(key, key_len, buf, len, hash)) ++ if (wpa_hmac_sha1(key, key_len, buf, len, hash)) + return -1; + os_memcpy(mic, hash, MD5_MAC_LEN); + break; +@@ -933,7 +933,7 @@ int wpa_eapol_key_mic(const u8 *key, size_t key_len, int akmp, int ver, + "WPA: EAPOL-Key MIC using HMAC-SHA%u (AKM-defined - SAE-EXT-KEY)", + (unsigned int) key_len * 8 * 2); + if (key_len == 128 / 8) { +- if (hmac_sha256(key, key_len, buf, len, hash)) ++ if (wpa_hmac_sha256(key, key_len, buf, len, hash)) + return -1; + } else { + wpa_printf(MSG_INFO, +@@ -946,14 +946,14 @@ int wpa_eapol_key_mic(const u8 *key, size_t key_len, int akmp, int ver, + #endif /* CONFIG_WPA3_SAE */ + #ifdef CONFIG_SUITEB + case WPA_KEY_MGMT_IEEE8021X_SUITE_B: +- if (hmac_sha256(key, key_len, buf, len, hash)) ++ if (wpa_hmac_sha256(key, key_len, buf, len, hash)) + return -1; + os_memcpy(mic, hash, MD5_MAC_LEN); + break; + #endif /* CONFIG_SUITEB */ + #ifdef CONFIG_SUITEB192 + case WPA_KEY_MGMT_IEEE8021X_SUITE_B_192: +- if (hmac_sha384(key, key_len, buf, len, hash)) ++ if (wpa_hmac_sha384(key, key_len, buf, len, hash)) + return -1; + os_memcpy(mic, hash, 24); + break; +@@ -964,7 +964,7 @@ int wpa_eapol_key_mic(const u8 *key, size_t key_len, int akmp, int ver, + "WPA: EAPOL-Key MIC using HMAC-SHA%u (AKM-defined - OWE)", + (unsigned int) key_len * 8 * 2); + if (key_len == 128 / 8) { +- if (hmac_sha256(key, key_len, buf, len, hash)) ++ if (wpa_hmac_sha256(key, key_len, buf, len, hash)) + return -1; + } else { + wpa_printf(MSG_INFO,"OWE: Unsupported KCK length: %u", +@@ -981,7 +981,7 @@ int wpa_eapol_key_mic(const u8 *key, size_t key_len, int akmp, int ver, + "WPA: EAPOL-Key MIC using HMAC-SHA%u (AKM-defined - DPP)", + (unsigned int) key_len * 8 * 2); + if (key_len == 128 / 8) { +- if (hmac_sha256(key, key_len, buf, len, hash)) ++ if (wpa_hmac_sha256(key, key_len, buf, len, hash)) + return -1; + } else { + wpa_printf(MSG_INFO, +@@ -1099,7 +1099,7 @@ int rsn_pmkid_suite_b(const u8 *kck, size_t kck_len, const u8 *aa, + addr[1] = aa; + addr[2] = spa; + +- if (hmac_sha256_vector(kck, kck_len, 3, addr, len, hash) < 0) ++ if (wpa_hmac_sha256_vector(kck, kck_len, 3, addr, len, hash) < 0) + return -1; + os_memcpy(pmkid, hash, PMKID_LEN); + return 0; +@@ -1131,7 +1131,7 @@ int rsn_pmkid_suite_b_192(const u8 *kck, size_t kck_len, const u8 *aa, + addr[1] = aa; + addr[2] = spa; + +- if (hmac_sha384_vector(kck, kck_len, 3, addr, len, hash) < 0) ++ if (wpa_hmac_sha384_vector(kck, kck_len, 3, addr, len, hash) < 0) + return -1; + os_memcpy(pmkid, hash, PMKID_LEN); + return 0; +@@ -1230,20 +1230,20 @@ int wpa_pmk_to_ptk(const u8 *pmk, size_t pmk_len, const char *label, + #if defined(CONFIG_SUITEB192) + if (wpa_key_mgmt_sha384(akmp)) { + wpa_printf(MSG_DEBUG, "WPA: PTK derivation using PRF(SHA384)"); +- if (sha384_prf(pmk, pmk_len, label, data, data_len, ++ if (wpa_sha384_prf(pmk, pmk_len, label, data, data_len, + tmp, ptk_len) < 0) + return -1; + } else + #endif + if (wpa_key_mgmt_sha256(akmp)) { +- sha256_prf(pmk, pmk_len, label, data, data_len, ++ wpa_sha256_prf(pmk, pmk_len, label, data, data_len, + tmp, ptk_len); + #ifdef CONFIG_WPA3_SAE + } else if (wpa_key_mgmt_sae_ext_key(akmp)) { + if (pmk_len == 32) { + wpa_printf(MSG_DEBUG, + "SAE: PTK derivation using PRF(SHA256)"); +- if (sha256_prf(pmk, pmk_len, label, data, data_len, ++ if (wpa_sha256_prf(pmk, pmk_len, label, data, data_len, + tmp, ptk_len) < 0) + return -1; + } else { +@@ -1253,7 +1253,7 @@ int wpa_pmk_to_ptk(const u8 *pmk, size_t pmk_len, const char *label, + } + #endif /* CONFIG_WPA3_SAE */ + } else { +- sha1_prf(pmk, pmk_len, label, data, data_len, tmp, ptk_len); ++ wpa_sha1_prf(pmk, pmk_len, label, data, data_len, tmp, ptk_len); + } + wpa_printf(MSG_DEBUG, "WPA: PTK derivation - A1=" MACSTR " A2=" MACSTR"\n", + MAC2STR(addr1), MAC2STR(addr2)); +@@ -1301,12 +1301,12 @@ void rsn_pmkid(const u8 *pmk, size_t pmk_len, const u8 *aa, const u8 *spa, + #ifdef CONFIG_IEEE80211W + if (wpa_key_mgmt_sha256(akmp)) { + wpa_printf(MSG_DEBUG, "RSN: Derive PMKID using HMAC-SHA-256"); +- hmac_sha256_vector(pmk, pmk_len, 3, addr, len, hash); ++ wpa_hmac_sha256_vector(pmk, pmk_len, 3, addr, len, hash); + } else + #endif /* CONFIG_IEEE80211W */ + { + wpa_printf(MSG_DEBUG, "RSN: Derive PMKID using HMAC-SHA-1"); +- hmac_sha1_vector(pmk, pmk_len, 3, addr, len, hash); ++ wpa_hmac_sha1_vector(pmk, pmk_len, 3, addr, len, hash); + } + os_memcpy(pmkid, hash, PMKID_LEN); + } +diff --git a/components/wpa_supplicant/src/crypto/aes-cbc.c b/components/wpa_supplicant/src/crypto/aes-cbc.c +index 0835f2cfb7..c5ce6f2bf7 100644 +--- a/components/wpa_supplicant/src/crypto/aes-cbc.c ++++ b/components/wpa_supplicant/src/crypto/aes-cbc.c +@@ -31,7 +31,7 @@ int aes_128_cbc_encrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len) + if (TEST_FAIL()) + return -1; + +- ctx = aes_encrypt_init(key, 16); ++ ctx = wpa_aes_encrypt_init(key, 16); + if (ctx == NULL) + return -1; + os_memcpy(cbc, iv, AES_BLOCK_SIZE); +@@ -40,11 +40,11 @@ int aes_128_cbc_encrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len) + for (i = 0; i < blocks; i++) { + for (j = 0; j < AES_BLOCK_SIZE; j++) + cbc[j] ^= pos[j]; +- aes_encrypt(ctx, cbc, cbc); ++ wpa_aes_encrypt(ctx, cbc, cbc); + os_memcpy(pos, cbc, AES_BLOCK_SIZE); + pos += AES_BLOCK_SIZE; + } +- aes_encrypt_deinit(ctx); ++ wpa_aes_encrypt_deinit(ctx); + return 0; + } + +@@ -67,7 +67,7 @@ int aes_128_cbc_decrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len) + if (TEST_FAIL()) + return -1; + +- ctx = aes_decrypt_init(key, 16); ++ ctx = wpa_aes_decrypt_init(key, 16); + if (ctx == NULL) + return -1; + os_memcpy(cbc, iv, AES_BLOCK_SIZE); +@@ -75,12 +75,12 @@ int aes_128_cbc_decrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len) + blocks = data_len / AES_BLOCK_SIZE; + for (i = 0; i < blocks; i++) { + os_memcpy(tmp, pos, AES_BLOCK_SIZE); +- aes_decrypt(ctx, pos, pos); ++ wpa_aes_decrypt(ctx, pos, pos); + for (j = 0; j < AES_BLOCK_SIZE; j++) + pos[j] ^= cbc[j]; + os_memcpy(cbc, tmp, AES_BLOCK_SIZE); + pos += AES_BLOCK_SIZE; + } +- aes_decrypt_deinit(ctx); ++ wpa_aes_decrypt_deinit(ctx); + return 0; + } +diff --git a/components/wpa_supplicant/src/crypto/aes-ccm.c b/components/wpa_supplicant/src/crypto/aes-ccm.c +index e5bb94ca08..bd0ba71ba3 100644 +--- a/components/wpa_supplicant/src/crypto/aes-ccm.c ++++ b/components/wpa_supplicant/src/crypto/aes-ccm.c +@@ -42,7 +42,7 @@ static void aes_ccm_auth_start(void *aes, size_t M, size_t L, const u8 *nonce, + WPA_PUT_BE16(&b[AES_BLOCK_SIZE - L], plain_len); + + wpa_hexdump_key(MSG_DEBUG, "CCM B_0", b, AES_BLOCK_SIZE); +- aes_encrypt(aes, b, x); /* X_1 = E(K, B_0) */ ++ wpa_aes_encrypt(aes, b, x); /* X_1 = E(K, B_0) */ + + if (!aad_len) + return; +@@ -52,12 +52,12 @@ static void aes_ccm_auth_start(void *aes, size_t M, size_t L, const u8 *nonce, + os_memset(aad_buf + 2 + aad_len, 0, sizeof(aad_buf) - 2 - aad_len); + + xor_aes_block(aad_buf, x); +- aes_encrypt(aes, aad_buf, x); /* X_2 = E(K, X_1 XOR B_1) */ ++ wpa_aes_encrypt(aes, aad_buf, x); /* X_2 = E(K, X_1 XOR B_1) */ + + if (aad_len > AES_BLOCK_SIZE - 2) { + xor_aes_block(&aad_buf[AES_BLOCK_SIZE], x); + /* X_3 = E(K, X_2 XOR B_2) */ +- aes_encrypt(aes, &aad_buf[AES_BLOCK_SIZE], x); ++ wpa_aes_encrypt(aes, &aad_buf[AES_BLOCK_SIZE], x); + } + } + +@@ -71,13 +71,13 @@ static void aes_ccm_auth(void *aes, const u8 *data, size_t len, u8 *x) + /* X_i+1 = E(K, X_i XOR B_i) */ + xor_aes_block(x, data); + data += AES_BLOCK_SIZE; +- aes_encrypt(aes, x, x); ++ wpa_aes_encrypt(aes, x, x); + } + if (last) { + /* XOR zero-padded last block */ + for (i = 0; i < last; i++) + x[i] ^= *data++; +- aes_encrypt(aes, x, x); ++ wpa_aes_encrypt(aes, x, x); + } + } + +@@ -100,14 +100,14 @@ static void aes_ccm_encr(void *aes, size_t L, const u8 *in, size_t len, u8 *out, + for (i = 1; i <= len / AES_BLOCK_SIZE; i++) { + WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], i); + /* S_i = E(K, A_i) */ +- aes_encrypt(aes, a, out); ++ wpa_aes_encrypt(aes, a, out); + xor_aes_block(out, in); + out += AES_BLOCK_SIZE; + in += AES_BLOCK_SIZE; + } + if (last) { + WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], i); +- aes_encrypt(aes, a, out); ++ wpa_aes_encrypt(aes, a, out); + /* XOR zero-padded last block */ + for (i = 0; i < last; i++) + *out++ ^= *in++; +@@ -123,7 +123,7 @@ static void aes_ccm_encr_auth(void *aes, size_t M, u8 *x, u8 *a, u8 *auth) + wpa_hexdump_key(MSG_DEBUG, "CCM T", x, M); + /* U = T XOR S_0; S_0 = E(K, A_0) */ + WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], 0); +- aes_encrypt(aes, a, tmp); ++ wpa_aes_encrypt(aes, a, tmp); + for (i = 0; i < M; i++) + auth[i] = x[i] ^ tmp[i]; + wpa_hexdump_key(MSG_DEBUG, "CCM U", auth, M); +@@ -138,7 +138,7 @@ static void aes_ccm_decr_auth(void *aes, size_t M, u8 *a, const u8 *auth, u8 *t) + wpa_hexdump_key(MSG_DEBUG, "CCM U", auth, M); + /* U = T XOR S_0; S_0 = E(K, A_0) */ + WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], 0); +- aes_encrypt(aes, a, tmp); ++ wpa_aes_encrypt(aes, a, tmp); + for (i = 0; i < M; i++) + t[i] = auth[i] ^ tmp[i]; + wpa_hexdump_key(MSG_DEBUG, "CCM T", t, M); +@@ -157,7 +157,7 @@ int aes_ccm_ae(const u8 *key, size_t key_len, const u8 *nonce, + if (aad_len > 30 || M > AES_BLOCK_SIZE) + return -1; + +- aes = aes_encrypt_init(key, key_len); ++ aes = wpa_aes_encrypt_init(key, key_len); + if (aes == NULL) + return -1; + +@@ -169,7 +169,7 @@ int aes_ccm_ae(const u8 *key, size_t key_len, const u8 *nonce, + aes_ccm_encr(aes, L, plain, plain_len, crypt, a); + aes_ccm_encr_auth(aes, M, x, a, auth); + +- aes_encrypt_deinit(aes); ++ wpa_aes_encrypt_deinit(aes); + + return 0; + } +@@ -188,7 +188,7 @@ int aes_ccm_ad(const u8 *key, size_t key_len, const u8 *nonce, + if (aad_len > 30 || M > AES_BLOCK_SIZE) + return -1; + +- aes = aes_encrypt_init(key, key_len); ++ aes = wpa_aes_encrypt_init(key, key_len); + if (aes == NULL) + return -1; + +@@ -202,7 +202,7 @@ int aes_ccm_ad(const u8 *key, size_t key_len, const u8 *nonce, + aes_ccm_auth_start(aes, M, L, nonce, aad, aad_len, crypt_len, x); + aes_ccm_auth(aes, plain, crypt_len, x); + +- aes_encrypt_deinit(aes); ++ wpa_aes_encrypt_deinit(aes); + + if (os_memcmp_const(x, t, M) != 0) { + wpa_printf(MSG_DEBUG, "CCM: Auth mismatch"); +diff --git a/components/wpa_supplicant/src/crypto/aes-ctr.c b/components/wpa_supplicant/src/crypto/aes-ctr.c +index 8ce05b894d..88d64e5841 100644 +--- a/components/wpa_supplicant/src/crypto/aes-ctr.c ++++ b/components/wpa_supplicant/src/crypto/aes-ctr.c +@@ -31,13 +31,13 @@ int aes_ctr_encrypt(const u8 *key, size_t key_len, const u8 *nonce, + u8 *pos = data; + u8 counter[AES_BLOCK_SIZE], buf[AES_BLOCK_SIZE]; + +- ctx = aes_encrypt_init(key, key_len); ++ ctx = wpa_aes_encrypt_init(key, key_len); + if (ctx == NULL) + return -1; + os_memcpy(counter, nonce, AES_BLOCK_SIZE); + + while (left > 0) { +- aes_encrypt(ctx, counter, buf); ++ wpa_aes_encrypt(ctx, counter, buf); + + len = (left < AES_BLOCK_SIZE) ? left : AES_BLOCK_SIZE; + for (j = 0; j < len; j++) +@@ -51,7 +51,7 @@ int aes_ctr_encrypt(const u8 *key, size_t key_len, const u8 *nonce, + break; + } + } +- aes_encrypt_deinit(ctx); ++ wpa_aes_encrypt_deinit(ctx); + return 0; + } + +diff --git a/components/wpa_supplicant/src/crypto/aes-gcm.c b/components/wpa_supplicant/src/crypto/aes-gcm.c +index 84294d2d10..6420c67edf 100644 +--- a/components/wpa_supplicant/src/crypto/aes-gcm.c ++++ b/components/wpa_supplicant/src/crypto/aes-gcm.c +@@ -155,7 +155,7 @@ static void aes_gctr(void *aes, const u8 *icb, const u8 *x, size_t xlen, u8 *y) + os_memcpy(cb, icb, AES_BLOCK_SIZE); + /* Full blocks */ + for (i = 0; i < n; i++) { +- aes_encrypt(aes, cb, ypos); ++ wpa_aes_encrypt(aes, cb, ypos); + xor_block(ypos, xpos); + xpos += AES_BLOCK_SIZE; + ypos += AES_BLOCK_SIZE; +@@ -165,7 +165,7 @@ static void aes_gctr(void *aes, const u8 *icb, const u8 *x, size_t xlen, u8 *y) + last = x + xlen - xpos; + if (last) { + /* Last, partial block */ +- aes_encrypt(aes, cb, tmp); ++ wpa_aes_encrypt(aes, cb, tmp); + for (i = 0; i < last; i++) + *ypos++ = *xpos++ ^ tmp[i]; + } +@@ -176,13 +176,13 @@ static void * aes_gcm_init_hash_subkey(const u8 *key, size_t key_len, u8 *H) + { + void *aes; + +- aes = aes_encrypt_init(key, key_len); ++ aes = wpa_aes_encrypt_init(key, key_len); + if (aes == NULL) + return NULL; + + /* Generate hash subkey H = AES_K(0^128) */ + os_memset(H, 0, AES_BLOCK_SIZE); +- aes_encrypt(aes, H, H); ++ wpa_aes_encrypt(aes, H, H); + wpa_hexdump_key(MSG_EXCESSIVE, "Hash subkey H for GHASH", + H, AES_BLOCK_SIZE); + return aes; +@@ -276,7 +276,7 @@ int aes_gcm_ae(const u8 *key, size_t key_len, const u8 *iv, size_t iv_len, + + /* Return (C, T) */ + +- aes_encrypt_deinit(aes); ++ wpa_aes_encrypt_deinit(aes); + + return 0; + } +@@ -308,7 +308,7 @@ int aes_gcm_ad(const u8 *key, size_t key_len, const u8 *iv, size_t iv_len, + /* T' = MSB_t(GCTR_K(J_0, S)) */ + aes_gctr(aes, J0, S, sizeof(S), T); + +- aes_encrypt_deinit(aes); ++ wpa_aes_encrypt_deinit(aes); + + if (os_memcmp_const(tag, T, 16) != 0) { + wpa_printf(MSG_EXCESSIVE, "GCM: Tag mismatch"); +diff --git a/components/wpa_supplicant/src/crypto/aes-internal-dec.c b/components/wpa_supplicant/src/crypto/aes-internal-dec.c +index 7482295949..5c5171123e 100644 +--- a/components/wpa_supplicant/src/crypto/aes-internal-dec.c ++++ b/components/wpa_supplicant/src/crypto/aes-internal-dec.c +@@ -31,7 +31,7 @@ static int rijndaelKeySetupDec(u32 rk[], const u8 cipherKey[], int keyBits) + u32 temp; + + /* expand the cipher key: */ +- Nr = rijndaelKeySetupEnc(rk, cipherKey, keyBits); ++ Nr = wpa_rijndaelKeySetupEnc(rk, cipherKey, keyBits); + if (Nr < 0) + return Nr; + /* invert the order of the round keys: */ +@@ -56,7 +56,7 @@ static int rijndaelKeySetupDec(u32 rk[], const u8 cipherKey[], int keyBits) + return Nr; + } + +-void * aes_decrypt_init(const u8 *key, size_t len) ++void * wpa_aes_decrypt_init(const u8 *key, size_t len) + { + u32 *rk; + int res; +@@ -148,7 +148,7 @@ d##3 = TD0(s##3) ^ TD1(s##2) ^ TD2(s##1) ^ TD3(s##0) ^ rk[4 * i + 3] + } + + +-int aes_decrypt(void *ctx, const u8 *crypt, u8 *plain) ++int wpa_aes_decrypt(void *ctx, const u8 *crypt, u8 *plain) + { + u32 *rk = ctx; + rijndaelDecrypt(ctx, rk[AES_PRIV_NR_POS], crypt, plain); +@@ -156,7 +156,7 @@ int aes_decrypt(void *ctx, const u8 *crypt, u8 *plain) + } + + +-void aes_decrypt_deinit(void *ctx) ++void wpa_aes_decrypt_deinit(void *ctx) + { + os_memset(ctx, 0, AES_PRIV_SIZE); + os_free(ctx); +diff --git a/components/wpa_supplicant/src/crypto/aes-internal-enc.c b/components/wpa_supplicant/src/crypto/aes-internal-enc.c +index baeffcaf63..2e00ba9a6e 100644 +--- a/components/wpa_supplicant/src/crypto/aes-internal-enc.c ++++ b/components/wpa_supplicant/src/crypto/aes-internal-enc.c +@@ -95,7 +95,7 @@ d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3] + } + + +-void * aes_encrypt_init(const u8 *key, size_t len) ++void * wpa_aes_encrypt_init(const u8 *key, size_t len) + { + u32 *rk; + int res; +@@ -106,7 +106,7 @@ void * aes_encrypt_init(const u8 *key, size_t len) + rk = os_malloc(AES_PRIV_SIZE); + if (rk == NULL) + return NULL; +- res = rijndaelKeySetupEnc(rk, key, len * 8); ++ res = wpa_rijndaelKeySetupEnc(rk, key, len * 8); + if (res < 0) { + os_free(rk); + return NULL; +@@ -116,7 +116,7 @@ void * aes_encrypt_init(const u8 *key, size_t len) + } + + +-int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt) ++int wpa_aes_encrypt(void *ctx, const u8 *plain, u8 *crypt) + { + u32 *rk = ctx; + rijndaelEncrypt(ctx, rk[AES_PRIV_NR_POS], plain, crypt); +@@ -124,7 +124,7 @@ int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt) + } + + +-void aes_encrypt_deinit(void *ctx) ++void wpa_aes_encrypt_deinit(void *ctx) + { + os_memset(ctx, 0, AES_PRIV_SIZE); + os_free(ctx); +diff --git a/components/wpa_supplicant/src/crypto/aes-internal.c b/components/wpa_supplicant/src/crypto/aes-internal.c +index bd4535d209..6b646027c8 100644 +--- a/components/wpa_supplicant/src/crypto/aes-internal.c ++++ b/components/wpa_supplicant/src/crypto/aes-internal.c +@@ -776,7 +776,7 @@ const u8 rcons[] = { + * + * @return the number of rounds for the given cipher key size. + */ +-int rijndaelKeySetupEnc(u32 rk[], const u8 cipherKey[], int keyBits) ++int wpa_rijndaelKeySetupEnc(u32 rk[], const u8 cipherKey[], int keyBits) + { + int i; + u32 temp; +diff --git a/components/wpa_supplicant/src/crypto/aes-omac1.c b/components/wpa_supplicant/src/crypto/aes-omac1.c +index 8642516340..bfc118afca 100644 +--- a/components/wpa_supplicant/src/crypto/aes-omac1.c ++++ b/components/wpa_supplicant/src/crypto/aes-omac1.c +@@ -51,7 +51,7 @@ int omac1_aes_vector(const u8 *key, size_t key_len, size_t num_elem, + if (TEST_FAIL()) + return -1; + +- ctx = aes_encrypt_init(key, key_len); ++ ctx = wpa_aes_encrypt_init(key, key_len); + if (ctx == NULL) + return -1; + os_memset(cbc, 0, AES_BLOCK_SIZE); +@@ -82,12 +82,12 @@ int omac1_aes_vector(const u8 *key, size_t key_len, size_t num_elem, + } + } + if (left > AES_BLOCK_SIZE) +- aes_encrypt(ctx, cbc, cbc); ++ wpa_aes_encrypt(ctx, cbc, cbc); + left -= AES_BLOCK_SIZE; + } + + os_memset(pad, 0, AES_BLOCK_SIZE); +- aes_encrypt(ctx, pad, pad); ++ wpa_aes_encrypt(ctx, pad, pad); + gf_mulx(pad); + + if (left || total_len == 0) { +@@ -111,8 +111,8 @@ int omac1_aes_vector(const u8 *key, size_t key_len, size_t num_elem, + + for (i = 0; i < AES_BLOCK_SIZE; i++) + pad[i] ^= cbc[i]; +- aes_encrypt(ctx, pad, mac); +- aes_encrypt_deinit(ctx); ++ wpa_aes_encrypt(ctx, pad, mac); ++ wpa_aes_encrypt_deinit(ctx); + return 0; + } + +diff --git a/components/wpa_supplicant/src/crypto/aes-unwrap.c b/components/wpa_supplicant/src/crypto/aes-unwrap.c +index ec793d9dbf..704f62cb0a 100644 +--- a/components/wpa_supplicant/src/crypto/aes-unwrap.c ++++ b/components/wpa_supplicant/src/crypto/aes-unwrap.c +@@ -36,7 +36,7 @@ int aes_unwrap(const u8 *kek, size_t kek_len, int n, const u8 *cipher, + r = plain; + os_memcpy(r, cipher + 8, 8 * n); + +- ctx = aes_decrypt_init(kek, kek_len); ++ ctx = wpa_aes_decrypt_init(kek, kek_len); + if (ctx == NULL) + return -1; + +@@ -58,13 +58,13 @@ int aes_unwrap(const u8 *kek, size_t kek_len, int n, const u8 *cipher, + b[4] ^= t >> 24; + + os_memcpy(b + 8, r, 8); +- aes_decrypt(ctx, b, b); ++ wpa_aes_decrypt(ctx, b, b); + os_memcpy(a, b, 8); + os_memcpy(r, b + 8, 8); + r -= 8; + } + } +- aes_decrypt_deinit(ctx); ++ wpa_aes_decrypt_deinit(ctx); + + /* 3) Output results. + * +diff --git a/components/wpa_supplicant/src/crypto/aes-wrap.c b/components/wpa_supplicant/src/crypto/aes-wrap.c +index 7ed34e803e..fec086c815 100644 +--- a/components/wpa_supplicant/src/crypto/aes-wrap.c ++++ b/components/wpa_supplicant/src/crypto/aes-wrap.c +@@ -37,7 +37,7 @@ int aes_wrap(const u8 *kek, size_t kek_len, int n, const u8 *plain, u8 *cipher) + os_memset(a, 0xa6, 8); + os_memcpy(r, plain, 8 * n); + +- ctx = aes_encrypt_init(kek, kek_len); ++ ctx = wpa_aes_encrypt_init(kek, kek_len); + if (ctx == NULL) + return -1; + +@@ -53,7 +53,7 @@ int aes_wrap(const u8 *kek, size_t kek_len, int n, const u8 *plain, u8 *cipher) + for (i = 1; i <= n; i++) { + os_memcpy(b, a, 8); + os_memcpy(b + 8, r, 8); +- aes_encrypt(ctx, b, b); ++ wpa_aes_encrypt(ctx, b, b); + os_memcpy(a, b, 8); + t = n * j + i; + a[7] ^= t; +@@ -64,7 +64,7 @@ int aes_wrap(const u8 *kek, size_t kek_len, int n, const u8 *plain, u8 *cipher) + r += 8; + } + } +- aes_encrypt_deinit(ctx); ++ wpa_aes_encrypt_deinit(ctx); + + /* 3) Output the results. + * +diff --git a/components/wpa_supplicant/src/crypto/aes.h b/components/wpa_supplicant/src/crypto/aes.h +index 8ab3de2ee8..3352e345dd 100644 +--- a/components/wpa_supplicant/src/crypto/aes.h ++++ b/components/wpa_supplicant/src/crypto/aes.h +@@ -11,11 +11,11 @@ + + #define AES_BLOCK_SIZE 16 + +-void * aes_encrypt_init(const u8 *key, size_t len); +-int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt); +-void aes_encrypt_deinit(void *ctx); +-void * aes_decrypt_init(const u8 *key, size_t len); +-int aes_decrypt(void *ctx, const u8 *crypt, u8 *plain); +-void aes_decrypt_deinit(void *ctx); ++void * wpa_aes_encrypt_init(const u8 *key, size_t len); ++int wpa_aes_encrypt(void *ctx, const u8 *plain, u8 *crypt); ++void wpa_aes_encrypt_deinit(void *ctx); ++void * wpa_aes_decrypt_init(const u8 *key, size_t len); ++int wpa_aes_decrypt(void *ctx, const u8 *crypt, u8 *plain); ++void wpa_aes_decrypt_deinit(void *ctx); + + #endif /* AES_H */ +diff --git a/components/wpa_supplicant/src/crypto/aes_i.h b/components/wpa_supplicant/src/crypto/aes_i.h +index b20ec92203..52f4c82cc0 100644 +--- a/components/wpa_supplicant/src/crypto/aes_i.h ++++ b/components/wpa_supplicant/src/crypto/aes_i.h +@@ -120,6 +120,6 @@ static inline u32 rotr(u32 val, int bits) + #define AES_PRIV_SIZE (4 * 4 * 15 + 4) + #define AES_PRIV_NR_POS (4 * 15) + +-int rijndaelKeySetupEnc(u32 rk[], const u8 cipherKey[], int keyBits); ++int wpa_rijndaelKeySetupEnc(u32 rk[], const u8 cipherKey[], int keyBits); + + #endif /* AES_I_H */ +diff --git a/components/wpa_supplicant/src/crypto/crypto.h b/components/wpa_supplicant/src/crypto/crypto.h +index 183cbf590f..780478e828 100644 +--- a/components/wpa_supplicant/src/crypto/crypto.h ++++ b/components/wpa_supplicant/src/crypto/crypto.h +@@ -51,7 +51,7 @@ int md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac); + * @mac: Buffer for the hash + * Returns: 0 on success, -1 on failure + */ +-int sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, ++int wpa_sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, + u8 *mac); + + /** +@@ -77,7 +77,7 @@ int __must_check fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x, + * @mac: Buffer for the hash + * Returns: 0 on success, -1 on failure + */ +-int sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len, ++int wpa_sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len, + u8 *mac); + + /** +@@ -88,7 +88,7 @@ int sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len, + * @mac: Buffer for the hash + * Returns: 0 on success, -1 on failure + */ +-int sha384_vector(size_t num_elem, const u8 *addr[], const size_t *len, ++int wpa_sha384_vector(size_t num_elem, const u8 *addr[], const size_t *len, + u8 *mac); + + /** +@@ -99,7 +99,7 @@ int sha384_vector(size_t num_elem, const u8 *addr[], const size_t *len, + * @mac: Buffer for the hash + * Returns: 0 on success, -1 on failure + */ +-int sha512_vector(size_t num_elem, const u8 *addr[], const size_t *len, ++int wpa_sha512_vector(size_t num_elem, const u8 *addr[], const size_t *len, + u8 *mac); + + /** +@@ -112,50 +112,50 @@ int sha512_vector(size_t num_elem, const u8 *addr[], const size_t *len, + int des_encrypt(const u8 *clear, const u8 *key, u8 *cypher); + + /** +- * aes_encrypt_init - Initialize AES for encryption ++ * wpa_aes_encrypt_init - Initialize AES for encryption + * @key: Encryption key + * @len: Key length in bytes (usually 16, i.e., 128 bits) + * Returns: Pointer to context data or %NULL on failure + */ +-void * aes_encrypt_init(const u8 *key, size_t len); ++void * wpa_aes_encrypt_init(const u8 *key, size_t len); + + /** +- * aes_encrypt - Encrypt one AES block +- * @ctx: Context pointer from aes_encrypt_init() ++ * wpa_aes_encrypt - Encrypt one AES block ++ * @ctx: Context pointer from wpa_aes_encrypt_init() + * @plain: Plaintext data to be encrypted (16 bytes) + * @crypt: Buffer for the encrypted data (16 bytes) + * Returns: 0 on success, -1 on failure + */ +-int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt); ++int wpa_aes_encrypt(void *ctx, const u8 *plain, u8 *crypt); + + /** +- * aes_encrypt_deinit - Deinitialize AES encryption +- * @ctx: Context pointer from aes_encrypt_init() ++ * wpa_aes_encrypt_deinit - Deinitialize AES encryption ++ * @ctx: Context pointer from wpa_aes_encrypt_init() + */ +-void aes_encrypt_deinit(void *ctx); ++void wpa_aes_encrypt_deinit(void *ctx); + + /** +- * aes_decrypt_init - Initialize AES for decryption ++ * wpa_aes_decrypt_init - Initialize AES for decryption + * @key: Decryption key + * @len: Key length in bytes (usually 16, i.e., 128 bits) + * Returns: Pointer to context data or %NULL on failure + */ +-void * aes_decrypt_init(const u8 *key, size_t len); ++void * wpa_aes_decrypt_init(const u8 *key, size_t len); + + /** +- * aes_decrypt - Decrypt one AES block +- * @ctx: Context pointer from aes_encrypt_init() ++ * wpa_aes_decrypt - Decrypt one AES block ++ * @ctx: Context pointer from wpa_aes_encrypt_init() + * @crypt: Encrypted data (16 bytes) + * @plain: Buffer for the decrypted data (16 bytes) + * Returns: 0 on success, -1 on failure + */ +-int aes_decrypt(void *ctx, const u8 *crypt, u8 *plain); ++int wpa_aes_decrypt(void *ctx, const u8 *crypt, u8 *plain); + + /** +- * aes_decrypt_deinit - Deinitialize AES decryption +- * @ctx: Context pointer from aes_encrypt_init() ++ * wpa_aes_decrypt_deinit - Deinitialize AES decryption ++ * @ctx: Context pointer from wpa_aes_encrypt_init() + */ +-void aes_decrypt_deinit(void *ctx); ++void wpa_aes_decrypt_deinit(void *ctx); + + + enum crypto_hash_alg { +diff --git a/components/wpa_supplicant/src/crypto/crypto_internal-cipher.c b/components/wpa_supplicant/src/crypto/crypto_internal-cipher.c +index ad0930a5a9..e3f5794cf7 100644 +--- a/components/wpa_supplicant/src/crypto/crypto_internal-cipher.c ++++ b/components/wpa_supplicant/src/crypto/crypto_internal-cipher.c +@@ -62,14 +62,14 @@ struct crypto_cipher * crypto_cipher_init(enum crypto_cipher_alg alg, + os_memcpy(ctx->u.rc4.key, key, key_len); + break; + case CRYPTO_CIPHER_ALG_AES: +- ctx->u.aes.ctx_enc = aes_encrypt_init(key, key_len); ++ ctx->u.aes.ctx_enc = wpa_aes_encrypt_init(key, key_len); + if (ctx->u.aes.ctx_enc == NULL) { + os_free(ctx); + return NULL; + } +- ctx->u.aes.ctx_dec = aes_decrypt_init(key, key_len); ++ ctx->u.aes.ctx_dec = wpa_aes_decrypt_init(key, key_len); + if (ctx->u.aes.ctx_dec == NULL) { +- aes_encrypt_deinit(ctx->u.aes.ctx_enc); ++ wpa_aes_encrypt_deinit(ctx->u.aes.ctx_enc); + os_free(ctx); + return NULL; + } +@@ -120,7 +120,7 @@ int crypto_cipher_encrypt(struct crypto_cipher *ctx, const u8 *plain, + for (i = 0; i < blocks; i++) { + for (j = 0; j < AES_BLOCK_SIZE; j++) + ctx->u.aes.cbc[j] ^= plain[j]; +- aes_encrypt(ctx->u.aes.ctx_enc, ctx->u.aes.cbc, ++ wpa_aes_encrypt(ctx->u.aes.ctx_enc, ctx->u.aes.cbc, + ctx->u.aes.cbc); + os_memcpy(crypt, ctx->u.aes.cbc, AES_BLOCK_SIZE); + plain += AES_BLOCK_SIZE; +@@ -183,7 +183,7 @@ int crypto_cipher_decrypt(struct crypto_cipher *ctx, const u8 *crypt, + blocks = len / AES_BLOCK_SIZE; + for (i = 0; i < blocks; i++) { + os_memcpy(tmp, crypt, AES_BLOCK_SIZE); +- aes_decrypt(ctx->u.aes.ctx_dec, crypt, plain); ++ wpa_aes_decrypt(ctx->u.aes.ctx_dec, crypt, plain); + for (j = 0; j < AES_BLOCK_SIZE; j++) + plain[j] ^= ctx->u.aes.cbc[j]; + os_memcpy(ctx->u.aes.cbc, tmp, AES_BLOCK_SIZE); +@@ -231,8 +231,8 @@ void crypto_cipher_deinit(struct crypto_cipher *ctx) + { + switch (ctx->alg) { + case CRYPTO_CIPHER_ALG_AES: +- aes_encrypt_deinit(ctx->u.aes.ctx_enc); +- aes_decrypt_deinit(ctx->u.aes.ctx_dec); ++ wpa_aes_encrypt_deinit(ctx->u.aes.ctx_enc); ++ wpa_aes_decrypt_deinit(ctx->u.aes.ctx_dec); + break; + case CRYPTO_CIPHER_ALG_3DES: + break; +diff --git a/components/wpa_supplicant/src/crypto/crypto_internal.c b/components/wpa_supplicant/src/crypto/crypto_internal.c +index aad40af16e..ed74dd2a4f 100644 +--- a/components/wpa_supplicant/src/crypto/crypto_internal.c ++++ b/components/wpa_supplicant/src/crypto/crypto_internal.c +@@ -59,17 +59,17 @@ struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key, + break; + #ifdef CONFIG_SHA256 + case CRYPTO_HASH_ALG_SHA256: +- sha256_init(&ctx->u.sha256); ++ wpa_sha256_init(&ctx->u.sha256); + break; + #endif /* CONFIG_SHA256 */ + #ifdef CONFIG_INTERNAL_SHA384 + case CRYPTO_HASH_ALG_SHA384: +- sha384_init(&ctx->u.sha384); ++ wpa_sha384_init(&ctx->u.sha384); + break; + #endif /* CONFIG_INTERNAL_SHA384 */ + #ifdef CONFIG_INTERNAL_SHA512 + case CRYPTO_HASH_ALG_SHA512: +- sha512_init(&ctx->u.sha512); ++ wpa_sha512_init(&ctx->u.sha512); + break; + #endif /* CONFIG_INTERNAL_SHA512 */ + case CRYPTO_HASH_ALG_HMAC_MD5: +@@ -113,9 +113,9 @@ struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key, + #ifdef CONFIG_SHA256 + case CRYPTO_HASH_ALG_HMAC_SHA256: + if (key_len > sizeof(k_pad)) { +- sha256_init(&ctx->u.sha256); +- sha256_process(&ctx->u.sha256, key, key_len); +- sha256_done(&ctx->u.sha256, tk); ++ wpa_sha256_init(&ctx->u.sha256); ++ wpa_sha256_process(&ctx->u.sha256, key, key_len); ++ wpa_sha256_done(&ctx->u.sha256, tk); + key = tk; + key_len = 32; + } +@@ -127,8 +127,8 @@ struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key, + os_memset(k_pad + key_len, 0, sizeof(k_pad) - key_len); + for (i = 0; i < sizeof(k_pad); i++) + k_pad[i] ^= 0x36; +- sha256_init(&ctx->u.sha256); +- sha256_process(&ctx->u.sha256, k_pad, sizeof(k_pad)); ++ wpa_sha256_init(&ctx->u.sha256); ++ wpa_sha256_process(&ctx->u.sha256, k_pad, sizeof(k_pad)); + break; + #endif /* CONFIG_SHA256 */ + default: +@@ -157,17 +157,17 @@ void crypto_hash_update(struct crypto_hash *ctx, const u8 *data, size_t len) + #ifdef CONFIG_SHA256 + case CRYPTO_HASH_ALG_SHA256: + case CRYPTO_HASH_ALG_HMAC_SHA256: +- sha256_process(&ctx->u.sha256, data, len); ++ wpa_sha256_process(&ctx->u.sha256, data, len); + break; + #endif /* CONFIG_SHA256 */ + #ifdef CONFIG_INTERNAL_SHA384 + case CRYPTO_HASH_ALG_SHA384: +- sha384_process(&ctx->u.sha384, data, len); ++ wpa_sha384_process(&ctx->u.sha384, data, len); + break; + #endif /* CONFIG_INTERNAL_SHA384 */ + #ifdef CONFIG_INTERNAL_SHA512 + case CRYPTO_HASH_ALG_SHA512: +- sha512_process(&ctx->u.sha512, data, len); ++ wpa_sha512_process(&ctx->u.sha512, data, len); + break; + #endif /* CONFIG_INTERNAL_SHA512 */ + default: +@@ -216,7 +216,7 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len) + return -1; + } + *len = 32; +- sha256_done(&ctx->u.sha256, mac); ++ wpa_sha256_done(&ctx->u.sha256, mac); + break; + #endif /* CONFIG_SHA256 */ + #ifdef CONFIG_INTERNAL_SHA384 +@@ -227,7 +227,7 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len) + return -1; + } + *len = 48; +- sha384_done(&ctx->u.sha384, mac); ++ wpa_sha384_done(&ctx->u.sha384, mac); + break; + #endif /* CONFIG_INTERNAL_SHA384 */ + #ifdef CONFIG_INTERNAL_SHA512 +@@ -238,7 +238,7 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len) + return -1; + } + *len = 64; +- sha512_done(&ctx->u.sha512, mac); ++ wpa_sha512_done(&ctx->u.sha512, mac); + break; + #endif /* CONFIG_INTERNAL_SHA512 */ + case CRYPTO_HASH_ALG_HMAC_MD5: +@@ -290,17 +290,17 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len) + } + *len = 32; + +- sha256_done(&ctx->u.sha256, mac); ++ wpa_sha256_done(&ctx->u.sha256, mac); + + os_memcpy(k_pad, ctx->key, ctx->key_len); + os_memset(k_pad + ctx->key_len, 0, + sizeof(k_pad) - ctx->key_len); + for (i = 0; i < sizeof(k_pad); i++) + k_pad[i] ^= 0x5c; +- sha256_init(&ctx->u.sha256); +- sha256_process(&ctx->u.sha256, k_pad, sizeof(k_pad)); +- sha256_process(&ctx->u.sha256, mac, 32); +- sha256_done(&ctx->u.sha256, mac); ++ wpa_sha256_init(&ctx->u.sha256); ++ wpa_sha256_process(&ctx->u.sha256, k_pad, sizeof(k_pad)); ++ wpa_sha256_process(&ctx->u.sha256, mac, 32); ++ wpa_sha256_done(&ctx->u.sha256, mac); + break; + #endif /* CONFIG_SHA256 */ + default: +diff --git a/components/wpa_supplicant/src/crypto/crypto_ops.c b/components/wpa_supplicant/src/crypto/crypto_ops.c +index 0346d17f5c..88af2421dd 100644 +--- a/components/wpa_supplicant/src/crypto/crypto_ops.c ++++ b/components/wpa_supplicant/src/crypto/crypto_ops.c +@@ -36,7 +36,7 @@ static int esp_aes_gmac(const u8 *key, size_t key_len, const u8 *iv, size_t iv_l + const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs = { + .size = sizeof(wpa_crypto_funcs_t), + .version = ESP_WIFI_CRYPTO_VERSION, +- .hmac_sha256_vector = (esp_hmac_sha256_vector_t)hmac_sha256_vector, ++ .hmac_sha256_vector = (esp_hmac_sha256_vector_t)wpa_hmac_sha256_vector, + .pbkdf2_sha1 = (esp_pbkdf2_sha1_t)pbkdf2_sha1, + .aes_128_encrypt = (esp_aes_128_encrypt_t)aes_128_cbc_encrypt, + .aes_128_decrypt = (esp_aes_128_decrypt_t)aes_128_cbc_decrypt, +@@ -44,7 +44,7 @@ const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs = { + .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, ++ .sha256_vector = (esp_sha256_vector_t)wpa_sha256_vector, + }; + + const mesh_crypto_funcs_t g_wifi_default_mesh_crypto_funcs = { +diff --git a/components/wpa_supplicant/src/crypto/ms_funcs.c b/components/wpa_supplicant/src/crypto/ms_funcs.c +index aff7d33f4e..a2e1ce799a 100644 +--- a/components/wpa_supplicant/src/crypto/ms_funcs.c ++++ b/components/wpa_supplicant/src/crypto/ms_funcs.c +@@ -92,7 +92,7 @@ int challenge_hash(const u8 *peer_challenge, const u8 *auth_challenge, + addr[2] = username; + len[2] = username_len; + +- if (sha1_vector(3, addr, len, hash)) ++ if (wpa_sha1_vector(3, addr, len, hash)) + return -1; + os_memcpy(challenge, hash, 8); + return 0; +@@ -259,11 +259,11 @@ int generate_authenticator_response_pwhash( + addr2[2] = magic2; + + if (hash_nt_password_hash(password_hash, password_hash_hash) || +- sha1_vector(3, addr1, len1, response) || ++ wpa_sha1_vector(3, addr1, len1, response) || + challenge_hash(peer_challenge, auth_challenge, username, + username_len, challenge)) + return -1; +- return sha1_vector(3, addr2, len2, response); ++ return wpa_sha1_vector(3, addr2, len2, response); + } + + +@@ -338,7 +338,7 @@ int get_master_key(const u8 *password_hash_hash, const u8 *nt_response, + addr[1] = nt_response; + addr[2] = magic1; + +- if (sha1_vector(3, addr, len, hash)) ++ if (wpa_sha1_vector(3, addr, len, hash)) + return -1; + os_memcpy(master_key, hash, 16); + return 0; +@@ -406,7 +406,7 @@ int get_asymetric_start_key(const u8 *master_key, u8 *session_key, + } + addr[3] = shs_pad2; + +- if (sha1_vector(4, addr, len, digest)) ++ if (wpa_sha1_vector(4, addr, len, digest)) + return -1; + + if (session_key_len > SHA1_MAC_LEN) +diff --git a/components/wpa_supplicant/src/crypto/sha1-internal.c b/components/wpa_supplicant/src/crypto/sha1-internal.c +index ffa04df017..f792cad221 100644 +--- a/components/wpa_supplicant/src/crypto/sha1-internal.c ++++ b/components/wpa_supplicant/src/crypto/sha1-internal.c +@@ -28,7 +28,7 @@ void SHA1Transform(u32 state[5], const unsigned char buffer[64]); + * @mac: Buffer for the hash + * Returns: 0 on success, -1 of failure + */ +-int sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac) ++int wpa_sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac) + { + SHA1_CTX ctx; + size_t i; +diff --git a/components/wpa_supplicant/src/crypto/sha1-pbkdf2.c b/components/wpa_supplicant/src/crypto/sha1-pbkdf2.c +index 8effe2fe06..d3e86f0d5f 100644 +--- a/components/wpa_supplicant/src/crypto/sha1-pbkdf2.c ++++ b/components/wpa_supplicant/src/crypto/sha1-pbkdf2.c +@@ -37,13 +37,13 @@ static int pbkdf2_sha1_f(const char *passphrase, const u8 *ssid, + count_buf[1] = (count >> 16) & 0xff; + count_buf[2] = (count >> 8) & 0xff; + count_buf[3] = count & 0xff; +- if (hmac_sha1_vector((u8 *) passphrase, passphrase_len, 2, addr, len, ++ if (wpa_hmac_sha1_vector((u8 *) passphrase, passphrase_len, 2, addr, len, + tmp)) + return -1; + os_memcpy(digest, tmp, SHA1_MAC_LEN); + + for (i = 1; i < iterations; i++) { +- if (hmac_sha1((u8 *) passphrase, passphrase_len, tmp, ++ if (wpa_hmac_sha1((u8 *) passphrase, passphrase_len, tmp, + SHA1_MAC_LEN, tmp2)) + return -1; + os_memcpy(tmp, tmp2, SHA1_MAC_LEN); +diff --git a/components/wpa_supplicant/src/crypto/sha1-prf.c b/components/wpa_supplicant/src/crypto/sha1-prf.c +index 13851494fb..3b44d9a26e 100644 +--- a/components/wpa_supplicant/src/crypto/sha1-prf.c ++++ b/components/wpa_supplicant/src/crypto/sha1-prf.c +@@ -27,7 +27,7 @@ + * This function is used to derive new, cryptographically separate keys from a + * given key (e.g., PMK in IEEE 802.11i). + */ +-int sha1_prf(const u8 *key, size_t key_len, const char *label, ++int wpa_sha1_prf(const u8 *key, size_t key_len, const char *label, + const u8 *data, size_t data_len, u8 *buf, size_t buf_len) + { + u8 counter = 0; +@@ -48,12 +48,12 @@ int sha1_prf(const u8 *key, size_t key_len, const char *label, + while (pos < buf_len) { + plen = buf_len - pos; + if (plen >= SHA1_MAC_LEN) { +- if (hmac_sha1_vector(key, key_len, 3, addr, len, ++ if (wpa_hmac_sha1_vector(key, key_len, 3, addr, len, + &buf[pos])) + return -1; + pos += SHA1_MAC_LEN; + } else { +- if (hmac_sha1_vector(key, key_len, 3, addr, len, ++ if (wpa_hmac_sha1_vector(key, key_len, 3, addr, len, + hash)) + return -1; + os_memcpy(&buf[pos], hash, plen); +diff --git a/components/wpa_supplicant/src/crypto/sha1-tlsprf.c b/components/wpa_supplicant/src/crypto/sha1-tlsprf.c +index 5e8d15920c..c5a04b2b2a 100644 +--- a/components/wpa_supplicant/src/crypto/sha1-tlsprf.c ++++ b/components/wpa_supplicant/src/crypto/sha1-tlsprf.c +@@ -69,7 +69,7 @@ int tls_prf_sha1_md5(const u8 *secret, size_t secret_len, const char *label, + } + + hmac_md5_vector(S1, L_S1, 2, &MD5_addr[1], &MD5_len[1], A_MD5); +- hmac_sha1_vector(S2, L_S2, 2, &SHA1_addr[1], &SHA1_len[1], A_SHA1); ++ wpa_hmac_sha1_vector(S2, L_S2, 2, &SHA1_addr[1], &SHA1_len[1], A_SHA1); + + MD5_pos = MD5_MAC_LEN; + SHA1_pos = SHA1_MAC_LEN; +@@ -80,10 +80,10 @@ int tls_prf_sha1_md5(const u8 *secret, size_t secret_len, const char *label, + hmac_md5(S1, L_S1, A_MD5, MD5_MAC_LEN, A_MD5); + } + if (SHA1_pos == SHA1_MAC_LEN) { +- hmac_sha1_vector(S2, L_S2, 3, SHA1_addr, SHA1_len, ++ wpa_hmac_sha1_vector(S2, L_S2, 3, SHA1_addr, SHA1_len, + P_SHA1); + SHA1_pos = 0; +- hmac_sha1(S2, L_S2, A_SHA1, SHA1_MAC_LEN, A_SHA1); ++ wpa_hmac_sha1(S2, L_S2, A_SHA1, SHA1_MAC_LEN, A_SHA1); + } + + out[i] = P_MD5[MD5_pos] ^ P_SHA1[SHA1_pos]; +diff --git a/components/wpa_supplicant/src/crypto/sha1-tprf.c b/components/wpa_supplicant/src/crypto/sha1-tprf.c +index c3acf19750..d0518e1eaa 100644 +--- a/components/wpa_supplicant/src/crypto/sha1-tprf.c ++++ b/components/wpa_supplicant/src/crypto/sha1-tprf.c +@@ -26,7 +26,7 @@ + * This function is used to derive new, cryptographically separate keys from a + * given key for EAP-FAST. T-PRF is defined in RFC 4851, Section 5.5. + */ +-int sha1_t_prf(const u8 *key, size_t key_len, const char *label, ++int wpa_sha1_t_prf(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; +@@ -54,7 +54,7 @@ int sha1_t_prf(const u8 *key, size_t key_len, const char *label, + while (pos < buf_len) { + counter++; + plen = buf_len - pos; +- if (hmac_sha1_vector(key, key_len, 5, addr, len, hash)) ++ if (wpa_hmac_sha1_vector(key, key_len, 5, addr, len, hash)) + return -1; + if (plen >= SHA1_MAC_LEN) { + os_memcpy(&buf[pos], hash, SHA1_MAC_LEN); +diff --git a/components/wpa_supplicant/src/crypto/sha1.c b/components/wpa_supplicant/src/crypto/sha1.c +index 76d7a68f26..127aa9cc1c 100644 +--- a/components/wpa_supplicant/src/crypto/sha1.c ++++ b/components/wpa_supplicant/src/crypto/sha1.c +@@ -23,7 +23,7 @@ + * @mac: Buffer for the hash (20 bytes) + * Returns: 0 on success, -1 on failure + */ +-int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, ++int wpa_hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, + const u8 *addr[], const size_t *len, u8 *mac) + { + unsigned char k_pad[64]; /* padding - key XORd with ipad/opad */ +@@ -42,7 +42,7 @@ int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, + + /* if key is longer than 64 bytes reset it to key = SHA1(key) */ + if (key_len > 64) { +- if (sha1_vector(1, &key, &key_len, tk)) ++ if (wpa_sha1_vector(1, &key, &key_len, tk)) + return -1; + key = tk; + key_len = 20; +@@ -71,7 +71,7 @@ int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, + _addr[i + 1] = addr[i]; + _len[i + 1] = len[i]; + } +- if (sha1_vector(1 + num_elem, _addr, _len, mac)) ++ if (wpa_sha1_vector(1 + num_elem, _addr, _len, mac)) + return -1; + + os_memset(k_pad, 0, sizeof(k_pad)); +@@ -85,7 +85,7 @@ int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, + _len[0] = 64; + _addr[1] = mac; + _len[1] = SHA1_MAC_LEN; +- ret = sha1_vector(2, _addr, _len, mac); ++ ret = wpa_sha1_vector(2, _addr, _len, mac); + forced_memzero(k_pad, sizeof(k_pad)); + forced_memzero(tk, sizeof(tk)); + return ret; +@@ -101,8 +101,8 @@ int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, + * @mac: Buffer for the hash (20 bytes) + * Returns: 0 on success, -1 of failure + */ +-int hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len, ++int wpa_hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len, + u8 *mac) + { +- return hmac_sha1_vector(key, key_len, 1, &data, &data_len, mac); ++ return wpa_hmac_sha1_vector(key, key_len, 1, &data, &data_len, mac); + } +diff --git a/components/wpa_supplicant/src/crypto/sha1.h b/components/wpa_supplicant/src/crypto/sha1.h +index 933cd81b95..cdf39f840a 100644 +--- a/components/wpa_supplicant/src/crypto/sha1.h ++++ b/components/wpa_supplicant/src/crypto/sha1.h +@@ -11,13 +11,13 @@ + + #define SHA1_MAC_LEN 20 + +-int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, ++int wpa_hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, + const u8 *addr[], const size_t *len, u8 *mac); +-int hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len, ++int wpa_hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len, + u8 *mac); +-int sha1_prf(const u8 *key, size_t key_len, const char *label, ++int wpa_sha1_prf(const u8 *key, size_t key_len, const char *label, + const u8 *data, size_t data_len, u8 *buf, size_t buf_len); +-int sha1_t_prf(const u8 *key, size_t key_len, const char *label, ++int wpa_sha1_t_prf(const u8 *key, size_t key_len, const char *label, + const u8 *seed, size_t seed_len, u8 *buf, size_t buf_len); + int __must_check tls_prf_sha1_md5(const u8 *secret, size_t secret_len, + const char *label, const u8 *seed, +diff --git a/components/wpa_supplicant/src/crypto/sha256-internal.c b/components/wpa_supplicant/src/crypto/sha256-internal.c +index ff1e2ba168..bc9370d0a7 100644 +--- a/components/wpa_supplicant/src/crypto/sha256-internal.c ++++ b/components/wpa_supplicant/src/crypto/sha256-internal.c +@@ -22,7 +22,7 @@ + * @mac: Buffer for the hash + * Returns: 0 on success, -1 of failure + */ +-int sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len, ++int wpa_sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len, + u8 *mac) + { + struct sha256_state ctx; +@@ -31,11 +31,11 @@ int sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len, + if (TEST_FAIL()) + return -1; + +- sha256_init(&ctx); ++ wpa_sha256_init(&ctx); + for (i = 0; i < num_elem; i++) +- if (sha256_process(&ctx, addr[i], len[i])) ++ if (wpa_sha256_process(&ctx, addr[i], len[i])) + return -1; +- if (sha256_done(&ctx, mac)) ++ if (wpa_sha256_done(&ctx, mac)) + return -1; + return 0; + } +@@ -81,7 +81,7 @@ static const unsigned long K[64] = { + #endif + + /* compress 512-bits */ +-static int sha256_compress(struct sha256_state *md, unsigned char *buf) ++static int wpa_sha256_compress(struct sha256_state *md, unsigned char *buf) + { + u32 S[8], W[64], t0, t1; + u32 t; +@@ -124,7 +124,7 @@ static int sha256_compress(struct sha256_state *md, unsigned char *buf) + + + /* Initialize the hash state */ +-void sha256_init(struct sha256_state *md) ++void wpa_sha256_init(struct sha256_state *md) + { + md->curlen = 0; + md->length = 0; +@@ -145,7 +145,7 @@ void sha256_init(struct sha256_state *md) + @param inlen The length of the data (octets) + @return CRYPT_OK if successful + */ +-int sha256_process(struct sha256_state *md, const unsigned char *in, ++int wpa_sha256_process(struct sha256_state *md, const unsigned char *in, + unsigned long inlen) + { + unsigned long n; +@@ -155,7 +155,7 @@ int sha256_process(struct sha256_state *md, const unsigned char *in, + + while (inlen > 0) { + if (md->curlen == 0 && inlen >= SHA256_BLOCK_SIZE) { +- if (sha256_compress(md, (unsigned char *) in) < 0) ++ if (wpa_sha256_compress(md, (unsigned char *) in) < 0) + return -1; + md->length += SHA256_BLOCK_SIZE * 8; + in += SHA256_BLOCK_SIZE; +@@ -167,7 +167,7 @@ int sha256_process(struct sha256_state *md, const unsigned char *in, + in += n; + inlen -= n; + if (md->curlen == SHA256_BLOCK_SIZE) { +- if (sha256_compress(md, md->buf) < 0) ++ if (wpa_sha256_compress(md, md->buf) < 0) + return -1; + md->length += 8 * SHA256_BLOCK_SIZE; + md->curlen = 0; +@@ -185,7 +185,7 @@ int sha256_process(struct sha256_state *md, const unsigned char *in, + @param out [out] The destination of the hash (32 bytes) + @return CRYPT_OK if successful + */ +-int sha256_done(struct sha256_state *md, unsigned char *out) ++int wpa_sha256_done(struct sha256_state *md, unsigned char *out) + { + int i; + +@@ -206,7 +206,7 @@ int sha256_done(struct sha256_state *md, unsigned char *out) + while (md->curlen < SHA256_BLOCK_SIZE) { + md->buf[md->curlen++] = (unsigned char) 0; + } +- sha256_compress(md, md->buf); ++ wpa_sha256_compress(md, md->buf); + md->curlen = 0; + } + +@@ -217,7 +217,7 @@ int sha256_done(struct sha256_state *md, unsigned char *out) + + /* store length */ + WPA_PUT_BE64(md->buf + 56, md->length); +- sha256_compress(md, md->buf); ++ wpa_sha256_compress(md, md->buf); + + /* copy output */ + for (i = 0; i < 8; i++) +diff --git a/components/wpa_supplicant/src/crypto/sha256-kdf.c b/components/wpa_supplicant/src/crypto/sha256-kdf.c +index 5a6b744552..271981157c 100644 +--- a/components/wpa_supplicant/src/crypto/sha256-kdf.c ++++ b/components/wpa_supplicant/src/crypto/sha256-kdf.c +@@ -29,7 +29,7 @@ + * with label = NULL and seed = info, this matches HKDF-Expand() defined in + * RFC 5869, Chapter 2.3. + */ +-int hmac_sha256_kdf(const u8 *secret, size_t secret_len, ++int wpa_hmac_sha256_kdf(const u8 *secret, size_t secret_len, + const char *label, const u8 *seed, size_t seed_len, + u8 *out, size_t outlen) + { +@@ -53,7 +53,7 @@ int hmac_sha256_kdf(const u8 *secret, size_t secret_len, + addr[3] = &iter; + len[3] = 1; + +- if (hmac_sha256_vector(secret, secret_len, 3, &addr[1], &len[1], T) < 0) ++ if (wpa_hmac_sha256_vector(secret, secret_len, 3, &addr[1], &len[1], T) < 0) + return -1; + + pos = 0; +@@ -74,7 +74,7 @@ int hmac_sha256_kdf(const u8 *secret, size_t secret_len, + } + iter++; + +- if (hmac_sha256_vector(secret, secret_len, 4, addr, len, T) < 0) ++ if (wpa_hmac_sha256_vector(secret, secret_len, 4, addr, len, T) < 0) + { + os_memset(out, 0, outlen); + forced_memzero(T, SHA256_MAC_LEN); +diff --git a/components/wpa_supplicant/src/crypto/sha256-prf.c b/components/wpa_supplicant/src/crypto/sha256-prf.c +index d665a9983c..99371a92a0 100644 +--- a/components/wpa_supplicant/src/crypto/sha256-prf.c ++++ b/components/wpa_supplicant/src/crypto/sha256-prf.c +@@ -27,10 +27,10 @@ + * 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, ++int wpa_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, ++ return wpa_sha256_prf_bits(key, key_len, label, data, data_len, buf, + buf_len * 8); + } + +@@ -51,7 +51,7 @@ int sha256_prf(const u8 *key, size_t key_len, const char *label, + * 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, ++int wpa_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) + { +@@ -78,12 +78,12 @@ int sha256_prf_bits(const u8 *key, size_t key_len, const char *label, + 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, ++ if (wpa_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, ++ if (wpa_hmac_sha256_vector(key, key_len, 4, addr, len, + hash) < 0) + return -1; + os_memcpy(&buf[pos], hash, plen); +diff --git a/components/wpa_supplicant/src/crypto/sha256-tlsprf.c b/components/wpa_supplicant/src/crypto/sha256-tlsprf.c +index 9045cd36b4..0848667c41 100644 +--- a/components/wpa_supplicant/src/crypto/sha256-tlsprf.c ++++ b/components/wpa_supplicant/src/crypto/sha256-tlsprf.c +@@ -50,14 +50,14 @@ int tls_prf_sha256(const u8 *secret, size_t secret_len, const char *label, + * PRF(secret, label, seed) = P_SHA256(secret, label + seed) + */ + +- if (hmac_sha256_vector(secret, secret_len, 2, &addr[1], &len[1], A) < 0) ++ if (wpa_hmac_sha256_vector(secret, secret_len, 2, &addr[1], &len[1], A) < 0) + return -1; + + pos = 0; + while (pos < outlen) { +- if (hmac_sha256_vector(secret, secret_len, 3, addr, len, P) < ++ if (wpa_hmac_sha256_vector(secret, secret_len, 3, addr, len, P) < + 0 || +- hmac_sha256(secret, secret_len, A, SHA256_MAC_LEN, A) < 0) ++ wpa_hmac_sha256(secret, secret_len, A, SHA256_MAC_LEN, A) < 0) + return -1; + + clen = outlen - pos; +diff --git a/components/wpa_supplicant/src/crypto/sha256.c b/components/wpa_supplicant/src/crypto/sha256.c +index 17af964ad0..72f88b0501 100644 +--- a/components/wpa_supplicant/src/crypto/sha256.c ++++ b/components/wpa_supplicant/src/crypto/sha256.c +@@ -23,7 +23,7 @@ + * @mac: Buffer for the hash (32 bytes) + * Returns: 0 on success, -1 on failure + */ +-int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, ++int wpa_hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, + const u8 *addr[], const size_t *len, u8 *mac) + { + unsigned char k_pad[64]; /* padding - key XORd with ipad/opad */ +@@ -41,7 +41,7 @@ int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, + + /* if key is longer than 64 bytes reset it to key = SHA256(key) */ + if (key_len > 64) { +- if (sha256_vector(1, &key, &key_len, tk) < 0) ++ if (wpa_sha256_vector(1, &key, &key_len, tk) < 0) + return -1; + key = tk; + key_len = 32; +@@ -70,7 +70,7 @@ int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, + _addr[i + 1] = addr[i]; + _len[i + 1] = len[i]; + } +- if (sha256_vector(1 + num_elem, _addr, _len, mac) < 0) ++ if (wpa_sha256_vector(1 + num_elem, _addr, _len, mac) < 0) + return -1; + + os_memset(k_pad, 0, sizeof(k_pad)); +@@ -84,7 +84,7 @@ int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, + _len[0] = 64; + _addr[1] = mac; + _len[1] = SHA256_MAC_LEN; +- return sha256_vector(2, _addr, _len, mac); ++ return wpa_sha256_vector(2, _addr, _len, mac); + } + + +@@ -97,8 +97,8 @@ int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, + * @mac: Buffer for the hash (32 bytes) + * Returns: 0 on success, -1 on failure + */ +-int hmac_sha256(const u8 *key, size_t key_len, const u8 *data, ++int wpa_hmac_sha256(const u8 *key, size_t key_len, const u8 *data, + size_t data_len, u8 *mac) + { +- return hmac_sha256_vector(key, key_len, 1, &data, &data_len, mac); ++ return wpa_hmac_sha256_vector(key, key_len, 1, &data, &data_len, mac); + } +diff --git a/components/wpa_supplicant/src/crypto/sha256.h b/components/wpa_supplicant/src/crypto/sha256.h +index 8054bbe5c5..4f9b652aac 100644 +--- a/components/wpa_supplicant/src/crypto/sha256.h ++++ b/components/wpa_supplicant/src/crypto/sha256.h +@@ -11,19 +11,19 @@ + + #define SHA256_MAC_LEN 32 + +-int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, ++int wpa_hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, + const u8 *addr[], const size_t *len, u8 *mac); +-int hmac_sha256(const u8 *key, size_t key_len, const u8 *data, ++int wpa_hmac_sha256(const u8 *key, size_t key_len, const u8 *data, + size_t data_len, u8 *mac); +-int sha256_prf(const u8 *key, size_t key_len, const char *label, ++int wpa_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); +-int sha256_prf_bits(const u8 *key, size_t key_len, const char *label, ++int wpa_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); + int tls_prf_sha256(const u8 *secret, size_t secret_len, + const char *label, const u8 *seed, size_t seed_len, + u8 *out, size_t outlen); +-int hmac_sha256_kdf(const u8 *secret, size_t secret_len, ++int wpa_hmac_sha256_kdf(const u8 *secret, size_t secret_len, + const char *label, const u8 *seed, size_t seed_len, + u8 *out, size_t outlen); + +diff --git a/components/wpa_supplicant/src/crypto/sha256_i.h b/components/wpa_supplicant/src/crypto/sha256_i.h +index a502d2ba5d..84b1ccce1a 100644 +--- a/components/wpa_supplicant/src/crypto/sha256_i.h ++++ b/components/wpa_supplicant/src/crypto/sha256_i.h +@@ -17,9 +17,9 @@ struct sha256_state { + u8 buf[SHA256_BLOCK_SIZE]; + }; + +-void sha256_init(struct sha256_state *md); +-int sha256_process(struct sha256_state *md, const unsigned char *in, ++void wpa_sha256_init(struct sha256_state *md); ++int wpa_sha256_process(struct sha256_state *md, const unsigned char *in, + unsigned long inlen); +-int sha256_done(struct sha256_state *md, unsigned char *out); ++int wpa_sha256_done(struct sha256_state *md, unsigned char *out); + + #endif /* SHA256_I_H */ +diff --git a/components/wpa_supplicant/src/crypto/sha384-internal.c b/components/wpa_supplicant/src/crypto/sha384-internal.c +index 646f72979c..8577897d41 100644 +--- a/components/wpa_supplicant/src/crypto/sha384-internal.c ++++ b/components/wpa_supplicant/src/crypto/sha384-internal.c +@@ -21,17 +21,17 @@ + * @mac: Buffer for the hash + * Returns: 0 on success, -1 of failure + */ +-int sha384_vector(size_t num_elem, const u8 *addr[], const size_t *len, ++int wpa_sha384_vector(size_t num_elem, const u8 *addr[], const size_t *len, + u8 *mac) + { + struct sha384_state ctx; + size_t i; + +- sha384_init(&ctx); ++ wpa_sha384_init(&ctx); + for (i = 0; i < num_elem; i++) +- if (sha384_process(&ctx, addr[i], len[i])) ++ if (wpa_sha384_process(&ctx, addr[i], len[i])) + return -1; +- if (sha384_done(&ctx, mac)) ++ if (wpa_sha384_done(&ctx, mac)) + return -1; + return 0; + } +@@ -49,7 +49,7 @@ int sha384_vector(size_t num_elem, const u8 *addr[], const size_t *len, + @param md The hash state you wish to initialize + @return CRYPT_OK if successful + */ +-void sha384_init(struct sha384_state *md) ++void wpa_sha384_init(struct sha384_state *md) + { + md->curlen = 0; + md->length = 0; +@@ -63,10 +63,10 @@ void sha384_init(struct sha384_state *md) + md->state[7] = CONST64(0x47b5481dbefa4fa4); + } + +-int sha384_process(struct sha384_state *md, const unsigned char *in, ++int wpa_sha384_process(struct sha384_state *md, const unsigned char *in, + unsigned long inlen) + { +- return sha512_process(md, in, inlen); ++ return wpa_sha512_process(md, in, inlen); + } + + /** +@@ -75,14 +75,14 @@ int sha384_process(struct sha384_state *md, const unsigned char *in, + @param out [out] The destination of the hash (48 bytes) + @return CRYPT_OK if successful + */ +-int sha384_done(struct sha384_state *md, unsigned char *out) ++int wpa_sha384_done(struct sha384_state *md, unsigned char *out) + { + unsigned char buf[64]; + + if (md->curlen >= sizeof(md->buf)) + return -1; + +- if (sha512_done(md, buf) != 0) ++ if (wpa_sha512_done(md, buf) != 0) + return -1; + + os_memcpy(out, buf, 48); +diff --git a/components/wpa_supplicant/src/crypto/sha384-prf.c b/components/wpa_supplicant/src/crypto/sha384-prf.c +index 420e78c380..4f1b6d555a 100644 +--- a/components/wpa_supplicant/src/crypto/sha384-prf.c ++++ b/components/wpa_supplicant/src/crypto/sha384-prf.c +@@ -27,10 +27,10 @@ + * This function is used to derive new, cryptographically separate keys from a + * given key. + */ +-int sha384_prf(const u8 *key, size_t key_len, const char *label, ++int wpa_sha384_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 sha384_prf_bits(key, key_len, label, data, data_len, buf, ++ return wpa_sha384_prf_bits(key, key_len, label, data, data_len, buf, + buf_len * 8); + } + +@@ -51,7 +51,7 @@ int sha384_prf(const u8 *key, size_t key_len, const char *label, + * significant 1-7 bits of the last octet in the output are not part of the + * requested output. + */ +-int sha384_prf_bits(const u8 *key, size_t key_len, const char *label, ++int wpa_sha384_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) + { +@@ -78,12 +78,12 @@ int sha384_prf_bits(const u8 *key, size_t key_len, const char *label, + plen = buf_len - pos; + WPA_PUT_LE16(counter_le, counter); + if (plen >= SHA384_MAC_LEN) { +- if (hmac_sha384_vector(key, key_len, 4, addr, len, ++ if (wpa_hmac_sha384_vector(key, key_len, 4, addr, len, + &buf[pos]) < 0) + return -1; + pos += SHA384_MAC_LEN; + } else { +- if (hmac_sha384_vector(key, key_len, 4, addr, len, ++ if (wpa_hmac_sha384_vector(key, key_len, 4, addr, len, + hash) < 0) + return -1; + os_memcpy(&buf[pos], hash, plen); +diff --git a/components/wpa_supplicant/src/crypto/sha384-tlsprf.c b/components/wpa_supplicant/src/crypto/sha384-tlsprf.c +index 9ff96ac2c7..a45d529c63 100644 +--- a/components/wpa_supplicant/src/crypto/sha384-tlsprf.c ++++ b/components/wpa_supplicant/src/crypto/sha384-tlsprf.c +@@ -50,14 +50,14 @@ int tls_prf_sha384(const u8 *secret, size_t secret_len, const char *label, + * PRF(secret, label, seed) = P_SHA384(secret, label + seed) + */ + +- if (hmac_sha384_vector(secret, secret_len, 2, &addr[1], &len[1], A) < 0) ++ if (wpa_hmac_sha384_vector(secret, secret_len, 2, &addr[1], &len[1], A) < 0) + return -1; + + pos = 0; + while (pos < outlen) { +- if (hmac_sha384_vector(secret, secret_len, 3, addr, len, P) < ++ if (wpa_hmac_sha384_vector(secret, secret_len, 3, addr, len, P) < + 0 || +- hmac_sha384(secret, secret_len, A, SHA384_MAC_LEN, A) < 0) ++ wpa_hmac_sha384(secret, secret_len, A, SHA384_MAC_LEN, A) < 0) + return -1; + + clen = outlen - pos; +diff --git a/components/wpa_supplicant/src/crypto/sha384.h b/components/wpa_supplicant/src/crypto/sha384.h +index 1a2c1edffb..1259540534 100644 +--- a/components/wpa_supplicant/src/crypto/sha384.h ++++ b/components/wpa_supplicant/src/crypto/sha384.h +@@ -12,19 +12,19 @@ + #define SHA384_MAC_LEN 48 + #define SHA512_MAC_LEN 64 + +-int hmac_sha384_vector(const u8 *key, size_t key_len, size_t num_elem, ++int wpa_hmac_sha384_vector(const u8 *key, size_t key_len, size_t num_elem, + const u8 *addr[], const size_t *len, u8 *mac); +-int hmac_sha384(const u8 *key, size_t key_len, const u8 *data, ++int wpa_hmac_sha384(const u8 *key, size_t key_len, const u8 *data, + size_t data_len, u8 *mac); +-int sha384_prf(const u8 *key, size_t key_len, const char *label, ++int wpa_sha384_prf(const u8 *key, size_t key_len, const char *label, + const u8 *data, size_t data_len, u8 *buf, size_t buf_len); +-int sha384_prf_bits(const u8 *key, size_t key_len, const char *label, ++int wpa_sha384_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); + int tls_prf_sha384(const u8 *secret, size_t secret_len, + const char *label, const u8 *seed, size_t seed_len, + u8 *out, size_t outlen); +-int hmac_sha384_kdf(const u8 *secret, size_t secret_len, ++int wpa_hmac_sha384_kdf(const u8 *secret, size_t secret_len, + const char *label, const u8 *seed, size_t seed_len, + u8 *out, size_t outlen); + +diff --git a/components/wpa_supplicant/src/crypto/sha384_i.h b/components/wpa_supplicant/src/crypto/sha384_i.h +index a00253ff2c..a56c9656dc 100644 +--- a/components/wpa_supplicant/src/crypto/sha384_i.h ++++ b/components/wpa_supplicant/src/crypto/sha384_i.h +@@ -15,9 +15,9 @@ + + #define sha384_state sha512_state + +-void sha384_init(struct sha384_state *md); +-int sha384_process(struct sha384_state *md, const unsigned char *in, ++void wpa_sha384_init(struct sha384_state *md); ++int wpa_sha384_process(struct sha384_state *md, const unsigned char *in, + unsigned long inlen); +-int sha384_done(struct sha384_state *md, unsigned char *out); ++int wpa_sha384_done(struct sha384_state *md, unsigned char *out); + + #endif /* SHA384_I_H */ +diff --git a/components/wpa_supplicant/src/crypto/sha512-internal.c b/components/wpa_supplicant/src/crypto/sha512-internal.c +index c0263941c1..b8fb97ddfe 100644 +--- a/components/wpa_supplicant/src/crypto/sha512-internal.c ++++ b/components/wpa_supplicant/src/crypto/sha512-internal.c +@@ -21,17 +21,17 @@ + * @mac: Buffer for the hash + * Returns: 0 on success, -1 of failure + */ +-int sha512_vector(size_t num_elem, const u8 *addr[], const size_t *len, ++int wpa_sha512_vector(size_t num_elem, const u8 *addr[], const size_t *len, + u8 *mac) + { + struct sha512_state ctx; + size_t i; + +- sha512_init(&ctx); ++ wpa_sha512_init(&ctx); + for (i = 0; i < num_elem; i++) +- if (sha512_process(&ctx, addr[i], len[i])) ++ if (wpa_sha512_process(&ctx, addr[i], len[i])) + return -1; +- if (sha512_done(&ctx, mac)) ++ if (wpa_sha512_done(&ctx, mac)) + return -1; + return 0; + } +@@ -107,7 +107,7 @@ static const u64 K[80] = { + CONST64(0xFFFFFFFFFFFFFFFF)) + + /* compress 1024-bits */ +-static int sha512_compress(struct sha512_state *md, unsigned char *buf) ++static int wpa_sha512_compress(struct sha512_state *md, unsigned char *buf) + { + u64 S[8], t0, t1; + u64 *W; +@@ -161,7 +161,7 @@ static int sha512_compress(struct sha512_state *md, unsigned char *buf) + @param md The hash state you wish to initialize + @return CRYPT_OK if successful + */ +-void sha512_init(struct sha512_state *md) ++void wpa_sha512_init(struct sha512_state *md) + { + md->curlen = 0; + md->length = 0; +@@ -183,7 +183,7 @@ void sha512_init(struct sha512_state *md) + @param inlen The length of the data (octets) + @return CRYPT_OK if successful + */ +-int sha512_process(struct sha512_state *md, const unsigned char *in, ++int wpa_sha512_process(struct sha512_state *md, const unsigned char *in, + unsigned long inlen) + { + unsigned long n; +@@ -193,7 +193,7 @@ int sha512_process(struct sha512_state *md, const unsigned char *in, + + while (inlen > 0) { + if (md->curlen == 0 && inlen >= SHA512_BLOCK_SIZE) { +- if (sha512_compress(md, (unsigned char *) in) < 0) ++ if (wpa_sha512_compress(md, (unsigned char *) in) < 0) + return -1; + md->length += SHA512_BLOCK_SIZE * 8; + in += SHA512_BLOCK_SIZE; +@@ -205,7 +205,7 @@ int sha512_process(struct sha512_state *md, const unsigned char *in, + in += n; + inlen -= n; + if (md->curlen == SHA512_BLOCK_SIZE) { +- if (sha512_compress(md, md->buf) < 0) ++ if (wpa_sha512_compress(md, md->buf) < 0) + return -1; + md->length += 8 * SHA512_BLOCK_SIZE; + md->curlen = 0; +@@ -223,7 +223,7 @@ int sha512_process(struct sha512_state *md, const unsigned char *in, + @param out [out] The destination of the hash (64 bytes) + @return CRYPT_OK if successful + */ +-int sha512_done(struct sha512_state *md, unsigned char *out) ++int wpa_sha512_done(struct sha512_state *md, unsigned char *out) + { + int i; + +@@ -244,7 +244,7 @@ int sha512_done(struct sha512_state *md, unsigned char *out) + while (md->curlen < 128) { + md->buf[md->curlen++] = (unsigned char) 0; + } +- sha512_compress(md, md->buf); ++ wpa_sha512_compress(md, md->buf); + md->curlen = 0; + } + +@@ -258,7 +258,7 @@ int sha512_done(struct sha512_state *md, unsigned char *out) + + /* store length */ + WPA_PUT_BE64(md->buf + 120, md->length); +- sha512_compress(md, md->buf); ++ wpa_sha512_compress(md, md->buf); + + /* copy output */ + for (i = 0; i < 8; i++) +diff --git a/components/wpa_supplicant/src/crypto/sha512_i.h b/components/wpa_supplicant/src/crypto/sha512_i.h +index 108958911e..1100b8eae8 100644 +--- a/components/wpa_supplicant/src/crypto/sha512_i.h ++++ b/components/wpa_supplicant/src/crypto/sha512_i.h +@@ -17,9 +17,9 @@ struct sha512_state { + u8 buf[SHA512_BLOCK_SIZE]; + }; + +-void sha512_init(struct sha512_state *md); +-int sha512_process(struct sha512_state *md, const unsigned char *in, ++void wpa_sha512_init(struct sha512_state *md); ++int wpa_sha512_process(struct sha512_state *md, const unsigned char *in, + unsigned long inlen); +-int sha512_done(struct sha512_state *md, unsigned char *out); ++int wpa_sha512_done(struct sha512_state *md, unsigned char *out); + + #endif /* SHA512_I_H */ +diff --git a/components/wpa_supplicant/src/eap_peer/eap_fast.c b/components/wpa_supplicant/src/eap_peer/eap_fast.c +index 2031c53933..833c487d7e 100644 +--- a/components/wpa_supplicant/src/eap_peer/eap_fast.c ++++ b/components/wpa_supplicant/src/eap_peer/eap_fast.c +@@ -630,7 +630,7 @@ static void eap_fast_write_crypto_binding( + rbind->subtype = EAP_TLV_CRYPTO_BINDING_SUBTYPE_RESPONSE; + os_memcpy(rbind->nonce, _bind->nonce, sizeof(_bind->nonce)); + inc_byte_array(rbind->nonce, sizeof(rbind->nonce)); +- hmac_sha1(cmk, EAP_FAST_CMK_LEN, (u8 *) rbind, sizeof(*rbind), ++ wpa_hmac_sha1(cmk, EAP_FAST_CMK_LEN, (u8 *) rbind, sizeof(*rbind), + rbind->compound_mac); + + wpa_printf(MSG_DEBUG, "EAP-FAST: Reply Crypto-Binding TLV: Version %d " +@@ -709,7 +709,7 @@ static int eap_fast_get_cmk(struct eap_sm *sm, struct eap_fast_data *data, + if (eap_fast_get_phase2_key(sm, data, isk, sizeof(isk)) < 0) + return -1; + wpa_hexdump_key(MSG_MSGDUMP, "EAP-FAST: ISK[j]", isk, sizeof(isk)); +- if (sha1_t_prf(data->simck, EAP_FAST_SIMCK_LEN, ++ if (wpa_sha1_t_prf(data->simck, EAP_FAST_SIMCK_LEN, + "Inner Methods Compound Keys", + isk, sizeof(isk), imck, sizeof(imck)) < 0) + return -1; +@@ -771,7 +771,7 @@ static struct wpabuf * eap_fast_process_crypto_binding( + os_memset(_bind->compound_mac, 0, sizeof(cmac)); + wpa_hexdump(MSG_MSGDUMP, "EAP-FAST: Crypto-Binding TLV for Compound " + "MAC calculation", (u8 *) _bind, bind_len); +- hmac_sha1(cmk, EAP_FAST_CMK_LEN, (u8 *) _bind, bind_len, ++ wpa_hmac_sha1(cmk, EAP_FAST_CMK_LEN, (u8 *) _bind, bind_len, + _bind->compound_mac); + res = os_memcmp_const(cmac, _bind->compound_mac, sizeof(cmac)); + wpa_hexdump(MSG_DEBUG, "EAP-FAST: Received Compound MAC", +diff --git a/components/wpa_supplicant/src/eap_peer/eap_fast_common.c b/components/wpa_supplicant/src/eap_peer/eap_fast_common.c +index bb64ca750b..675f16dac5 100644 +--- a/components/wpa_supplicant/src/eap_peer/eap_fast_common.c ++++ b/components/wpa_supplicant/src/eap_peer/eap_fast_common.c +@@ -84,7 +84,7 @@ void eap_fast_derive_master_secret(const u8 *pac_key, const u8 *server_random, + */ + os_memcpy(seed, server_random, TLS_RANDOM_LEN); + os_memcpy(seed + TLS_RANDOM_LEN, client_random, TLS_RANDOM_LEN); +- sha1_t_prf(pac_key, EAP_FAST_PAC_KEY_LEN, ++ wpa_sha1_t_prf(pac_key, EAP_FAST_PAC_KEY_LEN, + "PAC to master secret label hash", + seed, sizeof(seed), master_secret, TLS_MASTER_SECRET_LEN); + +@@ -117,7 +117,7 @@ int eap_fast_derive_eap_msk(const u8 *simck, u8 *msk) + * MSK = T-PRF(S-IMCK[j], "Session Key Generating Function", 64) + */ + +- if (sha1_t_prf(simck, EAP_FAST_SIMCK_LEN, ++ if (wpa_sha1_t_prf(simck, EAP_FAST_SIMCK_LEN, + "Session Key Generating Function", (u8 *) "", 0, + msk, EAP_FAST_KEY_LEN) < 0) + return -1; +@@ -135,7 +135,7 @@ int eap_fast_derive_eap_emsk(const u8 *simck, u8 *emsk) + * "Extended Session Key Generating Function", 64) + */ + +- if (sha1_t_prf(simck, EAP_FAST_SIMCK_LEN, ++ if (wpa_sha1_t_prf(simck, EAP_FAST_SIMCK_LEN, + "Extended Session Key Generating Function", (u8 *) "", 0, + emsk, EAP_EMSK_LEN) < 0) + return -1; +diff --git a/components/wpa_supplicant/src/eap_peer/eap_peap.c b/components/wpa_supplicant/src/eap_peer/eap_peap.c +index 312536a880..1c7075e6c0 100644 +--- a/components/wpa_supplicant/src/eap_peer/eap_peap.c ++++ b/components/wpa_supplicant/src/eap_peer/eap_peap.c +@@ -363,7 +363,7 @@ eap_tlv_add_cryptobinding(struct eap_sm *sm, + addr[0], len[0]); + wpa_hexdump(MSG_MSGDUMP, "EAP-PEAP: Compound_MAC data 2", + addr[1], len[1]); +- hmac_sha1_vector(data->cmk, 20, 2, addr, len, mac); ++ wpa_hmac_sha1_vector(data->cmk, 20, 2, addr, len, mac); + wpa_hexdump(MSG_MSGDUMP, "EAP-PEAP: Compound_MAC", mac, SHA1_MAC_LEN); + data->crypto_binding_used = 1; + +@@ -458,7 +458,7 @@ eap_tlv_validate_cryptobinding(struct eap_sm *sm, + buf[60] = EAP_TYPE_PEAP; + wpa_hexdump(MSG_DEBUG, "EAP-PEAP: Compound_MAC data", + buf, sizeof(buf)); +- hmac_sha1(data->cmk, 20, buf, sizeof(buf), mac); ++ wpa_hmac_sha1(data->cmk, 20, buf, sizeof(buf), mac); + + if (os_memcmp(mac, pos, SHA1_MAC_LEN) != 0) { + wpa_printf(MSG_DEBUG, "EAP-PEAP: Invalid Compound_MAC in " +diff --git a/components/wpa_supplicant/src/eap_peer/eap_peap_common.c b/components/wpa_supplicant/src/eap_peer/eap_peap_common.c +index 2cafe71975..2d078ceb89 100644 +--- a/components/wpa_supplicant/src/eap_peer/eap_peap_common.c ++++ b/components/wpa_supplicant/src/eap_peer/eap_peap_common.c +@@ -72,7 +72,7 @@ peap_prfplus(int version, const u8 *key, size_t key_len, + while (pos < buf_len) { + counter++; + plen = buf_len - pos; +- if (hmac_sha1_vector(key, key_len, 5, addr, len, hash) < 0) ++ if (wpa_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); +diff --git a/components/wpa_supplicant/src/eap_server/eap_server.c b/components/wpa_supplicant/src/eap_server/eap_server.c +index a0aaf8e652..a6ba3c3ee5 100644 +--- a/components/wpa_supplicant/src/eap_server/eap_server.c ++++ b/components/wpa_supplicant/src/eap_server/eap_server.c +@@ -462,7 +462,7 @@ static void eap_server_erp_init(struct eap_sm *sm) + wpa_hexdump_key(MSG_DEBUG, "EAP: EMSK", emsk, emsk_len); + + WPA_PUT_BE16(len, EAP_EMSK_NAME_LEN); +- if (hmac_sha256_kdf(sm->eap_if.eapSessionId, sm->eap_if.eapSessionIdLen, ++ if (wpa_hmac_sha256_kdf(sm->eap_if.eapSessionId, sm->eap_if.eapSessionIdLen, + "EMSK", len, sizeof(len), + EMSKname, EAP_EMSK_NAME_LEN) < 0) { + wpa_printf(MSG_DEBUG, "EAP: Could not derive EMSKname"); +@@ -476,7 +476,7 @@ static void eap_server_erp_init(struct eap_sm *sm) + os_memcpy(&erp->keyname_nai[pos + 1], domain, domain_len); + + WPA_PUT_BE16(len, emsk_len); +- if (hmac_sha256_kdf(emsk, emsk_len, ++ if (wpa_hmac_sha256_kdf(emsk, emsk_len, + "EAP Re-authentication Root Key@ietf.org", + len, sizeof(len), erp->rRK, emsk_len) < 0) { + wpa_printf(MSG_DEBUG, "EAP: Could not derive rRK for ERP"); +@@ -487,7 +487,7 @@ static void eap_server_erp_init(struct eap_sm *sm) + + ctx[0] = EAP_ERP_CS_HMAC_SHA256_128; + WPA_PUT_BE16(&ctx[1], erp->rRK_len); +- if (hmac_sha256_kdf(erp->rRK, erp->rRK_len, ++ if (wpa_hmac_sha256_kdf(erp->rRK, erp->rRK_len, + "Re-authentication Integrity Key@ietf.org", + ctx, sizeof(ctx), erp->rIK, erp->rRK_len) < 0) { + wpa_printf(MSG_DEBUG, "EAP: Could not derive rIK for ERP"); +@@ -743,7 +743,7 @@ static void erp_send_finish_reauth(struct eap_sm *sm, + + if (erp) { + wpabuf_put_u8(msg, erp->cryptosuite); +- if (hmac_sha256(erp->rIK, erp->rIK_len, ++ if (wpa_hmac_sha256(erp->rIK, erp->rIK_len, + wpabuf_head(msg), wpabuf_len(msg), hash) < 0) { + wpabuf_free(msg); + return; +@@ -776,7 +776,7 @@ static void erp_send_finish_reauth(struct eap_sm *sm, + + WPA_PUT_BE16(seed, seq); + WPA_PUT_BE16(&seed[2], erp->rRK_len); +- if (hmac_sha256_kdf(erp->rRK, erp->rRK_len, ++ if (wpa_hmac_sha256_kdf(erp->rRK, erp->rRK_len, + "Re-authentication Master Session Key@ietf.org", + seed, sizeof(seed), + sm->eap_if.eapKeyData, erp->rRK_len) < 0) { +@@ -928,7 +928,7 @@ SM_STATE(EAP, INITIATE_RECEIVED) + } + + if (hash_len) { +- if (hmac_sha256(erp->rIK, erp->rIK_len, hdr, ++ if (wpa_hmac_sha256(erp->rIK, erp->rIK_len, hdr, + end - hdr - hash_len, hash) < 0) + goto fail; + if (os_memcmp(end - hash_len, hash, hash_len) != 0) { +@@ -941,7 +941,7 @@ SM_STATE(EAP, INITIATE_RECEIVED) + /* Check if any supported CS results in matching tag */ + if (!hash_len && max_len >= 1 + 32 && + end[-33] == EAP_ERP_CS_HMAC_SHA256_256) { +- if (hmac_sha256(erp->rIK, erp->rIK_len, hdr, ++ if (wpa_hmac_sha256(erp->rIK, erp->rIK_len, hdr, + end - hdr - 32, hash) < 0) + goto fail; + if (os_memcmp(end - 32, hash, 32) == 0) { +@@ -953,7 +953,7 @@ SM_STATE(EAP, INITIATE_RECEIVED) + } + + if (!hash_len && end[-17] == EAP_ERP_CS_HMAC_SHA256_128) { +- if (hmac_sha256(erp->rIK, erp->rIK_len, hdr, ++ if (wpa_hmac_sha256(erp->rIK, erp->rIK_len, hdr, + end - hdr - 16, hash) < 0) + goto fail; + if (os_memcmp(end - 16, hash, 16) == 0) { +diff --git a/components/wpa_supplicant/src/rsn_supp/wpa.c b/components/wpa_supplicant/src/rsn_supp/wpa.c +index aef17fc9c0..0ead21a2c8 100644 +--- a/components/wpa_supplicant/src/rsn_supp/wpa.c ++++ b/components/wpa_supplicant/src/rsn_supp/wpa.c +@@ -2945,7 +2945,7 @@ int owe_process_assoc_resp(const u8 *rsn_ie, size_t rsn_len, const uint8_t *dh_i + addr[1] = dh_ie + 2; + len[1] = dh_len - 2; + +- int res = sha256_vector(2, addr, len, pmkid); ++ int res = wpa_sha256_vector(2, addr, len, pmkid); + if (res < 0 ) { + goto fail; + } +@@ -2969,7 +2969,7 @@ int owe_process_assoc_resp(const u8 *rsn_ie, size_t rsn_len, const uint8_t *dh_i + wpabuf_put_data(hkey, dh_ie + 2, dh_len - 2); /* A */ + wpabuf_put_le16(hkey, sm->owe_group); /* group */ + +- res = hmac_sha256(wpabuf_head(hkey), wpabuf_len(hkey), wpabuf_head(sh_secret), wpabuf_len(sh_secret), prk); ++ res = wpa_hmac_sha256(wpabuf_head(hkey), wpabuf_len(hkey), wpabuf_head(sh_secret), wpabuf_len(sh_secret), prk); + if (res < 0 ) { + goto fail; + } +@@ -2982,7 +2982,7 @@ int owe_process_assoc_resp(const u8 *rsn_ie, size_t rsn_len, const uint8_t *dh_i + wpa_hexdump_key(MSG_DEBUG, "OWE: prk", prk, hash_len); + + /* PMK = HKDF-expand(prk, "OWE Key Generation", n) */ +- res = hmac_sha256_kdf(prk, hash_len, NULL, (const u8 *)info, ++ res = wpa_hmac_sha256_kdf(prk, hash_len, NULL, (const u8 *)info, + os_strlen(info), pmk, hash_len); + if (res < 0 ) { + goto fail; +diff --git a/components/wpa_supplicant/src/tls/pkcs5.c b/components/wpa_supplicant/src/tls/pkcs5.c +index 7bef89b4fd..ccee6d78e6 100644 +--- a/components/wpa_supplicant/src/tls/pkcs5.c ++++ b/components/wpa_supplicant/src/tls/pkcs5.c +@@ -444,13 +444,13 @@ static int pkcs12_key_gen(const u8 *pw, size_t pw_len, const u8 *salt, + len[0] = v; + addr[1] = I; + len[1] = S_len + P_len; +- if (sha1_vector(2, addr, len, hash) < 0) ++ if (wpa_sha1_vector(2, addr, len, hash) < 0) + goto done; + + addr[0] = hash; + len[0] = SHA1_MAC_LEN; + for (i = 1; i < iter; i++) { +- if (sha1_vector(1, addr, len, hash) < 0) ++ if (wpa_sha1_vector(1, addr, len, hash) < 0) + goto done; + } + +diff --git a/components/wpa_supplicant/src/tls/tlsv1_client_ocsp.c b/components/wpa_supplicant/src/tls/tlsv1_client_ocsp.c +index 128f4b5b9e..c4d06c3de9 100644 +--- a/components/wpa_supplicant/src/tls/tlsv1_client_ocsp.c ++++ b/components/wpa_supplicant/src/tls/tlsv1_client_ocsp.c +@@ -55,7 +55,7 @@ static int ocsp_responder_id_match(struct x509_certificate *signer, + const u8 *addr[1] = { signer->public_key }; + size_t len[1] = { signer->public_key_len }; + +- if (sha1_vector(1, addr, len, hash) < 0) ++ if (wpa_sha1_vector(1, addr, len, hash) < 0) + return 0; + return os_memcmp(hash, key_hash, SHA1_MAC_LEN) == 0; + } +@@ -72,28 +72,28 @@ static unsigned int ocsp_hash_data(struct asn1_oid *alg, const u8 *data, + char buf[100]; + + if (x509_sha1_oid(alg)) { +- if (sha1_vector(1, addr, len, hash) < 0) ++ if (wpa_sha1_vector(1, addr, len, hash) < 0) + return 0; + wpa_hexdump(MSG_MSGDUMP, "OCSP: Hash (SHA1)", hash, 20); + return 20; + } + + if (x509_sha256_oid(alg)) { +- if (sha256_vector(1, addr, len, hash) < 0) ++ if (wpa_sha256_vector(1, addr, len, hash) < 0) + return 0; + wpa_hexdump(MSG_MSGDUMP, "OCSP: Hash (SHA256)", hash, 32); + return 32; + } + + if (x509_sha384_oid(alg)) { +- if (sha384_vector(1, addr, len, hash) < 0) ++ if (wpa_sha384_vector(1, addr, len, hash) < 0) + return 0; + wpa_hexdump(MSG_MSGDUMP, "OCSP: Hash (SHA384)", hash, 48); + return 48; + } + + if (x509_sha512_oid(alg)) { +- if (sha512_vector(1, addr, len, hash) < 0) ++ if (wpa_sha512_vector(1, addr, len, hash) < 0) + return 0; + wpa_hexdump(MSG_MSGDUMP, "OCSP: Hash (SHA512)", hash, 64); + return 64; +diff --git a/components/wpa_supplicant/src/tls/tlsv1_client_read.c b/components/wpa_supplicant/src/tls/tlsv1_client_read.c +index 3394873655..e13a7fc8dc 100644 +--- a/components/wpa_supplicant/src/tls/tlsv1_client_read.c ++++ b/components/wpa_supplicant/src/tls/tlsv1_client_read.c +@@ -304,7 +304,7 @@ static void tls_peer_cert_event(struct tlsv1_client *conn, int depth, + size_t len[1]; + addr[0] = wpabuf_head(cert_buf); + len[0] = wpabuf_len(cert_buf); +- if (sha256_vector(1, addr, len, hash) == 0) { ++ if (wpa_sha256_vector(1, addr, len, hash) == 0) { + ev.peer_cert.hash = hash; + ev.peer_cert.hash_len = sizeof(hash); + } +@@ -519,7 +519,7 @@ static int tls_process_certificate(struct tlsv1_client *conn, u8 ct, + "TLSv1: Validate server certificate hash"); + x509_name_string(&chain->subject, buf, sizeof(buf)); + wpa_printf(MSG_DEBUG, "TLSv1: 0: %s", buf); +- if (sha256_vector(1, &chain->cert_start, &chain->cert_len, ++ if (wpa_sha256_vector(1, &chain->cert_start, &chain->cert_len, + hash) < 0 || + os_memcmp(conn->cred->srv_cert_hash, hash, + SHA256_MAC_LEN) != 0) { +diff --git a/components/wpa_supplicant/src/tls/tlsv1_cred.c b/components/wpa_supplicant/src/tls/tlsv1_cred.c +index 1310f4e10e..0cee09749d 100644 +--- a/components/wpa_supplicant/src/tls/tlsv1_cred.c ++++ b/components/wpa_supplicant/src/tls/tlsv1_cred.c +@@ -130,7 +130,7 @@ static int tlsv1_add_cert(struct x509_certificate **chain, + return -1; + } + +- der = base64_decode((const char *) pos, end - pos, &der_len); ++ der = wpa_base64_decode((const char *) pos, end - pos, &der_len); + if (der == NULL) { + wpa_printf(MSG_INFO, "TLSv1: Could not decode PEM " + "certificate"); +@@ -293,7 +293,7 @@ static struct crypto_private_key * tlsv1_set_key_pem(const u8 *key, size_t len) + } + } + +- der = base64_decode((const char *) pos, end - pos, &der_len); ++ der = wpa_base64_decode((const char *) pos, end - pos, &der_len); + if (!der) + return NULL; + pkey = crypto_private_key_import(der, der_len, NULL); +@@ -321,7 +321,7 @@ static struct crypto_private_key * tlsv1_set_key_enc_pem(const u8 *key, + if (!end) + return NULL; + +- der = base64_decode((const char *) pos, end - pos, &der_len); ++ der = wpa_base64_decode((const char *) pos, end - pos, &der_len); + if (!der) + return NULL; + pkey = crypto_private_key_import(der, der_len, passwd); +@@ -1158,7 +1158,7 @@ static int tlsv1_set_dhparams_blob(struct tlsv1_credentials *cred, + return -1; + } + +- der = base64_decode((const char *) pos, end - pos, &der_len); ++ der = wpa_base64_decode((const char *) pos, end - pos, &der_len); + if (der == NULL) { + wpa_printf(MSG_INFO, "TLSv1: Could not decode PEM dhparams"); + return -1; +diff --git a/components/wpa_supplicant/src/tls/x509v3.c b/components/wpa_supplicant/src/tls/x509v3.c +index 1bbd80ade8..4057e40b03 100644 +--- a/components/wpa_supplicant/src/tls/x509v3.c ++++ b/components/wpa_supplicant/src/tls/x509v3.c +@@ -2047,25 +2047,25 @@ skip_digest_oid: + hash, hash_len); + break; + case 5: /* sha-1WithRSAEncryption */ +- sha1_vector(1, addr, len, hash); ++ wpa_sha1_vector(1, addr, len, hash); + hash_len = 20; + wpa_hexdump(MSG_MSGDUMP, "X509: Certificate hash (SHA1)", + hash, hash_len); + break; + case 11: /* sha256WithRSAEncryption */ +- sha256_vector(1, addr, len, hash); ++ wpa_sha256_vector(1, addr, len, hash); + hash_len = 32; + wpa_hexdump(MSG_MSGDUMP, "X509: Certificate hash (SHA256)", + hash, hash_len); + break; + case 12: /* sha384WithRSAEncryption */ +- sha384_vector(1, addr, len, hash); ++ wpa_sha384_vector(1, addr, len, hash); + hash_len = 48; + wpa_hexdump(MSG_MSGDUMP, "X509: Certificate hash (SHA384)", + hash, hash_len); + break; + case 13: /* sha512WithRSAEncryption */ +- sha512_vector(1, addr, len, hash); ++ wpa_sha512_vector(1, addr, len, hash); + hash_len = 64; + wpa_hexdump(MSG_MSGDUMP, "X509: Certificate hash (SHA512)", + hash, hash_len); +diff --git a/components/wpa_supplicant/src/utils/base64.c b/components/wpa_supplicant/src/utils/base64.c +index a17d2d36dc..ac347ce00f 100644 +--- a/components/wpa_supplicant/src/utils/base64.c ++++ b/components/wpa_supplicant/src/utils/base64.c +@@ -151,7 +151,7 @@ static unsigned char * base64_gen_decode(const char *src, size_t len, + + + /** +- * base64_encode - Base64 encode ++ * wpa_base64_encode - Base64 encode + * @src: Data to be encoded + * @len: Length of the data to be encoded + * @out_len: Pointer to output length variable, or %NULL if not used +@@ -162,20 +162,20 @@ static unsigned char * base64_gen_decode(const char *src, size_t len, + * nul terminated to make it easier to use as a C string. The nul terminator is + * not included in out_len. + */ +-char * base64_encode(const void *src, size_t len, size_t *out_len) ++char * wpa_base64_encode(const void *src, size_t len, size_t *out_len) + { + return base64_gen_encode(src, len, out_len, base64_table, 1); + } + + +-char * base64_url_encode(const void *src, size_t len, size_t *out_len) ++char * wpa_base64_url_encode(const void *src, size_t len, size_t *out_len) + { + return base64_gen_encode(src, len, out_len, base64_url_table, 0); + } + + + /** +- * base64_decode - Base64 decode ++ * wpa_base64_decode - Base64 decode + * @src: Data to be decoded + * @len: Length of the data to be decoded + * @out_len: Pointer to output length variable +@@ -184,13 +184,13 @@ char * base64_url_encode(const void *src, size_t len, size_t *out_len) + * + * Caller is responsible for freeing the returned buffer. + */ +-unsigned char * base64_decode(const char *src, size_t len, size_t *out_len) ++unsigned char * wpa_base64_decode(const char *src, size_t len, size_t *out_len) + { + return base64_gen_decode(src, len, out_len, base64_table); + } + + +-unsigned char * base64_url_decode(const char *src, size_t len, size_t *out_len) ++unsigned char * wpa_base64_url_decode(const char *src, size_t len, size_t *out_len) + { + return base64_gen_decode(src, len, out_len, base64_url_table); + } +diff --git a/components/wpa_supplicant/src/utils/base64.h b/components/wpa_supplicant/src/utils/base64.h +index 6216f44e55..be380ee1ca 100644 +--- a/components/wpa_supplicant/src/utils/base64.h ++++ b/components/wpa_supplicant/src/utils/base64.h +@@ -6,12 +6,12 @@ + * See README for more details. + */ + +-#ifndef BASE64_H +-#define BASE64_H ++#ifndef WPA_BASE64_H ++#define WPA_BASE64_H + +-char * base64_encode(const void *src, size_t len, size_t *out_len); +-unsigned char * base64_decode(const char *src, size_t len, size_t *out_len); +-char * base64_url_encode(const void *src, size_t len, size_t *out_len); +-unsigned char * base64_url_decode(const char *src, size_t len, size_t *out_len); ++char * wpa_base64_encode(const void *src, size_t len, size_t *out_len); ++unsigned char * wpa_base64_decode(const char *src, size_t len, size_t *out_len); ++char * wpa_base64_url_encode(const void *src, size_t len, size_t *out_len); ++unsigned char * wpa_base64_url_decode(const char *src, size_t len, size_t *out_len); + +-#endif /* BASE64_H */ ++#endif /* WPA_BASE64_H */ +diff --git a/components/wpa_supplicant/src/utils/json.c b/components/wpa_supplicant/src/utils/json.c +index 5a0edf2114..58093c6b8e 100644 +--- a/components/wpa_supplicant/src/utils/json.c ++++ b/components/wpa_supplicant/src/utils/json.c +@@ -516,7 +516,7 @@ struct wpabuf * json_get_member_base64url(struct json_token *json, + token = json_get_member(json, name); + if (!token || token->type != JSON_STRING) + return NULL; +- buf = base64_url_decode(token->string, os_strlen(token->string), ++ buf = wpa_base64_url_decode(token->string, os_strlen(token->string), + &buflen); + if (!buf) + return NULL; +@@ -611,7 +611,7 @@ int json_add_base64url(struct wpabuf *json, const char *name, const void *val, + { + char *b64; + +- b64 = base64_url_encode(val, len, NULL); ++ b64 = wpa_base64_url_encode(val, len, NULL); + if (!b64) + return -1; + json_add_string(json, name, b64); +diff --git a/components/wpa_supplicant/src/wps/wps_attr_build.c b/components/wpa_supplicant/src/wps/wps_attr_build.c +index c7d739a0c3..b4609ec647 100644 +--- a/components/wpa_supplicant/src/wps/wps_attr_build.c ++++ b/components/wpa_supplicant/src/wps/wps_attr_build.c +@@ -181,7 +181,7 @@ int wps_build_authenticator(struct wps_data *wps, struct wpabuf *msg) + len[0] = wpabuf_len(wps->last_msg); + addr[1] = wpabuf_head(msg); + len[1] = wpabuf_len(msg); +- if (hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 2, addr, len, ++ if (wpa_hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 2, addr, len, + hash) < 0) + return -1; + +@@ -385,7 +385,7 @@ int wps_build_key_wrap_auth(struct wps_data *wps, struct wpabuf *msg) + u8 hash[SHA256_MAC_LEN]; + + wpa_printf(MSG_DEBUG, "WPS: * Key Wrap Authenticator"); +- if (hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, wpabuf_head(msg), ++ if (wpa_hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, wpabuf_head(msg), + wpabuf_len(msg), hash) < 0) + return -1; + +@@ -438,7 +438,7 @@ int wps_build_oob_dev_pw(struct wpabuf *msg, u16 dev_pw_id, + dev_pw_id); + addr[0] = wpabuf_head(pubkey); + hash_len = wpabuf_len(pubkey); +- if (sha256_vector(1, addr, &hash_len, pubkey_hash) < 0) ++ if (wpa_sha256_vector(1, addr, &hash_len, pubkey_hash) < 0) + return -1; + #ifdef CONFIG_WPS_TESTING + if (wps_corrupt_pkhash) { +diff --git a/components/wpa_supplicant/src/wps/wps_attr_process.c b/components/wpa_supplicant/src/wps/wps_attr_process.c +index 44436a4862..9eca971ae9 100644 +--- a/components/wpa_supplicant/src/wps/wps_attr_process.c ++++ b/components/wpa_supplicant/src/wps/wps_attr_process.c +@@ -40,7 +40,7 @@ int wps_process_authenticator(struct wps_data *wps, const u8 *authenticator, + addr[1] = wpabuf_head(msg); + len[1] = wpabuf_len(msg) - 4 - WPS_AUTHENTICATOR_LEN; + +- if (hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 2, addr, len, ++ if (wpa_hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 2, addr, len, + hash) < 0 || + os_memcmp_const(hash, authenticator, WPS_AUTHENTICATOR_LEN) != 0) { + wpa_printf(MSG_DEBUG, "WPS: Incorrect Authenticator"); +@@ -71,7 +71,7 @@ int wps_process_key_wrap_auth(struct wps_data *wps, struct wpabuf *msg, + return -1; + } + +- if (hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, head, len, hash) < 0 || ++ if (wpa_hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, head, len, hash) < 0 || + os_memcmp_const(hash, key_wrap_auth, WPS_KWA_LEN) != 0) { + wpa_printf(MSG_DEBUG, "WPS: Invalid KWA"); + return -1; +diff --git a/components/wpa_supplicant/src/wps/wps_common.c b/components/wpa_supplicant/src/wps/wps_common.c +index 7d4288c7c6..89fe937d68 100644 +--- a/components/wpa_supplicant/src/wps/wps_common.c ++++ b/components/wpa_supplicant/src/wps/wps_common.c +@@ -48,7 +48,7 @@ void wps_kdf(const u8 *key, const u8 *label_prefix, size_t label_prefix_len, + + for (i = 1; i <= iter; i++) { + WPA_PUT_BE32(i_buf, i); +- hmac_sha256_vector(key, SHA256_MAC_LEN, 4, addr, len, hash); ++ wpa_hmac_sha256_vector(key, SHA256_MAC_LEN, 4, addr, len, hash); + if (i < iter) { + os_memcpy(opos, hash, SHA256_MAC_LEN); + opos += SHA256_MAC_LEN; +@@ -104,7 +104,7 @@ int wps_derive_keys(struct wps_data *wps) + /* DHKey = SHA-256(g^AB mod p) */ + addr[0] = wpabuf_head(dh_shared); + len[0] = wpabuf_len(dh_shared); +- sha256_vector(1, addr, len, dhkey); ++ wpa_sha256_vector(1, addr, len, dhkey); + wpa_hexdump_key(MSG_DEBUG, "WPS: DHKey", dhkey, sizeof(dhkey)); + wpabuf_clear_free(dh_shared); + +@@ -115,7 +115,7 @@ int wps_derive_keys(struct wps_data *wps) + len[1] = ETH_ALEN; + addr[2] = wps->nonce_r; + len[2] = WPS_NONCE_LEN; +- hmac_sha256_vector(dhkey, sizeof(dhkey), 3, addr, len, kdk); ++ wpa_hmac_sha256_vector(dhkey, sizeof(dhkey), 3, addr, len, kdk); + wpa_hexdump_key(MSG_DEBUG, "WPS: KDK", kdk, sizeof(kdk)); + + wps_kdf(kdk, NULL, 0, "Wi-Fi Easy and Secure Key Derivation", +@@ -140,11 +140,11 @@ int wps_derive_psk(struct wps_data *wps, const u8 *dev_passwd, + { + u8 hash[SHA256_MAC_LEN]; + +- if (hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, dev_passwd, ++ if (wpa_hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, dev_passwd, + (dev_passwd_len + 1) / 2, hash) < 0) + return -1; + os_memcpy(wps->psk1, hash, WPS_PSK_LEN); +- if (hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, ++ if (wpa_hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, + dev_passwd + (dev_passwd_len + 1) / 2, + dev_passwd_len / 2, hash) < 0) + return -1; +diff --git a/components/wpa_supplicant/src/wps/wps_enrollee.c b/components/wpa_supplicant/src/wps/wps_enrollee.c +index 2f8e1aacfd..973c939733 100644 +--- a/components/wpa_supplicant/src/wps/wps_enrollee.c ++++ b/components/wpa_supplicant/src/wps/wps_enrollee.c +@@ -65,7 +65,7 @@ static int wps_build_e_hash(struct wps_data *wps, struct wpabuf *msg) + len[2] = wpabuf_len(wps->dh_pubkey_e); + addr[3] = wpabuf_head(wps->dh_pubkey_r); + len[3] = wpabuf_len(wps->dh_pubkey_r); +- hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); ++ wpa_hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); + wpa_hexdump(MSG_DEBUG, "WPS: E-Hash1", hash, SHA256_MAC_LEN); + + wpa_printf(MSG_DEBUG, "WPS: * E-Hash2"); +@@ -75,7 +75,7 @@ static int wps_build_e_hash(struct wps_data *wps, struct wpabuf *msg) + /* E-Hash2 = HMAC_AuthKey(E-S2 || PSK2 || PK_E || PK_R) */ + addr[0] = wps->snonce + WPS_SECRET_NONCE_LEN; + addr[1] = wps->psk2; +- hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); ++ wpa_hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); + wpa_hexdump(MSG_DEBUG, "WPS: E-Hash2", hash, SHA256_MAC_LEN); + + return 0; +@@ -576,7 +576,7 @@ static int wps_process_pubkey(struct wps_data *wps, const u8 *pk, + + if (wps->peer_pubkey_hash_set) { + u8 hash[WPS_HASH_LEN]; +- sha256_vector(1, &pk, &pk_len, hash); ++ wpa_sha256_vector(1, &pk, &pk_len, hash); + if (os_memcmp_const(hash, wps->peer_pubkey_hash, + WPS_OOB_PUBKEY_HASH_LEN) != 0) { + wpa_printf(MSG_ERROR, "WPS: Public Key hash mismatch"); +@@ -655,7 +655,7 @@ static int wps_process_r_snonce1(struct wps_data *wps, const u8 *r_snonce1) + len[2] = wpabuf_len(wps->dh_pubkey_e); + addr[3] = wpabuf_head(wps->dh_pubkey_r); + len[3] = wpabuf_len(wps->dh_pubkey_r); +- hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); ++ wpa_hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); + + if (os_memcmp_const(wps->peer_hash1, hash, WPS_HASH_LEN) != 0) { + wpa_printf(MSG_DEBUG, "WPS: R-Hash1 derived from R-S1 does " +@@ -695,7 +695,7 @@ static int wps_process_r_snonce2(struct wps_data *wps, const u8 *r_snonce2) + len[2] = wpabuf_len(wps->dh_pubkey_e); + addr[3] = wpabuf_head(wps->dh_pubkey_r); + len[3] = wpabuf_len(wps->dh_pubkey_r); +- hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); ++ wpa_hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); + + if (os_memcmp_const(wps->peer_hash2, hash, WPS_HASH_LEN) != 0) { + wpa_printf(MSG_DEBUG, "WPS: R-Hash2 derived from R-S2 does " +diff --git a/components/wpa_supplicant/src/wps/wps_registrar.c b/components/wpa_supplicant/src/wps/wps_registrar.c +index a7edf79ff6..4424e9ba45 100644 +--- a/components/wpa_supplicant/src/wps/wps_registrar.c ++++ b/components/wpa_supplicant/src/wps/wps_registrar.c +@@ -1499,7 +1499,7 @@ static int wps_build_r_hash(struct wps_data *wps, struct wpabuf *msg) + len[2] = wpabuf_len(wps->dh_pubkey_e); + addr[3] = wpabuf_head(wps->dh_pubkey_r); + len[3] = wpabuf_len(wps->dh_pubkey_r); +- hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); ++ wpa_hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); + wpa_hexdump(MSG_DEBUG, "WPS: R-Hash1", hash, SHA256_MAC_LEN); + + wpa_printf(MSG_DEBUG, "WPS: * R-Hash2"); +@@ -1509,7 +1509,7 @@ static int wps_build_r_hash(struct wps_data *wps, struct wpabuf *msg) + /* R-Hash2 = HMAC_AuthKey(R-S2 || PSK2 || PK_E || PK_R) */ + addr[0] = wps->snonce + WPS_SECRET_NONCE_LEN; + addr[1] = wps->psk2; +- hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); ++ wpa_hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); + wpa_hexdump(MSG_DEBUG, "WPS: R-Hash2", hash, SHA256_MAC_LEN); + + return 0; +@@ -1748,7 +1748,7 @@ int wps_build_cred(struct wps_data *wps, struct wpabuf *msg) + return -1; + } + os_free(wps->new_psk); +- wps->new_psk = (u8 *) base64_encode(r, sizeof(r), ++ wps->new_psk = (u8 *) wpa_base64_encode(r, sizeof(r), + &wps->new_psk_len); + if (wps->new_psk == NULL) + return -1; +@@ -2329,7 +2329,7 @@ static int wps_process_e_snonce1(struct wps_data *wps, const u8 *e_snonce1) + len[2] = wpabuf_len(wps->dh_pubkey_e); + addr[3] = wpabuf_head(wps->dh_pubkey_r); + len[3] = wpabuf_len(wps->dh_pubkey_r); +- hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); ++ wpa_hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); + + if (os_memcmp_const(wps->peer_hash1, hash, WPS_HASH_LEN) != 0) { + wpa_printf(MSG_DEBUG, "WPS: E-Hash1 derived from E-S1 does " +@@ -2369,7 +2369,7 @@ static int wps_process_e_snonce2(struct wps_data *wps, const u8 *e_snonce2) + len[2] = wpabuf_len(wps->dh_pubkey_e); + addr[3] = wpabuf_head(wps->dh_pubkey_r); + len[3] = wpabuf_len(wps->dh_pubkey_r); +- hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); ++ wpa_hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash); + + if (os_memcmp_const(wps->peer_hash2, hash, WPS_HASH_LEN) != 0) { + wpa_printf(MSG_DEBUG, "WPS: E-Hash2 derived from E-S2 does " +@@ -2721,7 +2721,7 @@ static enum wps_process_res wps_process_m1(struct wps_data *wps, + + addr[0] = attr->public_key; + len = attr->public_key_len; +- sha256_vector(1, addr, &len, hash); ++ wpa_sha256_vector(1, addr, &len, hash); + if (os_memcmp_const(hash, + wps->nfc_pw_token->pubkey_hash, + WPS_OOB_PUBKEY_HASH_LEN) != 0) { +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0003-wpa_supplicant-use-ztimer_sleep-in-os_sleep.patch b/pkg/esp32_sdk/patches/0003-wpa_supplicant-use-ztimer_sleep-in-os_sleep.patch new file mode 100644 index 0000000000..34913e30ae --- /dev/null +++ b/pkg/esp32_sdk/patches/0003-wpa_supplicant-use-ztimer_sleep-in-os_sleep.patch @@ -0,0 +1,38 @@ +From 76a15bfad81c3cd6b31222f8afdc050a69276170 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 17:32:12 +0100 +Subject: [PATCH 03/28] wpa_supplicant: use ztimer_sleep in os_sleep + +--- + components/wpa_supplicant/port/os_xtensa.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/components/wpa_supplicant/port/os_xtensa.c b/components/wpa_supplicant/port/os_xtensa.c +index 7a2309e8b5..57e16ddc6a 100644 +--- a/components/wpa_supplicant/port/os_xtensa.c ++++ b/components/wpa_supplicant/port/os_xtensa.c +@@ -30,6 +30,8 @@ + #include "utils/common.h" + #include "mbedtls/platform_util.h" + ++#include "ztimer.h" ++ + int os_get_time(struct os_time *t) + { + struct timeval tv; +@@ -53,10 +55,10 @@ int os_get_random(unsigned char *buf, size_t len) + void os_sleep(os_time_t sec, os_time_t usec) + { + if (sec) { +- sleep(sec); ++ ztimer_sleep(ZTIMER_SEC, sec); + } + if (usec) { +- usleep(usec); ++ ztimer_sleep(ZTIMER_USEC, usec); + } + } + +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0004-wpa_supplicant-conditional-include-for-mbedtls.patch b/pkg/esp32_sdk/patches/0004-wpa_supplicant-conditional-include-for-mbedtls.patch new file mode 100644 index 0000000000..83a6e8d519 --- /dev/null +++ b/pkg/esp32_sdk/patches/0004-wpa_supplicant-conditional-include-for-mbedtls.patch @@ -0,0 +1,26 @@ +From cd2cadff0a0a1fcb4cfdbd802989934d3b15a22e Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 17:33:00 +0100 +Subject: [PATCH 04/28] wpa_supplicant: conditional include for mbedtls + +--- + components/wpa_supplicant/port/os_xtensa.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/components/wpa_supplicant/port/os_xtensa.c b/components/wpa_supplicant/port/os_xtensa.c +index 57e16ddc6a..7e5d78bd70 100644 +--- a/components/wpa_supplicant/port/os_xtensa.c ++++ b/components/wpa_supplicant/port/os_xtensa.c +@@ -28,7 +28,9 @@ + #include + #include "esp_random.h" + #include "utils/common.h" ++#if USE_MBEDTLS_CRYPTO + #include "mbedtls/platform_util.h" ++#endif + + #include "ztimer.h" + +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0005-wpa_suppplicant-avoid-conflicts-for-ARRAY_SIZE-macro.patch b/pkg/esp32_sdk/patches/0005-wpa_suppplicant-avoid-conflicts-for-ARRAY_SIZE-macro.patch new file mode 100644 index 0000000000..4d423951aa --- /dev/null +++ b/pkg/esp32_sdk/patches/0005-wpa_suppplicant-avoid-conflicts-for-ARRAY_SIZE-macro.patch @@ -0,0 +1,27 @@ +From e3f73720b24abaa73b6f818c954b6dbdc0d879b3 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 17:38:43 +0100 +Subject: [PATCH 05/28] wpa_suppplicant: avoid conflicts for ARRAY_SIZE macro + +--- + components/wpa_supplicant/src/utils/common.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/components/wpa_supplicant/src/utils/common.h b/components/wpa_supplicant/src/utils/common.h +index 998870e90f..8f01822939 100644 +--- a/components/wpa_supplicant/src/utils/common.h ++++ b/components/wpa_supplicant/src/utils/common.h +@@ -449,7 +449,10 @@ struct wpa_freq_range_list { + unsigned int num; + }; + ++#ifndef ARRAY_SIZE + #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) ++#endif ++ + #ifndef TEST_FAIL + #define TEST_FAIL() 0 + #endif +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0006-bootloader-allow-compilation-for-RIOT-OS.patch b/pkg/esp32_sdk/patches/0006-bootloader-allow-compilation-for-RIOT-OS.patch new file mode 100644 index 0000000000..2a1bf773c0 --- /dev/null +++ b/pkg/esp32_sdk/patches/0006-bootloader-allow-compilation-for-RIOT-OS.patch @@ -0,0 +1,375 @@ +From 2273125f8cc71c1e03be9f199dfba6d94a82aeb5 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 17:38:07 +0100 +Subject: [PATCH 06/28] bootloader: allow compilation for RIOT-OS + +--- + .../subproject/main/ld/esp32/bootloader.ld | 58 ++++++++--------- + .../subproject/main/ld/esp32c3/bootloader.ld | 58 ++++++++--------- + .../subproject/main/ld/esp32s2/bootloader.ld | 62 +++++++++---------- + .../subproject/main/ld/esp32s3/bootloader.ld | 60 +++++++++--------- + components/log/include/esp_log.h | 4 ++ + components/log/include/esp_log_buffer.h | 4 ++ + components/log/include/esp_log_color.h | 2 + + 7 files changed, 129 insertions(+), 119 deletions(-) + +diff --git a/components/bootloader/subproject/main/ld/esp32/bootloader.ld b/components/bootloader/subproject/main/ld/esp32/bootloader.ld +index d5fb575ddd..97bb99b8a6 100644 +--- a/components/bootloader/subproject/main/ld/esp32/bootloader.ld ++++ b/components/bootloader/subproject/main/ld/esp32/bootloader.ld +@@ -41,38 +41,38 @@ SECTIONS + _loader_text_start = ABSOLUTE(.); + *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) + *(.iram1 .iram1.*) /* catch stray IRAM_ATTR */ +- *liblog.a:(.literal .text .literal.* .text.*) ++ *components/log/*(.literal .text .literal.* .text.*) + /* we use either libgcc or compiler-rt, so put similar entries for them here */ + *libgcc.a:(.literal .text .literal.* .text.*) + *libclang_rt.builtins.a:(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_clock_loader.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_common_loader.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_flash.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_random.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable) +- *libesp_common.a:fpga_overrides.*(.literal.bootloader_fill_random .text.bootloader_fill_random) +- *libbootloader_support.a:bootloader_efuse.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_utility.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_soc.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*) +- *libmicro-ecc.a:*.*(.literal .text .literal.* .text.*) +- *libspi_flash.a:*.*(.literal .text .literal.* .text.*) +- *libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*) +- *libhal.a:mmu_hal.*(.literal .text .literal.* .text.*) +- *libhal.a:efuse_hal.*(.literal .text .literal.* .text.*) +- *libesp_hw_support.a:rtc_clk.*(.literal .text .literal.* .text.*) +- *libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*) +- *libefuse.a:*.*(.literal .text .literal.* .text.*) +- *libesp_rom.a:*.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_clock_loader.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_common_loader.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_flash.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_random.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable) ++ *components/esp_system/fpga_overrides.*(.literal.bootloader_fill_random .text.bootloader_fill_random) ++ *components/bootloader_support/*/bootloader_efuse.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_utility.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_sha.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_console_loader.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_panic.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_soc.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/esp_image_format.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/flash_encrypt.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/flash_encryption_secure_features.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/flash_partitions.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/secure_boot.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/secure_boot_secure_features.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*) ++ *components/*/micro-ecc/*(.literal .text .literal.* .text.*) ++ *components/spi_flash/*(.literal .text .literal.* .text.*) ++ *components/hal/wdt_hal_iram.*(.literal .text .literal.* .text.*) ++ *components/hal/mmu_hal.*(.literal .text .literal.* .text.*) ++ *components/hal/efuse_hal.*(.literal .text .literal.* .text.*) ++ *components/esp_hw_support/*/rtc_clk.*(.literal .text .literal.* .text.*) ++ *components/esp_hw_support/*/rtc_time.*(.literal .text .literal.* .text.*) ++ *components/efuse/*(.literal .text .literal.* .text.*) ++ *components/esp_rom/*/*(.literal .text .literal.* .text.*) + *(.fini.literal) + *(.fini) + *(.gnu.version) +diff --git a/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld b/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld +index 21f19c14fe..0a7a2d32dc 100644 +--- a/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld ++++ b/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld +@@ -62,38 +62,38 @@ SECTIONS + _loader_text_start = ABSOLUTE(.); + *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) + *(.iram1 .iram1.*) /* catch stray IRAM_ATTR */ +- *liblog.a:(.literal .text .literal.* .text.*) ++ *components/log/*(.literal .text .literal.* .text.*) + /* we use either libgcc or compiler-rt, so put similar entries for them here */ + *libgcc.a:(.literal .text .literal.* .text.*) + *libclang_rt.builtins.a:(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_clock_loader.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_common_loader.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_flash.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_random.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable) +- *libbootloader_support.a:bootloader_efuse.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_utility.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_soc.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*) +- *libmicro-ecc.a:*.*(.literal .text .literal.* .text.*) +- *libspi_flash.a:*.*(.literal .text .literal.* .text.*) +- *libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*) +- *libhal.a:mmu_hal.*(.literal .text .literal.* .text.*) +- *libhal.a:cache_hal.*(.literal .text .literal.* .text.*) +- *libhal.a:efuse_hal.*(.literal .text .literal.* .text.*) +- *libesp_hw_support.a:rtc_clk.*(.literal .text .literal.* .text.*) +- *libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*) +- *libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*) +- *libefuse.a:*.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_clock_loader.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_common_loader.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_flash.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_random.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable) ++ *components/bootloader_support/*/bootloader_efuse.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_utility.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_sha.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_console_loader.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_panic.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_soc.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/esp_image_format.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/flash_encrypt.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/flash_encryption_secure_features.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/flash_partitions.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/secure_boot.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/secure_boot_secure_features.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*) ++ *components/*/micro-ecc/*(.literal .text .literal.* .text.*) ++ *components/spi_flash/*(.literal .text .literal.* .text.*) ++ *components/hal/wdt_hal_iram.*(.literal .text .literal.* .text.*) ++ *components/hal/mmu_hal.*(.literal .text .literal.* .text.*) ++ *components/hal/cache_hal.*(.literal .text .literal.* .text.*) ++ *components/hal/efuse_hal.*(.literal .text .literal.* .text.*) ++ *components/esp_hw_support/*/rtc_clk.*(.literal .text .literal.* .text.*) ++ *components/esp_hw_support/*/rtc_time.*(.literal .text .literal.* .text.*) ++ *components/esp_hw_support/regi2c_ctrl.*(.literal .text .literal.* .text.*) ++ *components/efuse/*(.literal .text .literal.* .text.*) + *(.fini.literal) + *(.fini) + *(.gnu.version) +diff --git a/components/bootloader/subproject/main/ld/esp32s2/bootloader.ld b/components/bootloader/subproject/main/ld/esp32s2/bootloader.ld +index f2c4ede304..d26362429e 100644 +--- a/components/bootloader/subproject/main/ld/esp32s2/bootloader.ld ++++ b/components/bootloader/subproject/main/ld/esp32s2/bootloader.ld +@@ -28,40 +28,40 @@ SECTIONS + _loader_text_start = ABSOLUTE(.); + *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) + *(.iram1 .iram1.*) /* catch stray IRAM_ATTR */ +- *liblog.a:(.literal .text .literal.* .text.*) ++ *components/log/*(.literal .text .literal.* .text.*) + /* we use either libgcc or compiler-rt, so put similar entries for them here */ + *libgcc.a:(.literal .text .literal.* .text.*) + *libclang_rt.builtins.a:(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_clock_loader.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_common_loader.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_flash.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_random.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable) +- *libesp_common.a:fpga_overrides.*(.literal.bootloader_fill_random .text.bootloader_fill_random) +- *libbootloader_support.a:bootloader_efuse.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_utility.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_soc.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*) +- *libmicro-ecc.a:*.*(.literal .text .literal.* .text.*) +- *libspi_flash.a:*.*(.literal .text .literal.* .text.*) +- *libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*) +- *libhal.a:mmu_hal.*(.literal .text .literal.* .text.*) +- *libhal.a:cache_hal.*(.literal .text .literal.* .text.*) +- *libhal.a:efuse_hal.*(.literal .text .literal.* .text.*) +- *libesp_hw_support.a:rtc_clk.*(.literal .text .literal.* .text.*) +- *libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*) +- *libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*) +- *libefuse.a:*.*(.literal .text .literal.* .text.*) +- *libesp_rom.a:esp_rom_regi2c.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_clock_loader.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_common_loader.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_flash.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_random.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable) ++ *components/esp_system/fpga_overrides.*(.literal.bootloader_fill_random .text.bootloader_fill_random) ++ *components/bootloader_support/*/bootloader_efuse.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_utility.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_sha.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_console_loader.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_panic.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_soc.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/esp_image_format.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/flash_encrypt.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/flash_encryption_secure_features.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/flash_partitions.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/secure_boot.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/secure_boot_secure_features.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*) ++ *components/*/micro-ecc/*(.literal .text .literal.* .text.*) ++ *components/spi_flash/*(.literal .text .literal.* .text.*) ++ *components/hal/wdt_hal_iram.*(.literal .text .literal.* .text.*) ++ *components/hal/mmu_hal.*(.literal .text .literal.* .text.*) ++ *components/hal/cache_hal.*(.literal .text .literal.* .text.*) ++ *components/hal/efuse_hal.*(.literal .text .literal.* .text.*) ++ *components/esp_hw_support/*/rtc_clk.*(.literal .text .literal.* .text.*) ++ *components/esp_hw_support/*/rtc_time.*(.literal .text .literal.* .text.*) ++ *components/esp_hw_support/regi2c_ctrl.*(.literal .text .literal.* .text.*) ++ *components/efuse/*(.literal .text .literal.* .text.*) ++ *components/esp_rom/*/esp_rom_regi2c.*(.literal .text .literal.* .text.*) + *(.fini.literal) + *(.fini) + *(.gnu.version) +diff --git a/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld b/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld +index c0f4702a01..e57c49c434 100644 +--- a/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld ++++ b/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld +@@ -63,39 +63,39 @@ SECTIONS + _loader_text_start = ABSOLUTE(.); + *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) + *(.iram1 .iram1.*) /* catch stray IRAM_ATTR */ +- *liblog.a:(.literal .text .literal.* .text.*) ++ *components/log/*(.literal .text .literal.* .text.*) + /* we use either libgcc or compiler-rt, so put similar entries for them here */ + *libgcc.a:(.literal .text .literal.* .text.*) + *libclang_rt.builtins.a:(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_clock_loader.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_common_loader.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_flash.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_random.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable) +- *libesp_common.a:fpga_overrides.*(.literal.bootloader_fill_random .text.bootloader_fill_random) +- *libbootloader_support.a:bootloader_efuse.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_utility.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:bootloader_soc.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*) +- *libbootloader_support.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*) +- *libmicro-ecc.a:*.*(.literal .text .literal.* .text.*) +- *libspi_flash.a:*.*(.literal .text .literal.* .text.*) +- *libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*) +- *libhal.a:mmu_hal.*(.literal .text .literal.* .text.*) +- *libhal.a:cache_hal.*(.literal .text .literal.* .text.*) +- *libhal.a:efuse_hal.*(.literal .text .literal.* .text.*) +- *libesp_hw_support.a:rtc_clk.*(.literal .text .literal.* .text.*) +- *libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*) +- *libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*) +- *libefuse.a:*.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_clock_loader.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_common_loader.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_flash.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_random.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable) ++ *components/esp_system/fpga_overrides.*(.literal.bootloader_fill_random .text.bootloader_fill_random) ++ *components/bootloader_support/*/bootloader_efuse.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_utility.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_sha.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_console_loader.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_panic.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/bootloader_soc.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/esp_image_format.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/flash_encrypt.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/flash_encryption_secure_features.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/flash_partitions.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/secure_boot.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/secure_boot_secure_features.*(.literal .text .literal.* .text.*) ++ *components/bootloader_support/*/secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*) ++ *components/*/micro-ecc/*(.literal .text .literal.* .text.*) ++ *components/spi_flash/*(.literal .text .literal.* .text.*) ++ *components/hal/wdt_hal_iram.*(.literal .text .literal.* .text.*) ++ *components/hal/mmu_hal.*(.literal .text .literal.* .text.*) ++ *components/hal/cache_hal.*(.literal .text .literal.* .text.*) ++ *components/hal/efuse_hal.*(.literal .text .literal.* .text.*) ++ *components/esp_hw_support/*/rtc_clk.*(.literal .text .literal.* .text.*) ++ *components/esp_hw_support/*/rtc_time.*(.literal .text .literal.* .text.*) ++ *components/esp_hw_support/regi2c_ctrl.*(.literal .text .literal.* .text.*) ++ *components/efuse/*(.literal .text .literal.* .text.*) + *(.fini.literal) + *(.fini) + *(.gnu.version) +diff --git a/components/log/include/esp_log.h b/components/log/include/esp_log.h +index e2cb068f43..eb6d94acad 100644 +--- a/components/log/include/esp_log.h ++++ b/components/log/include/esp_log.h +@@ -59,6 +59,8 @@ void esp_log_writev(esp_log_level_t level, const char* tag, const char* format, + + /** @cond */ + ++#if !defined(RIOT_VERSION) || defined(BOOTLOADER_BUILD) ++ + #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" + #define LOG_SYSTEM_TIME_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%s) %s: " format LOG_RESET_COLOR "\n" + +@@ -259,6 +261,8 @@ void esp_log_writev(esp_log_level_t level, const char* tag, const char* format, + #endif // !(defined(__cplusplus) && (__cplusplus > 201703L)) + /** @endcond */ + ++#endif /* !defined(RIOT_VERSION) || defined(BOOTLOADER_BUILD) */ ++ + #ifdef __cplusplus + } + #endif +diff --git a/components/log/include/esp_log_buffer.h b/components/log/include/esp_log_buffer.h +index 5453061403..603a3c5b3b 100644 +--- a/components/log/include/esp_log_buffer.h ++++ b/components/log/include/esp_log_buffer.h +@@ -63,6 +63,8 @@ void esp_log_buffer_char_internal(const char *tag, const void *buffer, uint16_t + */ + void esp_log_buffer_hexdump_internal(const char *tag, const void *buffer, uint16_t buff_len, esp_log_level_t log_level); + ++#if !defined(RIOT_VERSION) || defined(BOOTLOADER_BUILD) ++ + /** + * @brief Log a buffer of hex bytes at specified level, separated into 16 bytes each line. + * +@@ -173,6 +175,8 @@ static inline void esp_log_buffer_char(const char *tag, const void *buffer, uint + } + /** @endcond */ + ++#endif /* !defined(RIOT_VERSION) || defined(BOOTLOADER_BUILD) */ ++ + #endif // !NON_OS_BUILD || __DOXYGEN__ + + #ifdef __cplusplus +diff --git a/components/log/include/esp_log_color.h b/components/log/include/esp_log_color.h +index 483d634ea6..dde406a526 100644 +--- a/components/log/include/esp_log_color.h ++++ b/components/log/include/esp_log_color.h +@@ -94,12 +94,14 @@ extern "C" { + #define LOG_COLOR_D "" + #define LOG_COLOR_V "" + #else ++#if !defined(RIOT_VERSION) || defined(BOOTLOADER_BUILD) + #define LOG_RESET_COLOR "" + #define LOG_COLOR_E "" + #define LOG_COLOR_W "" + #define LOG_COLOR_I "" + #define LOG_COLOR_D "" + #define LOG_COLOR_V "" ++#endif /* !defined(RIOT_VERSION) || defined(BOOTLOADER_BUILD) */ + #endif + /** @endcond */ + +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0007-sdmmc-avoid-type-definition-conflicts.patch b/pkg/esp32_sdk/patches/0007-sdmmc-avoid-type-definition-conflicts.patch new file mode 100644 index 0000000000..b9d371cf88 --- /dev/null +++ b/pkg/esp32_sdk/patches/0007-sdmmc-avoid-type-definition-conflicts.patch @@ -0,0 +1,50 @@ +From b63a8db9ecc824fd05ab19b51fbc7c217234e582 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 17:40:10 +0100 +Subject: [PATCH 07/28] sdmmc: avoid type definition conflicts + +--- + components/sdmmc/include/sd_protocol_types.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/components/sdmmc/include/sd_protocol_types.h b/components/sdmmc/include/sd_protocol_types.h +index 70cdf76d12..41fac5d339 100644 +--- a/components/sdmmc/include/sd_protocol_types.h ++++ b/components/sdmmc/include/sd_protocol_types.h +@@ -34,6 +34,7 @@ + extern "C" { + #endif + ++#if !defined(RIOT_VERSION) + /** + * Decoded values from SD card Card Specific Data register + */ +@@ -96,6 +97,8 @@ typedef struct { + uint8_t sec_feature; /*!< secure data management features supported by the card */ + } sdmmc_ext_csd_t; + ++#endif /* !defined(RIOT_VERSION) */ ++ + /** + * SD/MMC command response buffer + */ +@@ -245,6 +248,7 @@ typedef struct { + esp_err_t (*is_slot_set_to_uhs1)(int slot, bool *is_uhs1); /*!< host slot is set to uhs1 or not*/ + } sdmmc_host_t; + ++#if !defined(RIOT_VERSION) + /** + * SD/MMC card information structure + */ +@@ -273,6 +277,8 @@ typedef struct { + uint32_t reserved : 22; /*!< Reserved for future expansion */ + } sdmmc_card_t; + ++#endif /* !defined(RIOT_VERSION) */ ++ + /** + * SD/MMC erase command(38) arguments + * SD: +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0008-sdmmc-fix-byte-wise-writing-to-CMD-register.patch b/pkg/esp32_sdk/patches/0008-sdmmc-fix-byte-wise-writing-to-CMD-register.patch new file mode 100644 index 0000000000..9e07813cd6 --- /dev/null +++ b/pkg/esp32_sdk/patches/0008-sdmmc-fix-byte-wise-writing-to-CMD-register.patch @@ -0,0 +1,40 @@ +From 97e5f240e60ca9d7806f9e4ed53ac1c025e8ce87 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 17:55:31 +0100 +Subject: [PATCH 08/28] sdmmc: fix byte-wise writing to CMD register + +Writing the 32-bit CMD register using memcpy results in the register being written byte by byte in any order. If the start bit in the CMD register is set before all bytes have been written, a wrong command is executed. Writing to the 32-bit CMD register must be performed as a single word register copy instruction which is guaranteed by the assignment. +--- + components/hal/esp32/include/hal/sdmmc_ll.h | 2 +- + components/hal/esp32s3/include/hal/sdmmc_ll.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/components/hal/esp32/include/hal/sdmmc_ll.h b/components/hal/esp32/include/hal/sdmmc_ll.h +index 0f5a62ea37..feecb231e5 100644 +--- a/components/hal/esp32/include/hal/sdmmc_ll.h ++++ b/components/hal/esp32/include/hal/sdmmc_ll.h +@@ -491,7 +491,7 @@ static inline void sdmmc_ll_poll_demand(sdmmc_dev_t *hw) + */ + static inline void sdmmc_ll_set_command(sdmmc_dev_t *hw, sdmmc_hw_cmd_t cmd) + { +- memcpy((void *)&hw->cmd, &cmd, sizeof(sdmmc_hw_cmd_t)); ++ hw->cmd = cmd; + } + + /** +diff --git a/components/hal/esp32s3/include/hal/sdmmc_ll.h b/components/hal/esp32s3/include/hal/sdmmc_ll.h +index 2747905931..60cd5923bd 100644 +--- a/components/hal/esp32s3/include/hal/sdmmc_ll.h ++++ b/components/hal/esp32s3/include/hal/sdmmc_ll.h +@@ -527,7 +527,7 @@ static inline void sdmmc_ll_poll_demand(sdmmc_dev_t *hw) + */ + static inline void sdmmc_ll_set_command(sdmmc_dev_t *hw, sdmmc_hw_cmd_t cmd) + { +- memcpy((void *)&hw->cmd, &cmd, sizeof(sdmmc_hw_cmd_t)); ++ hw->cmd = cmd; + } + + /** +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0009-bt-controller-fix-printf-format-string.patch b/pkg/esp32_sdk/patches/0009-bt-controller-fix-printf-format-string.patch new file mode 100644 index 0000000000..6019a62425 --- /dev/null +++ b/pkg/esp32_sdk/patches/0009-bt-controller-fix-printf-format-string.patch @@ -0,0 +1,25 @@ +From 321ef67c4675f566dcbe885558ece59e3a4f3845 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 17:56:30 +0100 +Subject: [PATCH 09/28] bt/controller: fix printf format string + +--- + components/bt/controller/esp32/bt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/components/bt/controller/esp32/bt.c b/components/bt/controller/esp32/bt.c +index d94c9c0507..6a20c2b1b7 100644 +--- a/components/bt/controller/esp32/bt.c ++++ b/components/bt/controller/esp32/bt.c +@@ -1273,7 +1273,7 @@ static void btdm_controller_mem_init(void) + { + /* initialise .data section */ + memcpy(&_data_start_btdm, (void *)_data_start_btdm_rom, &_data_end_btdm - &_data_start_btdm); +- ESP_LOGD(BTDM_LOG_TAG, ".data initialise [0x%08x] <== [0x%08x]", (uint32_t)&_data_start_btdm, _data_start_btdm_rom); ++ ESP_LOGD(BTDM_LOG_TAG, ".data initialise [0x%08"PRIx32"] <== [0x%08"PRIx32"]", (uint32_t)&_data_start_btdm, _data_start_btdm_rom); + + //initial em, .bss section + for (int i = 1; i < sizeof(btdm_dram_available_region)/sizeof(btdm_dram_available_region_t); i++) { +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0010-bt-controller-add-missing-includes.patch b/pkg/esp32_sdk/patches/0010-bt-controller-add-missing-includes.patch new file mode 100644 index 0000000000..3c141b6c8a --- /dev/null +++ b/pkg/esp32_sdk/patches/0010-bt-controller-add-missing-includes.patch @@ -0,0 +1,25 @@ +From b0a8bfb89d5f80f951cfa9f57e128c90940d0523 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 17:57:00 +0100 +Subject: [PATCH 10/28] bt/controller: add missing includes + +--- + components/bt/controller/esp32c3/bt.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/components/bt/controller/esp32c3/bt.c b/components/bt/controller/esp32c3/bt.c +index 19eea2ee87..90123c47cd 100644 +--- a/components/bt/controller/esp32c3/bt.c ++++ b/components/bt/controller/esp32c3/bt.c +@@ -30,6 +30,8 @@ + #include "esp_err.h" + #include "esp_log.h" + #include "esp_pm.h" ++#include "esp_intr_types.h" ++#include "esp_intr_alloc.h" + #include "esp_ipc.h" + #include "esp_private/periph_ctrl.h" + #include "esp_private/esp_clk.h" +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0011-esp_wifi-add-missing-includes.patch b/pkg/esp32_sdk/patches/0011-esp_wifi-add-missing-includes.patch new file mode 100644 index 0000000000..25cdab24ee --- /dev/null +++ b/pkg/esp32_sdk/patches/0011-esp_wifi-add-missing-includes.patch @@ -0,0 +1,63 @@ +From fb8d63941e9ae075cdcd9dddab01716b01e54ee8 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 17:57:26 +0100 +Subject: [PATCH 11/28] esp_wifi: add missing includes + +--- + components/esp_wifi/esp32/esp_adapter.c | 1 + + components/esp_wifi/esp32c3/esp_adapter.c | 1 + + components/esp_wifi/esp32s2/esp_adapter.c | 1 + + components/esp_wifi/esp32s3/esp_adapter.c | 1 + + 4 files changed, 4 insertions(+) + +diff --git a/components/esp_wifi/esp32/esp_adapter.c b/components/esp_wifi/esp32/esp_adapter.c +index 3d69706012..92795986d8 100644 +--- a/components/esp_wifi/esp32/esp_adapter.c ++++ b/components/esp_wifi/esp32/esp_adapter.c +@@ -32,6 +32,7 @@ + #include "esp_cpu.h" + #include "esp_private/wifi_os_adapter.h" + #include "esp_private/wifi.h" ++#include "esp_system.h" + #ifdef CONFIG_ESP_PHY_ENABLED + #include "esp_phy_init.h" + #include "phy_init_data.h" +diff --git a/components/esp_wifi/esp32c3/esp_adapter.c b/components/esp_wifi/esp32c3/esp_adapter.c +index 7c72f19c9f..59e69b3d78 100644 +--- a/components/esp_wifi/esp32c3/esp_adapter.c ++++ b/components/esp_wifi/esp32c3/esp_adapter.c +@@ -31,6 +31,7 @@ + #include "esp_timer.h" + #include "esp_private/wifi_os_adapter.h" + #include "esp_private/wifi.h" ++#include "esp_system.h" + #ifdef CONFIG_ESP_PHY_ENABLED + #include "esp_phy_init.h" + #include "phy_init_data.h" +diff --git a/components/esp_wifi/esp32s2/esp_adapter.c b/components/esp_wifi/esp32s2/esp_adapter.c +index 725a553dba..7358e324d6 100644 +--- a/components/esp_wifi/esp32s2/esp_adapter.c ++++ b/components/esp_wifi/esp32s2/esp_adapter.c +@@ -32,6 +32,7 @@ + #include "esp_cpu.h" + #include "esp_private/wifi_os_adapter.h" + #include "esp_private/wifi.h" ++#include "esp_system.h" + #ifdef CONFIG_ESP_PHY_ENABLED + #include "esp_phy_init.h" + #include "phy_init_data.h" +diff --git a/components/esp_wifi/esp32s3/esp_adapter.c b/components/esp_wifi/esp32s3/esp_adapter.c +index 1e00fbbedb..faa5da1018 100644 +--- a/components/esp_wifi/esp32s3/esp_adapter.c ++++ b/components/esp_wifi/esp32s3/esp_adapter.c +@@ -32,6 +32,7 @@ + #include "esp_cpu.h" + #include "esp_private/wifi_os_adapter.h" + #include "esp_private/wifi.h" ++#include "esp_system.h" + #ifdef CONFIG_ESP_PHY_ENABLED + #include "esp_phy_init.h" + #include "phy_init_data.h" +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0012-esp_eth-add-missing-includes.patch b/pkg/esp32_sdk/patches/0012-esp_eth-add-missing-includes.patch new file mode 100644 index 0000000000..cded91b164 --- /dev/null +++ b/pkg/esp32_sdk/patches/0012-esp_eth-add-missing-includes.patch @@ -0,0 +1,24 @@ +From f230a2601a0ff9cb47fe128015e6ef8e61baab1e Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 17:58:33 +0100 +Subject: [PATCH 12/28] esp_eth: add missing includes + +--- + components/esp_eth/include/esp_eth_mac_esp.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/components/esp_eth/include/esp_eth_mac_esp.h b/components/esp_eth/include/esp_eth_mac_esp.h +index f18bf4d75c..1cbcc52730 100644 +--- a/components/esp_eth/include/esp_eth_mac_esp.h ++++ b/components/esp_eth/include/esp_eth_mac_esp.h +@@ -5,6 +5,7 @@ + */ + #pragma once + ++#include + #include + #include "soc/soc_caps.h" + #include "esp_eth_com.h" +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0013-esp_hw_support-add-missing-includes.patch b/pkg/esp32_sdk/patches/0013-esp_hw_support-add-missing-includes.patch new file mode 100644 index 0000000000..e4160e245c --- /dev/null +++ b/pkg/esp32_sdk/patches/0013-esp_hw_support-add-missing-includes.patch @@ -0,0 +1,24 @@ +From 83210f57c6d79b124b0644969f6aec92f04c1189 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 17:59:14 +0100 +Subject: [PATCH 13/28] esp_hw_support: add missing includes + +--- + components/esp_hw_support/sleep_modes.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c +index 3a5944bc23..207c173449 100644 +--- a/components/esp_hw_support/sleep_modes.c ++++ b/components/esp_hw_support/sleep_modes.c +@@ -11,6 +11,7 @@ + #include + + #include "esp_attr.h" ++#include "esp_cpu.h" + #include "esp_rom_caps.h" + #include "esp_macros.h" + #include "esp_memory_utils.h" +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0014-esp_phy-add-missing-includes.patch b/pkg/esp32_sdk/patches/0014-esp_phy-add-missing-includes.patch new file mode 100644 index 0000000000..0fb14a9139 --- /dev/null +++ b/pkg/esp32_sdk/patches/0014-esp_phy-add-missing-includes.patch @@ -0,0 +1,24 @@ +From a1a7998e4905862ed8a9e22c4bc704877bbf23ac Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 18:02:34 +0100 +Subject: [PATCH 14/28] esp_phy: add missing includes + +--- + components/esp_phy/src/phy_init.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/components/esp_phy/src/phy_init.c b/components/esp_phy/src/phy_init.c +index bc8d28bf3f..5d6d3cc525 100644 +--- a/components/esp_phy/src/phy_init.c ++++ b/components/esp_phy/src/phy_init.c +@@ -32,6 +32,7 @@ + #include "esp_private/wifi.h" + #include "esp_rom_crc.h" + #include "esp_rom_sys.h" ++#include "esp_system.h" + + #include "soc/rtc_periph.h" + +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0015-hal-fix-signed-unsigned-comparison.patch b/pkg/esp32_sdk/patches/0015-hal-fix-signed-unsigned-comparison.patch new file mode 100644 index 0000000000..4c6831b581 --- /dev/null +++ b/pkg/esp32_sdk/patches/0015-hal-fix-signed-unsigned-comparison.patch @@ -0,0 +1,39 @@ +From f504db165a55f83e9d253194a1b880b2a5f746c4 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 18:03:20 +0100 +Subject: [PATCH 15/28] hal: fix signed/unsigned comparison + +--- + components/hal/esp32c3/include/hal/gpspi_flash_ll.h | 2 +- + components/hal/esp32c3/include/hal/spimem_flash_ll.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/components/hal/esp32c3/include/hal/gpspi_flash_ll.h b/components/hal/esp32c3/include/hal/gpspi_flash_ll.h +index 18465d85f1..2d2934b97d 100644 +--- a/components/hal/esp32c3/include/hal/gpspi_flash_ll.h ++++ b/components/hal/esp32c3/include/hal/gpspi_flash_ll.h +@@ -85,7 +85,7 @@ static inline void gpspi_flash_ll_get_buffer_data(spi_dev_t *dev, void *buffer, + } else { + // Otherwise, slow(er) path copies word by word + int copy_len = read_len; +- for (int i = 0; i < (read_len + 3) / 4; i++) { ++ for (uint32_t i = 0; i < (read_len + 3) / 4; i++) { + int word_len = MIN(sizeof(uint32_t), copy_len); + uint32_t word = dev->data_buf[i]; + memcpy(buffer, &word, word_len); +diff --git a/components/hal/esp32c3/include/hal/spimem_flash_ll.h b/components/hal/esp32c3/include/hal/spimem_flash_ll.h +index fd9bc38ed9..c643919bb0 100644 +--- a/components/hal/esp32c3/include/hal/spimem_flash_ll.h ++++ b/components/hal/esp32c3/include/hal/spimem_flash_ll.h +@@ -332,7 +332,7 @@ static inline void spimem_flash_ll_get_buffer_data(spi_mem_dev_t *dev, void *buf + } else { + // Otherwise, slow(er) path copies word by word + int copy_len = read_len; +- for (int i = 0; i < (read_len + 3) / 4; i++) { ++ for (uint32_t i = 0; i < (read_len + 3) / 4; i++) { + int word_len = MIN(sizeof(uint32_t), copy_len); + uint32_t word = dev->data_buf[i]; + memcpy(buffer, &word, word_len); +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0016-hal-gpio_types-avoid-type-conflicts-with-RIOT-gpio-t.patch b/pkg/esp32_sdk/patches/0016-hal-gpio_types-avoid-type-conflicts-with-RIOT-gpio-t.patch new file mode 100644 index 0000000000..912abe3087 --- /dev/null +++ b/pkg/esp32_sdk/patches/0016-hal-gpio_types-avoid-type-conflicts-with-RIOT-gpio-t.patch @@ -0,0 +1,61 @@ +From 9220ae3c3d5bf30804f6741c43b753317d3486ef Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 18:04:05 +0100 +Subject: [PATCH 16/28] hal/gpio_types: avoid type conflicts with RIOT gpio + types + +--- + components/hal/include/hal/gpio_types.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/components/hal/include/hal/gpio_types.h b/components/hal/include/hal/gpio_types.h +index d785ec491a..1a60a4181c 100644 +--- a/components/hal/include/hal/gpio_types.h ++++ b/components/hal/include/hal/gpio_types.h +@@ -14,10 +14,12 @@ + extern "C" { + #endif + ++#ifndef HAVE_GPIO_PORT_T + typedef enum { + GPIO_PORT_0 = 0, + GPIO_PORT_MAX, + } gpio_port_t; ++#endif + + #define GPIO_PIN_REG_0 IO_MUX_GPIO0_REG + #define GPIO_PIN_REG_1 IO_MUX_GPIO1_REG +@@ -92,6 +94,7 @@ typedef enum { + #define GPIO_MODE_DEF_OD (BIT2) ///< bit mask for OD mode + /** @endcond */ + ++#ifndef HAVE_GPIO_MODE_T + typedef enum { + GPIO_MODE_DISABLE = GPIO_MODE_DEF_DISABLE, /*!< GPIO mode : disable input and output */ + GPIO_MODE_INPUT = GPIO_MODE_DEF_INPUT, /*!< GPIO mode : input only */ +@@ -100,6 +103,7 @@ typedef enum { + GPIO_MODE_INPUT_OUTPUT_OD = ((GPIO_MODE_DEF_INPUT) | (GPIO_MODE_DEF_OUTPUT) | (GPIO_MODE_DEF_OD)), /*!< GPIO mode : output and input with open-drain mode*/ + GPIO_MODE_INPUT_OUTPUT = ((GPIO_MODE_DEF_INPUT) | (GPIO_MODE_DEF_OUTPUT)), /*!< GPIO mode : output and input mode */ + } gpio_mode_t; ++#endif + + typedef enum { + GPIO_PULLUP_DISABLE = 0x0, /*!< Disable GPIO pull-up resistor */ +@@ -111,12 +115,14 @@ typedef enum { + GPIO_PULLDOWN_ENABLE = 0x1, /*!< Enable GPIO pull-down resistor */ + } gpio_pulldown_t; + ++#ifndef HAVE_GPIO_PULL_T + typedef enum { + GPIO_PULLUP_ONLY, /*!< Pad pull up */ + GPIO_PULLDOWN_ONLY, /*!< Pad pull down */ + GPIO_PULLUP_PULLDOWN, /*!< Pad pull up + pull down*/ + GPIO_FLOATING, /*!< Pad floating */ + } gpio_pull_mode_t; ++#endif + + typedef enum { + GPIO_DRIVE_CAP_0 = 0, /*!< Pad drive capability: weak */ +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0017-hal-avoid-conflicts-for-ARRAY_SIZE-macro.patch b/pkg/esp32_sdk/patches/0017-hal-avoid-conflicts-for-ARRAY_SIZE-macro.patch new file mode 100644 index 0000000000..b3a8e0d028 --- /dev/null +++ b/pkg/esp32_sdk/patches/0017-hal-avoid-conflicts-for-ARRAY_SIZE-macro.patch @@ -0,0 +1,27 @@ +From d1d459905d7152eb1ff065ea80dd73e384c7ff7b Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 18:04:52 +0100 +Subject: [PATCH 17/28] hal: avoid conflicts for ARRAY_SIZE macro + +--- + components/hal/esp32s3/include/hal/mspi_timing_tuning_ll.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/components/hal/esp32s3/include/hal/mspi_timing_tuning_ll.h b/components/hal/esp32s3/include/hal/mspi_timing_tuning_ll.h +index 9ba2778472..c740e8d0cf 100644 +--- a/components/hal/esp32s3/include/hal/mspi_timing_tuning_ll.h ++++ b/components/hal/esp32s3/include/hal/mspi_timing_tuning_ll.h +@@ -25,7 +25,10 @@ + extern "C" { + #endif + ++#ifndef ARRAY_SIZE + #define ARRAY_SIZE(arr) (sizeof((arr))/sizeof(*(arr))) ++#endif ++ + #define MSPI_TIMING_LL_FLASH_OCT_MASK (SPI_MEM_FCMD_OCT | SPI_MEM_FADDR_OCT | SPI_MEM_FDIN_OCT | SPI_MEM_FDOUT_OCT) + #define MSPI_TIMING_LL_FLASH_QUAD_MASK (SPI_MEM_FASTRD_MODE | SPI_MEM_FREAD_DUAL | SPI_MEM_FREAD_DIO | SPI_MEM_FREAD_QUAD | SPI_MEM_FREAD_QIO) + #define MSPI_TIMING_LL_FLASH_QIO_MODE_MASK (SPI_MEM_FREAD_QIO | SPI_MEM_FASTRD_MODE) +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0018-freertos-portasm-changes-for-RIOT-for-riscv32.patch b/pkg/esp32_sdk/patches/0018-freertos-portasm-changes-for-RIOT-for-riscv32.patch new file mode 100644 index 0000000000..e0d2bb0f9c --- /dev/null +++ b/pkg/esp32_sdk/patches/0018-freertos-portasm-changes-for-RIOT-for-riscv32.patch @@ -0,0 +1,77 @@ +From 0065ed08bb49264552b1f966196736872e27eba2 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 18:28:29 +0100 +Subject: [PATCH 18/28] freertos/portasm: changes for RIOT for riscv32 + +--- + .../FreeRTOS-Kernel/portable/riscv/portasm.S | 33 ++++++++++++++++--- + 1 file changed, 28 insertions(+), 5 deletions(-) + +diff --git a/components/freertos/FreeRTOS-Kernel/portable/riscv/portasm.S b/components/freertos/FreeRTOS-Kernel/portable/riscv/portasm.S +index 5f32c613a0..f6ba4eb72b 100644 +--- a/components/freertos/FreeRTOS-Kernel/portable/riscv/portasm.S ++++ b/components/freertos/FreeRTOS-Kernel/portable/riscv/portasm.S +@@ -4,17 +4,30 @@ + * SPDX-License-Identifier: Apache-2.0 + */ + #include "sdkconfig.h" +-#include "portmacro.h" +-#include "freertos/FreeRTOSConfig.h" + #include "soc/soc_caps.h" +-#include "riscv/rvruntime-frames.h" +-#include "riscv/csr_hwlp.h" +-#include "riscv/csr_pie.h" + + .extern pxCurrentTCBs + + #if CONFIG_ESP_SYSTEM_HW_STACK_GUARD + #include "esp_private/hw_stack_guard.h" ++#endif ++ ++#ifdef RIOT_VERSION ++#include "cpu_conf.h" ++ ++#define port_uxInterruptNesting irq_interrupt_nesting ++#define port_xSchedulerRunning sched_num_threads ++#define pxCurrentTCB sched_active_thread ++#define pxCurrentTCBs sched_active_thread ++#define vTaskSwitchContext sched_run ++#define xPortSwitchFlag sched_context_switch_request ++ ++#define configISR_STACK_SIZE ESP_ISR_STACKSIZE ++ ++.extern sched_active_thread ++.extern sched_num_threads ++.extern sched_context_switch_request ++.extern irq_interrupt_nesting + #endif + + .global port_uxInterruptNesting +@@ -30,6 +43,14 @@ + .global esp_hw_stack_guard_set_bounds + #endif /* CONFIG_ESP_SYSTEM_HW_STACK_GUARD */ + ++ .data ++ .align 16 ++ .global port_IntStack ++port_IntStack: ++ .space configISR_STACK_SIZE ++ .global port_IntStackTop ++port_IntStackTop: ++ + .section .text + + +@@ -707,7 +728,9 @@ no_switch_restored: + #else + /* Recover the stack of next task */ + lw a0, pxCurrentTCBs ++ beq a0, zero, rtos_enter_isr_stack + lw sp, 0(a0) ++rtos_enter_isr_stack: + #endif /* ( configNUM_CORES > 1 ) */ + + +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0019-heap-IRAM-is-not-used-as-heap.patch b/pkg/esp32_sdk/patches/0019-heap-IRAM-is-not-used-as-heap.patch new file mode 100644 index 0000000000..6a031d17c7 --- /dev/null +++ b/pkg/esp32_sdk/patches/0019-heap-IRAM-is-not-used-as-heap.patch @@ -0,0 +1,33 @@ +From 7517fc3cdf4913727dda1a1cad464927d24db7ec Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sun, 2 Mar 2025 10:20:04 +0100 +Subject: [PATCH 19/28] heap: IRAM is not used as heap + +RIOT only supports memory as a heap that allows byte access. IRAM only allows word-by-word access. +--- + components/heap/port/esp32/memory_layout.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/components/heap/port/esp32/memory_layout.c b/components/heap/port/esp32/memory_layout.c +index b35d8c1b3e..b6c6d59010 100644 +--- a/components/heap/port/esp32/memory_layout.c ++++ b/components/heap/port/esp32/memory_layout.c +@@ -95,6 +95,7 @@ const soc_memory_region_t soc_memory_regions[] = { + { 0x3FFF0000, 0x8000, SOC_MEMORY_TYPE_DIRAM, 0x400A8000,true}, //pool 7 <- can be used for MAC dump + { 0x3FFF8000, 0x4000, SOC_MEMORY_TYPE_DIRAM, 0x400A4000,true}, //pool 6 blk 1 <- can be used as trace memory + { 0x3FFFC000, 0x4000, SOC_MEMORY_TYPE_DIRAM, 0x400A0000,true}, //pool 6 blk 0 <- can be used as trace memory ++#if !defined(RIOT_VERSION) + { 0x40070000, 0x8000, SOC_MEMORY_TYPE_IRAM, 0, false}, //pool 0 + { 0x40078000, 0x8000, SOC_MEMORY_TYPE_IRAM, 0, false}, //pool 1 + { 0x40080000, 0x2000, SOC_MEMORY_TYPE_IRAM, 0, false}, //pool 2-5, mmu page 0 +@@ -113,6 +114,7 @@ const soc_memory_region_t soc_memory_regions[] = { + { 0x4009A000, 0x2000, SOC_MEMORY_TYPE_IRAM, 0, false}, //pool 2-5, mmu page 13 + { 0x4009C000, 0x2000, SOC_MEMORY_TYPE_IRAM, 0, false}, //pool 2-5, mmu page 14 + { 0x4009E000, 0x2000, SOC_MEMORY_TYPE_IRAM, 0, false}, //pool 2-5, mmu page 15 ++#endif + #ifdef CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP + { SOC_RTC_DRAM_LOW, 0x2000, SOC_MEMORY_TYPE_RTCRAM, 0, false}, //RTC Fast Memory + #endif +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0020-nvs_flash-extern-declaration-of-strlcpy.patch b/pkg/esp32_sdk/patches/0020-nvs_flash-extern-declaration-of-strlcpy.patch new file mode 100644 index 0000000000..00bca9bf39 --- /dev/null +++ b/pkg/esp32_sdk/patches/0020-nvs_flash-extern-declaration-of-strlcpy.patch @@ -0,0 +1,25 @@ +From b215127198549f5b1362479c72856fd9c4a75cdb Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sun, 2 Mar 2025 10:21:03 +0100 +Subject: [PATCH 20/28] nvs_flash: extern declaration of strlcpy + +--- + components/nvs_flash/src/nvs_storage.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/components/nvs_flash/src/nvs_storage.cpp b/components/nvs_flash/src/nvs_storage.cpp +index e5db0caefe..4db36cec91 100644 +--- a/components/nvs_flash/src/nvs_storage.cpp ++++ b/components/nvs_flash/src/nvs_storage.cpp +@@ -7,6 +7,8 @@ + #if __has_include() + // for strlcpy + #include ++#else ++extern size_t strlcpy(char *, const char *, size_t); + #endif + + #ifndef ESP_PLATFORM +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0021-newlib-include-the-newlibc-sys-uio.h.patch b/pkg/esp32_sdk/patches/0021-newlib-include-the-newlibc-sys-uio.h.patch new file mode 100644 index 0000000000..e9de8a8ef6 --- /dev/null +++ b/pkg/esp32_sdk/patches/0021-newlib-include-the-newlibc-sys-uio.h.patch @@ -0,0 +1,27 @@ +From f052e96b90746eaffcd9142341136201c080910a Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sun, 2 Mar 2025 10:22:41 +0100 +Subject: [PATCH 21/28] newlib: include the newlibc sys/uio.h + +--- + components/newlib/platform_include/sys/uio.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/components/newlib/platform_include/sys/uio.h b/components/newlib/platform_include/sys/uio.h +index 3ff3eba871..5a8652a797 100644 +--- a/components/newlib/platform_include/sys/uio.h ++++ b/components/newlib/platform_include/sys/uio.h +@@ -6,6 +6,10 @@ + + #pragma once + ++#ifdef RIOT_VERSION ++#include_next ++#endif /* RIOT_VERSION */ ++ + #include + #include + +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0022-esp_system-conditional-define-of-esp_get_free_heap_s.patch b/pkg/esp32_sdk/patches/0022-esp_system-conditional-define-of-esp_get_free_heap_s.patch new file mode 100644 index 0000000000..96a398d6ea --- /dev/null +++ b/pkg/esp32_sdk/patches/0022-esp_system-conditional-define-of-esp_get_free_heap_s.patch @@ -0,0 +1,34 @@ +From 9bb7d4820132d756a37aab8a4a4ea5228d6bf134 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sun, 2 Mar 2025 10:27:20 +0100 +Subject: [PATCH 22/28] esp_system: conditional define of + esp_get_free_heap_size + +Define the function `esp_get_free_heap_size` in ESP-IDF only if the heap implementation of ESP-IDF is used, that is if module `esp_idf_heap` is enabled. Otherwise, this function is defined in `cpu/esp_common/syscalls.c`. +--- + components/esp_system/port/esp_system_chip.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/components/esp_system/port/esp_system_chip.c b/components/esp_system/port/esp_system_chip.c +index 864c2e4c23..dff4a1bd83 100644 +--- a/components/esp_system/port/esp_system_chip.c ++++ b/components/esp_system/port/esp_system_chip.c +@@ -67,6 +67,7 @@ void IRAM_ATTR esp_restart_noos_dig(void) + } + #endif + ++#ifdef MODULE_ESP_IDF_HEAP + uint32_t esp_get_free_heap_size(void) + { + return heap_caps_get_free_size(MALLOC_CAP_DEFAULT); +@@ -76,6 +77,7 @@ uint32_t esp_get_free_internal_heap_size(void) + { + return heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL); + } ++#endif + + uint32_t esp_get_minimum_free_heap_size(void) + { +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0023-esp_system-conditional-define-of-esp_system_abort.patch b/pkg/esp32_sdk/patches/0023-esp_system-conditional-define-of-esp_system_abort.patch new file mode 100644 index 0000000000..3e15e9b9d4 --- /dev/null +++ b/pkg/esp32_sdk/patches/0023-esp_system-conditional-define-of-esp_system_abort.patch @@ -0,0 +1,26 @@ +From b7bf248a900dff96bd04f655ffeb120847ec2fb7 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sun, 2 Mar 2025 10:29:08 +0100 +Subject: [PATCH 23/28] esp_system: conditional define of esp_system_abort + +--- + components/esp_system/port/esp_system_chip.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/components/esp_system/port/esp_system_chip.c b/components/esp_system/port/esp_system_chip.c +index dff4a1bd83..ce7cb27efb 100644 +--- a/components/esp_system/port/esp_system_chip.c ++++ b/components/esp_system/port/esp_system_chip.c +@@ -89,7 +89,9 @@ const char *esp_get_idf_version(void) + return IDF_VER; + } + ++#ifndef RIOT_VERSION + void __attribute__((noreturn)) esp_system_abort(const char *details) + { + panic_abort(details); + } ++#endif +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0024-esp_common-use-_Static_assert-instead-of-static_asse.patch b/pkg/esp32_sdk/patches/0024-esp_common-use-_Static_assert-instead-of-static_asse.patch new file mode 100644 index 0000000000..21ac80ed03 --- /dev/null +++ b/pkg/esp32_sdk/patches/0024-esp_common-use-_Static_assert-instead-of-static_asse.patch @@ -0,0 +1,28 @@ +From b2454c0629b03bb244ea9781f294c4a96b7fd848 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sun, 2 Mar 2025 10:40:35 +0100 +Subject: [PATCH 24/28] esp_common: use _Static_assert instead of static_assert + +--- + components/esp_common/include/esp_assert.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/components/esp_common/include/esp_assert.h b/components/esp_common/include/esp_assert.h +index fa54fdbedb..e6a77ae046 100644 +--- a/components/esp_common/include/esp_assert.h ++++ b/components/esp_common/include/esp_assert.h +@@ -10,7 +10,11 @@ + + /* Since IDF v5.0, C17 standard is used, which supports both _Static_assert and static_assert syntax */ + /* Please do not use `_Static_assert` for C++ compatibility */ ++#ifndef RIOT_VERSION + #define ESP_STATIC_ASSERT static_assert ++#else ++#define ESP_STATIC_ASSERT _Static_assert ++#endif + + /* Assert at compile time if possible, runtime otherwise */ + #ifndef __cplusplus +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0025-esp_app_format-set-app_elf_sha256-in-esp_app_desc.patch b/pkg/esp32_sdk/patches/0025-esp_app_format-set-app_elf_sha256-in-esp_app_desc.patch new file mode 100644 index 0000000000..f5c9204e0c --- /dev/null +++ b/pkg/esp32_sdk/patches/0025-esp_app_format-set-app_elf_sha256-in-esp_app_desc.patch @@ -0,0 +1,25 @@ +From d203d26a1c478fb1cec92ed569fec73a89299bd8 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sun, 2 Mar 2025 10:42:40 +0100 +Subject: [PATCH 25/28] esp_app_format: set app_elf_sha256 in esp_app_desc + +--- + components/esp_app_format/esp_app_desc.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/components/esp_app_format/esp_app_desc.c b/components/esp_app_format/esp_app_desc.c +index 302250b179..c44b32648b 100644 +--- a/components/esp_app_format/esp_app_desc.c ++++ b/components/esp_app_format/esp_app_desc.c +@@ -42,6 +42,8 @@ const __attribute__((weak)) __attribute__((section(".rodata_desc"))) esp_app_de + // On Linux we just initialize the hash to some known value for testing + #if CONFIG_IDF_TARGET_LINUX + .app_elf_sha256 = { 0xDE, 0xAD, 0xBE, 0xEF, 0x47, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B}, ++#else ++ .app_elf_sha256 = { }, + #endif + + #ifdef CONFIG_BOOTLOADER_APP_SECURE_VERSION +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0026-esp_hw_support-rename-rtc_init.patch b/pkg/esp32_sdk/patches/0026-esp_hw_support-rename-rtc_init.patch new file mode 100644 index 0000000000..8dbbbcfc7b --- /dev/null +++ b/pkg/esp32_sdk/patches/0026-esp_hw_support-rename-rtc_init.patch @@ -0,0 +1,222 @@ +From a9b8142108e1d9aa88c7d5b2bc968fbe9a0e4433 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sat, 1 Mar 2025 17:17:13 +0100 +Subject: [PATCH 26/28] esp_hw_support: rename rtc_init + +Rename `rtc_init` to `rtc_init_module` due to name conflicts with RIOT `periph/rtc` module. +--- + components/esp_hw_support/port/esp32/include/soc/rtc.h | 2 +- + components/esp_hw_support/port/esp32/rtc_init.c | 2 +- + components/esp_hw_support/port/esp32c2/include/soc/rtc.h | 2 +- + components/esp_hw_support/port/esp32c2/rtc_init.c | 2 +- + components/esp_hw_support/port/esp32c3/include/soc/rtc.h | 2 +- + components/esp_hw_support/port/esp32c3/rtc_init.c | 2 +- + components/esp_hw_support/port/esp32s2/include/soc/rtc.h | 2 +- + components/esp_hw_support/port/esp32s2/rtc_init.c | 2 +- + components/esp_hw_support/port/esp32s3/include/soc/rtc.h | 2 +- + components/esp_hw_support/port/esp32s3/rtc_init.c | 2 +- + components/esp_system/port/soc/esp32/clk.c | 2 +- + components/esp_system/port/soc/esp32c2/clk.c | 2 +- + components/esp_system/port/soc/esp32c3/clk.c | 2 +- + components/esp_system/port/soc/esp32s2/clk.c | 2 +- + components/esp_system/port/soc/esp32s3/clk.c | 2 +- + 15 files changed, 15 insertions(+), 15 deletions(-) + +diff --git a/components/esp_hw_support/port/esp32/include/soc/rtc.h b/components/esp_hw_support/port/esp32/include/soc/rtc.h +index 22f7cfe157..1f0f9f2e77 100644 +--- a/components/esp_hw_support/port/esp32/include/soc/rtc.h ++++ b/components/esp_hw_support/port/esp32/include/soc/rtc.h +@@ -666,7 +666,7 @@ typedef struct rtc_config_s { + * Initialize RTC clock and power control related functions + * @param cfg configuration options as rtc_config_t + */ +-void rtc_init(rtc_config_t cfg); ++void rtc_init_module(rtc_config_t cfg); + + #define RTC_VDDSDIO_TIEH_1_8V 0 //!< TIEH field value for 1.8V VDDSDIO + #define RTC_VDDSDIO_TIEH_3_3V 1 //!< TIEH field value for 3.3V VDDSDIO +diff --git a/components/esp_hw_support/port/esp32/rtc_init.c b/components/esp_hw_support/port/esp32/rtc_init.c +index 087824c279..9eecbef376 100644 +--- a/components/esp_hw_support/port/esp32/rtc_init.c ++++ b/components/esp_hw_support/port/esp32/rtc_init.c +@@ -17,7 +17,7 @@ + #endif + + +-void rtc_init(rtc_config_t cfg) ++void rtc_init_module(rtc_config_t cfg) + { + /** + * When run rtc_init, it maybe deep sleep reset. Since we power down modem in deep sleep, after wakeup +diff --git a/components/esp_hw_support/port/esp32c2/include/soc/rtc.h b/components/esp_hw_support/port/esp32c2/include/soc/rtc.h +index 9f8d412f59..3d2ae50f99 100644 +--- a/components/esp_hw_support/port/esp32c2/include/soc/rtc.h ++++ b/components/esp_hw_support/port/esp32c2/include/soc/rtc.h +@@ -690,7 +690,7 @@ typedef struct { + * Initialize RTC clock and power control related functions + * @param cfg configuration options as rtc_config_t + */ +-void rtc_init(rtc_config_t cfg); ++void rtc_init_module(rtc_config_t cfg); + + // -------------------------- CLOCK TREE DEFS ALIAS ---------------------------- + // **WARNING**: The following are only for backwards compatibility. +diff --git a/components/esp_hw_support/port/esp32c2/rtc_init.c b/components/esp_hw_support/port/esp32c2/rtc_init.c +index abb5370c67..32549d5376 100644 +--- a/components/esp_hw_support/port/esp32c2/rtc_init.c ++++ b/components/esp_hw_support/port/esp32c2/rtc_init.c +@@ -29,7 +29,7 @@ static void set_ocode_by_efuse(int ocode_scheme_ver); + static void calibrate_ocode(void); + static void set_rtc_dig_dbias(void); + +-void rtc_init(rtc_config_t cfg) ++void rtc_init_module(rtc_config_t cfg) + { + REGI2C_WRITE_MASK(I2C_DIG_REG, I2C_DIG_REG_XPD_DIG_REG, 0); + REGI2C_WRITE_MASK(I2C_DIG_REG, I2C_DIG_REG_XPD_RTC_REG, 0); +diff --git a/components/esp_hw_support/port/esp32c3/include/soc/rtc.h b/components/esp_hw_support/port/esp32c3/include/soc/rtc.h +index 58a26dd41e..bae3de4931 100644 +--- a/components/esp_hw_support/port/esp32c3/include/soc/rtc.h ++++ b/components/esp_hw_support/port/esp32c3/include/soc/rtc.h +@@ -759,7 +759,7 @@ typedef struct { + * Initialize RTC clock and power control related functions + * @param cfg configuration options as rtc_config_t + */ +-void rtc_init(rtc_config_t cfg); ++void rtc_init_module(rtc_config_t cfg); + + // -------------------------- CLOCK TREE DEFS ALIAS ---------------------------- + // **WARNING**: The following are only for backwards compatibility. +diff --git a/components/esp_hw_support/port/esp32c3/rtc_init.c b/components/esp_hw_support/port/esp32c3/rtc_init.c +index c7a1eb55f0..ed62540c6e 100644 +--- a/components/esp_hw_support/port/esp32c3/rtc_init.c ++++ b/components/esp_hw_support/port/esp32c3/rtc_init.c +@@ -29,7 +29,7 @@ static void set_ocode_by_efuse(int calib_version); + static void calibrate_ocode(void); + static void set_rtc_dig_dbias(void); + +-void rtc_init(rtc_config_t cfg) ++void rtc_init_module(rtc_config_t cfg) + { + /** + * When run rtc_init, it maybe deep sleep reset. Since we power down modem in deep sleep, after wakeup +diff --git a/components/esp_hw_support/port/esp32s2/include/soc/rtc.h b/components/esp_hw_support/port/esp32s2/include/soc/rtc.h +index 5a3dda4844..109e956af2 100644 +--- a/components/esp_hw_support/port/esp32s2/include/soc/rtc.h ++++ b/components/esp_hw_support/port/esp32s2/include/soc/rtc.h +@@ -799,7 +799,7 @@ typedef struct { + * Initialize RTC clock and power control related functions + * @param cfg configuration options as rtc_config_t + */ +-void rtc_init(rtc_config_t cfg); ++void rtc_init_module(rtc_config_t cfg); + + /** + * Structure describing vddsdio configuration +diff --git a/components/esp_hw_support/port/esp32s2/rtc_init.c b/components/esp_hw_support/port/esp32s2/rtc_init.c +index 549cdffd43..0f1111c758 100644 +--- a/components/esp_hw_support/port/esp32s2/rtc_init.c ++++ b/components/esp_hw_support/port/esp32s2/rtc_init.c +@@ -26,7 +26,7 @@ __attribute__((unused)) static const char *TAG = "rtc_init"; + static void set_ocode_by_efuse(int calib_version); + static void calibrate_ocode(void); + +-void rtc_init(rtc_config_t cfg) ++void rtc_init_module(rtc_config_t cfg) + { + /** + * When run rtc_init, it maybe deep sleep reset. Since we power down modem in deep sleep, after wakeup +diff --git a/components/esp_hw_support/port/esp32s3/include/soc/rtc.h b/components/esp_hw_support/port/esp32s3/include/soc/rtc.h +index 27a4845f5f..f4c37716e5 100644 +--- a/components/esp_hw_support/port/esp32s3/include/soc/rtc.h ++++ b/components/esp_hw_support/port/esp32s3/include/soc/rtc.h +@@ -786,7 +786,7 @@ typedef struct { + * Initialize RTC clock and power control related functions + * @param cfg configuration options as rtc_config_t + */ +-void rtc_init(rtc_config_t cfg); ++void rtc_init_module(rtc_config_t cfg); + + /** + * Structure describing vddsdio configuration +diff --git a/components/esp_hw_support/port/esp32s3/rtc_init.c b/components/esp_hw_support/port/esp32s3/rtc_init.c +index bbdf99ee89..3e28058c87 100644 +--- a/components/esp_hw_support/port/esp32s3/rtc_init.c ++++ b/components/esp_hw_support/port/esp32s3/rtc_init.c +@@ -43,7 +43,7 @@ uint32_t g_rtc_dbias_pvt_240m = 28; + uint32_t g_dig_dbias_pvt_non_240m = 27; + uint32_t g_rtc_dbias_pvt_non_240m = 27; + +-void rtc_init(rtc_config_t cfg) ++void rtc_init_module(rtc_config_t cfg) + { + /** + * When run rtc_init, it maybe deep sleep reset. Since we power down modem in deep sleep, after wakeup +diff --git a/components/esp_system/port/soc/esp32/clk.c b/components/esp_system/port/soc/esp32/clk.c +index 88f72ff947..197a17b5e1 100644 +--- a/components/esp_system/port/soc/esp32/clk.c ++++ b/components/esp_system/port/soc/esp32/clk.c +@@ -109,7 +109,7 @@ static void select_rtc_slow_clk(slow_clk_sel_t slow_clk) + void esp_rtc_init(void) + { + rtc_config_t cfg = RTC_CONFIG_DEFAULT(); +- rtc_init(cfg); ++ rtc_init_module(cfg); + } + + __attribute__((weak)) void esp_clk_init(void) +diff --git a/components/esp_system/port/soc/esp32c2/clk.c b/components/esp_system/port/soc/esp32c2/clk.c +index 6cc267ea6c..5c8fc6c2f4 100644 +--- a/components/esp_system/port/soc/esp32c2/clk.c ++++ b/components/esp_system/port/soc/esp32c2/clk.c +@@ -70,7 +70,7 @@ void esp_rtc_init(void) + if (rst_reas == RESET_REASON_CHIP_POWER_ON) { + cfg.cali_ocode = 1; + } +- rtc_init(cfg); ++ rtc_init_module(cfg); + #endif + } + +diff --git a/components/esp_system/port/soc/esp32c3/clk.c b/components/esp_system/port/soc/esp32c3/clk.c +index ecb5d08385..bc4687bbd6 100644 +--- a/components/esp_system/port/soc/esp32c3/clk.c ++++ b/components/esp_system/port/soc/esp32c3/clk.c +@@ -69,7 +69,7 @@ void esp_rtc_init(void) + ) { + cfg.cali_ocode = 1; + } +- rtc_init(cfg); ++ rtc_init_module(cfg); + } + + __attribute__((weak)) void esp_clk_init(void) +diff --git a/components/esp_system/port/soc/esp32s2/clk.c b/components/esp_system/port/soc/esp32s2/clk.c +index 2b786b62f9..26d86af6c3 100644 +--- a/components/esp_system/port/soc/esp32s2/clk.c ++++ b/components/esp_system/port/soc/esp32s2/clk.c +@@ -72,7 +72,7 @@ void esp_rtc_init(void) + esp_rom_output_tx_wait_idle(CONFIG_ESP_CONSOLE_ROM_SERIAL_PORT_NUM); + } + } +- rtc_init(cfg); ++ rtc_init_module(cfg); + } + + __attribute__((weak)) void esp_clk_init(void) +diff --git a/components/esp_system/port/soc/esp32s3/clk.c b/components/esp_system/port/soc/esp32s3/clk.c +index fac148fb41..fe6f9bee6d 100644 +--- a/components/esp_system/port/soc/esp32s3/clk.c ++++ b/components/esp_system/port/soc/esp32s3/clk.c +@@ -71,7 +71,7 @@ void esp_rtc_init(void) + if (rst_reas == RESET_REASON_CHIP_POWER_ON) { + cfg.cali_ocode = 1; + } +- rtc_init(cfg); ++ rtc_init_module(cfg); + } + + __attribute__((weak)) void esp_clk_init(void) +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0027-wpa_supplicant-fix-include-to-find-correct-base64.h.patch b/pkg/esp32_sdk/patches/0027-wpa_supplicant-fix-include-to-find-correct-base64.h.patch new file mode 100644 index 0000000000..60a8997897 --- /dev/null +++ b/pkg/esp32_sdk/patches/0027-wpa_supplicant-fix-include-to-find-correct-base64.h.patch @@ -0,0 +1,25 @@ +From d52016bf6f16eac0c3a4b895707368ee8a3babea Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sun, 2 Mar 2025 17:15:03 +0100 +Subject: [PATCH 27/28] wpa_supplicant: fix include to find correct base64.h + +--- + components/wpa_supplicant/src/tls/tlsv1_cred.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/components/wpa_supplicant/src/tls/tlsv1_cred.c b/components/wpa_supplicant/src/tls/tlsv1_cred.c +index 0cee09749d..4d5d9d0b29 100644 +--- a/components/wpa_supplicant/src/tls/tlsv1_cred.c ++++ b/components/wpa_supplicant/src/tls/tlsv1_cred.c +@@ -9,7 +9,7 @@ + #include "includes.h" + + #include "common.h" +-#include "base64.h" ++#include "utils/base64.h" + #include "crypto/crypto.h" + #include "crypto/sha1.h" + #include "pkcs5.h" +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0028-heap-add-prefix-esp_-to-tlsf-to-avoid-conflicts-with.patch b/pkg/esp32_sdk/patches/0028-heap-add-prefix-esp_-to-tlsf-to-avoid-conflicts-with.patch new file mode 100644 index 0000000000..6bfac7675f --- /dev/null +++ b/pkg/esp32_sdk/patches/0028-heap-add-prefix-esp_-to-tlsf-to-avoid-conflicts-with.patch @@ -0,0 +1,190 @@ +From 6a80d252810469dd3c6e0bbd4f27de02c90cb12e Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Tue, 11 Mar 2025 02:01:29 +0100 +Subject: [PATCH 28/28] heap: add prefix esp_ to tlsf to avoid conflicts with + tlsf package + +--- + components/heap/multi_heap.c | 58 ++++++++++++++++++------------------ + 1 file changed, 29 insertions(+), 29 deletions(-) + +diff --git a/components/heap/multi_heap.c b/components/heap/multi_heap.c +index d47a6c0a3a..78fc411b74 100644 +--- a/components/heap/multi_heap.c ++++ b/components/heap/multi_heap.c +@@ -15,8 +15,8 @@ + #include "multi_heap.h" + #include "multi_heap_internal.h" + +-#include "tlsf.h" +-#include "tlsf_block_functions.h" ++#include "esp_tlsf.h" ++#include "esp_tlsf_block_functions.h" + + /* Note: Keep platform-specific parts in this header, this source + file should depend on libc only */ +@@ -110,7 +110,7 @@ void multi_heap_in_rom_init(void) + /* Check a block is valid for this heap. Used to verify parameters. */ + __attribute__((noinline)) NOCLONE_ATTR static void assert_valid_block(const heap_t *heap, const multi_heap_block_handle_t block) + { +- pool_t pool = tlsf_get_pool(heap->heap_data); ++ pool_t pool = esp_tlsf_get_pool(heap->heap_data); + void *ptr = block_to_ptr(block); + + MULTI_HEAP_ASSERT((ptr >= pool) && +@@ -125,7 +125,7 @@ void *multi_heap_get_block_address_impl(multi_heap_block_handle_t block) + + size_t multi_heap_get_allocated_size_impl(multi_heap_handle_t heap, void *p) + { +- return tlsf_block_size(p); ++ return esp_tlsf_block_size(p); + } + + multi_heap_handle_t multi_heap_register_impl(void *start_ptr, size_t size) +@@ -142,13 +142,13 @@ multi_heap_handle_t multi_heap_register_impl(void *start_ptr, size_t size) + /* Do not specify any maximum size for the allocations so that the default configuration is used */ + const size_t max_bytes = 0; + +- result->heap_data = tlsf_create_with_pool(start_ptr + sizeof(heap_t), size, max_bytes); ++ result->heap_data = esp_tlsf_create_with_pool(start_ptr + sizeof(heap_t), size, max_bytes); + if(!result->heap_data) { + return NULL; + } + + result->lock = NULL; +- result->free_bytes = size - tlsf_size(result->heap_data); ++ result->free_bytes = size - esp_tlsf_size(result->heap_data); + result->pool_size = size; + result->minimum_free_bytes = result->free_bytes; + return result; +@@ -172,7 +172,7 @@ void multi_heap_internal_unlock(multi_heap_handle_t heap) + multi_heap_block_handle_t multi_heap_get_first_block(multi_heap_handle_t heap) + { + assert(heap != NULL); +- pool_t pool = tlsf_get_pool(heap->heap_data); ++ pool_t pool = esp_tlsf_get_pool(heap->heap_data); + multi_heap_block_handle_t block = offset_to_block(pool, -(int)block_header_overhead); + + return block; +@@ -206,10 +206,10 @@ void *multi_heap_malloc_impl(multi_heap_handle_t heap, size_t size) + + + multi_heap_internal_lock(heap); +- void *result = tlsf_malloc(heap->heap_data, size); ++ void *result = esp_tlsf_malloc(heap->heap_data, size); + if(result) { +- heap->free_bytes -= tlsf_block_size(result); +- heap->free_bytes -= tlsf_alloc_overhead(); ++ heap->free_bytes -= esp_tlsf_block_size(result); ++ heap->free_bytes -= esp_tlsf_alloc_overhead(); + if (heap->free_bytes < heap->minimum_free_bytes) { + heap->minimum_free_bytes = heap->free_bytes; + } +@@ -228,9 +228,9 @@ void multi_heap_free_impl(multi_heap_handle_t heap, void *p) + assert_valid_block(heap, block_from_ptr(p)); + + multi_heap_internal_lock(heap); +- heap->free_bytes += tlsf_block_size(p); +- heap->free_bytes += tlsf_alloc_overhead(); +- tlsf_free(heap->heap_data, p); ++ heap->free_bytes += esp_tlsf_block_size(p); ++ heap->free_bytes += esp_tlsf_alloc_overhead(); ++ esp_tlsf_free(heap->heap_data, p); + multi_heap_internal_unlock(heap); + } + +@@ -249,13 +249,13 @@ void *multi_heap_realloc_impl(multi_heap_handle_t heap, void *p, size_t size) + } + + multi_heap_internal_lock(heap); +- size_t previous_block_size = tlsf_block_size(p); +- void *result = tlsf_realloc(heap->heap_data, p, size); ++ size_t previous_block_size = esp_tlsf_block_size(p); ++ void *result = esp_tlsf_realloc(heap->heap_data, p, size); + if(result) { +- /* No need to subtract the tlsf_alloc_overhead() as it has already ++ /* No need to subtract the esp_tlsf_alloc_overhead() as it has already + * been subtracted when allocating the block at first with malloc */ + heap->free_bytes += previous_block_size; +- heap->free_bytes -= tlsf_block_size(result); ++ heap->free_bytes -= esp_tlsf_block_size(result); + if (heap->free_bytes < heap->minimum_free_bytes) { + heap->minimum_free_bytes = heap->free_bytes; + } +@@ -282,10 +282,10 @@ void *multi_heap_aligned_alloc_impl_offs(multi_heap_handle_t heap, size_t size, + } + + multi_heap_internal_lock(heap); +- void *result = tlsf_memalign_offs(heap->heap_data, alignment, size, offset); ++ void *result = esp_tlsf_memalign_offs(heap->heap_data, alignment, size, offset); + if(result) { +- heap->free_bytes -= tlsf_block_size(result); +- heap->free_bytes -= tlsf_alloc_overhead(); ++ heap->free_bytes -= esp_tlsf_block_size(result); ++ heap->free_bytes -= esp_tlsf_alloc_overhead(); + if(heap->free_bytes < heap->minimum_free_bytes) { + heap->minimum_free_bytes = heap->free_bytes; + } +@@ -322,7 +322,7 @@ static bool g_print_errors = false; + * + * @return bool: true if the the memory is not corrupted, false if the memory if corrupted. + */ +-bool tlsf_check_hook(void *start, size_t size, bool is_free) ++bool esp_tlsf_check_hook(void *start, size_t size, bool is_free) + { + return multi_heap_internal_check_block_poisoning(start, size, is_free, g_print_errors); + } +@@ -341,11 +341,11 @@ bool multi_heap_check(multi_heap_handle_t heap, bool print_errors) + (void) print_errors; + #endif + +- if(tlsf_check(heap->heap_data)) { ++ if(esp_tlsf_check(heap->heap_data)) { + valid = false; + } + +- if(tlsf_check_pool(tlsf_get_pool(heap->heap_data))) { ++ if(esp_tlsf_check_pool(esp_tlsf_get_pool(heap->heap_data))) { + valid = false; + } + +@@ -366,7 +366,7 @@ void multi_heap_dump(multi_heap_handle_t heap) + + multi_heap_internal_lock(heap); + MULTI_HEAP_STDERR_PRINTF("Showing data for heap: %p \n", (void *)heap); +- tlsf_walk_pool(tlsf_get_pool(heap->heap_data), multi_heap_dump_tlsf, NULL); ++ esp_tlsf_walk_pool(esp_tlsf_get_pool(heap->heap_data), multi_heap_dump_tlsf, NULL); + multi_heap_internal_unlock(heap); + } + +@@ -417,14 +417,14 @@ void multi_heap_get_info_impl(multi_heap_handle_t heap, multi_heap_info_t *info) + } + + multi_heap_internal_lock(heap); +- tlsf_walk_pool(tlsf_get_pool(heap->heap_data), multi_heap_get_info_tlsf, info); ++ esp_tlsf_walk_pool(esp_tlsf_get_pool(heap->heap_data), multi_heap_get_info_tlsf, info); + /* TLSF has an overhead per block. Calculate the total amount of overhead, it shall not be + * part of the allocated bytes */ +- overhead = info->allocated_blocks * tlsf_alloc_overhead(); +- info->total_allocated_bytes = (heap->pool_size - tlsf_size(heap->heap_data)) - heap->free_bytes - overhead; ++ overhead = info->allocated_blocks * esp_tlsf_alloc_overhead(); ++ info->total_allocated_bytes = (heap->pool_size - esp_tlsf_size(heap->heap_data)) - heap->free_bytes - overhead; + info->minimum_free_bytes = heap->minimum_free_bytes; + info->total_free_bytes = heap->free_bytes; +- info->largest_free_block = tlsf_fit_size(heap->heap_data, info->largest_free_block); ++ info->largest_free_block = esp_tlsf_fit_size(heap->heap_data, info->largest_free_block); + multi_heap_internal_unlock(heap); + } + +@@ -433,7 +433,7 @@ void multi_heap_walk(multi_heap_handle_t heap, multi_heap_walker_cb_t walker_fun + assert(heap != NULL); + + multi_heap_internal_lock(heap); +- tlsf_walk_pool(tlsf_get_pool(heap->heap_data), walker_func, user_data); ++ esp_tlsf_walk_pool(esp_tlsf_get_pool(heap->heap_data), walker_func, user_data); + multi_heap_internal_unlock(heap); + } + +-- +2.34.1 + diff --git a/pkg/esp32_sdk/patches/0030-newlib-remove-semaphore.h-to-avoid-conflicts.patch b/pkg/esp32_sdk/patches/0030-newlib-remove-semaphore.h-to-avoid-conflicts.patch new file mode 100644 index 0000000000..4953390610 --- /dev/null +++ b/pkg/esp32_sdk/patches/0030-newlib-remove-semaphore.h-to-avoid-conflicts.patch @@ -0,0 +1,92 @@ +From 415abab5769271f7d68b6c0daae68c54fe411734 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Thu, 10 Apr 2025 00:29:40 +0200 +Subject: [PATCH 30/30] newlib: remove semaphore.h to avoid conflicts + +--- + .../newlib/platform_include/semaphore.h | 73 ------------------- + 1 file changed, 73 deletions(-) + delete mode 100644 components/newlib/platform_include/semaphore.h + +diff --git a/components/newlib/platform_include/semaphore.h b/components/newlib/platform_include/semaphore.h +deleted file mode 100644 +index 31d47d2072..0000000000 +--- a/components/newlib/platform_include/semaphore.h ++++ /dev/null +@@ -1,73 +0,0 @@ +-/* +- * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD +- * +- * SPDX-License-Identifier: Apache-2.0 +- */ +- +-#pragma once +- +-#include +- +-#ifdef __cplusplus +-extern "C" { +-#endif +- +-typedef unsigned int sem_t; +- +-/** +- * This is the maximum value to which any POSIX semaphore can count on ESP chips. +- */ +-#define SEM_VALUE_MAX 0x7FFF +- +-/** +- * This is a POSIX function, please refer to the POSIX specification for a detailed description. +- * +- * Must NOT be called if threads are still blocked on semaphore! +- */ +-int sem_destroy(sem_t *sem); +- +-/** +- * This is a POSIX function, please refer to the POSIX specification for a detailed description. +- * +- * Note that on ESP chips, pshared is ignored. Semaphores can always be shared between FreeRTOS tasks. +- */ +-int sem_init(sem_t *sem, int pshared, unsigned value); +- +-/** +- * This is a POSIX function, please refer to the POSIX specification for a detailed description. +- * +- * Note that, unlike specified in POSIX, this implementation returns -1 and sets errno to +- * EAGAIN if the semaphore can not be unlocked (posted) due to its value being SEM_VALUE_MAX. +- */ +-int sem_post(sem_t *sem); +- +-/** +- * This is a POSIX function, please refer to the POSIX specification for a detailed description. +- * +- * Note the following three deviations/issues originating from the underlying FreeRTOS implementation: +- * * The time value passed by abstime will be rounded up to the next FreeRTOS tick. +- * * The actual timeout will happen after the tick the time was rounded to +- * and before the following tick. +- * * It is possible, though unlikely, that the task is preempted directly after the timeout calculation, +- * delaying timeout of the following blocking operating system call by the duration of the preemption. +- */ +-int sem_timedwait(sem_t *semaphore, const struct timespec *abstime); +- +-/** +- * This is a POSIX function, please refer to the POSIX specification for a detailed description. +- */ +-int sem_trywait(sem_t *sem); +- +-/** +- * This is a POSIX function, please refer to the POSIX specification for a detailed description. +- */ +-int sem_wait(sem_t *sem); +- +-/** +- * This is a POSIX function, please refer to the POSIX specification for a detailed description. +- */ +-int sem_getvalue(sem_t *sem, int *sval); +- +-#ifdef __cplusplus +-} +-#endif +-- +2.34.1 +