diff --git a/components/wpa_supplicant/CMakeLists.txt b/components/wpa_supplicant/CMakeLists.txt index e80fcdabee8..6028a2b9238 100644 --- a/components/wpa_supplicant/CMakeLists.txt +++ b/components/wpa_supplicant/CMakeLists.txt @@ -260,11 +260,6 @@ idf_component_register(SRCS "${srcs}" "${esp_srcs}" "${tls_src}" "${roaming_src} LDFRAGMENTS ${linker_fragments} PRIV_REQUIRES mbedtls esp_timer esp_wifi) -target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-strict-aliasing -Wno-write-strings -Werror) -if(CONFIG_COMPILER_STATIC_ANALYZER AND CMAKE_C_COMPILER_ID STREQUAL "GNU") # TODO IDF-10090 - target_compile_options(${COMPONENT_LIB} PRIVATE "-fno-analyzer") -endif() - target_compile_definitions(${COMPONENT_LIB} PRIVATE __ets__ ESP_SUPPLICANT @@ -368,5 +363,3 @@ if(CONFIG_ESP_WIFI_NAN_USD_ENABLE) target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_NAN_USD) endif() set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 3) - -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-bignum.c b/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-bignum.c index cdda28e30ee..120883257d5 100644 --- a/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-bignum.c +++ b/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-bignum.c @@ -125,7 +125,7 @@ static void p256_words_sub(u32 *a, const u32 *b) static void p256_words_swap(u32 *a, u32 *b) { - u32 tmp[P256_WORDS]; + u32 tmp[P256_WORDS] = {0}; os_memcpy(tmp, a, sizeof(tmp)); os_memcpy(a, b, sizeof(tmp)); @@ -134,7 +134,7 @@ static void p256_words_swap(u32 *a, u32 *b) static void p256_words_mod(u32 *a, const u32 *n) { - u32 tmp[P256_WORDS]; + u32 tmp[P256_WORDS] = {0}; while (p256_words_cmp(a, n) >= 0) { size_t a_bits = p256_words_bitlen(a); @@ -155,10 +155,10 @@ static int crypto_bignum_mulmod_secp256r1(const mbedtls_mpi *a, const mbedtls_mpi *mod, mbedtls_mpi *out) { - u32 a_words[P256_WORDS]; - u32 b_words[P256_WORDS]; - u32 b_mont[P256_WORDS]; - u32 result[P256_WORDS]; + u32 a_words[P256_WORDS] = {0}; + u32 b_words[P256_WORDS] = {0}; + u32 b_mont[P256_WORDS] = {0}; + u32 result[P256_WORDS] = {0}; if (!mpi_is_secp256r1_prime(mod) || p256_words_from_mpi_reduced(a, a_words) != 0 || @@ -175,8 +175,8 @@ static int crypto_bignum_mulmod_secp256r1(const mbedtls_mpi *a, static int crypto_bignum_legendre_secp256r1(const mbedtls_mpi *a, const mbedtls_mpi *p) { - u32 A[P256_WORDS]; - u32 N[P256_WORDS]; + u32 A[P256_WORDS] = {0}; + u32 N[P256_WORDS] = {0}; unsigned int n_mod8; unsigned int a_mod4; unsigned int n_mod4; diff --git a/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-ec.c b/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-ec.c index 19370713c87..9f8362aa126 100644 --- a/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-ec.c +++ b/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-ec.c @@ -293,7 +293,7 @@ static int crypto_ec_key_ensure_public_key_cached(crypto_ec_key_wrapper_t *wrapp status = psa_export_public_key(wrapper->key_id, pub_key_buf, sizeof(pub_key_buf), &pub_key_len); if (status != PSA_SUCCESS) { - wpa_printf(MSG_ERROR, "psa_export_public_key failed with %d", status); + wpa_printf(MSG_ERROR, "psa_export_public_key failed with %d", (int) status); return -1; } @@ -564,7 +564,7 @@ static u32 p256_fast_words_add_carry(u32 *z, const u32 *x, const u32 *y) static void p256_fast_words_add_mod(u32 *z, const u32 *x, const u32 *y) { - u32 reduced[P256_WORDS]; + u32 reduced[P256_WORDS] = {0}; u32 carry = p256_fast_words_add_carry(z, x, y); u32 borrow = p256_words_sub_borrow(reduced, z, p256_p_le); u32 use_sub = carry | (1U - borrow); @@ -574,7 +574,7 @@ static void p256_fast_words_add_mod(u32 *z, const u32 *x, const u32 *y) static void p256_fast_words_sub_mod(u32 *z, const u32 *x, const u32 *y) { - u32 tmp[P256_WORDS]; + u32 tmp[P256_WORDS] = {0}; if (p256_words_sub_borrow(z, x, y) != 0) { (void) p256_fast_words_add_carry(tmp, z, p256_p_le); @@ -597,7 +597,7 @@ static void p256_words_rshift1_with_carry(u32 *z, u32 carry) static void p256_fast_half_mod(u32 *z) { if (z[0] & 1U) { - u32 tmp[P256_WORDS]; + u32 tmp[P256_WORDS] = {0}; u32 carry = p256_fast_words_add_carry(tmp, z, p256_p_le); p256_words_rshift1_with_carry(tmp, carry); @@ -610,7 +610,7 @@ static void p256_fast_half_mod(u32 *z) static int p256_fast_inv_std(u32 out[P256_WORDS], const u32 in[P256_WORDS]) { - u32 u[P256_WORDS], v[P256_WORDS], r[P256_WORDS], s[P256_WORDS]; + u32 u[P256_WORDS] = {0}, v[P256_WORDS] = {0}, r[P256_WORDS] = {0}, s[P256_WORDS] = {0}; if (p256_words_is_zero(in)) { return -1; @@ -717,7 +717,7 @@ static void p256_fast_dbl(u32 out[P256_WORDS], const u32 in[P256_WORDS]) static void p256_fast_triple(u32 out[P256_WORDS], const u32 in[P256_WORDS]) { - u32 tmp[P256_WORDS]; + u32 tmp[P256_WORDS] = {0}; p256_fast_dbl(tmp, in); p256_fast_words_add_mod(out, tmp, in); @@ -725,7 +725,7 @@ static void p256_fast_triple(u32 out[P256_WORDS], const u32 in[P256_WORDS]) static void p256_fast_eight(u32 out[P256_WORDS], const u32 in[P256_WORDS]) { - u32 tmp[P256_WORDS]; + u32 tmp[P256_WORDS] = {0}; p256_fast_dbl(tmp, in); p256_fast_dbl(tmp, tmp); @@ -767,10 +767,10 @@ static void p256_fast_point_from_affine(p256_fast_jac_point *p, static void p256_fast_point_double(p256_fast_jac_point *r) { - u32 z2[P256_WORDS], y2[P256_WORDS], y4[P256_WORDS]; - u32 s[P256_WORDS], m[P256_WORDS], x3[P256_WORDS]; - u32 y3[P256_WORDS], z3[P256_WORDS], tmp1[P256_WORDS]; - u32 tmp2[P256_WORDS]; + u32 z2[P256_WORDS] = {0}, y2[P256_WORDS] = {0}, y4[P256_WORDS] = {0}; + u32 s[P256_WORDS] = {0}, m[P256_WORDS] = {0}, x3[P256_WORDS] = {0}; + u32 y3[P256_WORDS] = {0}, z3[P256_WORDS] = {0}, tmp1[P256_WORDS] = {0}; + u32 tmp2[P256_WORDS] = {0}; if (p256_words_is_zero(r->Z) || p256_words_is_zero(r->Y)) { p256_fast_point_set_zero(r); @@ -812,11 +812,11 @@ static void p256_fast_point_add_mixed(p256_fast_jac_point *r, const u32 qy[P256_WORDS], const u32 one_mont[P256_WORDS]) { - u32 z1z1[P256_WORDS], z1z1z1[P256_WORDS]; - u32 u2[P256_WORDS], s2[P256_WORDS], h[P256_WORDS]; - u32 rr[P256_WORDS], hh[P256_WORDS], hhh[P256_WORDS]; - u32 v[P256_WORDS], x3[P256_WORDS], y3[P256_WORDS]; - u32 z3[P256_WORDS], tmp[P256_WORDS], y1[P256_WORDS]; + u32 z1z1[P256_WORDS] = {0}, z1z1z1[P256_WORDS] = {0}; + u32 u2[P256_WORDS] = {0}, s2[P256_WORDS] = {0}, h[P256_WORDS] = {0}; + u32 rr[P256_WORDS] = {0}, hh[P256_WORDS] = {0}, hhh[P256_WORDS] = {0}; + u32 v[P256_WORDS] = {0}, x3[P256_WORDS] = {0}, y3[P256_WORDS] = {0}; + u32 z3[P256_WORDS] = {0}, tmp[P256_WORDS] = {0}, y1[P256_WORDS] = {0}; if (p256_words_is_zero(r->Z)) { p256_fast_point_from_affine(r, qx, qy, one_mont); @@ -866,8 +866,8 @@ static int p256_fast_point_normalize(const mbedtls_ecp_group *grp, const p256_fast_jac_point *p, mbedtls_ecp_point *res) { - u32 z_std[P256_WORDS], inv_std[P256_WORDS], inv_mont[P256_WORDS]; - u32 x_std[P256_WORDS], y_std[P256_WORDS], tmp[P256_WORDS]; + u32 z_std[P256_WORDS] = {0}, inv_std[P256_WORDS] = {0}, inv_mont[P256_WORDS] = {0}; + u32 x_std[P256_WORDS] = {0}, y_std[P256_WORDS] = {0}, tmp[P256_WORDS] = {0}; int ret = MBEDTLS_ERR_ECP_BAD_INPUT_DATA; if (p256_words_is_zero(p->Z)) { @@ -900,10 +900,10 @@ static int p256_fast_points_batch_to_affine_mont( const p256_fast_jac_point *points, size_t num, u32(*xs)[P256_WORDS], u32(*ys)[P256_WORDS]) { - u32 prefix[P256_WINDOW_BATCH_COUNT][P256_WORDS]; - u32 prod_std[P256_WORDS], inv_std[P256_WORDS]; - u32 running_inv[P256_WORDS], inv_z[P256_WORDS]; - u32 tmp[P256_WORDS]; + u32 prefix[P256_WINDOW_BATCH_COUNT][P256_WORDS] = {{0}}; + u32 prod_std[P256_WORDS] = {0}, inv_std[P256_WORDS] = {0}; + u32 running_inv[P256_WORDS] = {0}, inv_z[P256_WORDS] = {0}; + u32 tmp[P256_WORDS] = {0}; size_t i; if (!points || !xs || !ys) { @@ -962,8 +962,8 @@ static int crypto_ec_point_mul_p256_window4_core(const mbedtls_ecp_group *grp, bool validate_inputs) { struct p256_window4_scratch *scratch = NULL; - u32 scalar[P256_WORDS], x_std[P256_WORDS], y_std[P256_WORDS]; - u32 x_mont[P256_WORDS], y_mont[P256_WORDS], one_mont[P256_WORDS]; + u32 scalar[P256_WORDS] = {0}, x_std[P256_WORDS] = {0}, y_std[P256_WORDS] = {0}; + u32 x_mont[P256_WORDS] = {0}, y_mont[P256_WORDS] = {0}, one_mont[P256_WORDS] = {0}; static const u32 one_std[P256_WORDS] = {1}; int window; int ret = MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE; @@ -1085,8 +1085,8 @@ static int crypto_ec_point_mul_p256_generator_comb_fast(const mbedtls_ecp_group bool validate_inputs) { p256_fast_jac_point r; - u32 scalar[P256_WORDS]; - u32 one_mont[P256_WORDS]; + u32 scalar[P256_WORDS] = {0}; + u32 one_mont[P256_WORDS] = {0}; static const u32 one_std[P256_WORDS] = {1}; int col; int ret = MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE; @@ -1427,12 +1427,12 @@ int crypto_ec_key_compare(struct crypto_ec_key *key1, struct crypto_ec_key *key2 psa_status_t status = psa_export_public_key(wrapper1->key_id, pub1, sizeof(pub1), &key1_len); if (status != PSA_SUCCESS) { - wpa_printf(MSG_ERROR, "crypto_ec_key_compare: psa_export_public_key failed with %d", status); + wpa_printf(MSG_ERROR, "crypto_ec_key_compare: psa_export_public_key failed with %d", (int)status); return 0; } status = psa_export_public_key(wrapper2->key_id, pub2, sizeof(pub2), &key2_len); if (status != PSA_SUCCESS) { - wpa_printf(MSG_ERROR, "crypto_ec_key_compare: psa_export_public_key failed with %d", status); + wpa_printf(MSG_ERROR, "crypto_ec_key_compare: psa_export_public_key failed with %d", (int)status); return 0; } @@ -1687,7 +1687,7 @@ struct crypto_ec_key * crypto_ec_key_set_pub(const struct crypto_ec_group *group psa_status_t status = psa_import_key(&key_attributes, key_buf, key_len, &wrapper->key_id); if (status != PSA_SUCCESS) { - wpa_printf(MSG_ERROR, "Failed to import key, %d", status); + wpa_printf(MSG_ERROR, "Failed to import key, %d", (int)status); os_free(key_buf); os_free(wrapper); return NULL; @@ -1742,7 +1742,7 @@ struct crypto_ec_point *crypto_ec_key_get_public_key(struct crypto_ec_key *key) status = psa_export_public_key(wrapper->key_id, pub_key_buf, sizeof(pub_key_buf), &pub_key_len); if (status != PSA_SUCCESS) { - wpa_printf(MSG_ERROR, "Failed to export public key: %d", status); + wpa_printf(MSG_ERROR, "Failed to export public key: %d", (int)status); return NULL; } if (pub_key_len < 3 || pub_key_buf[0] != 0x04) { @@ -1910,7 +1910,7 @@ int crypto_ec_key_group(struct crypto_ec_key *key) psa_status_t status = psa_get_key_attributes(wrapper->key_id, &key_attributes); if (status != PSA_SUCCESS) { - wpa_printf(MSG_ERROR, "crypto_ec_key_group: psa_get_key_attributes failed: %d", status); + wpa_printf(MSG_ERROR, "crypto_ec_key_group: psa_get_key_attributes failed: %d", (int)status); psa_reset_key_attributes(&key_attributes); return -1; } @@ -1992,13 +1992,13 @@ int crypto_ec_get_publickey_buf(struct crypto_ec_key *key, u8 *key_buf, int len) status = psa_get_key_attributes(wrapper->key_id, &key_attributes); if (status != PSA_SUCCESS) { - printf("psa_get_key_attributes failed with %d\n", status); + wpa_printf(MSG_ERROR, "psa_get_key_attributes failed with %d", (int) status); return -1; } size_t key_bits = psa_get_key_bits(&key_attributes); if (key_bits == 0) { - printf("psa_get_key_bits failed with %d\n", -1); + wpa_printf(MSG_ERROR, "psa_get_key_bits failed with %d", -1); return -1; } @@ -2033,7 +2033,7 @@ int crypto_ec_get_publickey_buf(struct crypto_ec_key *key, u8 *key_buf, int len) size_t key_len = 0; status = psa_export_public_key(wrapper->key_id, key_buf, len, &key_len); if (status != PSA_SUCCESS) { - printf("psa_export_public_key failed with %d\n", status); + wpa_printf(MSG_ERROR, "psa_export_public_key failed with %d", (int) status); return -1; } @@ -2314,7 +2314,7 @@ int crypto_ecdh(struct crypto_ec_key *key_own, struct crypto_ec_key *key_peer, secret, secret_buf_size, &secret_length); if (status != PSA_SUCCESS) { - wpa_printf(MSG_ERROR, "psa_raw_key_agreement failed with %d", status); + wpa_printf(MSG_ERROR, "psa_raw_key_agreement failed with %d", (int)status); return -1; } @@ -2333,7 +2333,7 @@ int crypto_ecdh(struct crypto_ec_key *key_own, struct crypto_ec_key *key_peer, PSA_EXPORT_PUBLIC_KEY_MAX_SIZE, &peer_key_len); if (status != PSA_SUCCESS) { - wpa_printf(MSG_ERROR, "psa_export_public_key failed with %d", status); + wpa_printf(MSG_ERROR, "psa_export_public_key failed with %d", (int)status); ret = -1; goto fail; } @@ -2345,7 +2345,7 @@ int crypto_ecdh(struct crypto_ec_key *key_own, struct crypto_ec_key *key_peer, secret_buf_size, &secret_length); if (status != PSA_SUCCESS) { - wpa_printf(MSG_ERROR, "psa_raw_key_agreement failed with %d", status); + wpa_printf(MSG_ERROR, "psa_raw_key_agreement failed with %d", (int)status); ret = -1; goto fail; } @@ -2372,7 +2372,7 @@ int crypto_ecdsa_get_sign(unsigned char *hash, psa_status_t status = psa_sign_hash(wrapper->key_id, PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256), hash, hash_len, signature, sizeof(signature), &signature_length); if (status != PSA_SUCCESS) { - printf("psa_sign_hash failed with %d\n", status); + wpa_printf(MSG_ERROR, "psa_sign_hash failed with %d", (int) status); return -1; } @@ -2413,7 +2413,7 @@ int crypto_ec_key_verify_signature_r_s(struct crypto_ec_key *csign, psa_status_t status = psa_verify_hash(wrapper->key_id, PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256), hash, hlen, sig, r_len + s_len); if (status != PSA_SUCCESS) { - printf("psa_verify_hash failed with %d\n", status); + wpa_printf(MSG_ERROR, "psa_verify_hash failed with %d", (int) status); os_free(sig); return -1; } @@ -2435,7 +2435,7 @@ void crypto_ec_key_debug_print(struct crypto_ec_key *key, const char *title) size_t pub_len = 0; psa_status_t status = psa_export_public_key(wrapper->key_id, pub, sizeof(pub), &pub_len); if (status != PSA_SUCCESS) { - wpa_printf(MSG_ERROR, "crypto_ec_key_debug_print: psa_export_public_key failed with %d", status); + wpa_printf(MSG_ERROR, "crypto_ec_key_debug_print: psa_export_public_key failed with %d", (int)status); return; } @@ -2445,7 +2445,7 @@ void crypto_ec_key_debug_print(struct crypto_ec_key *key, const char *title) psa_key_attributes_t key_attributes = PSA_KEY_ATTRIBUTES_INIT; status = psa_get_key_attributes(wrapper->key_id, &key_attributes); if (status != PSA_SUCCESS) { - wpa_printf(MSG_ERROR, "crypto_ec_key_debug_print: psa_get_key_attributes failed with %d", status); + wpa_printf(MSG_ERROR, "crypto_ec_key_debug_print: psa_get_key_attributes failed with %d", (int)status); return; } @@ -2557,7 +2557,7 @@ int crypto_is_ec_key(struct crypto_ec_key *key) psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; psa_status_t status = psa_get_key_attributes(wrapper->key_id, &attributes); if (status != PSA_SUCCESS) { - wpa_printf(MSG_DEBUG, "Failed to get key attributes: %d", status); + wpa_printf(MSG_DEBUG, "Failed to get key attributes: %d", (int)status); return 0; } @@ -2680,7 +2680,7 @@ int crypto_pk_write_formatted_pubkey_der(psa_key_id_t key_id, unsigned char *buf psa_status_t status = psa_export_public_key(key_id, point_buf, PSA_EXPORT_PUBLIC_KEY_MAX_SIZE, &point_len); if (status != PSA_SUCCESS) { os_free(point_buf); - wpa_printf(MSG_ERROR, "psa_export_public_key failed: %d", status); + wpa_printf(MSG_ERROR, "psa_export_public_key failed: %d", (int)status); return MBEDTLS_ERR_PK_BAD_INPUT_DATA; } @@ -3024,7 +3024,7 @@ struct wpabuf * crypto_ecdh_set_peerkey(struct crypto_ecdh *ecdh, int inc_y, os_free(peer_key_buf); if (status != PSA_SUCCESS) { - wpa_printf(MSG_ERROR, "psa_raw_key_agreement failed with PSA error 0x%x", status); + wpa_printf(MSG_ERROR, "psa_raw_key_agreement failed with PSA error 0x%x", (int)status); os_free(secret); return NULL; } @@ -3153,7 +3153,7 @@ int crypto_ec_key_verify_signature(struct crypto_ec_key *key, const u8 *data, psa_key_attributes_t key_attributes = PSA_KEY_ATTRIBUTES_INIT; psa_status_t status = psa_get_key_attributes(wrapper->key_id, &key_attributes); if (status != PSA_SUCCESS) { - wpa_printf(MSG_ERROR, "crypto_ec_key_verify_signature: psa_get_key_attributes failed: %d", status); + wpa_printf(MSG_ERROR, "crypto_ec_key_verify_signature: psa_get_key_attributes failed: %d", (int)status); psa_reset_key_attributes(&key_attributes); return -1; } @@ -3206,7 +3206,7 @@ int crypto_ec_key_verify_signature(struct crypto_ec_key *key, const u8 *data, status = psa_verify_hash(wrapper->key_id, verify_alg, data, len, sig_to_verify, sig_len_to_verify); if (status != PSA_SUCCESS) { - wpa_printf(MSG_ERROR, "crypto_ec_key_verify_signature: psa_verify_hash failed: %d", status); + wpa_printf(MSG_ERROR, "crypto_ec_key_verify_signature: psa_verify_hash failed: %d", (int)status); return -1; } diff --git a/components/wpa_supplicant/esp_supplicant/src/crypto/fastpbkdf2.c b/components/wpa_supplicant/esp_supplicant/src/crypto/fastpbkdf2.c index 135952c1279..d4c6892545e 100644 --- a/components/wpa_supplicant/esp_supplicant/src/crypto/fastpbkdf2.c +++ b/components/wpa_supplicant/esp_supplicant/src/crypto/fastpbkdf2.c @@ -133,8 +133,8 @@ static inline void md_pad(uint8_t *block, size_t blocksz, size_t used, size_t ms memset(k + nkey, 0, _blocksz - nkey); \ \ /* Start inner hash computation */ \ - uint8_t blk_inner[_blocksz]; \ - uint8_t blk_outer[_blocksz]; \ + uint8_t blk_inner[_blocksz] = {0}; \ + uint8_t blk_outer[_blocksz] = {0}; \ \ for (size_t i = 0; i < _blocksz; i++) \ { \ @@ -172,11 +172,11 @@ static inline void md_pad(uint8_t *block, size_t blocksz, size_t used, size_t ms uint32_t iterations, \ uint8_t *out) \ { \ - uint8_t countbuf[4]; \ + uint8_t countbuf[4] = {0}; \ write32_be(counter, countbuf); \ \ /* Prepare loop-invariant padding block. */ \ - uint8_t Ublock[_blocksz]; \ + uint8_t Ublock[_blocksz] = {0}; \ md_pad(Ublock, _blocksz, _hashsz, _blocksz + _hashsz); \ \ /* First iteration: \ diff --git a/components/wpa_supplicant/esp_supplicant/src/crypto/p256_common.h b/components/wpa_supplicant/esp_supplicant/src/crypto/p256_common.h index 394e9da0b65..6c8659347a6 100644 --- a/components/wpa_supplicant/esp_supplicant/src/crypto/p256_common.h +++ b/components/wpa_supplicant/esp_supplicant/src/crypto/p256_common.h @@ -248,7 +248,7 @@ static inline void p256_mont_mul(u32 z[P256_WORDS], const u32 y[P256_WORDS]) { u32 a[P256_WORDS + 1] = {0}; - u32 reduced[P256_WORDS]; + u32 reduced[P256_WORDS] = {0}; size_t i; for (i = 0; i < P256_WORDS; i++) { diff --git a/components/wpa_supplicant/src/common/wpa_common.c b/components/wpa_supplicant/src/common/wpa_common.c index 10688c3280a..457117caa03 100644 --- a/components/wpa_supplicant/src/common/wpa_common.c +++ b/components/wpa_supplicant/src/common/wpa_common.c @@ -1318,7 +1318,7 @@ int wpa_pmk_to_ptk(const u8 *pmk, size_t pmk_len, const char *label, void rsn_pmkid(const u8 *pmk, size_t pmk_len, const u8 *aa, const u8 *spa, u8 *pmkid, int akmp) { - char *title = "PMK Name"; + const char *title = "PMK Name"; const u8 *addr[3]; const size_t len[3] = { 8, ETH_ALEN, ETH_ALEN }; unsigned char hash[SHA256_MAC_LEN]; diff --git a/components/wpa_supplicant/src/eap_peer/eap.c b/components/wpa_supplicant/src/eap_peer/eap.c index c1e2d10f26b..8a9529a9dc0 100644 --- a/components/wpa_supplicant/src/eap_peer/eap.c +++ b/components/wpa_supplicant/src/eap_peer/eap.c @@ -59,7 +59,7 @@ u8 *g_wpa_password; int g_wpa_password_len; u8 *g_wpa_new_password; int g_wpa_new_password_len; -char *g_wpa_ttls_phase2_type; +const char *g_wpa_ttls_phase2_type; char *g_wpa_phase1_options; u8 *g_wpa_pac_file; int g_wpa_pac_file_len; diff --git a/components/wpa_supplicant/src/eap_peer/eap.h b/components/wpa_supplicant/src/eap_peer/eap.h index 1775413f149..0bc5f75d4c6 100644 --- a/components/wpa_supplicant/src/eap_peer/eap.h +++ b/components/wpa_supplicant/src/eap_peer/eap.h @@ -39,7 +39,7 @@ extern int g_wpa_password_len; extern u8 *g_wpa_new_password; extern int g_wpa_new_password_len; -extern char *g_wpa_ttls_phase2_type; +extern const char *g_wpa_ttls_phase2_type; extern char *g_wpa_phase1_options; extern u8 *g_wpa_pac_file; diff --git a/components/wpa_supplicant/src/eap_peer/eap_config.h b/components/wpa_supplicant/src/eap_peer/eap_config.h index 6dee56c7ac4..d8c2aea09cb 100644 --- a/components/wpa_supplicant/src/eap_peer/eap_config.h +++ b/components/wpa_supplicant/src/eap_peer/eap_config.h @@ -240,7 +240,7 @@ struct eap_peer_config { * be used to disable MSCHAPv2 password retry in authentication failure * cases. */ - char *phase2; + const char *phase2; /** * pcsc - Parameters for PC/SC smartcard interface for USIM and GSM SIM diff --git a/components/wpa_supplicant/src/eap_peer/eap_mschapv2.c b/components/wpa_supplicant/src/eap_peer/eap_mschapv2.c index ab536d15968..7d33a0aebb1 100644 --- a/components/wpa_supplicant/src/eap_peer/eap_mschapv2.c +++ b/components/wpa_supplicant/src/eap_peer/eap_mschapv2.c @@ -367,7 +367,7 @@ eap_mschapv2_success(struct eap_sm *sm, static int eap_mschapv2_failure_txt(struct eap_sm *sm, struct eap_mschapv2_data *data, char *txt) { - char *pos = ""; + const char *pos = ""; int retry = 1; struct eap_peer_config *config = eap_get_config(sm); diff --git a/components/wpa_supplicant/src/wps/wps_common.c b/components/wpa_supplicant/src/wps/wps_common.c index 0f6bccc7c6f..24c3777d03e 100644 --- a/components/wpa_supplicant/src/wps/wps_common.c +++ b/components/wpa_supplicant/src/wps/wps_common.c @@ -503,7 +503,7 @@ char * wps_dev_type_bin2str(const u8 dev_type[WPS_DEV_TYPE_LEN], char *buf, { int ret; - ret = os_snprintf(buf, buf_len, "%u-%08X-%u", + ret = os_snprintf(buf, buf_len, "%u-%08" PRIX32 "-%u", WPA_GET_BE16(dev_type), WPA_GET_BE32(&dev_type[2]), WPA_GET_BE16(&dev_type[6])); if (os_snprintf_error(buf_len, ret))