Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to build with openssl 1.1 on Windows #13

Open
lazka opened this issue Sep 25, 2018 · 1 comment
Open

Fails to build with openssl 1.1 on Windows #13

lazka opened this issue Sep 25, 2018 · 1 comment

Comments

@lazka
Copy link

lazka commented Sep 25, 2018

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
@lazka
Copy link
Author

lazka commented Sep 28, 2018

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

@lazka lazka changed the title Fails to build with openssl 1.1 Fails to build with openssl 1.1 on Windows Sep 28, 2018
1480c1 referenced this issue in m-ab-s/media-autobuild_suite Apr 4, 2020
1480c1 added a commit to m-ab-s/mabs-patches that referenced this issue Jul 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant