Skip to content

Commit

Permalink
set_cert_certificate_check: Clarify what is_requester_cert means
Browse files Browse the repository at this point in the history
Signed-off-by: Alistair Francis <[email protected]>
  • Loading branch information
alistair23 authored and jyao1 committed Jun 19, 2024
1 parent 0ef69e7 commit 486d9f9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
16 changes: 8 additions & 8 deletions include/library/spdm_crypt_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ bool libspdm_get_random_number(size_t size, uint8_t *rand);
* @param[in] cert_size The size of certificate data in bytes.
* @param[in] base_asym_algo SPDM base_asym_algo
* @param[in] base_hash_algo SPDM base_hash_algo
* @param[in] is_requester_cert Is the function verifying requester or responder cert.
* @param[in] is_requester Is the function verifying a cert as a requester or responder.
* @param[in] is_device_cert_model If true, the local endpoint uses the DeviceCert model.
* If false, the local endpoint uses the AliasCert model.
*
Expand All @@ -895,7 +895,7 @@ bool libspdm_get_random_number(size_t size, uint8_t *rand);
**/
bool libspdm_x509_certificate_check(const uint8_t *cert, size_t cert_size,
uint32_t base_asym_algo, uint32_t base_hash_algo,
bool is_requester_cert, bool is_device_cert_model);
bool is_requester, bool is_device_cert_model);

/**
* Certificate Check for SPDM leaf cert. It is used for SPDM 1.3.
Expand All @@ -904,23 +904,23 @@ bool libspdm_x509_certificate_check(const uint8_t *cert, size_t cert_size,
* @param[in] cert_size The size of certificate data in bytes.
* @param[in] base_asym_algo SPDM base_asym_algo
* @param[in] base_hash_algo SPDM base_hash_algo
* @param[in] is_requester_cert Is the function verifying requester or responder cert.
* @param[in] is_requester Is the function verifying a cert as a requester or responder.
* @param[in] cert_model One of the SPDM_CERTIFICATE_INFO_CERT_MODEL_* macros.
*
* @retval true Success.
* @retval false Certificate is not valid.
**/
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_cert, uint8_t cert_model);
bool is_requester, uint8_t cert_model);
/**
* Certificate Check for SPDM leaf cert when set_cert.
*
* @param[in] cert Pointer to the DER-encoded certificate data.
* @param[in] cert_size The size of certificate data in bytes.
* @param[in] base_asym_algo SPDM base_asym_algo
* @param[in] base_hash_algo SPDM base_hash_algo
* @param[in] is_requester_cert Is the function verifying requester or responder cert.
* @param[in] is_requester Is the function verifying a cert as a requester or responder.
* @param[in] is_device_cert_model If true, the local endpoint uses the DeviceCert model.
* If false, the local endpoint uses the AliasCert model.
*
Expand All @@ -929,7 +929,7 @@ bool libspdm_x509_certificate_check_ex(const uint8_t *cert, size_t cert_size,
**/
bool libspdm_x509_set_cert_certificate_check(const uint8_t *cert, size_t cert_size,
uint32_t base_asym_algo, uint32_t base_hash_algo,
bool is_requester_cert, bool is_device_cert_model);
bool is_requester, bool is_device_cert_model);

/**
* Certificate Check for SPDM leaf cert when set_cert. It is used for SPDM 1.3.
Expand All @@ -938,15 +938,15 @@ bool libspdm_x509_set_cert_certificate_check(const uint8_t *cert, size_t cert_si
* @param[in] cert_size The size of certificate data in bytes.
* @param[in] base_asym_algo SPDM base_asym_algo
* @param[in] base_hash_algo SPDM base_hash_algo
* @param[in] is_requester_cert Is the function verifying requester or responder cert.
* @param[in] is_requester Is the function verifying a cert as a requester or responder.
* @param[in] cert_model One of the SPDM_CERTIFICATE_INFO_CERT_MODEL_* macros.
*
* @retval true Success.
* @retval false Certificate is not valid.
**/
bool libspdm_x509_set_cert_certificate_check_ex(const uint8_t *cert, size_t cert_size,
uint32_t base_asym_algo, uint32_t base_hash_algo,
bool is_requester_cert, uint8_t cert_model);
bool is_requester, uint8_t cert_model);

