<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[209452] trunk/Tools</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/209452">209452</a></dd>
<dt>Author</dt> <dd>philn@webkit.org</dd>
<dt>Date</dt> <dd>2016-12-07 01:15:37 -0800 (Wed, 07 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GTK][jhbuild] gst-plugins-bad fails to build with OpenSSL 1.1.0
https://bugs.webkit.org/show_bug.cgi?id=165520
Reviewed by Carlos Garcia Campos.
* gtk/jhbuild.modules: Added missing dependency on openh264 in
gst-plugins-bad, along with 2 upstream patches fixing the build
against OpenSSL 1.1.0.
* gtk/patches/gst-plugins-bad-0001-dtls-port-to-OpenSSL-1.1.0.patch: Added.
* gtk/patches/gst-plugins-bad-0002-dtlscertificate-Fix-error-checking-in-RSA_generate_k.patch: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsgtkjhbuildmodules">trunk/Tools/gtk/jhbuild.modules</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsgtkpatchesgstpluginsbad0001dtlsporttoOpenSSL110patch">trunk/Tools/gtk/patches/gst-plugins-bad-0001-dtls-port-to-OpenSSL-1.1.0.patch</a></li>
<li><a href="#trunkToolsgtkpatchesgstpluginsbad0002dtlscertificateFixerrorcheckinginRSA_generate_kpatch">trunk/Tools/gtk/patches/gst-plugins-bad-0002-dtlscertificate-Fix-error-checking-in-RSA_generate_k.patch</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (209451 => 209452)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-12-07 07:48:23 UTC (rev 209451)
+++ trunk/Tools/ChangeLog        2016-12-07 09:15:37 UTC (rev 209452)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-12-07 Philippe Normand <pnormand@igalia.com>
+
+ [GTK][jhbuild] gst-plugins-bad fails to build with OpenSSL 1.1.0
+ https://bugs.webkit.org/show_bug.cgi?id=165520
+
+ Reviewed by Carlos Garcia Campos.
+
+ * gtk/jhbuild.modules: Added missing dependency on openh264 in
+ gst-plugins-bad, along with 2 upstream patches fixing the build
+ against OpenSSL 1.1.0.
+ * gtk/patches/gst-plugins-bad-0001-dtls-port-to-OpenSSL-1.1.0.patch: Added.
+ * gtk/patches/gst-plugins-bad-0002-dtlscertificate-Fix-error-checking-in-RSA_generate_k.patch: Added.
+
</ins><span class="cx"> 2016-12-06 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> Correct SDKROOT values in xcconfig files
</span></span></pre></div>
<a id="trunkToolsgtkjhbuildmodules"></a>
<div class="modfile"><h4>Modified: trunk/Tools/gtk/jhbuild.modules (209451 => 209452)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/gtk/jhbuild.modules        2016-12-07 07:48:23 UTC (rev 209451)
+++ trunk/Tools/gtk/jhbuild.modules        2016-12-07 09:15:37 UTC (rev 209452)
</span><span class="lines">@@ -399,11 +399,15 @@
</span><span class="cx"> </if>
</span><span class="cx"> <dependencies>
</span><span class="cx"> <dep package="gst-plugins-base"/>
</span><ins>+ <dep package="openh264"/>
</ins><span class="cx"> </dependencies>
</span><span class="cx"> <branch module="gst-plugins-bad/gst-plugins-bad-${version}.tar.xz" version="1.8.0"
</span><span class="cx"> repo="gstreamer"
</span><span class="cx"> hash="sha256:116376dd1085082422e0b21b0ecd3d1cb345c469c58e32463167d4675f4ca90e"
</span><del>- md5sum="1c2d797bb96a81e9ef570c7a0a37203e"/>
</del><ins>+ md5sum="1c2d797bb96a81e9ef570c7a0a37203e">
+ <patch file="gst-plugins-bad-0001-dtls-port-to-OpenSSL-1.1.0.patch" strip="1"/>
+ <patch file="gst-plugins-bad-0002-dtlscertificate-Fix-error-checking-in-RSA_generate_k.patch" strip="1"/>
+ </branch>
</ins><span class="cx"> </autotools>
</span><span class="cx">
</span><span class="cx"> <autotools id="gst-libav" autogenargs="--with-libav-extra-configure='--disable-yasm' --disable-gtk-doc">
</span></span></pre></div>
<a id="trunkToolsgtkpatchesgstpluginsbad0001dtlsporttoOpenSSL110patch"></a>
<div class="addfile"><h4>Added: trunk/Tools/gtk/patches/gst-plugins-bad-0001-dtls-port-to-OpenSSL-1.1.0.patch (0 => 209452)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/gtk/patches/gst-plugins-bad-0001-dtls-port-to-OpenSSL-1.1.0.patch         (rev 0)
+++ trunk/Tools/gtk/patches/gst-plugins-bad-0001-dtls-port-to-OpenSSL-1.1.0.patch        2016-12-07 09:15:37 UTC (rev 209452)
</span><span class="lines">@@ -0,0 +1,236 @@
</span><ins>+From e938933167c494cdca443334f658b02a03c4486b Mon Sep 17 00:00:00 2001
+From: Daiki Ueno <dueno@redhat.com>
+Date: Wed, 26 Oct 2016 14:51:01 +0200
+Subject: [PATCH] dtls: port to OpenSSL 1.1.0
+
+Changes are:
+
+- Use the wrapper functions to access opaque data types. To preserve
+ backward compatibility, define fallback definitions
+
+- Remove the use of idiom "pqueue_size(ssl->d1->sent_messages)", since
+ there is no replacement
+
+- Use RSA_generate_key_ex instead of the deprecated RSA_generate_key
+
+https://bugzilla.gnome.org/show_bug.cgi?id=773540
+---
+ ext/dtls/gstdtlscertificate.c | 15 ++++++++
+ ext/dtls/gstdtlsconnection.c | 87 ++++++++++++++++++++++++++++++++++++++-----
+ 2 files changed, 93 insertions(+), 9 deletions(-)
+
+diff --git a/ext/dtls/gstdtlscertificate.c b/ext/dtls/gstdtlscertificate.c
+index 95fbb83..c1c9602 100644
+--- a/ext/dtls/gstdtlscertificate.c
++++ b/ext/dtls/gstdtlscertificate.c
+@@ -199,7 +199,22 @@ init_generated (GstDtlsCertificate * self)
+ priv->private_key = NULL;
+ return;
+ }
++
++ /* XXX: RSA_generate_key is actually deprecated in 0.9.8 */
++#if OPENSSL_VERSION_NUMBER < 0x10100001L
+ rsa = RSA_generate_key (2048, RSA_F4, NULL, NULL);
++#else
++ rsa = RSA_new ();
++ if (rsa != NULL) {
++ BIGNUM *e = BN_new ();
++ if (e != NULL && BN_set_word (e, RSA_F4)
++ && RSA_generate_key_ex (rsa, 2048, e, NULL)) {
++ RSA_free (rsa);
++ rsa = NULL;
++ }
++ BN_free (e);
++ }
++#endif
+
+ if (!rsa) {
+ GST_WARNING_OBJECT (self, "failed to generate RSA");
+diff --git a/ext/dtls/gstdtlsconnection.c b/ext/dtls/gstdtlsconnection.c
+index 36f6d63..728f5a7 100644
+--- a/ext/dtls/gstdtlsconnection.c
++++ b/ext/dtls/gstdtlsconnection.c
+@@ -42,6 +42,8 @@
+ #include <openssl/err.h>
+ #include <openssl/ssl.h>
+
++#include <string.h>
++
+ GST_DEBUG_CATEGORY_STATIC (gst_dtls_connection_debug);
+ #define GST_CAT_DEFAULT gst_dtls_connection_debug
+ G_DEFINE_TYPE_WITH_CODE (GstDtlsConnection, gst_dtls_connection, G_TYPE_OBJECT,
+@@ -216,6 +218,38 @@ gst_dtls_connection_finalize (GObject * gobject)
+ G_OBJECT_CLASS (gst_dtls_connection_parent_class)->finalize (gobject);
+ }
+
++#if OPENSSL_VERSION_NUMBER < 0x10100001L
++static void
++BIO_set_data (BIO * bio, void *ptr)
++{
++ bio->ptr = ptr;
++}
++
++static void *
++BIO_get_data (BIO * bio)
++{
++ return bio->ptr;
++}
++
++static void
++BIO_set_shutdown (BIO * bio, int shutdown)
++{
++ bio->shutdown = shutdown;
++}
++
++static void
++BIO_set_init (BIO * bio, int init)
++{
++ bio->init = init;
++}
++
++static X509 *
++X509_STORE_CTX_get0_cert (X509_STORE_CTX * ctx)
++{
++ return ctx->cert;
++}
++#endif
++
+ static void
+ gst_dtls_connection_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
+@@ -239,7 +273,7 @@ gst_dtls_connection_set_property (GObject * object, guint prop_id,
+ priv->bio = BIO_new (BIO_s_gst_dtls_connection ());
+ g_return_if_fail (priv->bio);
+
+- priv->bio->ptr = self;
++ BIO_set_data (priv->bio, self);
+ SSL_set_bio (priv->ssl, priv->bio, priv->bio);
+
+ SSL_set_verify (priv->ssl,
+@@ -573,6 +607,7 @@ log_state (GstDtlsConnection * self, const gchar * str)
+ states |= (! !SSL_want_write (priv->ssl) << 20);
+ states |= (! !SSL_want_read (priv->ssl) << 24);
+
++#if OPENSSL_VERSION_NUMBER < 0x10100001L
+ GST_LOG_OBJECT (self, "%s: role=%s buf=(%d,%p:%d/%d) %x|%x %s",
+ str,
+ priv->is_client ? "client" : "server",
+@@ -581,6 +616,15 @@ log_state (GstDtlsConnection * self, const gchar * str)
+ priv->bio_buffer_offset,
+ priv->bio_buffer_len,
+ states, SSL_get_state (priv->ssl), SSL_state_string_long (priv->ssl));
++#else
++ GST_LOG_OBJECT (self, "%s: role=%s buf=(%p:%d/%d) %x|%x %s",
++ str,
++ priv->is_client ? "client" : "server",
++ priv->bio_buffer,
++ priv->bio_buffer_offset,
++ priv->bio_buffer_len,
++ states, SSL_get_state (priv->ssl), SSL_state_string_long (priv->ssl));
++#endif
+ }
+
+ static void
+@@ -737,7 +781,7 @@ openssl_verify_callback (int preverify_ok, X509_STORE_CTX * x509_ctx)
+ self = SSL_get_ex_data (ssl, connection_ex_index);
+ g_return_val_if_fail (GST_IS_DTLS_CONNECTION (self), FALSE);
+
+- pem = _gst_dtls_x509_to_pem (x509_ctx->cert);
++ pem = _gst_dtls_x509_to_pem (X509_STORE_CTX_get0_cert (x509_ctx));
+
+ if (!pem) {
+ GST_WARNING_OBJECT (self,
+@@ -749,7 +793,8 @@ openssl_verify_callback (int preverify_ok, X509_STORE_CTX * x509_ctx)
+ gint len;
+
+ len =
+- X509_NAME_print_ex (bio, X509_get_subject_name (x509_ctx->cert), 1,
++ X509_NAME_print_ex (bio,
++ X509_get_subject_name (X509_STORE_CTX_get0_cert (x509_ctx)), 1,
+ XN_FLAG_MULTILINE);
+ BIO_read (bio, buffer, len);
+ buffer[len] = '\0';
+@@ -777,6 +822,7 @@ openssl_verify_callback (int preverify_ok, X509_STORE_CTX * x509_ctx)
+ ######## #### #######
+ */
+
++#if OPENSSL_VERSION_NUMBER < 0x10100001L
+ static BIO_METHOD custom_bio_methods = {
+ BIO_TYPE_BIO,
+ "stream",
+@@ -795,11 +841,34 @@ BIO_s_gst_dtls_connection (void)
+ {
+ return &custom_bio_methods;
+ }
++#else
++static BIO_METHOD *custom_bio_methods;
++
++static BIO_METHOD *
++BIO_s_gst_dtls_connection (void)
++{
++ if (custom_bio_methods != NULL)
++ return custom_bio_methods;
++
++ custom_bio_methods = BIO_meth_new (BIO_TYPE_BIO, "stream");
++ if (custom_bio_methods == NULL
++ || !BIO_meth_set_write (custom_bio_methods, bio_method_write)
++ || !BIO_meth_set_read (custom_bio_methods, bio_method_read)
++ || !BIO_meth_set_ctrl (custom_bio_methods, bio_method_ctrl)
++ || !BIO_meth_set_create (custom_bio_methods, bio_method_new)
++ || !BIO_meth_set_destroy (custom_bio_methods, bio_method_free)) {
++ BIO_meth_free (custom_bio_methods);
++ return NULL;
++ }
++
++ return custom_bio_methods;
++}
++#endif
+
+ static int
+ bio_method_write (BIO * bio, const char *data, int size)
+ {
+- GstDtlsConnection *self = GST_DTLS_CONNECTION (bio->ptr);
++ GstDtlsConnection *self = GST_DTLS_CONNECTION (BIO_get_data (bio));
+
+ GST_LOG_OBJECT (self, "BIO: writing %d", size);
+
+@@ -824,7 +893,7 @@ bio_method_write (BIO * bio, const char *data, int size)
+ static int
+ bio_method_read (BIO * bio, char *out_buffer, int size)
+ {
+- GstDtlsConnection *self = GST_DTLS_CONNECTION (bio->ptr);
++ GstDtlsConnection *self = GST_DTLS_CONNECTION (BIO_get_data (bio));
+ GstDtlsConnectionPrivate *priv = self->priv;
+ guint internal_size;
+ gint copy_size;
+@@ -868,7 +937,7 @@ bio_method_read (BIO * bio, char *out_buffer, int size)
+ static long
+ bio_method_ctrl (BIO * bio, int cmd, long arg1, void *arg2)
+ {
+- GstDtlsConnection *self = GST_DTLS_CONNECTION (bio->ptr);
++ GstDtlsConnection *self = GST_DTLS_CONNECTION (BIO_get_data (bio));
+ GstDtlsConnectionPrivate *priv = self->priv;
+
+ switch (cmd) {
+@@ -916,8 +985,8 @@ bio_method_new (BIO * bio)
+ {
+ GST_LOG_OBJECT (NULL, "BIO: new");
+
+- bio->shutdown = 0;
+- bio->init = 1;
++ BIO_set_shutdown (bio, 0);
++ BIO_set_init (bio, 1);
+
+ return 1;
+ }
+@@ -930,6 +999,6 @@ bio_method_free (BIO * bio)
+ return 0;
+ }
+
+- GST_LOG_OBJECT (GST_DTLS_CONNECTION (bio->ptr), "BIO free");
++ GST_LOG_OBJECT (GST_DTLS_CONNECTION (BIO_get_data (bio)), "BIO free");
+ return 0;
+ }
+--
+2.10.2
+
</ins></span></pre></div>
<a id="trunkToolsgtkpatchesgstpluginsbad0002dtlscertificateFixerrorcheckinginRSA_generate_kpatch"></a>
<div class="addfile"><h4>Added: trunk/Tools/gtk/patches/gst-plugins-bad-0002-dtlscertificate-Fix-error-checking-in-RSA_generate_k.patch (0 => 209452)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/gtk/patches/gst-plugins-bad-0002-dtlscertificate-Fix-error-checking-in-RSA_generate_k.patch         (rev 0)
+++ trunk/Tools/gtk/patches/gst-plugins-bad-0002-dtlscertificate-Fix-error-checking-in-RSA_generate_k.patch        2016-12-07 09:15:37 UTC (rev 209452)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+From 3a069193e25364ebdacac86f4b03022c151ea29c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
+Date: Mon, 14 Nov 2016 11:32:17 +0200
+Subject: [PATCH] dtlscertificate: Fix error checking in RSA_generate_key_ex()
+ usage
+
+Was broken during the port for OpenSSL 1.1.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=774328
+---
+ ext/dtls/gstdtlscertificate.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/ext/dtls/gstdtlscertificate.c b/ext/dtls/gstdtlscertificate.c
+index c1c9602..c2d9bb2 100644
+--- a/ext/dtls/gstdtlscertificate.c
++++ b/ext/dtls/gstdtlscertificate.c
+@@ -207,12 +207,13 @@ init_generated (GstDtlsCertificate * self)
+ rsa = RSA_new ();
+ if (rsa != NULL) {
+ BIGNUM *e = BN_new ();
+- if (e != NULL && BN_set_word (e, RSA_F4)
+- && RSA_generate_key_ex (rsa, 2048, e, NULL)) {
++ if (e == NULL || !BN_set_word (e, RSA_F4)
++ || !RSA_generate_key_ex (rsa, 2048, e, NULL)) {
+ RSA_free (rsa);
+ rsa = NULL;
+ }
+- BN_free (e);
++ if (e)
++ BN_free (e);
+ }
+ #endif
+
+--
+2.10.2
+
</ins></span></pre>
</div>
</div>
</body>
</html>