Bug 228967 - www/squid-devel Broken with LibreSSL 2.7
Summary: www/squid-devel Broken with LibreSSL 2.7
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Martin Wilke
URL:
Keywords:
: 231115 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-06-12 17:55 UTC by Dean E. Weimer
Modified: 2018-10-01 16:43 UTC (History)
7 users (show)

See Also:
bugzilla: maintainer-feedback? (timp87)


Attachments
Build Failure Output (677.07 KB, text/plain)
2018-06-12 17:55 UTC, Dean E. Weimer
no flags Details
patch-bio.cc (497 bytes, text/plain)
2018-06-21 15:38 UTC, Walter Schwarzenfeld
no flags Details
patch-bio.cc_v2 (498 bytes, text/plain)
2018-06-21 15:43 UTC, Walter Schwarzenfeld
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dean E. Weimer 2018-06-12 17:55:45 UTC
Created attachment 194203 [details]
Build Failure Output

Broken with LibreSSL 2.7 build output is attached.
Comment 1 Pavel Timofeev 2018-06-20 14:17:32 UTC
Could you try https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229181?
Comment 2 Dean E. Weimer 2018-06-20 19:25:19 UTC
(In reply to timp87 from comment #1)
Still Doesn't Succeed on LibreSSL 2.7.4, I wouldn't hold up the update to 4.0.25, if it builds cleanly with OpenSSL.
Comment 3 Walter Schwarzenfeld freebsd_triage 2018-06-20 21:17:03 UTC
/usr/ports/www/squid-devel/work/squid-4.0.24/src/ssl/bio.cc
     66 BIO *
     67 Ssl::Bio::Create(const int fd, Security::Io::Type type)
     68 {
     69 #if HAVE_LIBCRYPTO_BIO_METH_NEW
     70     if (!SquidMethods) {
     71         SquidMethods = BIO_meth_new(BIO_TYPE_SOCKET, "squid");
     72         BIO_meth_set_write(SquidMethods, squid_bio_write);
     73         BIO_meth_set_read(SquidMethods, squid_bio_read);
     74         BIO_meth_set_puts(SquidMethods, squid_bio_puts);
     75         BIO_meth_set_gets(SquidMethods, NULL);
     76         BIO_meth_set_ctrl(SquidMethods, squid_bio_ctrl);
     77         BIO_meth_set_create(SquidMethods, squid_bio_create);
     78         BIO_meth_set_destroy(SquidMethods, squid_bio_destroy);
     79     }
 =>    80     const BIO_METHOD *useMethod = SquidMethods;
     81 #else
     82     BIO_METHOD *useMethod = &SquidMethods;
     83 #endif

If I remove const, it compiles fine.

I don't know the correct solution, but I guess it is to set HAVE_LIBCRYPTO_BIO_METH_NEW to the right value.
Comment 4 Walter Schwarzenfeld freebsd_triage 2018-06-20 21:18:46 UTC
No, the last line I wrote is not logical (HAVE_LIBCRYPTO_BIO_METH_NEW....)
Comment 5 Walter Schwarzenfeld freebsd_triage 2018-06-20 21:22:26 UTC
Maybe:
#if USE_OPENSSL
     const BIO_METHOD *useMethod = SquidMethods;
#endif

#if USE_LIBRESSL
    BIO_METHOD *useMethod = SquidMethods;
#endif
Comment 6 Walter Schwarzenfeld freebsd_triage 2018-06-20 22:32:05 UTC
No, does not work.

But this is working:
#if defined(LIBRESSL_VERSION_NUMBER)
    BIO_METHOD *useMethod = SquidMethods;
#else
    const BIO_METHOD *useMethod = SquidMethods;
#endif
Comment 7 Dean E. Weimer 2018-06-21 12:49:34 UTC
(In reply to w.schwarzenfeld from comment #6)

That worked for me as well with libressl, built in test environment. in process of rebuilding actual running jail with libressl to try it in use.

It did fail when I tried to rebuild under opnessl though.

libtool: link: ( cd ".libs" && rm -f "libsslutil.la" && ln -s "../libsslutil.la" "libsslutil.la" )
--- bio.lo ---
bio.cc:86:28: error: use of undeclared identifier 'useMethod'
    if (BIO *bio = BIO_new(useMethod)) {
                           ^
1 error generated.
*** [bio.lo] Error code 1


Added this to original patch:
squid-devel/files/patch-src_ssl_bio.cc

--- src/ssl/bio.cc.orig      2018-06-21 07:21:44.684311000 -0500
+++ src/ssl/bio.cc   2018-06-21 07:25:50.930483000 -0500
@@ -76,9 +76,11 @@
         BIO_meth_set_create(SquidMethods, squid_bio_create);
         BIO_meth_set_destroy(SquidMethods, squid_bio_destroy);
     }
-    const BIO_METHOD *useMethod = SquidMethods;
-#else
-    BIO_METHOD *useMethod = &SquidMethods;
+    #if defined(LIBRESSL_VERSION_NUMBER)
+        BIO_METHOD *useMethod = SquidMethods;
+    #else
+        const BIO_METHOD *useMethod = SquidMethods;
+    #endif
 #endif

     if (BIO *bio = BIO_new(useMethod)) {
Comment 8 Dean E. Weimer 2018-06-21 13:13:44 UTC
(In reply to Dean E. Weimer from comment #7)

Completed build in a live environment, running fine, however the issue with OpenSSL needs to be solved, its possible I didn't include the lines correctly, or took out something I wasn't supposed to. from the ssl/bio.ccc file.
Comment 9 Walter Schwarzenfeld freebsd_triage 2018-06-21 13:33:59 UTC
It's thing of the condition, quick idea. Test this one (I don't know if I have time today to test).

#if defined(LIBRESSL_VERSION_NUMBER)
        BIO_METHOD *useMethod = SquidMethods;
#endif
#if !defined(LIBRESSL_VERSION_NUMBER)
        const BIO_METHOD *useMethod = SquidMethods;
#endif
Comment 10 Walter Schwarzenfeld freebsd_triage 2018-06-21 15:38:06 UTC
Created attachment 194460 [details]
patch-bio.cc
Comment 11 Walter Schwarzenfeld freebsd_triage 2018-06-21 15:38:46 UTC
Tested it with 10.4 (with a little "cosmetic" change). Should work.
Comment 12 Walter Schwarzenfeld freebsd_triage 2018-06-21 15:43:56 UTC
Created attachment 194461 [details]
patch-bio.cc_v2

Forget: tested with libressl and openssl.
Was a typo in it.
Comment 13 Dean E. Weimer 2018-06-26 20:23:19 UTC
(In reply to w.schwarzenfeld from comment #12)
Tested with 194461, and no other edits after the 4.0.25 update to the port. built and installed fine on my system running 11.2-RC3 with LibreSSL 2.7.4
Comment 14 Pavel Timofeev 2018-06-29 07:45:32 UTC
Comment on attachment 194461 [details]
patch-bio.cc_v2

no objections
Comment 15 Pavel Timofeev 2018-07-09 06:22:09 UTC
www/squid was update to 4.1. I asked to delete www/squid-devel
So the patch is this PR should be applied to www/squid now.
Comment 16 Dean E. Weimer 2018-07-09 14:53:42 UTC
(In reply to timp87 from comment #15)
I was able to build and install the new www/squid with 4.1 successfully with the the patch in attachment 194461 [details].
Comment 17 takefu 2018-07-13 00:17:39 UTC
(In reply to Dean E. Weimer from comment #16)

r474197 the patch, and build it correctly, the operation seems to be no problem.
Comment 18 Martin Wilke freebsd_committer freebsd_triage 2018-07-27 18:41:18 UTC
looks like fixed in r474197
Comment 19 dewayne 2018-07-30 00:00:41 UTC
(In reply to Dean E. Weimer from comment #16)
Thanks for the patch.  I did require it on FreeBSD 11.2Stable amd64 with LibreSSL 2.7.4 to build squid-4.1_1
Comment 20 Samuel Chow 2018-09-20 19:03:07 UTC
I agree. My port tree is at r477214, and I needed to apply the patch to compile.
Comment 21 Pavel Timofeev 2018-09-22 12:41:32 UTC
Please, follow https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231442
Comment 22 Kurt Jaeger freebsd_committer freebsd_triage 2018-10-01 16:43:33 UTC
*** Bug 231115 has been marked as a duplicate of this bug. ***