mirror of
https://github.com/clearml/dropbear
synced 2025-06-26 18:17:32 +00:00
Use Dropbear's random source rather than libtommath's platform
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user