Commit 56fb5e4a9a4c193d0fc70d580c83421136a878c6

Daniel Mendler 2019-05-08T15:17:37

mp_rand_source(NULL) sets to platform random source

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/bn_mp_rand.c b/bn_mp_rand.c
index 6eae93c..f0954a0 100644
--- a/bn_mp_rand.c
+++ b/bn_mp_rand.c
@@ -165,7 +165,7 @@ static int (*s_rand_source)(void *, size_t) = s_mp_rand_source_platform;
 
 void mp_rand_source(int (*get)(void *out, size_t size))
 {
-   s_rand_source = get;
+   s_rand_source = get == NULL ? s_mp_rand_source_platform : get;
 }
 
 /* makes a pseudo-random int of a given size */