Current code didn't check return status of spdm_load_negotiated_state but logically spdm_load_negotiated_state could fail with some values left in spdm_context.
Maybe we could call spdm_load_negotiated_state immediately after spdm_init_context and re-init the context in case of load failures.
2) spdm_clear_negotiated_state has nothing to do with spdm_context. Suggest to take out the input parameter.
return_status spdm_clear_negotiated_state(IN void *spdm_context)
1) Take responder for example (same for the requester), https://github.com/DMTF/spdm-emu/blob/ecabfed2837b1dfc8f4af96f9c829cdf6b12a03c/spdm_emu/spdm_responder_emu/spdm_responder.c#L139
Current code didn't check return status of spdm_load_negotiated_state but logically spdm_load_negotiated_state could fail with some values left in spdm_context.
Maybe we could call spdm_load_negotiated_state immediately after spdm_init_context and re-init the context in case of load failures.
2) spdm_clear_negotiated_state has nothing to do with spdm_context. Suggest to take out the input parameter.
return_status spdm_clear_negotiated_state(IN void *spdm_context)