mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
protocomm security1: Restart security session if SESSION_STATE_CMD0 is received
With the introduction of cookies to track a session, it is possible that the clients restart the provisioning on the same session, specifically when a user cancels a current provisioning attempt. This can result in an error as the state on the device side and client side will go out of sync. This has now been changed such that if SESSION_STATE_CMD0 is received on an existing session, the state is reset and flow allowed to continue.
This commit is contained in:
parent
c13fe0be6e
commit
3a5be7ce26
@ -175,6 +175,8 @@ static esp_err_t handle_session_command1(session_t *cur_session,
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t sec1_new_session(protocomm_security_handle_t handle, uint32_t session_id);
|
||||
|
||||
static esp_err_t handle_session_command0(session_t *cur_session,
|
||||
uint32_t session_id,
|
||||
SessionData *req, SessionData *resp,
|
||||
@ -186,8 +188,9 @@ static esp_err_t handle_session_command0(session_t *cur_session,
|
||||
int mbed_err;
|
||||
|
||||
if (cur_session->state != SESSION_STATE_CMD0) {
|
||||
ESP_LOGE(TAG, "Invalid state of session %d (expected %d)", SESSION_STATE_CMD0, cur_session->state);
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
ESP_LOGW(TAG, "Invalid state of session %d (expected %d). Restarting session.",
|
||||
SESSION_STATE_CMD0, cur_session->state);
|
||||
sec1_new_session(cur_session, session_id);
|
||||
}
|
||||
|
||||
if (in->sc0->client_pubkey.len != PUBLIC_KEY_LEN) {
|
||||
|
Loading…
Reference in New Issue
Block a user