Merge branch 'bugfix/static_analysis_issue_supplicant' into 'master'

fix(supplicant): resolve constant expression warning in crypto_ecdh_output_size

Closes IDF-15548

See merge request espressif/esp-idf!47650
This commit is contained in:
Kapil Gupta
2026-04-20 12:40:57 +05:30
2 changed files with 6 additions and 7 deletions
@@ -1624,8 +1624,7 @@ static size_t crypto_ecdh_output_size(const crypto_ec_key_wrapper_t *wrapper)
return 0; return 0;
} }
return PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE( return PSA_BITS_TO_BYTES(key_bits);
PSA_KEY_TYPE_ECC_KEY_PAIR(ecc_family), key_bits);
} }
struct crypto_ec_key * crypto_ec_key_set_pub(const struct crypto_ec_group *group, struct crypto_ec_key * crypto_ec_key_set_pub(const struct crypto_ec_group *group,
@@ -41,7 +41,7 @@ static void aes_ccm_auth_start(void *aes, size_t M, size_t L, const u8 *nonce,
os_memcpy(&b[1], nonce, 15 - L); os_memcpy(&b[1], nonce, 15 - L);
WPA_PUT_BE16(&b[AES_BLOCK_SIZE - L], plain_len); WPA_PUT_BE16(&b[AES_BLOCK_SIZE - L], plain_len);
wpa_hexdump_key(MSG_DEBUG, "CCM B_0", b, AES_BLOCK_SIZE); wpa_hexdump_key(MSG_MSGDUMP, "CCM B_0", b, AES_BLOCK_SIZE);
aes_encrypt(aes, b, x); /* X_1 = E(K, B_0) */ aes_encrypt(aes, b, x); /* X_1 = E(K, B_0) */
if (!aad_len) if (!aad_len)
@@ -120,13 +120,13 @@ static void aes_ccm_encr_auth(void *aes, size_t M, u8 *x, u8 *a, u8 *auth)
size_t i; size_t i;
u8 tmp[AES_BLOCK_SIZE]; u8 tmp[AES_BLOCK_SIZE];
wpa_hexdump_key(MSG_DEBUG, "CCM T", x, M); wpa_hexdump_key(MSG_MSGDUMP, "CCM T", x, M);
/* U = T XOR S_0; S_0 = E(K, A_0) */ /* U = T XOR S_0; S_0 = E(K, A_0) */
WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], 0); WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], 0);
aes_encrypt(aes, a, tmp); aes_encrypt(aes, a, tmp);
for (i = 0; i < M; i++) for (i = 0; i < M; i++)
auth[i] = x[i] ^ tmp[i]; auth[i] = x[i] ^ tmp[i];
wpa_hexdump_key(MSG_DEBUG, "CCM U", auth, M); wpa_hexdump_key(MSG_MSGDUMP, "CCM U", auth, M);
} }
@@ -135,13 +135,13 @@ static void aes_ccm_decr_auth(void *aes, size_t M, u8 *a, const u8 *auth, u8 *t)
size_t i; size_t i;
u8 tmp[AES_BLOCK_SIZE]; u8 tmp[AES_BLOCK_SIZE];
wpa_hexdump_key(MSG_DEBUG, "CCM U", auth, M); wpa_hexdump_key(MSG_MSGDUMP, "CCM U", auth, M);
/* U = T XOR S_0; S_0 = E(K, A_0) */ /* U = T XOR S_0; S_0 = E(K, A_0) */
WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], 0); WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], 0);
aes_encrypt(aes, a, tmp); aes_encrypt(aes, a, tmp);
for (i = 0; i < M; i++) for (i = 0; i < M; i++)
t[i] = auth[i] ^ tmp[i]; t[i] = auth[i] ^ tmp[i];
wpa_hexdump_key(MSG_DEBUG, "CCM T", t, M); wpa_hexdump_key(MSG_MSGDUMP, "CCM T", t, M);
} }