microsoft / TSS.MSR

The TPM Software Stack from Microsoft Research
Other
428 stars 161 forks source link

LinuxTpmDevice constructor fails on Docker image : DllImport libtss2-tcti-tabrmd.so on Linux #193

Open Degarollo opened 5 months ago

Degarollo commented 5 months ago

https://github.com/microsoft/TSS.MSR/blob/60c26b51cf09a11cd831d8c9fd668b92da0c45a0/TSS.NET/TSS.Net/LinuxTpmDevice.cs#L25

On what I understand, it doesn't seems to be usefull to add "lib" before the library name (as it is a standard naming convensions on linux for library files).

When running on Linux or macOS, the runtime will try prepending lib and appending the canonical shared library extension. On these OSes, library name variations are tried in the following order Source : Library name variations

It can result in having this error message with a double "liblib" (liblibtss2-tcti-tabrmd.so) when the exact file is not found (for example if the library file is libtss2-tcti-tabrmd.so.0, or libtss2-tcti-tabrmd.so.0.0.0):

Exception while loading tpm2-abrmd: System.DllNotFoundException: Unable to load shared library 'libtss2-tcti-tabrmd.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibtss2-tcti-tabrmd.so: cannot open shared object file: No such file or directory

My quickfix is to :

Is there a better workaround?

Thank you in advance