diff options
author | Matt Johnston <matt@ucc.asn.au> | 2020-10-19 22:49:19 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2020-10-19 22:49:19 +0800 |
commit | 4c5b8fb6d62fc0428415ca50f797c2e6471172b9 (patch) | |
tree | 122ea60bef8e9c7d4e5306ac44c662ccf455748a /libtommath | |
parent | d5cc5eb25cace6499468292e1d2c3ddb6eeac15b (diff) |
Use Dropbear's random source rather than libtommath's platform
Diffstat (limited to 'libtommath')
-rw-r--r-- | libtommath/bn_mp_rand.c | 6 | ||||
-rw-r--r-- | libtommath/tommath_class.h | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/libtommath/bn_mp_rand.c b/libtommath/bn_mp_rand.c index 7e9052c..110efe3 100644 --- a/libtommath/bn_mp_rand.c +++ b/libtommath/bn_mp_rand.c @@ -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) diff --git a/libtommath/tommath_class.h b/libtommath/tommath_class.h index 19bef02..7e02515 100644 --- a/libtommath/tommath_class.h +++ b/libtommath/tommath_class.h @@ -1316,6 +1316,8 @@ #undef BN_S_MP_KARATSUBA_SQR_C #undef BN_S_MP_TOOM_MUL_C #undef BN_S_MP_TOOM_SQR_C +/* Dropbear uses its own random source */ +#undef BN_S_MP_RAND_PLATFORM_C #include "dbmalloc.h" #define MP_MALLOC m_malloc |