[Crypto] Implement CryptoCore::RandomGenerator.

As a cryptographically secure random generator.

Internally it uses mbedTLS CTR-DRBG implementation which gets re-seeded
with entropy from OS::get_entropy when needed.

CryptoCore now additionally depends on `ctr_drbg.c` and `entropy.c`
thirdparty mbedtls files.
This commit is contained in:
Fabio Alessandrelli
2022-02-08 10:34:43 +01:00
parent 6b5634b96a
commit ee7b67e135
4 changed files with 69 additions and 4 deletions

View File

@ -7,7 +7,12 @@
#define MBEDTLS_AES_C
#define MBEDTLS_BASE64_C
#define MBEDTLS_CTR_DRBG_C
#define MBEDTLS_ENTROPY_C
#define MBEDTLS_MD5_C
#define MBEDTLS_SHA1_C
#define MBEDTLS_SHA256_C
#define MBEDTLS_PLATFORM_ZEROIZE_ALT
#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
#include <limits.h>