/**
* Return certificate is root cert or not.
Expand Down
24 changes: 12 additions & 12 deletions library/spdm_crypt_lib/libspdm_crypt_cert.c
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ bool libspdm_x509_common_certificate_check(const uint8_t *cert, size_t cert_size
* @param[in] cert_size The size of certificate data in bytes.
* @param[in] base_asym_algo SPDM base_asym_algo
* @param[in] base_hash_algo SPDM base_hash_algo
* @param[in] is_requester_cert Is the function verifying requester or responder cert.
* @param[in] is_requester Is the function verifying a cert as a requester or responder.
* @param[in] is_device_cert_model If true, the local endpoint uses the DeviceCert model.
* If false, the local endpoint uses the AliasCert model.
*
Expand All @@ -1230,7 +1230,7 @@ bool libspdm_x509_common_certificate_check(const uint8_t *cert, size_t cert_size
bool libspdm_x509_certificate_check(const uint8_t *cert, size_t cert_size,
uint32_t base_asym_algo,
uint32_t base_hash_algo,
bool is_requester_cert,
bool is_requester,
bool is_device_cert_model)
{
bool status;
Expand All @@ -1243,7 +1243,7 @@ bool libspdm_x509_certificate_check(const uint8_t *cert, size_t cert_size,
}

status = libspdm_x509_common_certificate_check(cert, cert_size, base_asym_algo,
base_hash_algo, is_requester_cert,
base_hash_algo, is_requester,
cert_model);
if (!status) {
return false;
Expand All @@ -1262,7 +1262,7 @@ bool libspdm_x509_certificate_check(const uint8_t *cert, size_t cert_size,
* @param[in] cert_size The size of certificate data in bytes.
* @param[in] base_asym_algo SPDM base_asym_algo
* @param[in] base_hash_algo SPDM base_hash_algo
* @param[in] is_requester_cert Is the function verifying requester or responder cert.
* @param[in] is_requester Is the function verifying a cert as a requester or responder.
* @param[in] cert_model One of the SPDM_CERTIFICATE_INFO_CERT_MODEL_* macros.
*
* @retval true Success.
Expand All @@ -1271,13 +1271,13 @@ bool libspdm_x509_certificate_check(const uint8_t *cert, size_t cert_size,
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_cert,
bool is_requester,
uint8_t cert_model)
{
bool status;

status = libspdm_x509_common_certificate_check(cert, cert_size, base_asym_algo,
base_hash_algo, is_requester_cert,
base_hash_algo, is_requester,
cert_model);
if (!status) {
return false;
Expand All @@ -1296,7 +1296,7 @@ bool libspdm_x509_certificate_check_ex(const uint8_t *cert, size_t cert_size,
* @param[in] cert_size The size of certificate data in bytes.
* @param[in] base_asym_algo SPDM base_asym_algo
* @param[in] base_hash_algo SPDM base_hash_algo
* @param[in] is_requester_cert Is the function verifying requester or responder cert.
* @param[in] is_requester Is the function verifying a cert as a requester or responder.
* @param[in] is_device_cert_model If true, the local endpoint uses the DeviceCert model.
* If false, the local endpoint uses the AliasCert model.
*
Expand All @@ -1305,7 +1305,7 @@ bool libspdm_x509_certificate_check_ex(const uint8_t *cert, size_t cert_size,
**/
bool libspdm_x509_set_cert_certificate_check(const uint8_t *cert, size_t cert_size,
uint32_t base_asym_algo, uint32_t base_hash_algo,
bool is_requester_cert, bool is_device_cert_model)
bool is_requester, bool is_device_cert_model)
{
bool status;
uint8_t cert_model;
Expand All @@ -1317,7 +1317,7 @@ bool libspdm_x509_set_cert_certificate_check(const uint8_t *cert, size_t cert_si
}

status = libspdm_x509_common_certificate_check(cert, cert_size, base_asym_algo,
base_hash_algo, is_requester_cert,
base_hash_algo, is_requester,
cert_model);
if (!status) {
return false;
Expand All @@ -1336,20 +1336,20 @@ bool libspdm_x509_set_cert_certificate_check(const uint8_t *cert, size_t cert_si
* @param[in] cert_size The size of certificate data in bytes.
* @param[in] base_asym_algo SPDM base_asym_algo
* @param[in] base_hash_algo SPDM base_hash_algo
* @param[in] is_requester_cert Is the function verifying requester or responder cert.
* @param[in] is_requester Is the function verifying a cert as a requester or responder.
* @param[in] cert_model One of the SPDM_CERTIFICATE_INFO_CERT_MODEL_* macros.
*
* @retval true Success.
* @retval false Certificate is not valid.
**/
bool libspdm_x509_set_cert_certificate_check_ex(const uint8_t *cert, size_t cert_size,
uint32_t base_asym_algo, uint32_t base_hash_algo,
bool is_requester_cert, uint8_t cert_model)
bool is_requester, uint8_t cert_model)
{
bool status;

status = libspdm_x509_common_certificate_check(cert, cert_size, base_asym_algo,
base_hash_algo, is_requester_cert,
base_hash_algo, is_requester,
cert_model);
if (!status) {
return false;
Expand Down

0 comments on commit 486d9f9

Please sign in to comment.