Skip to content

Commit

Permalink
Clear libspdm_x509_get_extension_data return description
Browse files Browse the repository at this point in the history
Fix the issue: #2590

Signed-off-by: Wenxing Hou <[email protected]>
  • Loading branch information
Wenxing-hou authored and jyao1 committed Mar 7, 2024
1 parent 204d173 commit d65ab08
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 33 deletions.
9 changes: 6 additions & 3 deletions include/hal/library/cryptlib/cryptlib_cert.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -112,8 +112,11 @@ extern bool libspdm_x509_get_issuer_name(const uint8_t *cert, size_t cert_size,
* @param[out] extension_data Extension bytes.
* @param[in, out] extension_data_size Extension bytes size.
*
* @retval true
* @retval false
* @return true If the returned extension_data_size == 0, it means that cert and oid are valid, but the oid extension is not found;
* If the returned extension_data_size != 0, it means that cert and oid are valid, and the oid extension is found;
* @return false If the returned extension_data_size == 0, it means that cert or oid are invalid;
* If the returned extension_data_size != 0, it means that cert and oid are valid, and the oid extension is found,
* but the store buffer is too small.
**/
extern bool libspdm_x509_get_extension_data(const uint8_t *cert, size_t cert_size,
const uint8_t *oid, size_t oid_size,
Expand Down
16 changes: 6 additions & 10 deletions os_stub/cryptlib_mbedtls/pk/x509.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -1225,15 +1225,11 @@ libspdm_internal_x509_find_extension_data(uint8_t *start, uint8_t *end, const ui
* @param[out] extension_data Extension bytes.
* @param[in, out] extension_data_size Extension bytes size.
*
* @retval RETURN_SUCCESS The certificate Extension data retrieved successfully.
* @retval RETURN_INVALID_PARAMETER If cert is NULL.
* If extension_data_size is NULL.
* If extension_data is not NULL and *extension_data_size is 0.
* If Certificate is invalid.
* @retval RETURN_NOT_FOUND If no Extension entry match oid.
* @retval RETURN_BUFFER_TOO_SMALL If the extension_data is NULL. The required buffer size
* is returned in the extension_data_size parameter.
* @retval RETURN_UNSUPPORTED The operation is not supported.
* @return true If the returned extension_data_size == 0, it means that cert and oid are valid, but the oid extension is not found;
* If the returned extension_data_size != 0, it means that cert and oid are valid, and the oid extension is found;
* @return false If the returned extension_data_size == 0, it means that cert or oid are invalid;
* If the returned extension_data_size != 0, it means that cert and oid are valid, and the oid extension is found,
* but the store buffer is too small.
**/
bool libspdm_x509_get_extension_data(const uint8_t *cert, size_t cert_size,
const uint8_t *oid, size_t oid_size,
Expand Down
16 changes: 6 additions & 10 deletions os_stub/cryptlib_null/pk/x509.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -570,15 +570,11 @@ bool libspdm_x509_get_signature_algorithm(const uint8_t *cert,
* @param[out] extension_data Extension bytes.
* @param[in, out] extension_data_size Extension bytes size.
*
* @retval RETURN_SUCCESS The certificate Extension data retrieved successfully.
* @retval RETURN_INVALID_PARAMETER If cert is NULL.
* If extension_data_size is NULL.
* If extension_data is not NULL and *extension_data_size is 0.
* If Certificate is invalid.
* @retval RETURN_NOT_FOUND If no Extension entry match oid.
* @retval RETURN_BUFFER_TOO_SMALL If the extension_data is NULL. The required buffer size
* is returned in the extension_data_size parameter.
* @retval RETURN_UNSUPPORTED The operation is not supported.
* @return true If the returned extension_data_size == 0, it means that cert and oid are valid, but the oid extension is not found;
* If the returned extension_data_size != 0, it means that cert and oid are valid, and the oid extension is found;
* @return false If the returned extension_data_size == 0, it means that cert or oid are invalid;
* If the returned extension_data_size != 0, it means that cert and oid are valid, and the oid extension is found,
* but the store buffer is too small.
**/
bool libspdm_x509_get_extension_data(const uint8_t *cert, size_t cert_size,
const uint8_t *oid, size_t oid_size,
Expand Down
16 changes: 6 additions & 10 deletions os_stub/cryptlib_openssl/pk/x509.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -1326,15 +1326,11 @@ bool libspdm_x509_get_key_usage(const uint8_t *cert, size_t cert_size,
* @param[out] extension_data Extension bytes.
* @param[in, out] extension_data_size Extension bytes size.
*
* @retval RETURN_SUCCESS The certificate Extension data retrieved successfully.
* @retval RETURN_INVALID_PARAMETER If cert is NULL.
* If extension_data_size is NULL.
* If extension_data is not NULL and *extension_data_size is 0.
* If Certificate is invalid.
* @retval RETURN_NOT_FOUND If no Extension entry match oid.
* @retval RETURN_BUFFER_TOO_SMALL If the extension_data is NULL. The required buffer size
* is returned in the extension_data_size parameter.
* @retval RETURN_UNSUPPORTED The operation is not supported.
* @return true If the returned extension_data_size == 0, it means that cert and oid are valid, but the oid extension is not found;
* If the returned extension_data_size != 0, it means that cert and oid are valid, and the oid extension is found;
* @return false If the returned extension_data_size == 0, it means that cert or oid are invalid;
* If the returned extension_data_size != 0, it means that cert and oid are valid, and the oid extension is found,
* but the store buffer is too small.
**/
bool libspdm_x509_get_extension_data(const uint8_t *cert, size_t cert_size,
const uint8_t *oid, size_t oid_size,
Expand Down

0 comments on commit d65ab08

Please sign in to comment.