Skip to content

Commit 48a3568

Browse files
committed
Split up mp_rand_source.c
In order to make `helper.pl` happy, change the ternary operator to an if-else statement, otherwise it won't properly generate `tommath_class.h`. This fixes #582 This closes #583 Signed-off-by: Steffen Jaeckel <[email protected]>
1 parent a1f1c5f commit 48a3568

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

mp_rand_source.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#include "tommath_private.h"
2-
#ifdef MP_RAND_C
2+
#ifdef MP_RAND_SOURCE_C
33
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
44
/* SPDX-License-Identifier: Unlicense */
5-
6-
mp_err(*s_mp_rand_source)(void *out, size_t size) = s_mp_rand_platform;
7-
85
void mp_rand_source(mp_err(*source)(void *out, size_t size))
96
{
10-
s_mp_rand_source = (source == NULL) ? s_mp_rand_platform : source;
7+
if (source == NULL)
8+
s_mp_rand_source = s_mp_rand_platform;
9+
else
10+
s_mp_rand_source = source;
1111
}
1212
#endif

s_mp_rand_source.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "tommath_private.h"
2+
#ifdef S_MP_RAND_SOURCE_C
3+
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
4+
/* SPDX-License-Identifier: Unlicense */
5+
6+
mp_err(*s_mp_rand_source)(void *out, size_t size) = s_mp_rand_platform;
7+
#endif

tommath_superclass.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
# define MP_RADIX_SIZE_OVERESTIMATE_C
3232
# define MP_LOG_N_C
3333
# define MP_RAND_C
34+
# define MP_RAND_SOURCE_C
3435
# define MP_REDUCE_C
3536
# define MP_REDUCE_2K_L_C
3637
# define MP_FROM_SBIN_C

0 commit comments

Comments
 (0)