-
Notifications
You must be signed in to change notification settings - Fork 364
TCTI loader library
This is a proposal to add to the core TCTI specification a new library to automate the TCTI lifecycle. This requires a very limited set of functionality:
- A function to automate loading and initialization of available TCTI libraries from name / config strings
- A function to automate unloading and finalizing TCTI contexts
- A new library with header
This library will be referred to as tss2-tcti-ldr
for the remainder of this document. This is a "working name" and will probably change.
- The addition of this new library should have no impact on the existing TCTI header. No changes are made to the TCTI structure (no v3 structure). This is implied by the previous point but we state it explicitly for clarity.
- The
tss2-tcti-ldr
library is intended to be a peer to thetss2-esys
library and is intended for use by implementations of theEsys_Initialize
function or users of this function who need to initialize a TCTI instance for use with theEsys_Initialize
function. As such, implementations are constrained by the same functional requirements astss2-esys
.
Applications using the full set of TCTI features must currently implement the following in order to instantiate a TCTI context:
- discovery:
- mapping a name (string) to a TCTI library
- loading the library
- obtaining the TCTI info structure and thus a reference to the init function
- context allocation & initialization
- invoking the initialization function to determine the size of the TCTI context
- allocating memory for the TCTI context
- invoking the initialization function a second time to initialize the TCTI context
- deallocation & finalization
- finalize the TCTI context
- unload the TCTI library
This creates not only duplicate effort (we already have 2 implementations) but could also create incompatibility in TCTI library discovery algorithms. We expect this to be most hazardous for OS vendors that may want to configure their TSS2 plumbing in a way that we haven't anticipated.
TSS2_RC
Tss2_Tcti_Ldr_Init (const char *name,
const char *conf,
TSS2_TCTI_CONTEXT **context);
By providing a single function that wraps all details of TCTI discovery, allocation and initialization we provide the most simple interface possible. This function takes the name of the TCTI library, a configuration string, and a reference to a reference to a TSS2_TCTI_CONTEXT
structure.
- name: The name of the TCTI library, (
<name>
as defined in section 3.4 of the TCTI spec?) The resolution fromname
to library file follows the same rules as the underlying dynamic linker (dlopen on Linux, LoadLibrary on Windows) with one additional rule: A short name may be provided. It must be a substring of the recommended naming of TCTI libraries matching the patternlibtss2-tcti-<name>.SO
. Also consider allowing use of the string "default", requiring OS provide mechanism to resolve this to some platform default. - conf: The configuration string passed to the TCTI initialization function.
- context: A
TSS2_TCTI_CONTEXT**
used to return a reference to the allocated and initialized TCTI context back to the caller.
The Finalize
function is the dual of the Initialize
function above. Finalize
is required as a mechanism to clean up whatever resources were reserved or allocated by the Init
function. This function is separate from the finalize
function from a specific TCTI though when invoked it MUST call the finalize function for the underlying TCTI context.
void Tss2_Tcti_Util_Finalize (TSS2_TCTI_CONTEXT *context);