From e04b1231ecde605f1fcd2f8ee3b27052b86a17c9 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Mon, 14 Jul 2014 17:22:14 -0400 Subject: [PATCH 1/2] Fix public header files for c++ Fix the public header files for c++ usage. --- include/libtpms/tpm_library.h.in | 7 +++++++ include/libtpms/tpm_memory.h | 9 +++++++++ include/libtpms/tpm_tis.h | 7 +++++++ include/libtpms/tpm_types.h | 8 ++++++++ 4 files changed, 31 insertions(+) diff --git a/include/libtpms/tpm_library.h.in b/include/libtpms/tpm_library.h.in index 3e5ddba..17a0003 100644 --- a/include/libtpms/tpm_library.h.in +++ b/include/libtpms/tpm_library.h.in @@ -44,6 +44,10 @@ #include "tpm_types.h" +#ifdef __cplusplus +extern "C" { +#endif + #define TPM_LIBRARY_VER_MAJOR @LIBTPMS_VER_MAJOR@ #define TPM_LIBRARY_VER_MINOR @LIBTPMS_VER_MINOR@ #define TPM_LIBRARY_VER_MICRO @LIBTPMS_VER_MICRO@ @@ -124,5 +128,8 @@ enum TPMLIB_BlobType { TPM_RESULT TPMLIB_DecodeBlob(const char *data, enum TPMLIB_BlobType type, unsigned char **result, size_t *result_len); +#ifdef __cplusplus +} +#endif #endif /* TPM_LIBRARY_H */ diff --git a/include/libtpms/tpm_memory.h b/include/libtpms/tpm_memory.h index 9317ef6..69d60b4 100644 --- a/include/libtpms/tpm_memory.h +++ b/include/libtpms/tpm_memory.h @@ -42,8 +42,17 @@ #include "tpm_types.h" +#ifdef __cplusplus +extern "C" { +#endif + TPM_RESULT TPM_Malloc(unsigned char **buffer, uint32_t size); TPM_RESULT TPM_Realloc(unsigned char **buffer, uint32_t size); void TPM_Free(unsigned char *buffer); +#ifdef __cplusplus +} +#endif + + #endif diff --git a/include/libtpms/tpm_tis.h b/include/libtpms/tpm_tis.h index 6d4cf31..2ff30a4 100644 --- a/include/libtpms/tpm_tis.h +++ b/include/libtpms/tpm_tis.h @@ -42,6 +42,10 @@ #include "tpm_types.h" +#ifdef __cplusplus +extern "C" { +#endif + TPM_RESULT TPM_IO_Hash_Start(void); TPM_RESULT TPM_IO_Hash_Data(const unsigned char *data, uint32_t data_length); @@ -49,5 +53,8 @@ TPM_RESULT TPM_IO_Hash_End(void); TPM_RESULT TPM_IO_TpmEstablished_Get(TPM_BOOL *tpmEstablished); +#ifdef __cplusplus +} +#endif #endif diff --git a/include/libtpms/tpm_types.h b/include/libtpms/tpm_types.h index ecb109c..6dea326 100644 --- a/include/libtpms/tpm_types.h +++ b/include/libtpms/tpm_types.h @@ -46,6 +46,10 @@ #include /* for byte order conversions */ #endif +#ifdef __cplusplus +extern "C" { +#endif + /* 2.2.1 Basic data types rev 87 */ typedef unsigned char BYTE; /* Basic byte used to transmit all character fields. */ typedef unsigned char TPM_BOOL; /* TRUE/FALSE field. TRUE = 0x01, FALSE = 0x00 Use TPM_BOOL @@ -135,4 +139,8 @@ typedef uint16_t TPM_TAG; /* The command and response tags */ typedef unsigned char * TPM_SYMMETRIC_KEY_TOKEN; /* abstract symmetric key token */ typedef unsigned char * TPM_BIGNUM; /* abstract bignum */ +#ifdef __cplusplus +} +#endif + #endif -- 1.8.1.4