Skip to content

Commit eb0bf7c

Browse files
build checks on mp_read_radix
1 parent 9bc3b86 commit eb0bf7c

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/ssl_bn.c

+13
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,18 @@ char* wolfSSL_BN_bn2hex(const WOLFSSL_BIGNUM *bn)
575575
*/
576576
static int wolfssl_bn_radix2bn(WOLFSSL_BIGNUM** bn, const char* str, int radix)
577577
{
578+
#if defined(USE_FAST_MATH) && (!defined(OPENSSL_EXTRA) && defined(NO_DSA) && \
579+
!defined(HAVE_ECC))
580+
/* in this build case mp_read_radix is not available */
581+
WOLFSSL_ENTER("wolfSSL_BN_bn2dec");
582+
WOLFSSL_MSG("BN mp_read_radix not available");
583+
584+
(void)bn;
585+
(void)str;
586+
(void)radix;
587+
588+
return 0;
589+
#else
578590
int ret = 1;
579591
WOLFSSL_BIGNUM* a = NULL;
580592

@@ -608,6 +620,7 @@ static int wolfssl_bn_radix2bn(WOLFSSL_BIGNUM** bn, const char* str, int radix)
608620
*bn = NULL;
609621
}
610622
return ret;
623+
#endif
611624
}
612625

613626
/* Decode hex string into a big number.

wolfcrypt/src/tfm.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -5510,7 +5510,7 @@ static wcchar fp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
55105510
"abcdefghijklmnopqrstuvwxyz+/";
55115511
#endif
55125512

5513-
#if !defined(NO_DSA) || defined(HAVE_ECC)
5513+
#if defined(OPENSSL_EXTRA) || !defined(NO_DSA) || defined(HAVE_ECC)
55145514
#if DIGIT_BIT == 64 || DIGIT_BIT == 32
55155515
static int fp_read_radix_16(fp_int *a, const char *str)
55165516
{

wolfssl/wolfcrypt/tfm.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ MP_API int mp_radix_size (mp_int * a, int radix, int *size);
812812
#define mp_dump(desc, a, verbose)
813813
#endif
814814

815-
#if !defined(NO_DSA) || defined(HAVE_ECC)
815+
#if defined(OPENSSL_EXTRA) || !defined(NO_DSA) || defined(HAVE_ECC)
816816
MP_API int mp_read_radix(mp_int* a, const char* str, int radix);
817817
#endif
818818

0 commit comments

Comments
 (0)