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

Enforce mandatory CA in SET_CERTIFICATE #2850

Merged
merged 1 commit into from
Sep 27, 2024
Merged

Conversation

steven-bellock
Copy link
Contributor

Fix #2731.

Signed-off-by: Steven Bellock [email protected]

@@ -245,7 +260,8 @@ libspdm_return_t libspdm_get_response_set_certificate(libspdm_context_t *spdm_co

#if LIBSPDM_CERT_PARSE_SUPPORT
/*check the cert_chain*/
result = libspdm_set_cert_verify_certchain(cert_chain, cert_chain_size,
result = libspdm_set_cert_verify_certchain(spdm_version,
cert_chain, cert_chain_size,
spdm_context->connection_info.algorithm.base_asym_algo,
spdm_context->connection_info.algorithm.base_hash_algo,
is_device_cert_model);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last parameter is changed to uint8_t cert_model.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. Thank you for type checking when the C compiler could not. 😆

Comment on lines +48 to +56
if (!libspdm_x509_set_cert_certificate_check(leaf_cert_buffer, leaf_cert_buffer_size,
base_asym_algo, base_hash_algo,
false, is_device_cert_model)) {
return false;
}
} else {
if (!libspdm_x509_set_cert_certificate_check_ex(leaf_cert_buffer, leaf_cert_buffer_size,
base_asym_algo, base_hash_algo,
false, cert_model)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks weird to only support 1.3 in ex version and only support 1.2 in non-ex version.
I feel it will be easily mis-used, if it is designed in such way.

But I don't have good idea now. Need to think through.

@@ -917,7 +917,7 @@ bool libspdm_x509_certificate_check_ex(const uint8_t *cert, size_t cert_size,
uint32_t base_asym_algo, uint32_t base_hash_algo,
bool is_requester, uint8_t cert_model);
/**
* Certificate Check for SPDM leaf cert when set_cert.
* Certificate Check for SPDM leaf cert when set_cert. It is used for SPDM 1.2.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had better add some reason for the ex/non-ex version difference.
For example, the basic constrain is not checked in 1.2, but will be checked in 1.3.

@jyao1 jyao1 merged commit d8d079c into DMTF:main Sep 27, 2024
97 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libspdm_verify_set_cert_leaf_cert_basic_constraints needs to be updated for SPDM 1.3
2 participants