summaryrefslogtreecommitdiffhomepage
path: root/crypto_desc.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2020-10-19 22:49:19 +0800
committerMatt Johnston <matt@ucc.asn.au>2020-10-19 22:49:19 +0800
commit4c5b8fb6d62fc0428415ca50f797c2e6471172b9 (patch)
tree122ea60bef8e9c7d4e5306ac44c662ccf455748a /crypto_desc.c
parentd5cc5eb25cace6499468292e1d2c3ddb6eeac15b (diff)
Use Dropbear's random source rather than libtommath's platform
Diffstat (limited to 'crypto_desc.c')
-rw-r--r--crypto_desc.c9
1 files changed, 9 insertions, 0 deletions
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();