1 /**
2  *  Copyright Notice:
3  *  Copyright 2021-2023 DMTF. All rights reserved.
4  *  License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
5  **/
6 
7 #ifndef RESPONDER_SETCERTLIB_H
8 #define RESPONDER_SETCERTLIB_H
9 
10 #include "hal/base.h"
11 #include "internal/libspdm_lib_config.h"
12 #include "library/spdm_return_status.h"
13 #include "industry_standard/spdm.h"
14 
15 #if LIBSPDM_ENABLE_CAPABILITY_SET_CERT_CAP
16 /**
17  * return if current code is running in a trusted environment.
18  *
19  * @retval  true   It is in a trusted environment.
20  * @retval  false  It is not in a trusted environment.
21  **/
22 extern bool libspdm_is_in_trusted_environment();
23 
24 /**
25  * Stores a certificate chain in non-volatile memory.
26  *
27  *
28  * @param[in]  slot_id          The number of slot for the certificate chain.
29  * @param[in]  cert_chain       The pointer for the certificate chain to set.
30  * @param[in]  cert_chain_size  The size of the certificate chain to set.
31  * @param[in]  base_hash_algo   Indicates the negotiated hash algorithm.
32  * @param[in]  base_asym_algo   Indicates the negotiated signing algorithms.
33  *
34  * @retval true   The certificate chain was successfully written to non-volatile memory.
35  * @retval false  Unable to write certificate chain to non-volatile memory.
36  **/
37 extern bool libspdm_write_certificate_to_nvm(uint8_t slot_id, const void * cert_chain,
38                                              size_t cert_chain_size,
39                                              uint32_t base_hash_algo, uint32_t base_asym_algo);
40 
41 #endif /* LIBSPDM_ENABLE_CAPABILITY_SET_CERT_CAP */
42 
43 #endif /* RESPONDER_SETCERTLIB_H */
44