Bug 259688

Summary: databases/memcached: 1.6.12 fails to build with ssl=libressl: error: use of undeclared identifier 'TLS1_3_VERSION'
Product: Ports & Packages Reporter: lysfjord.daniel
Component: Individual Port(s)Assignee: Steve Wills <swills>
Status: Closed FIXED    
Severity: Affects Some People CC: brnrd, swills
Priority: --- Keywords: needs-qa
Version: LatestFlags: koobs: maintainer-feedback? (brnrd)
koobs: maintainer-feedback? (swills)
koobs: merge-quarterly?
Hardware: Any   
OS: Any   
Attachments:
Description Flags
poudriere build log for databases/memcached-1.6.12
none
patch for tls.c to check if LIBRESSL_VERSION is above 3.4, else disable TLS1.3
none
patch for memcached.c to check if LIBRESSL_VERSION is above 3.4, else disable TLS1.3
none
patch for tls.c, checking if TLS1_3_VERSION is defined before enabling it
none
patch for memcached.c, checking if TLS1_3_VERSION is defined before enabling it none

Description lysfjord.daniel 2021-11-07 00:24:32 UTC
Created attachment 229337 [details]
poudriere build log for databases/memcached-1.6.12

As per summary, the compile failes with the following lines:

memcached.c:4020:59: error: use of undeclared identifier 'TLS1_3_VERSION'
           ssl_proto_text(TLS1_2_VERSION), ssl_proto_text(TLS1_3_VERSION));
                                                          ^
memcached.c:5418:52: error: use of undeclared identifier 'TLS1_3_VERSION'
                        settings.ssl_min_version = TLS1_3_VERSION;


No surprise, as the code is having the following checks in multiple places:
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2021-11-07 00:32:37 UTC
Is this issue reproducible (same or different build issue), with any other ssl= values ?
Comment 2 lysfjord.daniel 2021-11-07 01:36:09 UTC
(In reply to Kubilay Kocak from comment #1)

Builds just fine with openssl when commenting out the line DEFAULT_VERSIONS+= ssl=libressl from make.conf
Comment 3 lysfjord.daniel 2021-11-07 02:22:49 UTC
(In reply to Kubilay Kocak from comment #1)
Also builds just fine with DEFAULT_VERSIONS+= ssl=openssl (aka. from ports)
Comment 4 lysfjord.daniel 2021-11-07 02:50:53 UTC
(In reply to Kubilay Kocak from comment #1)
Also builds fine with DEFAULT_VERSIONS+= ssl=libressl-devel. I guess they have implemented the public interfaces for TLS1.3 in version 3.4.
Comment 5 lysfjord.daniel 2021-11-07 14:56:15 UTC
Created attachment 229345 [details]
patch for tls.c to check if LIBRESSL_VERSION is above 3.4, else disable TLS1.3
Comment 6 lysfjord.daniel 2021-11-07 14:56:39 UTC
Created attachment 229346 [details]
patch for memcached.c to check if LIBRESSL_VERSION is above 3.4, else disable TLS1.3
Comment 7 lysfjord.daniel 2021-11-07 14:57:53 UTC
Added patches for tls.c and memcached.c to check for LIBRESSL_VERSION >= 3040000fL (this version number might not be the correct one, but, sometime during 3.4 they added the public interfaces for TLS1_3)..
Comment 8 Steve Wills freebsd_committer freebsd_triage 2021-11-07 16:22:16 UTC
(In reply to lysfjord.daniel from comment #7)
Thanks, I'll try to take a look and commit these soon. In the mean time, can you please send these upstream as well? Upstream tends to be fairly responsive.

https://github.com/memcached/memcached

Thanks
Comment 9 Bernard Spil freebsd_committer freebsd_triage 2021-11-07 17:27:50 UTC
Just when I'm about to update security/libressl to 3.4.1...
Comment 10 lysfjord.daniel 2021-11-07 22:02:17 UTC
(In reply to Steve Wills from comment #8)

Again, the version supplied in the patches might not be the correct ones.. I haven't checked the libressl patches to find *when* they implemented this.. I guess 3040100fL works, as that's what libressl-devel is currently at.
Comment 11 lysfjord.daniel 2021-11-09 18:22:03 UTC
Fix incoming from upstream.
Comment 12 lysfjord.daniel 2021-11-09 18:23:49 UTC
Created attachment 229384 [details]
patch for tls.c, checking if TLS1_3_VERSION is defined before enabling it
Comment 13 lysfjord.daniel 2021-11-09 18:24:31 UTC
Created attachment 229385 [details]
patch for memcached.c, checking if TLS1_3_VERSION is defined before enabling it
Comment 14 lysfjord.daniel 2021-11-10 18:43:17 UTC
(In reply to Bernard Spil from comment #9)
Thanks, now exim is broken instead:)
Comment 15 lysfjord.daniel 2022-01-05 20:25:02 UTC
Fix labeled merged/fixed for next, but still not merged..

https://github.com/memcached/memcached/pull/834
Comment 16 lysfjord.daniel 2022-01-13 18:09:53 UTC
Fixed in 1.6.13 according to upstream. Will close this as soon as I see 1.6.13 in ports.
Comment 17 Steve Wills freebsd_committer freebsd_triage 2022-03-13 20:01:44 UTC
Version 1.6.14 committed:

https://cgit.freebsd.org/ports/commit/?id=a0aac5cb53fde052c66c46504a6cea4065664a17