tpm2-software/tpm2-tss

Configuring DBus session using TPM2TSS_TCTI environment variable

abdawoud opened this issue · 1 comments

Hi,

TPM2TOOLS_TCTI and TPM2OPENSSL_TCTI work just fine to configure usage of session DBus, is there a TPM2TSS_TCTI equivalent?

e.g., export TPM2TSS_TCTI=tabrmd:bus_name=com.intel.tss2.Tabrmd,bus_type=session

Thank you!

Not really.

The System API is not smart like that. You pass a certain TCTI context to Tss2_Sys_Initialize() call and that's it.

TSS2_RC Tss2_Sys_Initialize(
TSS2_SYS_CONTEXT *sysContext,
size_t contextSize,
TSS2_TCTI_CONTEXT *tctiContext,
TSS2_ABI_VERSION *abiVersion)
{
_TSS2_SYS_CONTEXT_BLOB *ctx = syscontext_cast(sysContext);
if (!ctx || !tctiContext)
return TSS2_SYS_RC_BAD_REFERENCE;

The Enhanced System API is much more smart. It uses tctildr, but that does not support environment variables, afaik.

/** Initialize an ESYS_CONTEXT for further use.
*
* Initialize an ESYS_CONTEXT that holds all the state and metadata information
* during an interaction with the TPM.
* If not specified, load a TCTI in this order:
* Library libtss2-tcti-default.so (link to the preferred TCTI)
* Library libtss2-tcti-tabrmd.so (tabrmd)
* Device /dev/tpmrm0 (kernel resident resource manager)
* Device /dev/tpm0 (hardware TPM)
* TCP socket localhost:2321 (TPM simulator)
* @param esys_context [out] The ESYS_CONTEXT.
* @param tcti [in] The TCTI context used to connect to the TPM (may be NULL).
* @param abiVersion [in,out] The abi version to check and the abi version
* supported by this implementation (may be NULL).
* @retval TSS2_ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if esysContext is NULL.
* @retval TSS2_ESYS_RC_MEMORY if the ESAPI cannot allocate enough memory to
* create the context.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
TSS2_RC
Esys_Initialize(ESYS_CONTEXT ** esys_context, TSS2_TCTI_CONTEXT * tcti,
TSS2_ABI_VERSION * abiVersion)
{

The Feature API is configured via its config file. Here, you could set the path of the config file via the env variable TSS2_FAPICONF.

* tcti: The TCTI interface which will be used.

The tests can be configured via the env. variable TPM20TEST_TCTI_NAME, but i assume that is not what you're looking for.