Fails to build with openssl 1.1 on Windows
lazka opened this issue · comments
X509_LOOKUP and X509_LOOKUP_METHOD structs are opaque now from what I can see.
$ make
make all-am
make[1]: Entering directory '/home/xy/M/mingw-w64-opusfile/src/build-i686-w64-mingw32'
CC src/libopusurl_la-wincerts.lo
../opusfile-0.11/src/wincerts.c: In function 'op_capi_new':
../opusfile-0.11/src/wincerts.c:42:8: error: dereferencing pointer to incomplete type 'X509_LOOKUP {aka struct x509_lookup_st}'
_lu->method_data=(char *)h_store;
^~
../opusfile-0.11/src/wincerts.c: In function 'op_capi_retrieve_by_subject':
../opusfile-0.11/src/wincerts.c:61:3: warning: implicit declaration of function 'CRYPTO_w_lock'; did you mean 'CRYPTO_zalloc'? [-Wimplicit-function-declaration]
CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
^~~~~~~~~~~~~
CRYPTO_zalloc
../opusfile-0.11/src/wincerts.c:61:17: error: 'CRYPTO_LOCK_X509_STORE' undeclared (first use in this function); did you mean 'CRYPTO_EX_INDEX_X509_STORE'?
CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
^~~~~~~~~~~~~~~~~~~~~~
CRYPTO_EX_INDEX_X509_STORE
../opusfile-0.11/src/wincerts.c:61:17: note: each undeclared identifier is reported only once for each function it appears in
../opusfile-0.11/src/wincerts.c:63:3: warning: implicit declaration of function 'CRYPTO_w_unlock'; did you mean 'CRYPTO_realloc'? [-Wimplicit-function-declaration]
CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
^~~~~~~~~~~~~~~
CRYPTO_realloc
../opusfile-0.11/src/wincerts.c:65:9: error: dereferencing pointer to incomplete type 'X509_OBJECT {aka struct x509_object_st}'
_ret->type=obj->type;
^~
../opusfile-0.11/src/wincerts.c: In function 'op_capi_get_by_subject':
../opusfile-0.11/src/wincerts.c:76:11: error: dereferencing pointer to incomplete type 'X509_NAME {aka struct X509_name_st}'
if(_name->bytes==NULL||_name->bytes->length<=0||_name->modified){
^~
../opusfile-0.11/src/wincerts.c: At top level:
../opusfile-0.11/src/wincerts.c:147:1: error: variable 'X509_LOOKUP_CAPI' has initializer but incomplete type
static X509_LOOKUP_METHOD X509_LOOKUP_CAPI={
^~~~~~
../opusfile-0.11/src/wincerts.c:148:3: warning: excess elements in struct initializer
"Load Crypto API store into cache",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../opusfile-0.11/src/wincerts.c:148:3: note: (near initialization for 'X509_LOOKUP_CAPI')
../opusfile-0.11/src/wincerts.c:149:3: warning: excess elements in struct initializer
op_capi_new,
^~~~~~~~~~~
../opusfile-0.11/src/wincerts.c:149:3: note: (near initialization for 'X509_LOOKUP_CAPI')
../opusfile-0.11/src/wincerts.c:150:3: warning: excess elements in struct initializer
op_capi_free,
^~~~~~~~~~~~
../opusfile-0.11/src/wincerts.c:150:3: note: (near initialization for 'X509_LOOKUP_CAPI')
../opusfile-0.11/src/wincerts.c:151:3: warning: excess elements in struct initializer
NULL,
^~~~
../opusfile-0.11/src/wincerts.c:151:3: note: (near initialization for 'X509_LOOKUP_CAPI')
../opusfile-0.11/src/wincerts.c:152:3: warning: excess elements in struct initializer
NULL,
^~~~
../opusfile-0.11/src/wincerts.c:152:3: note: (near initialization for 'X509_LOOKUP_CAPI')
../opusfile-0.11/src/wincerts.c:153:3: warning: excess elements in struct initializer
NULL,
^~~~
../opusfile-0.11/src/wincerts.c:153:3: note: (near initialization for 'X509_LOOKUP_CAPI')
../opusfile-0.11/src/wincerts.c:154:3: warning: excess elements in struct initializer
op_capi_get_by_subject,
^~~~~~~~~~~~~~~~~~~~~~
../opusfile-0.11/src/wincerts.c:154:3: note: (near initialization for 'X509_LOOKUP_CAPI')
../opusfile-0.11/src/wincerts.c:155:3: warning: excess elements in struct initializer
NULL,
^~~~
../opusfile-0.11/src/wincerts.c:155:3: note: (near initialization for 'X509_LOOKUP_CAPI')
../opusfile-0.11/src/wincerts.c:156:3: warning: excess elements in struct initializer
NULL,
^~~~
../opusfile-0.11/src/wincerts.c:156:3: note: (near initialization for 'X509_LOOKUP_CAPI')
../opusfile-0.11/src/wincerts.c:157:3: warning: excess elements in struct initializer
NULL
^~~~
../opusfile-0.11/src/wincerts.c:157:3: note: (near initialization for 'X509_LOOKUP_CAPI')
../opusfile-0.11/src/wincerts.c:147:27: error: storage size of 'X509_LOOKUP_CAPI' isn't known
static X509_LOOKUP_METHOD X509_LOOKUP_CAPI={
^~~~~~~~~~~~~~~~
make[1]: *** [Makefile:671: src/libopusurl_la-wincerts.lo] Error 1
make[1]: Leaving directory '/home/xy/M/mingw-w64-opusfile/src/build-i686-w64-mingw32'
make: *** [Makefile:463: all] Error 2
Here is a patch for anyone facing the same problem (by just disabling the cert store integration):
diff -Nur opusfile-0.11/src/http.c opusfile-0.11-patched/src/http.c
--- opusfile-0.11/src/http.c 2018-09-14 23:25:45.000000000 +0200
+++ opusfile-0.11-patched/src/http.c 2018-09-27 15:42:55.161531800 +0200
@@ -327,10 +327,12 @@
typedef ptrdiff_t ssize_t;
# endif
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
/*Load certificates from the built-in certificate store.*/
int SSL_CTX_set_default_verify_paths_win32(SSL_CTX *_ssl_ctx);
# define SSL_CTX_set_default_verify_paths \
SSL_CTX_set_default_verify_paths_win32
+#endif
# else
/*Normal Berkeley sockets.*/
diff -Nur opusfile-0.11/src/wincerts.c opusfile-0.11-patched/src/wincerts.c
--- opusfile-0.11/src/wincerts.c 2017-04-22 06:01:35.000000000 +0200
+++ opusfile-0.11-patched/src/wincerts.c 2018-09-27 15:42:23.832739900 +0200
@@ -33,6 +33,8 @@
# include <openssl/err.h>
# include <openssl/x509.h>
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+
static int op_capi_new(X509_LOOKUP *_lu){
HCERTSTORE h_store;
h_store=CertOpenStore(CERT_STORE_PROV_SYSTEM_A,0,0,
@@ -171,3 +173,4 @@
}
#endif
+#endif