diff options
author | David J. Maria <davidjmaria@fb.com> | 2018-08-09 09:52:50 -0700 |
---|---|---|
committer | Tadeusz Struk <tadeusz.struk@intel.com> | 2018-08-10 14:13:38 -0700 |
commit | ad7f78b9dee896c28aa51e0096a73d83affdd0db (patch) | |
tree | c7345d4e4e05ec45435e6e7bf2933bc9898d9d47 /include | |
parent | 4f437009056d7e4ecf6609ad2cd3e70861063c04 (diff) | |
download | tpm2-tss-ad7f78b9dee896c28aa51e0096a73d83affdd0db.tar.gz |
[RFC] ESYS: Add esys_free helper function
Add esys_free, a wrapper around free(), to ESYS when building on Windows.
Having a wrapper around free is best practice when building libraries
on Windows; this is because there is a high chance that the caller
program will be built using a different version of the C runtime
than the library, which means that the program and the library will have
separate heaps. This is an issue because many of the ESYS functions
allocate memory for the caller and expect the caller to free the memory,
but in the case where the caller was built with a different version of
the C runtime, the caller will not be able to free the memory because
it does not have access to the esys heap. esys_free allows the caller
program to have the library free any memory that the caller didn't allocate.
Signed-off-by: David Maria <davidjmaria@fb.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/tss2/tss2_esys.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/tss2/tss2_esys.h b/include/tss2/tss2_esys.h index 63870ed3..fcd374f3 100644 --- a/include/tss2/tss2_esys.h +++ b/include/tss2/tss2_esys.h @@ -3220,6 +3220,13 @@ Esys_Vendor_TCG_Test_Finish( ESYS_CONTEXT *esysContext, TPM2B_DATA **outputData); +/* + * TPM 2.0 ESAPI Helper Functions + */ +void +esys_free( + void *__ptr); + #ifdef __cplusplus } #endif |