<div dir="ltr"><div><div><div>When using mingw32 inside cygwin on PC, I get a compilation error:<br><br><font size="1"><b><span style="font-family:monospace,monospace">./libtool
--tag=CC --mode=compile i686-pc-mingw32-gcc -I.
-I/usr/local/ssl/include -g -O2 -flto -pthread -o net_help.lo -c
util/net_help.c<br>libtool: compile: i686-pc-mingw32-gcc -I.
-I/usr/local/ssl/include -g -O2 -flto -pthread -c util/net_help.c
-DDLL_EXPORT -DPIC -o .libs/net_help.o<br>util/net_help.c: In function 'ub_crypto_id_cb':<br>util/net_help.c:768:2: error: aggregate value used where an integer was expected</span></b></font><br><br></div>This is because it appears unbound assumes pthread_t will fit inside an unsigned long, but mingw32 defines it thusly:<br><b><span style="font-family:monospace,monospace"><font size="1"><br>/*<br> * Generic handle type - intended to extend uniqueness beyond<br> * that available with a simple pointer. It should scale for either<br> * IA-32 or IA-64.<br> */<br>typedef struct {<br> void * p; /* Pointer to actual object */<br> unsigned int x; /* Extra information - reuse count etc */<br>} ptw32_handle_t;<br><br>typedef ptw32_handle_t pthread_t;</font></span></b><br><br></div>So the<b><font size="1"><span style="font-family:monospace,monospace"> void CRYPTO_set_id_callback(unsigned long (*func)(void));</span></font></b>
API provided by openssl doesn't seem to work here. However, in the
crypto.h header file provided by openssl I also see the following APIs:<br><br><font size="1"><b><span style="font-family:monospace,monospace">/* Don't use this structure directly. */<br>typedef struct crypto_threadid_st<br> {<br> void *ptr;<br> unsigned long val;<br> } CRYPTO_THREADID;<br>/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */<br>void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val);<br>void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr);<br>int CRYPTO_THREADID_set_callback(void (*threadid_func)(CRYPTO_THREADID *));<br>void (*CRYPTO_THREADID_get_callback(void))(CRYPTO_THREADID *);<br>void CRYPTO_THREADID_current(CRYPTO_THREADID *id);<br>int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b);<br>void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src);<br>unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id);</span></b></font></div><br>Presumably
these could be used to rewrite the code path that's apparently assuming
an unsigned long at the moment. Should unbound be converted over to
use these APIs?</div>