TropicSSL is included in Spark’s firmware, and it provides an implementation of the HAVEGE algorithm for generating pseudo-random numbers.
Does anyone know how effective one can expect this algorithm to be on the Spark Core? Can it provide decent entropy, or does it make more sense to use pre-computed random seeds with another PRNG algorithm?
Hi, sorry for the very delayed response, I’ve only just seen this thread (oh, discourse!)
Our distribution of TropicSSL isn’t a complete implementation - we only include the minimum necessary to support the cloud protocol. Consequently the HAVEGE PRNG isn’t included in our distribution.
However, you can always add the library/havege.c file in your own application. This is probably best rather than relying upon internal details, which may change between releases or different products.
PS: The random seed is set during handshake to a cryptographically secure random number from the cloud. Naturally, subsequent random numbers are only as strong as the PRNG used.
PPS: On the photon, we have access to a true RNG on the STM32F2 via uint32_t HAL_RNG_GetRandomNumber() in rng_hal.h. We are working to exposing this via a more friendlier interface - putting this here now in case it’s useful.