1 /* 2 * SPDX-License-Identifier: BSD-2-Clause 3 * Copyright 2019, Intel Corporation 4 * All rights reserved. 5 */ 6 #ifndef TCTILDR_H 7 #define TCTILDR_H 8 9 #include "tss2_tpm2_types.h" 10 #include "tss2_tcti.h" 11 12 #define TCTI_SUFFIX ".so" 13 #define TCTI_SUFFIX_0 TCTI_SUFFIX".0" 14 #define LIB_PREFIX "lib" 15 #define TCTI_PREFIX LIB_PREFIX"tss2-tcti" 16 #define TCTI_NAME_TEMPLATE TCTI_PREFIX"-%s"TCTI_SUFFIX 17 #define TCTI_NAME_TEMPLATE_0 TCTI_PREFIX"-%s"TCTI_SUFFIX_0 18 #define DEFAULT_TCTI_LIBRARY_NAME TCTI_PREFIX"-default"TCTI_SUFFIX 19 20 #define TCTILDR_MAGIC 0xbc44a31ca74b4aafULL 21 22 typedef void* TSS2_TCTI_LIBRARY_HANDLE; 23 typedef struct { 24 TSS2_TCTI_CONTEXT_COMMON_V2 v2; 25 TSS2_TCTI_LIBRARY_HANDLE library_handle; 26 TSS2_TCTI_INFO *info; 27 TSS2_TCTI_CONTEXT *tcti; 28 } TSS2_TCTILDR_CONTEXT; 29 30 TSS2_RC 31 tcti_from_init(TSS2_TCTI_INIT_FUNC init, 32 const char* conf, 33 TSS2_TCTI_CONTEXT **tcti); 34 TSS2_RC 35 tcti_from_info(TSS2_TCTI_INFO_FUNC infof, 36 const char* conf, 37 TSS2_TCTI_CONTEXT **tcti); 38 TSS2_RC 39 tctildr_conf_parse (const char *name_conf, 40 char *name, 41 char *conf); 42 TSS2_RC 43 tctildr_transmit ( 44 TSS2_TCTI_CONTEXT *tctiContext, 45 size_t command_size, 46 const uint8_t *command_buffer); 47 TSS2_RC 48 tctildr_receive ( 49 TSS2_TCTI_CONTEXT *tctiContext, 50 size_t *response_size, 51 uint8_t *response_buffer, 52 int32_t timeout); 53 void 54 tctildr_finalize ( 55 TSS2_TCTI_CONTEXT *tctiContext); 56 TSS2_RC 57 tctildr_cancel ( 58 TSS2_TCTI_CONTEXT *tctiContext); 59 TSS2_RC 60 tctildr_get_poll_handles ( 61 TSS2_TCTI_CONTEXT *tctiContext, 62 TSS2_TCTI_POLL_HANDLE *handles, 63 size_t *num_handles); 64 TSS2_RC 65 tctildr_set_locality ( 66 TSS2_TCTI_CONTEXT *tctiContext, 67 uint8_t locality); 68 TSS2_RC 69 tctildr_make_sticky ( 70 TSS2_TCTI_CONTEXT *tctiContext, 71 TPM2_HANDLE *handle, 72 uint8_t sticky); 73 TSS2_RC 74 tcti_from_info (TSS2_TCTI_INFO_FUNC infof, 75 const char *conf, 76 TSS2_TCTI_CONTEXT **context); 77 TSS2_RC 78 copy_info (const TSS2_TCTI_INFO *info_src, 79 TSS2_TCTI_INFO *info_dst); 80 81 #endif /* TCTILDR_H */ 82