Skip to content

Commit

Permalink
Put in extern C blocks in library headers to support use in CPP
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Teoh <[email protected]>
  • Loading branch information
alexteoh-intel authored and jyao1 committed May 31, 2024
1 parent e5eb448 commit ebb408e
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 6 deletions.
8 changes: 8 additions & 0 deletions include/library/spdm_common_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#ifndef SPDM_COMMON_LIB_H
#define SPDM_COMMON_LIB_H

#ifdef __cplusplus
extern "C" {
#endif

#include "internal/libspdm_lib_config.h"
#include "hal/base.h"
#include "library/spdm_secured_message_lib.h"
Expand Down Expand Up @@ -1002,4 +1006,8 @@ typedef libspdm_return_t (*libspdm_vendor_response_callback_func)(

#endif /* LIBSPDM_ENABLE_VENDOR_DEFINED_MESSAGES */

#ifdef __cplusplus
}
#endif

#endif /* SPDM_COMMON_LIB_H */
8 changes: 8 additions & 0 deletions include/library/spdm_crypt_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#ifndef SPDM_CRYPT_LIB_H
#define SPDM_CRYPT_LIB_H

#ifdef __cplusplus
extern "C" {
#endif

#include "internal/libspdm_lib_config.h"

#include "hal/base.h"
Expand Down Expand Up @@ -1121,4 +1125,8 @@ bool libspdm_verify_req_info(uint8_t *req_info, uint16_t req_info_len);
bool libspdm_fips_run_selftest(void *fips_selftest_context);
#endif

#ifdef __cplusplus
}
#endif

#endif /* SPDM_CRYPT_LIB_H */
8 changes: 8 additions & 0 deletions include/library/spdm_requester_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#ifndef SPDM_REQUESTER_LIB_H
#define SPDM_REQUESTER_LIB_H

#ifdef __cplusplus
extern "C" {
#endif

#include "library/spdm_common_lib.h"

/**
Expand Down Expand Up @@ -900,4 +904,8 @@ libspdm_return_t libspdm_vendor_send_request_receive_response(

#endif /* LIBSPDM_ENABLE_VENDOR_DEFINED_MESSAGES */

#ifdef __cplusplus
}
#endif

#endif /* SPDM_REQUESTER_LIB_H */
10 changes: 9 additions & 1 deletion include/library/spdm_responder_lib.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
/**
* 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
**/

#ifndef SPDM_RESPONDER_LIB_H
#define SPDM_RESPONDER_LIB_H

#ifdef __cplusplus
extern "C" {
#endif

#include "library/spdm_common_lib.h"
#include "library/spdm_secured_message_lib.h"

Expand Down Expand Up @@ -294,4 +298,8 @@ libspdm_return_t libspdm_register_vendor_callback_func(void *spdm_context,

#endif /* LIBSPDM_ENABLE_VENDOR_DEFINED_MESSAGES */

#ifdef __cplusplus
}
#endif

#endif /* SPDM_RESPONDER_LIB_H */
4 changes: 2 additions & 2 deletions include/library/spdm_return_status.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 @@ -203,4 +203,4 @@ typedef uint32_t libspdm_return_t;
#define LIBSPDM_STATUS_LOW_ENTROPY \
LIBSPDM_STATUS_CONSTRUCT(LIBSPDM_SEVERITY_ERROR, LIBSPDM_SOURCE_RNG, 0x0000)

#endif
#endif /* SPDM_RETURN_STATUS_H */
10 changes: 9 additions & 1 deletion include/library/spdm_secured_message_lib.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
/**
* Copyright Notice:
* Copyright 2021-2023 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
**/

#ifndef SPDM_SECURED_MESSAGE_LIB_H
#define SPDM_SECURED_MESSAGE_LIB_H

#ifdef __cplusplus
extern "C" {
#endif

#include "hal/base.h"
#include "industry_standard/spdm.h"
#include "industry_standard/spdm_secured_message.h"
Expand Down Expand Up @@ -295,4 +299,8 @@ void libspdm_secured_message_get_last_spdm_error_struct(
void *spdm_secured_message_context,
libspdm_error_struct_t *last_spdm_error);

#ifdef __cplusplus
}
#endif

#endif /* SPDM_SECURED_MESSAGE_LIB_H */
10 changes: 9 additions & 1 deletion include/library/spdm_transport_mctp_lib.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
/**
* 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
**/

#ifndef SPDM_MCTP_TRANSPORT_LIB_H
#define SPDM_MCTP_TRANSPORT_LIB_H

#ifdef __cplusplus
extern "C" {
#endif

#include "library/spdm_common_lib.h"
#include "library/spdm_crypt_lib.h"
#include "industry_standard/mctp.h"
Expand Down Expand Up @@ -138,4 +142,8 @@ uint32_t libspdm_mctp_get_max_random_number_count(void);
spdm_version_number_t libspdm_mctp_get_secured_spdm_version(
spdm_version_number_t secured_message_version);

#ifdef __cplusplus
}
#endif

#endif /* SPDM_MCTP_TRANSPORT_LIB_H */
10 changes: 9 additions & 1 deletion include/library/spdm_transport_pcidoe_lib.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
/**
* 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
**/

#ifndef PCI_DOE_TRANSPORT_LIB_H
#define PCI_DOE_TRANSPORT_LIB_H

#ifdef __cplusplus
extern "C" {
#endif

#include "library/spdm_common_lib.h"
#include "library/spdm_crypt_lib.h"
#include "industry_standard/pcidoe.h"
Expand Down Expand Up @@ -198,4 +202,8 @@ uint32_t libspdm_pci_doe_get_max_random_number_count(void);
spdm_version_number_t libspdm_pci_doe_get_secured_spdm_version(
spdm_version_number_t secured_message_version);

#ifdef __cplusplus
}
#endif

#endif /* PCI_DOE_TRANSPORT_LIB_H */

0 comments on commit ebb408e

Please sign in to comment.