Infineon / linux-optiga-trust-m

Linux tools and examples for OPTIGA™ Trust V1/V3 security solution
MIT License
22 stars 18 forks source link

Inter-process synchronization #16

Closed svenschwermer closed 3 years ago

svenschwermer commented 3 years ago

Why does this repo and its tools use a different inter-process synchronization scheme than trustm_lib/pal/linx/pal_os_lock.c (pal_os_lock_acquire and pal_os_lock_release). I realize that those particular functions are implemented incorrectly, but why does this repo introduce its own locking scheme (implemented twice: trustm_helper/trustm_helper_ipc_lock.c and trustm_engine/trustm_engine_ipc_lock.c) instead of fixing the scheme in the library repo? This makes it really difficult to have an application that uses trustm_lib directly and the OpenSSL engine from this repo side by side.

ayushev commented 3 years ago

'pal_os_lock_acquire' and 'pal_os_lock_release' are typically used in a different environment; e.g. MCU but they can implement real locks (not the default fake) and be called from the application. Is this what you mean?

svenschwermer commented 3 years ago

OK, the documentation doesn't reflect that those functions are meant for platforms other than Linux. Since we also need locking on Linux, why not port the *_ipc_lock.c code to those functions?

ayushev commented 3 years ago

'pal_os_lock.c' is related to the lower layers of the communication stack for some platforms, calling functions from application layer (like this is done right now) from the lower layer of the stack contradicts with the layered nature of the stack, there are some exceptions in the stack I dont deny it, but in this case it is better for the applicaiton to decide. To not confuse users we can simply remove the body of the pla_os_lock functions for Linux platform.