mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-04 12:29:40 +00:00
Merge branch 'bugfix/supplicant_analyzer_fixes' into 'master'
Bugfix/supplicant analyzer fixes Closes WIFIBUG-1218 and IDF-13129 See merge request espressif/esp-idf!39300
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -51,15 +51,20 @@ cleanup:
|
||||
|
||||
struct crypto_bignum * crypto_bignum_init_uint(unsigned int val)
|
||||
{
|
||||
int ret;
|
||||
|
||||
mbedtls_mpi *bn = os_zalloc(sizeof(mbedtls_mpi));
|
||||
if (bn == NULL) {
|
||||
if (!bn) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mbedtls_mpi_init(bn);
|
||||
mbedtls_mpi_lset(bn, val);
|
||||
ret = mbedtls_mpi_lset(bn, val);
|
||||
|
||||
if (ret) {
|
||||
crypto_bignum_deinit((struct crypto_bignum *)bn, 0);
|
||||
bn = NULL;
|
||||
}
|
||||
return (struct crypto_bignum *)bn;
|
||||
}
|
||||
|
||||
|
@@ -1177,6 +1177,7 @@ struct wpabuf * crypto_ecdh_get_pubkey(struct crypto_ecdh *ecdh, int y)
|
||||
{
|
||||
struct wpabuf *public_key = NULL;
|
||||
uint8_t *buf = NULL;
|
||||
int ret;
|
||||
mbedtls_ecdh_context *ctx = (mbedtls_ecdh_context *)ecdh;
|
||||
size_t prime_len = ACCESS_ECDH(ctx, grp).pbits / 8;
|
||||
|
||||
@@ -1187,8 +1188,13 @@ struct wpabuf * crypto_ecdh_get_pubkey(struct crypto_ecdh *ecdh, int y)
|
||||
}
|
||||
|
||||
/* Export an MPI into unsigned big endian binary data of fixed size */
|
||||
mbedtls_mpi_write_binary(ACCESS_ECDH(&ctx, Q).MBEDTLS_PRIVATE(X), buf, prime_len);
|
||||
ret = mbedtls_mpi_write_binary(ACCESS_ECDH(&ctx, Q).MBEDTLS_PRIVATE(X), buf, prime_len);
|
||||
if (ret) {
|
||||
goto cleanup;
|
||||
}
|
||||
public_key = wpabuf_alloc_copy(buf, 32);
|
||||
|
||||
cleanup:
|
||||
os_free(buf);
|
||||
return public_key;
|
||||
}
|
||||
|
@@ -109,7 +109,7 @@ static inline void md_pad(uint8_t *block, size_t blocksz, size_t used, size_t ms
|
||||
const uint8_t *key, size_t nkey) \
|
||||
{ \
|
||||
/* Prepare key: */ \
|
||||
uint8_t k[_blocksz]; \
|
||||
uint8_t k[_blocksz] = {0}; \
|
||||
\
|
||||
/* Shorten long keys. */ \
|
||||
if (nkey > _blocksz) \
|
||||
|
@@ -641,11 +641,11 @@ int wps_process_wps_mX_req(u8 *ubuf, int len, enum wps_process_res *res)
|
||||
tlen = frag_len;
|
||||
}
|
||||
|
||||
if (tlen > 50000) {
|
||||
wpa_printf(MSG_ERROR, "EAP-WSC: Invalid Message Length");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
if ((flag & WPS_MSG_FLAG_MORE) || wps_buf != NULL) {//frag msg
|
||||
if (tlen > 50000) {
|
||||
wpa_printf(MSG_ERROR, "EAP-WSC: Invalid Message Length");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
wpa_printf(MSG_DEBUG, "rx frag msg id:%d, flag:%d, frag_len: %d, tot_len: %d, be_tot_len:%d", sm->current_identifier, flag, frag_len, tlen, be_tot_len);
|
||||
if (ESP_OK != wps_enrollee_process_msg_frag(&wps_buf, tlen, tbuf, frag_len, flag)) {
|
||||
if (wps_buf) {
|
||||
|
Reference in New Issue
Block a user