Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When reading certificate fail, we should stop the communication betwe… #22

Merged
merged 1 commit into from
Dec 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions spdm_emu/spdm_requester_emu/spdm_requester.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ void *spdm_client_init(void)
SPDM_DATA_PEER_PUBLIC_CERT_CHAIN,
&parameter, data, data_size);
// Do not free it.
} else {
printf("read_responder_public_certificate_chain fail!\n");
free(m_spdm_context);
m_spdm_context = NULL;
return NULL;
}
} else {
res = read_responder_root_public_certificate(m_use_hash_algo,
Expand All @@ -272,6 +277,11 @@ void *spdm_client_init(void)
SPDM_DATA_PEER_PUBLIC_ROOT_CERT,
&parameter, root_cert, root_cert_size);
// Do not free it.
} else {
printf("read_responder_root_public_certificate fail!\n");
free(m_spdm_context);
m_spdm_context = NULL;
return NULL;
}
}

Expand All @@ -293,6 +303,11 @@ void *spdm_client_init(void)
&parameter, data, data_size);
}
// do not free it
} else {
printf("read_requester_public_certificate_chain fail!\n");
free(m_spdm_context);
m_spdm_context = NULL;
return NULL;
}

status = spdm_set_data(spdm_context, SPDM_DATA_PSK_HINT, NULL,
Expand Down