Skip to content

Commit

Permalink
correct libspdm_start_watchdog enablement.
Browse files Browse the repository at this point in the history
Signed-off-by: Qi Zhang <[email protected]>
  • Loading branch information
qizhangz authored and jyao1 committed Feb 11, 2022
1 parent 1224ab3 commit c7c4aaa
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
7 changes: 7 additions & 0 deletions library/spdm_responder_lib/libspdm_rsp_finish.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
**/

#include "internal/libspdm_responder_lib.h"
#include "hal/library/platform_lib.h"

#if LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP

Expand Down Expand Up @@ -287,6 +288,12 @@ return_status spdm_get_response_finish(IN void *context, IN uintn request_size,
response_size, response);
}

result = libspdm_start_watchdog(session_id,
spdm_context->local_context.heartbeat_period);
if (!result) {
return RETURN_DEVICE_ERROR;
}

return RETURN_SUCCESS;
}

Expand Down
6 changes: 0 additions & 6 deletions library/spdm_responder_lib/libspdm_rsp_psk_exchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
**/

#include "internal/libspdm_responder_lib.h"
#include "hal/library/platform_lib.h"

#if LIBSPDM_ENABLE_CAPABILITY_PSK_EX_CAP

Expand Down Expand Up @@ -360,11 +359,6 @@ return_status spdm_get_response_psk_exchange(IN void *context,

spdm_set_session_state(spdm_context, session_id,
LIBSPDM_SESSION_STATE_ESTABLISHED);
result = libspdm_start_watchdog(session_id,
spdm_context->local_context.heartbeat_period);
if (!result) {
return RETURN_DEVICE_ERROR;
}
}

return RETURN_SUCCESS;
Expand Down
7 changes: 7 additions & 0 deletions library/spdm_responder_lib/libspdm_rsp_psk_finish.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
**/

#include "internal/libspdm_responder_lib.h"
#include "hal/library/platform_lib.h"

/**
* Process the SPDM PSK_FINISH request and return the response.
Expand Down Expand Up @@ -173,5 +174,11 @@ return_status spdm_get_response_psk_finish(IN void *context,
response_size, response);
}

result = libspdm_start_watchdog(session_id,
spdm_context->local_context.heartbeat_period);
if (!result) {
return RETURN_DEVICE_ERROR;
}

return RETURN_SUCCESS;
}
16 changes: 0 additions & 16 deletions library/spdm_responder_lib/libspdm_rsp_receive_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,10 @@ return_status libspdm_build_response(IN void *context, IN uint32_t *session_id,
spdm_session_info_t *session_info;
spdm_message_header_t *spdm_request;
spdm_message_header_t *spdm_response;
bool session_state_established;
bool result;
uint32_t watchdog_session_id;

spdm_context = context;
status = RETURN_UNSUPPORTED;
session_state_established = false;

if (spdm_context->last_spdm_error.error_code != 0) {

Expand Down Expand Up @@ -478,15 +475,11 @@ return_status libspdm_build_response(IN void *context, IN uint32_t *session_id,
spdm_set_session_state(
spdm_context, *session_id,
LIBSPDM_SESSION_STATE_ESTABLISHED);
watchdog_session_id = *session_id;
session_state_established = true;
}
break;
case SPDM_PSK_FINISH_RSP:
spdm_set_session_state(spdm_context, *session_id,
LIBSPDM_SESSION_STATE_ESTABLISHED);
watchdog_session_id = *session_id;
session_state_established = true;
break;
case SPDM_END_SESSION_ACK:
spdm_set_session_state(spdm_context, *session_id,
Expand All @@ -512,8 +505,6 @@ return_status libspdm_build_response(IN void *context, IN uint32_t *session_id,
spdm_context,
spdm_context->latest_session_id,
LIBSPDM_SESSION_STATE_ESTABLISHED);
watchdog_session_id = spdm_context->latest_session_id;
session_state_established = true;
}
break;
default:
Expand All @@ -522,13 +513,6 @@ return_status libspdm_build_response(IN void *context, IN uint32_t *session_id,
}
}

if (session_state_established) {
result = libspdm_start_watchdog(watchdog_session_id,
spdm_context->local_context.heartbeat_period);
if (!result) {
return RETURN_DEVICE_ERROR;
}
}
return RETURN_SUCCESS;
}

Expand Down

0 comments on commit c7c4aaa

Please sign in to comment.