[Libwebsockets] compile warning - undefined function

Jaco Kroon jaco at uls.co.za
Sun Mar 15 20:15:02 CET 2020

Hi Andy,

On 2020/03/13 18:57, Andy Green wrote:
> On 3/13/20 4:49 PM, Jaco Kroon wrote:
>> Hi Andy,
>> https://bugs.gentoo.org/709508 relates.
>> /var/tmp/portage/net-libs/libwebsockets-3.2.1/work/libwebsockets-3.2.1/lib/tls/openssl/lws-genec.c:
>> In function ‘BN_bn2binpad’:
>> /var/tmp/portage/net-libs/libwebsockets-3.2.1/work/libwebsockets-3.2.1/lib/tls/openssl/lws-genec.c:61:5:
>> error: implicit declaration of function ‘bn_check_top’
>> [-Werror=implicit-function-declaration]
>>     61 |     bn_check_top(a);
>>        |     ^~~~~~~~~~~~
>> cc1: all warnings being treated as errors
>> ninja: build stopped: subcommand failed.
>> I dug through my system quickly and honestly I'm not sure what the
>> best way forward here is.
> This is almost always due to not running, or problems with, the cmake
> part of building lws.  There's definitely no problem building it on
> 1.1.1d on any platform.
>> Looks like bn_check_top is a #define in older versions of OpenSSL.  I
>> can confirm it was in openssl 1.0.1 but no longer in 1.1.1d.
>> Even then it looks like it was a no-op, as in:
>> #define b_check_top(a)
>> Unless BN_DEBUG is defined before including.
>> So may be OK so simply drop that line completely?
>> Alternatively, perhaps wrap the line in #ifdef bn_check_top ...
> Mmm if you look at the actual code it's like this
> #if !defined(LWS_HAVE_BN_bn2binpad)
> int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen)
> {
>     int i;
>     BN_ULONG l;
>     bn_check_top(a);
> ie, it's already wrapped with LWS_HAVE_BN_bn2binpad... 1.1.1d has its
> own bn2binpad, which cmake looks for
Yea.  And because I'm using openssl 1.1.1d and the user of the system
reporting the bug is using libressl ... *boom*.

Anyway, I've reverted to Gentoo's libressl guys, hopefully they'll let
us know what needs to happen, might end being:

+#ifdef bn_check_top

I'm assuming you'll object to that?  Or do you perhaps have some other
alternative suggestion?

Kind Regards,

More information about the Libwebsockets mailing list