From a6ebb19fea02af394be06e325509682940af2f6e Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 30 Jan 2026 12:50:11 +0530 Subject: [PATCH] fix(bt): Keep older error code for backward comatibility --- components/bt/common/api/include/api/esp_blufi_api.h | 4 +++- examples/bluetooth/blufi/main/blufi_security.c | 8 ++++---- examples/bluetooth/blufi/sdkconfig.defaults | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/components/bt/common/api/include/api/esp_blufi_api.h b/components/bt/common/api/include/api/esp_blufi_api.h index b6f3fe295c..bcec29381b 100644 --- a/components/bt/common/api/include/api/esp_blufi_api.h +++ b/components/bt/common/api/include/api/esp_blufi_api.h @@ -76,9 +76,11 @@ typedef enum { ESP_BLUFI_READ_PARAM_ERROR, ESP_BLUFI_MAKE_PUBLIC_ERROR, ESP_BLUFI_DATA_FORMAT_ERROR, - ESP_BLUFI_CALC_SHA_256_ERROR, + // BLUFI_CALC_MD5 entry kept for backward compatibility + ESP_BLUFI_CALC_MD5_ERROR, ESP_BLUFI_WIFI_SCAN_FAIL, ESP_BLUFI_MSG_STATE_ERROR, + ESP_BLUFI_CALC_SHA_256_ERROR, } esp_blufi_error_state_t; /** diff --git a/examples/bluetooth/blufi/main/blufi_security.c b/examples/bluetooth/blufi/main/blufi_security.c index b775643ee5..bca615a1db 100644 --- a/examples/bluetooth/blufi/main/blufi_security.c +++ b/examples/bluetooth/blufi/main/blufi_security.c @@ -170,11 +170,11 @@ void blufi_dh_negotiate_data_handler(uint8_t *data, int len, uint8_t **output_da } /* Determine key bits based on public key length (RFC7919 key sizes) - * Note: Only 2048 and 3072 bit keys are supported due to buffer size constraints - * (DH_SELF_PUB_KEY_LEN = 384 bytes = 3072 bits maximum) */ + * Note: Only 3072 bit keys are supported due to buffer size constraints + * (DH_SELF_PUB_KEY_LEN = 384 bytes = 3072 bits) */ size_t key_bits = pub_len * 8; - if (key_bits != 2048 && key_bits != 3072) { - BLUFI_ERROR("Unsupported DH key length: %d bytes (only 2048 and 3072 bit keys supported)", pub_len); + if (key_bits != 3072) { + BLUFI_ERROR("Unsupported DH key length: %d bytes (only 3072 bit keys supported)", pub_len); btc_blufi_report_error(ESP_BLUFI_DH_PARAM_ERROR); return; } diff --git a/examples/bluetooth/blufi/sdkconfig.defaults b/examples/bluetooth/blufi/sdkconfig.defaults index 52371ad1fe..eaade3486a 100644 --- a/examples/bluetooth/blufi/sdkconfig.defaults +++ b/examples/bluetooth/blufi/sdkconfig.defaults @@ -14,7 +14,7 @@ CONFIG_BT_ENABLED=y CONFIG_BT_GATTC_ENABLE=n CONFIG_BT_BLE_SMP_ENABLE=n CONFIG_BT_BLE_BLUFI_ENABLE=y -CONFIG_MBEDTLS_HARDWARE_MPI=n +CONFIG_MBEDTLS_HARDWARE_MPI=y # CONFIG_BT_BLE_42_DTM_TEST_EN is not set # CONFIG_BT_BLE_42_SCAN_EN is not set # CONFIG_BT_BLE_50_FEATURES_SUPPORTED is not set