From 8409e3bcbe4d296117fa6cd4464ec7c28f2fb9d7 Mon Sep 17 00:00:00 2001 From: xiewenxiang Date: Wed, 8 Dec 2021 09:37:07 +0800 Subject: [PATCH] components/bt: fix blufi encryption fail --- .../btc/profile/esp/blufi/bluedroid_host/esp_blufi.c | 6 ++++++ .../common/btc/profile/esp/blufi/nimble_host/esp_blufi.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c b/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c index 071046dce9..fe6f96c73d 100644 --- a/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c +++ b/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c @@ -324,6 +324,12 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) blufi_env.conn_id = p_data->conn.conn_id; blufi_env.recv_seq = blufi_env.send_seq = 0; blufi_env.sec_mode = 0x0; + blufi_env.offset = 0; + + if (blufi_env.aggr_buf != NULL) { + osi_free(blufi_env.aggr_buf); + blufi_env.aggr_buf = NULL; + } msg.sig = BTC_SIG_API_CB; msg.pid = BTC_PID_BLUFI; diff --git a/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c b/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c index 5538357b94..37cae9fd8f 100644 --- a/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c +++ b/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c @@ -274,6 +274,13 @@ esp_blufi_gap_event(struct ble_gap_event *event, void *arg) blufi_env.is_connected = false; blufi_env.recv_seq = blufi_env.send_seq = 0; blufi_env.sec_mode = 0x0; + blufi_env.offset = 0; + + if (blufi_env.aggr_buf != NULL) { + osi_free(blufi_env.aggr_buf); + blufi_env.aggr_buf = NULL; + } + btc_msg_t msg; esp_blufi_cb_param_t param;