opened 02:02PM - 20 Jul 22 UTC
I build OpenWRT for my wrt3200acm from master and I've been hitting this build e…rror since the commit mentioned in the title.
```
/var/lib/openwrt/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-12.1.0_musl_eabi/lib/gcc/arm-openwrt-linux-muslgnueabi/12.1.0/../../../../arm-openwrt-linux-muslgnueabi/bin/ld: /var/lib/openwrt/tmp/ccTXipBn.ltrans14.ltrans.o: in function `wolfSSL_BN_generate_prime_ex':
<artificial>:(.text+0x404c): undefined reference to `sp_rand_prime'
/var/lib/openwrt/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-12.1.0_musl_eabi/lib/gcc/arm-openwrt-linux-muslgnueabi/12.1.0/../../../../arm-openwrt-linux-muslgnueabi/bin/ld: src/.libs/libwolfssl.so.5.4.0.d242c60a: hidden symbol `sp_rand_prime' isn't defined
/var/lib/openwrt/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-12.1.0_musl_eabi/lib/gcc/arm-openwrt-linux-muslgnueabi/12.1.0/../../../../arm-openwrt-linux-muslgnueabi/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
```
The function sp_rand_prime is defined in wolfcrypt/src/sp_int.c under the following conditionals:
```
#if defined(WOLFSSL_KEY_GEN) && (!defined(NO_DH) || !defined(NO_DSA)) && \
!defined(WC_NO_RNG)
/* Generate a random prime for RSA only.
*
* @param [out] r SP integer to hold result.
* @param [in] len Number of bytes in prime.
* @param [in] rng Random number generator.
* @param [in] heap Heap hint. Unused.
*
* @return MP_OKAY on success
* @return MP_VAL when r or rng is NULL, length is not supported or random
* number generator fails.
*/
int sp_rand_prime(sp_int* r, int len, WC_RNG* rng, void* heap)
...
```
However, we compile sp_int.c with WOLFSSL_KEY_GEN, NO_DH and NO_DSA all defined, so we skip compiling the sp_rand_prime function, leading to the above error.
I've attached the compile log for WolfSSL and my OpenWRT config file.
Please let me know if any other information is required and I'll provide it.
Thanks in advance for looking at this.
Best regards,
- John
[compile.txt](https://github.com/openwrt/openwrt/files/9150474/compile.txt)
[config.txt](https://github.com/openwrt/openwrt/files/9150477/config.txt)