Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-voip/telepathy-gabble/, net-voip/telepathy-gabble/files/
Date: Sun, 02 Dec 2018 20:41:16
Message-Id: 1543783250.ef1871cc2442b12c4b41ad04ff1635786e24e724.asturm@gentoo
1 commit: ef1871cc2442b12c4b41ad04ff1635786e24e724
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Sun Dec 2 20:34:20 2018 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 2 20:40:50 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef1871cc
7
8 net-voip/telepathy-gabble: Fix build with openssl-1.1
9
10 Closes: https://bugs.gentoo.org/658902
11 Package-Manager: Portage-2.3.52, Repoman-2.3.12
12 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
13
14 .../telepathy-gabble-0.18.4-openssl-1.1.patch | 223 +++++++++++++++++++++
15 .../telepathy-gabble-0.18.4-r1.ebuild | 91 +++++++++
16 2 files changed, 314 insertions(+)
17
18 diff --git a/net-voip/telepathy-gabble/files/telepathy-gabble-0.18.4-openssl-1.1.patch b/net-voip/telepathy-gabble/files/telepathy-gabble-0.18.4-openssl-1.1.patch
19 new file mode 100644
20 index 00000000000..0e0d647b700
21 --- /dev/null
22 +++ b/net-voip/telepathy-gabble/files/telepathy-gabble-0.18.4-openssl-1.1.patch
23 @@ -0,0 +1,223 @@
24 +From 68e7fb2f17dd9348e586ef676d8138c4b849a1ce Mon Sep 17 00:00:00 2001
25 +From: Roel Aaij <roel.aaij@××××××.nl>
26 +Date: Fri, 26 Oct 2018 15:01:37 +0200
27 +Subject: [PATCH] openssl: fix build with openssl >= 1.1.0
28 +
29 +---
30 + wocky/wocky-openssl-dh1024.c | 10 ++++++++++
31 + wocky/wocky-openssl-dh2048.c | 10 ++++++++++
32 + wocky/wocky-openssl-dh4096.c | 10 ++++++++++
33 + wocky/wocky-openssl-dh512.c | 10 ++++++++++
34 + wocky/wocky-openssl.c | 38 ++++++++++++++++++++++++++++++++----
35 + 5 files changed, 74 insertions(+), 4 deletions(-)
36 +
37 +diff --git a/lib/ext/wocky/wocky/wocky-openssl-dh1024.c b/lib/ext/wocky/wocky/wocky-openssl-dh1024.c
38 +index b77fb4c..bb50523 100644
39 +--- a/lib/ext/wocky/wocky/wocky-openssl-dh1024.c
40 ++++ b/lib/ext/wocky/wocky/wocky-openssl-dh1024.c
41 +@@ -25,11 +25,21 @@ DH *get_dh1024(void)
42 + 0x02,
43 + };
44 + DH *dh;
45 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
46 ++ int r = 0;
47 ++#endif
48 +
49 + if ((dh=DH_new()) == NULL) return(NULL);
50 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
51 ++ r = DH_set0_pqg(dh, BN_bin2bn(dh1024_p,sizeof(dh1024_p),NULL),
52 ++ NULL, BN_bin2bn(dh1024_g,sizeof(dh1024_g),NULL));
53 ++ if (!r)
54 ++ { DH_free(dh); return(NULL); }
55 ++#else
56 + dh->p=BN_bin2bn(dh1024_p,sizeof(dh1024_p),NULL);
57 + dh->g=BN_bin2bn(dh1024_g,sizeof(dh1024_g),NULL);
58 + if ((dh->p == NULL) || (dh->g == NULL))
59 + { DH_free(dh); return(NULL); }
60 ++#endif
61 + return(dh);
62 + }
63 +diff --git a/lib/ext/wocky/wocky/wocky-openssl-dh2048.c b/lib/ext/wocky/wocky/wocky-openssl-dh2048.c
64 +index c16deb7..d53ceda 100644
65 +--- a/lib/ext/wocky/wocky/wocky-openssl-dh2048.c
66 ++++ b/lib/ext/wocky/wocky/wocky-openssl-dh2048.c
67 +@@ -36,11 +36,21 @@ DH *get_dh2048(void)
68 + 0x02,
69 + };
70 + DH *dh;
71 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
72 ++ int r = 0;
73 ++#endif
74 +
75 + if ((dh=DH_new()) == NULL) return(NULL);
76 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
77 ++ r = DH_set0_pqg(dh, BN_bin2bn(dh2048_p,sizeof(dh2048_p),NULL),
78 ++ NULL, BN_bin2bn(dh2048_g,sizeof(dh2048_g),NULL));
79 ++ if (!r)
80 ++ { DH_free(dh); return(NULL); }
81 ++#else
82 + dh->p=BN_bin2bn(dh2048_p,sizeof(dh2048_p),NULL);
83 + dh->g=BN_bin2bn(dh2048_g,sizeof(dh2048_g),NULL);
84 + if ((dh->p == NULL) || (dh->g == NULL))
85 + { DH_free(dh); return(NULL); }
86 ++#endif
87 + return(dh);
88 + }
89 +diff --git a/lib/ext/wocky/wocky/wocky-openssl-dh4096.c b/lib/ext/wocky/wocky/wocky-openssl-dh4096.c
90 +index 2854385..93fa7e5 100644
91 +--- a/lib/ext/wocky/wocky/wocky-openssl-dh4096.c
92 ++++ b/lib/ext/wocky/wocky/wocky-openssl-dh4096.c
93 +@@ -57,11 +57,21 @@ DH *get_dh4096(void)
94 + 0x02,
95 + };
96 + DH *dh;
97 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
98 ++ int r = 0;
99 ++#endif
100 +
101 + if ((dh=DH_new()) == NULL) return(NULL);
102 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
103 ++ r = DH_set0_pqg(dh, BN_bin2bn(dh4096_p,sizeof(dh4096_p),NULL),
104 ++ NULL, BN_bin2bn(dh4096_g,sizeof(dh4096_g),NULL));
105 ++ if (!r)
106 ++ { DH_free(dh); return(NULL); }
107 ++#else
108 + dh->p=BN_bin2bn(dh4096_p,sizeof(dh4096_p),NULL);
109 + dh->g=BN_bin2bn(dh4096_g,sizeof(dh4096_g),NULL);
110 + if ((dh->p == NULL) || (dh->g == NULL))
111 + { DH_free(dh); return(NULL); }
112 ++#endif
113 + return(dh);
114 + }
115 +diff --git a/lib/ext/wocky/wocky/wocky-openssl-dh512.c b/lib/ext/wocky/wocky/wocky-openssl-dh512.c
116 +index 8e7a278..c2891cd 100644
117 +--- a/lib/ext/wocky/wocky/wocky-openssl-dh512.c
118 ++++ b/lib/ext/wocky/wocky/wocky-openssl-dh512.c
119 +@@ -20,11 +20,21 @@ DH *get_dh512(void)
120 + 0x02,
121 + };
122 + DH *dh;
123 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
124 ++ int r = 0;
125 ++#endif
126 +
127 + if ((dh=DH_new()) == NULL) return(NULL);
128 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
129 ++ r = DH_set0_pqg(dh, BN_bin2bn(dh512_p,sizeof(dh512_p),NULL),
130 ++ NULL, BN_bin2bn(dh512_g,sizeof(dh512_g),NULL));
131 ++ if (!r)
132 ++ { DH_free(dh); return(NULL); }
133 ++#else
134 + dh->p=BN_bin2bn(dh512_p,sizeof(dh512_p),NULL);
135 + dh->g=BN_bin2bn(dh512_g,sizeof(dh512_g),NULL);
136 + if ((dh->p == NULL) || (dh->g == NULL))
137 + { DH_free(dh); return(NULL); }
138 ++#endif
139 + return(dh);
140 + }
141 +diff --git a/lib/ext/wocky/wocky/wocky-openssl.c b/lib/ext/wocky/wocky/wocky-openssl.c
142 +index 2201213..18f9981 100644
143 +--- a/lib/ext/wocky/wocky/wocky-openssl.c
144 ++++ b/lib/ext/wocky/wocky/wocky-openssl.c
145 +@@ -885,7 +885,11 @@ check_peer_name (const char *target, X509 *cert)
146 + int i;
147 + gboolean rval = FALSE;
148 + X509_NAME *subject = X509_get_subject_name (cert);
149 +- X509_CINF *ci = cert->cert_info;
150 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
151 ++ const STACK_OF(X509_EXTENSION)* extensions = X509_get0_extensions(cert);
152 ++#else
153 ++ const STACK_OF(X509_EXTENSION)* extensions = cert->cert_info->extensions;
154 ++#endif
155 + static const long nid[] = { NID_commonName, NID_subject_alt_name, NID_undef };
156 +
157 + /* first, see if the x509 name contains the info we want: */
158 +@@ -906,16 +910,21 @@ check_peer_name (const char *target, X509 *cert)
159 + * and extract the subject_alt_name from the x509 v3 extensions: if that *
160 + * extension is present, and a string, use that. If it is present, and *
161 + * a multi-value stack, trawl it for the "DNS" entry and use that */
162 +- if (!rval && (ci->extensions != NULL))
163 +- for (i = 0; i < sk_X509_EXTENSION_num(ci->extensions) && !rval; i++)
164 ++ if (!rval && (extensions != NULL))
165 ++ for (i = 0; i < sk_X509_EXTENSION_num(extensions) && !rval; i++)
166 + {
167 +- X509_EXTENSION *ext = sk_X509_EXTENSION_value (ci->extensions, i);
168 ++ X509_EXTENSION *ext = sk_X509_EXTENSION_value (extensions, i);
169 + ASN1_OBJECT *obj = X509_EXTENSION_get_object (ext);
170 + X509V3_EXT_METHOD *convert = NULL;
171 + long ni = OBJ_obj2nid (obj);
172 + const guchar *p;
173 + char *value = NULL;
174 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
175 ++ const ASN1_OCTET_STRING* ext_value = X509_EXTENSION_get_data(ext);
176 ++ int len = ASN1_STRING_length(ext_value);
177 ++#else
178 + int len = ext->value->length;
179 ++#endif
180 + void *ext_str = NULL;
181 +
182 + if (ni != NID_subject_alt_name)
183 +@@ -927,7 +936,11 @@ check_peer_name (const char *target, X509 *cert)
184 + if ((convert = (X509V3_EXT_METHOD *) X509V3_EXT_get (ext)) == NULL)
185 + continue;
186 +
187 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
188 ++ p = ASN1_STRING_get0_data(ext_value);
189 ++#else
190 + p = ext->value->data;
191 ++#endif
192 + ext_str = ((convert->it != NULL) ?
193 + ASN1_item_d2i (NULL, &p, len, ASN1_ITEM_ptr(convert->it)) :
194 + convert->d2i (NULL, &p, len) );
195 +@@ -1120,13 +1133,22 @@ _cert_status (WockyTLSSession *session,
196 + X509_STORE *store = SSL_CTX_get_cert_store(session->ctx);
197 + X509 *cert = SSL_get_peer_certificate (session->ssl);
198 + STACK_OF(X509) *chain = SSL_get_peer_cert_chain (session->ssl);
199 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
200 ++ X509_VERIFY_PARAM* param = X509_STORE_get0_param(store);
201 ++ long old_flags = X509_VERIFY_PARAM_get_flags(param);
202 ++#else
203 + long old_flags = store->param->flags;
204 ++#endif
205 + long new_flags = old_flags;
206 + DEBUG("No CRL available, but not in strict mode - re-verifying");
207 +
208 + new_flags &= ~(X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL);
209 +
210 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
211 ++ X509_VERIFY_PARAM_set_flags(param, new_flags);
212 ++#else
213 + store->param->flags = new_flags;
214 ++#endif
215 + X509_STORE_CTX_init (xctx, store, cert, chain);
216 + X509_STORE_CTX_set_flags (xctx, new_flags);
217 +
218 +@@ -1136,7 +1158,11 @@ _cert_status (WockyTLSSession *session,
219 + status = _cert_status (session, new_code, level, ssl_code);
220 + }
221 +
222 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
223 ++ X509_VERIFY_PARAM_set_flags(param, old_flags);
224 ++#else
225 + store->param->flags = old_flags;
226 ++#endif
227 + X509_STORE_CTX_free (xctx);
228 + X509_free (cert);
229 +
230 +@@ -1675,12 +1701,16 @@ wocky_tls_session_init (WockyTLSSession *session)
231 +
232 + if G_UNLIKELY (g_once_init_enter (&initialised))
233 + {
234 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
235 ++ DEBUG ("initialising SSL library and error strings");
236 ++#else
237 + gint malloc_init_succeeded;
238 +
239 + DEBUG ("initialising SSL library and error strings");
240 +
241 + malloc_init_succeeded = CRYPTO_malloc_init ();
242 + g_warn_if_fail (malloc_init_succeeded);
243 ++#endif
244 +
245 + SSL_library_init ();
246 + SSL_load_error_strings ();
247
248 diff --git a/net-voip/telepathy-gabble/telepathy-gabble-0.18.4-r1.ebuild b/net-voip/telepathy-gabble/telepathy-gabble-0.18.4-r1.ebuild
249 new file mode 100644
250 index 00000000000..fee27c8404b
251 --- /dev/null
252 +++ b/net-voip/telepathy-gabble/telepathy-gabble-0.18.4-r1.ebuild
253 @@ -0,0 +1,91 @@
254 +# Copyright 1999-2018 Gentoo Authors
255 +# Distributed under the terms of the GNU General Public License v2
256 +
257 +EAPI=6
258 +# Python is used during build for some scripted source files generation (and twisted tests)
259 +PYTHON_COMPAT=( python2_7 )
260 +
261 +inherit gnome2 python-any-r1
262 +
263 +DESCRIPTION="A XMPP connection manager, handles single and multi user chats and voice calls"
264 +HOMEPAGE="https://telepathy.freedesktop.org/"
265 +SRC_URI="https://telepathy.freedesktop.org/releases/${PN}/${P}.tar.gz"
266 +
267 +LICENSE="LGPL-2.1"
268 +SLOT="0"
269 +KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-linux"
270 +IUSE="gnutls +jingle libressl plugins test"
271 +
272 +# Prevent false positives due nested configure
273 +QA_CONFIGURE_OPTIONS=".*"
274 +
275 +# FIXME: missing sasl-2 for tests ? (automagic)
276 +# missing libiphb for wocky ?
277 +# x11-libs/gtksourceview:3.0 needed by telepathy-gabble-xmpp-console, bug #495184
278 +# Keep in mind some deps or higher minimum versions are in ext/wocky/configure.ac
279 +RDEPEND="
280 + >=dev-libs/glib-2.44:2
281 + >=sys-apps/dbus-1.1.0
282 + >=dev-libs/dbus-glib-0.82
283 + >=net-libs/telepathy-glib-0.19.9
284 +
285 + dev-libs/libxml2
286 + dev-db/sqlite:3
287 +
288 + gnutls? ( >=net-libs/gnutls-2.10.2 )
289 + !gnutls? (
290 + libressl? ( dev-libs/libressl:0= )
291 + !libressl? ( >=dev-libs/openssl-0.9.8g:0=[-bindist] )
292 + )
293 + jingle? (
294 + >=net-libs/libsoup-2.42
295 + >=net-libs/libnice-0.0.11 )
296 + plugins? ( x11-libs/gtksourceview:3.0[introspection] )
297 +
298 + !<net-im/telepathy-mission-control-5.5.0
299 +"
300 +DEPEND="${RDEPEND}
301 + ${PYTHON_DEPS}
302 + dev-util/glib-utils
303 + >=dev-util/gtk-doc-am-1.17
304 + dev-libs/libxslt
305 + virtual/pkgconfig
306 +"
307 +# Twisted tests fail if bad ipv6 setup, upstream bug #30565
308 +# Random twisted tests fail with org.freedesktop.DBus.Error.NoReply for some reason
309 +# pygobject:2 is needed by twisted-17 for gtk2reactor usage by gabble
310 +#test? (
311 +# dev-python/pygobject:2
312 +# || (
313 +# >=dev-python/twisted-16.0.0
314 +# ( >=dev-python/twisted-core-0.8.2
315 +# >=dev-python/twisted-words-0.8.2
316 +# >=dev-python/dbus-python-0.83
317 +# ) )
318 +#)
319 +
320 +PATCHES=(
321 + "${FILESDIR}"/${P}-build-fix-no-jingle.patch # build with USE=-jingle, bug #523230
322 + "${FILESDIR}"/${P}-openssl-1.1.patch # bug #658902
323 +)
324 +
325 +pkg_setup() {
326 + python-any-r1_pkg_setup
327 +}
328 +
329 +src_configure() {
330 + gnome2_src_configure \
331 + --disable-coding-style-checks \
332 + --disable-static \
333 + --disable-Werror \
334 + --enable-file-transfer \
335 + $(use_enable jingle voip) \
336 + $(use_enable jingle google-relay) \
337 + $(use_enable plugins) \
338 + --with-tls=$(usex gnutls gnutls openssl)
339 +}
340 +
341 +src_test() {
342 + # This runs only C tests (see tests/README):
343 + emake -C tests check-TESTS
344 +}