From 4c5b8fb6d62fc0428415ca50f797c2e6471172b9 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Mon, 19 Oct 2020 22:49:19 +0800 Subject: Use Dropbear's random source rather than libtommath's platform --- crypto_desc.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'crypto_desc.c') diff --git a/crypto_desc.c b/crypto_desc.c index 0f946fc..50b63dc 100644 --- a/crypto_desc.c +++ b/crypto_desc.c @@ -3,11 +3,18 @@ #include "crypto_desc.h" #include "ltc_prng.h" #include "ecc.h" +#include "dbrandom.h" #if DROPBEAR_LTC_PRNG int dropbear_ltc_prng = -1; #endif +/* Wrapper for libtommath */ +static mp_err dropbear_rand_source(void* out, size_t size) { + genrandom((unsigned char*)out, (unsigned int)size); + return MP_OKAY; +} + /* Register the compiled in ciphers. * This should be run before using any of the ciphers/hashes */ @@ -67,6 +74,8 @@ void crypto_init() { } #endif + mp_rand_source(dropbear_rand_source); + #if DROPBEAR_ECC ltc_mp = ltm_desc; dropbear_ecc_fill_dp(); -- cgit v1.2.3