diff libtommath/bn_mp_rand.c @ 1748:34d9d3c022ce

Use Dropbear's random source rather than libtommath's platform
author Matt Johnston <matt@ucc.asn.au>
date Mon, 19 Oct 2020 22:49:19 +0800
parents 1051e4eea25a
children
line wrap: on
line diff
--- a/libtommath/bn_mp_rand.c	Mon Oct 19 21:38:20 2020 +0800
+++ b/libtommath/bn_mp_rand.c	Mon Oct 19 22:49:19 2020 +0800
@@ -3,11 +3,13 @@
 /* LibTomMath, multiple-precision integer library -- Tom St Denis */
 /* SPDX-License-Identifier: Unlicense */
 
-mp_err(*s_mp_rand_source)(void *out, size_t size) = s_mp_rand_platform;
+/* Dropbear sets this separately, avoid platform code */
+mp_err(*s_mp_rand_source)(void *out, size_t size) = NULL;
 
 void mp_rand_source(mp_err(*source)(void *out, size_t size))
 {
-   s_mp_rand_source = (source == NULL) ? s_mp_rand_platform : source;
+   /* Dropbear, don't reset to platform if source==NULL */
+   s_mp_rand_source = source;
 }
 
 mp_err mp_rand(mp_int *a, int digits)