Add an API to generate random bytes (platform-dependent entropy sources)
SOPC_CryptoProfile
has a pFnGenRnd
to get random bytes then to avoid initialize a provider with None, we can add a new API dedicated to it. This API could be defined in src/ClientServer/Common/crypto
and it may involve adding an API in src/ClientServer/common/helpers_platform_dep
to get platform-dependent entropy sources for other libraries than mbedtls.
Indeed mbedtls is smart and directly looks in the host system to get the entropy sources:
mbedtls_null_entropy_poll
and mbedtls_hardclock_poll
are used in S2OPC for standards like the /dev/urandom or Windows CryptoAPI. These sources are added when the entropy context is initialized by mbedtls_entropy_init
.
An API has been added, see the MR !1156 (merged). For the moment the implementation is only for Linux, and the entropy is retrieved in the /dev/urandom
file.