Should FAPI work out of the box without poll()?
Closed this issue · 3 comments
tpm2-tss/include/tss2/tss2_fapi.h
Lines 61 to 65 in 74e8294
If I understand this code correctly, it is saying that FAPI can be used on systems without poll()
. I would imagine it will just wait for the TPM chip to respond, making the async functions kinda useless but still being useful as a sync library.
But it's not really possible, because FAPI also calls poll()
unconditionally:
tpm2-tss/src/tss2-fapi/ifapi_io.c
Lines 706 to 710 in 74e8294
This code is not inside an #ifdef
. It is also in a file that is needed for fapi to work at all. So it seems to me that there's no way to disable this, apart from resorting to #define poll(...) 0
and the like.
Is FAPI supposed to "just work" on systems that don't have poll()
?
Also, it seems that the typedef to void
doesn't work at all. For example, this does not compile because handles
has type void **
and cannot be dereferenced twice:
tpm2-tss/src/tss2-fapi/ifapi_io.c
Lines 745 to 746 in 74e8294
@Akuli No FAPI should not work out of the box without poll. Also some tctis should not compile in the case :
#else
typedef void TSS2_TCTI_POLL_HANDLE;
#ifndef TSS2_TCTI_SUPPRESS_POLL_WARNINGS
#pragma message "Info: Platform not supported for TCTI_POLL_HANDLES"
In this case compilation is possible after:
./configure --disable-tcti-device --disable-tcti-mssim --disable-tcti-cmd --disable-fapi
@AndreasFuchsTPM @joholl Wouldn't it be better to create an error in this case at least for fapi?
The FAPI API (i.e. include/tss2/tss2-fapi.h) is designed to work on multiple systems, those with poll() being one of such.
The implementation of ifapi-io.c is specific to systems that have poll().
In order to get FAPI working on e.g. Windows, ifapi-io.c would need to be made more flexible, or maybe we would even want to have an ifapi-io-linux.c and an ifapi-io-windows.c