Title: [221582] releases/WebKitGTK/webkit-2.18/Source
Revision
221582
Author
[email protected]
Date
2017-09-04 02:24:06 -0700 (Mon, 04 Sep 2017)

Log Message

Merge r221572 - [GTK] Libgcrypt warning: missing initialization - please fix the application
https://bugs.webkit.org/show_bug.cgi?id=171230

Reviewed by Michael Catanzaro.

Source/WebCore/PAL:

Add the Initialization.h header, containing the single initialize() static
function that initializes the libgcrypt library. This header only includes
the default libgcrypt header, and nothing else.

It's not added to the existing Utilities.h header because that one pulls in
other unnecessary headers that for instance use the new() operator, but that
collides with the implementation files that define WebKit process entrypoints
and intentionally don't include the config.h that brings in FastMalloc to
properly define the new() and delete() operators, resulting in compilation
errors due to the new and delete operators being defined to warning strings
in always-included WebKit2Prefix.h.

* pal/crypto/gcrypt/Initialization.h: Copied from Source/WebKit/WebProcess/EntryPoint/unix/WebProcessMain.cpp.
(PAL::GCrypt::initialize):

Source/WebKit:

Replicate the libgcrypt initialization in the NetworkProcess entrypoint.
This is required due to libgcrypt being used through digest operations
originating from the certificate hash computation in SoupNetworkSession.

The initialization is moved to the PAL library, and the initialize()
function is now leveraged in both NetworkProcess and WebProcess entrypoints.

* NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
(main):
* WebProcess/EntryPoint/unix/WebProcessMain.cpp:
(main):

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/PAL/ChangeLog (221581 => 221582)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/PAL/ChangeLog	2017-09-04 09:22:13 UTC (rev 221581)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/PAL/ChangeLog	2017-09-04 09:24:06 UTC (rev 221582)
@@ -1,3 +1,25 @@
+2017-09-03  Zan Dobersek  <[email protected]>
+
+        [GTK] Libgcrypt warning: missing initialization - please fix the application
+        https://bugs.webkit.org/show_bug.cgi?id=171230
+
+        Reviewed by Michael Catanzaro.
+
+        Add the Initialization.h header, containing the single initialize() static
+        function that initializes the libgcrypt library. This header only includes
+        the default libgcrypt header, and nothing else.
+
+        It's not added to the existing Utilities.h header because that one pulls in
+        other unnecessary headers that for instance use the new() operator, but that
+        collides with the implementation files that define WebKit process entrypoints
+        and intentionally don't include the config.h that brings in FastMalloc to
+        properly define the new() and delete() operators, resulting in compilation
+        errors due to the new and delete operators being defined to warning strings
+        in always-included WebKit2Prefix.h.
+
+        * pal/crypto/gcrypt/Initialization.h: Copied from Source/WebKit/WebProcess/EntryPoint/unix/WebProcessMain.cpp.
+        (PAL::GCrypt::initialize):
+
 2017-08-14  Simon Fraser  <[email protected]>
 
         Remove Proximity Events and related code

Copied: releases/WebKitGTK/webkit-2.18/Source/WebCore/PAL/pal/crypto/gcrypt/Initialization.h (from rev 221581, releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/EntryPoint/unix/WebProcessMain.cpp) (0 => 221582)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/PAL/pal/crypto/gcrypt/Initialization.h	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/PAL/pal/crypto/gcrypt/Initialization.h	2017-09-04 09:24:06 UTC (rev 221582)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2017 Metrological Group B.V.
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <gcrypt.h>
+
+namespace PAL {
+namespace GCrypt {
+
+static inline void initialize()
+{
+    // Call gcry_check_version() before any other libgcrypt call, ignoring the
+    // returned version string.
+    gcry_check_version(nullptr);
+
+    // Pre-allocate 16kB of secure memory and finish the initialization.
+    gcry_control(GCRYCTL_INIT_SECMEM, 16384, nullptr);
+    gcry_control(GCRYCTL_INITIALIZATION_FINISHED, nullptr);
+}
+
+} // namespace PAL
+} // namespace GCrypt

Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/ChangeLog (221581 => 221582)


--- releases/WebKitGTK/webkit-2.18/Source/WebKit/ChangeLog	2017-09-04 09:22:13 UTC (rev 221581)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/ChangeLog	2017-09-04 09:24:06 UTC (rev 221582)
@@ -1,3 +1,22 @@
+2017-09-03  Zan Dobersek  <[email protected]>
+
+        [GTK] Libgcrypt warning: missing initialization - please fix the application
+        https://bugs.webkit.org/show_bug.cgi?id=171230
+
+        Reviewed by Michael Catanzaro.
+
+        Replicate the libgcrypt initialization in the NetworkProcess entrypoint.
+        This is required due to libgcrypt being used through digest operations
+        originating from the certificate hash computation in SoupNetworkSession.
+
+        The initialization is moved to the PAL library, and the initialize()
+        function is now leveraged in both NetworkProcess and WebProcess entrypoints.
+
+        * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
+        (main):
+        * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
+        (main):
+
 2017-09-03  Yusuke Suzuki  <[email protected]>
 
         String#utf8() allocates new CString

Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp (221581 => 221582)


--- releases/WebKitGTK/webkit-2.18/Source/WebKit/NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp	2017-09-04 09:22:13 UTC (rev 221581)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp	2017-09-04 09:24:06 UTC (rev 221582)
@@ -27,6 +27,10 @@
 
 #include <cstdlib>
 
+#if USE(GCRYPT)
+#include <pal/crypto/gcrypt/Initialization.h>
+#endif
+
 using namespace WebKit;
 
 int main(int argc, char** argv)
@@ -41,5 +45,9 @@
     // WARNING: This needs to be KEPT IN SYNC with WebProcessMain.cpp.
     setenv("G_TLS_GNUTLS_PRIORITY", "NORMAL:%COMPAT:!VERS-SSL3.0:!ARCFOUR-128", 0);
 
+#if USE(GCRYPT)
+    PAL::GCrypt::initialize();
+#endif
+
     return NetworkProcessMainUnix(argc, argv);
 }

Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/EntryPoint/unix/WebProcessMain.cpp (221581 => 221582)


--- releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/EntryPoint/unix/WebProcessMain.cpp	2017-09-04 09:22:13 UTC (rev 221581)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/EntryPoint/unix/WebProcessMain.cpp	2017-09-04 09:24:06 UTC (rev 221582)
@@ -28,7 +28,7 @@
 #include <cstdlib>
 
 #if USE(GCRYPT)
-#include <gcrypt.h>
+#include <pal/crypto/gcrypt/Initialization.h>
 #endif
 
 using namespace WebKit;
@@ -46,13 +46,7 @@
     setenv("G_TLS_GNUTLS_PRIORITY", "NORMAL:%COMPAT:!VERS-SSL3.0:!ARCFOUR-128", 0);
 
 #if USE(GCRYPT)
-    // Call gcry_check_version() before any other libgcrypt call, ignoring the
-    // returned version string.
-    gcry_check_version(nullptr);
-
-    // Pre-allocate 16kB of secure memory and finish the initialization.
-    gcry_control(GCRYCTL_INIT_SECMEM, 16384, nullptr);
-    gcry_control(GCRYCTL_INITIALIZATION_FINISHED, nullptr);
+    PAL::GCrypt::initialize();
 #endif
 
     return WebProcessMainUnix(argc, argv);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to