Blame SOURCES/0002-CryptoPkg-Upgrade-OpenSSL-to-1.1.1d.patch

6009e6
From bbda3f776bfcdbcb77b82f1f7fd5dafd798d9784 Mon Sep 17 00:00:00 2001
6009e6
From: Shenglei Zhang <shenglei.zhang@intel.com>
6009e6
Date: Mon, 21 Oct 2019 15:53:42 +0800
6009e6
Subject: CryptoPkg: Upgrade OpenSSL to 1.1.1d
6009e6
6009e6
Notes about the RHEL-8.1/20190308-89910a39dcfd [edk2-stable201903] ->
6009e6
RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] rebase:
6009e6
6009e6
- New patch (cherry-picked from upstream, to be dropped at the next
6009e6
  downstream rebase).
6009e6
6009e6
- Upstream OpenSSL-1.1.1c contains commit 5fba3afad017 ("Rework DSO API
6009e6
  conditions and configuration option", 2019-04-10). This upstream OpenSSL
6009e6
  change requires edk2 to #define DSO_NONE explicitly.
6009e6
6009e6
- The present patch (which is going to be released in edk2-stable201911)
6009e6
  updates "process_files.pl" to generate "dso_conf.h" with the above
6009e6
  macro, and captures the result (i.e. the actual definition of the macro)
6009e6
  in the git tree.
6009e6
6009e6
- This patch is being backported primarily for the DSO_NONE macro (OpenSSL
6009e6
  in RHEL-8.2.0 is based on OpenSSL-1.1.1c). The patch could also come in
6009e6
  handy in case we have to re-run "process_files.pl" ourselves.
6009e6
6009e6
Upgrade openssl from 1.1.1b to 1.1.1d.
6009e6
Something needs to be noticed is that, there is a bug existing in the
6009e6
released 1_1_1d version(894da2fb7ed5d314ee5c2fc9fd2d9b8b74111596),
6009e6
which causes build failure. So we switch the code base to a usable
6009e6
version, which is 2 commits later than the stable tag.
6009e6
Now we use the version c3656cc594daac8167721dde7220f0e59ae146fc.
6009e6
This log is to fix the build failure.
6009e6
https://bugzilla.tianocore.org/show_bug.cgi?id=2226
6009e6
6009e6
Besides, the absense of "DSO_NONE" in dso_conf.h causes build failure
6009e6
in OvmfPkg. So update process_files.pl to generate information from
6009e6
"crypto/include/internal/dso_conf.h.in".
6009e6
6009e6
shm.h and utsname.h are added to avoid GCC build failure.
6009e6
6009e6
Cc: Jian J Wang <jian.j.wang@intel.com>
6009e6
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
6009e6
Cc: Liming Gao <liming.gao@intel.com>
6009e6
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
6009e6
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
6009e6
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
6009e6
Tested-by: Laszlo Ersek <lersek@redhat.com>
6009e6
(cherry picked from commit 1bcc65b9a1408cf445b7b3f9499b27d9c235db71)
6009e6
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
6009e6
---
6009e6
 CryptoPkg/Library/Include/internal/dso_conf.h | 16 ++++++++++++++++
6009e6
 CryptoPkg/Library/Include/sys/shm.h           |  9 +++++++++
6009e6
 CryptoPkg/Library/Include/sys/utsname.h       |  9 +++++++++
6009e6
 CryptoPkg/Library/OpensslLib/openssl          |  2 +-
6009e6
 CryptoPkg/Library/OpensslLib/process_files.pl | 17 +++++++++++++++--
6009e6
 5 files changed, 50 insertions(+), 3 deletions(-)
6009e6
 create mode 100644 CryptoPkg/Library/Include/sys/shm.h
6009e6
 create mode 100644 CryptoPkg/Library/Include/sys/utsname.h
6009e6
6009e6
diff --git a/CryptoPkg/Library/Include/internal/dso_conf.h b/CryptoPkg/Library/Include/internal/dso_conf.h
6009e6
index e69de29bb2..43c891588b 100644
6009e6
--- a/CryptoPkg/Library/Include/internal/dso_conf.h
6009e6
+++ b/CryptoPkg/Library/Include/internal/dso_conf.h
6009e6
@@ -0,0 +1,16 @@
6009e6
+/* WARNING: do not edit! */
6009e6
+/* Generated from crypto/include/internal/dso_conf.h.in */
6009e6
+/*
6009e6
+ * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
6009e6
+ *
6009e6
+ * Licensed under the OpenSSL license (the "License").  You may not use
6009e6
+ * this file except in compliance with the License.  You can obtain a copy
6009e6
+ * in the file LICENSE in the source distribution or at
6009e6
+ * https://www.openssl.org/source/license.html
6009e6
+ */
6009e6
+
6009e6
+#ifndef HEADER_DSO_CONF_H
6009e6
+# define HEADER_DSO_CONF_H
6009e6
+# define DSO_NONE
6009e6
+# define DSO_EXTENSION ".so"
6009e6
+#endif
6009e6
diff --git a/CryptoPkg/Library/Include/sys/shm.h b/CryptoPkg/Library/Include/sys/shm.h
6009e6
new file mode 100644
6009e6
index 0000000000..dc0b8e81c8
6009e6
--- /dev/null
6009e6
+++ b/CryptoPkg/Library/Include/sys/shm.h
6009e6
@@ -0,0 +1,9 @@
6009e6
+/** @file
6009e6
+  Include file to support building the third-party cryptographic library.
6009e6
+
6009e6
+Copyright (c) 2019, Intel Corporation. All rights reserved.
6009e6
+SPDX-License-Identifier: BSD-2-Clause-Patent
6009e6
+
6009e6
+**/
6009e6
+
6009e6
+#include <CrtLibSupport.h>
6009e6
diff --git a/CryptoPkg/Library/Include/sys/utsname.h b/CryptoPkg/Library/Include/sys/utsname.h
6009e6
new file mode 100644
6009e6
index 0000000000..dc0b8e81c8
6009e6
--- /dev/null
6009e6
+++ b/CryptoPkg/Library/Include/sys/utsname.h
6009e6
@@ -0,0 +1,9 @@
6009e6
+/** @file
6009e6
+  Include file to support building the third-party cryptographic library.
6009e6
+
6009e6
+Copyright (c) 2019, Intel Corporation. All rights reserved.
6009e6
+SPDX-License-Identifier: BSD-2-Clause-Patent
6009e6
+
6009e6
+**/
6009e6
+
6009e6
+#include <CrtLibSupport.h>
6009e6
diff --git a/CryptoPkg/Library/OpensslLib/process_files.pl b/CryptoPkg/Library/OpensslLib/process_files.pl
6009e6
index 4fe54cd808..bbcfa0d0e7 100755
6009e6
--- a/CryptoPkg/Library/OpensslLib/process_files.pl
6009e6
+++ b/CryptoPkg/Library/OpensslLib/process_files.pl
6009e6
@@ -2,7 +2,7 @@
6009e6
 #
6009e6
 # This script runs the OpenSSL Configure script, then processes the
6009e6
 # resulting file list into our local OpensslLib[Crypto].inf and also
6009e6
-# takes a copy of opensslconf.h.
6009e6
+# takes copies of opensslconf.h and dso_conf.h.
6009e6
 #
6009e6
 # This only needs to be done once by a developer when updating to a
6009e6
 # new version of OpenSSL (or changing options, etc.). Normal users
6009e6
@@ -106,6 +106,14 @@ BEGIN {
6009e6
                 ) == 0 ||
6009e6
                     die "Failed to generate opensslconf.h!\n";
6009e6
 
6009e6
+            # Generate dso_conf.h per config data
6009e6
+            system(
6009e6
+                "perl -I. -Mconfigdata util/dofile.pl " .
6009e6
+                "crypto/include/internal/dso_conf.h.in " .
6009e6
+                "> include/internal/dso_conf.h"
6009e6
+                ) == 0 ||
6009e6
+                    die "Failed to generate dso_conf.h!\n";
6009e6
+
6009e6
             chdir($basedir) ||
6009e6
                 die "Cannot change to base directory \"" . $basedir . "\"";
6009e6
 
6009e6
@@ -249,12 +257,17 @@ rename( $new_inf_file, $inf_file ) ||
6009e6
 print "Done!";
6009e6
 
6009e6
 #
6009e6
-# Copy opensslconf.h generated from OpenSSL Configuration
6009e6
+# Copy opensslconf.h and dso_conf.h generated from OpenSSL Configuration
6009e6
 #
6009e6
 print "\n--> Duplicating opensslconf.h into Include/openssl ... ";
6009e6
 copy($OPENSSL_PATH . "/include/openssl/opensslconf.h",
6009e6
      $OPENSSL_PATH . "/../../Include/openssl/") ||
6009e6
    die "Cannot copy opensslconf.h!";
6009e6
+print "Done!";
6009e6
+print "\n--> Duplicating dso_conf.h into Include/internal ... ";
6009e6
+copy($OPENSSL_PATH . "/include/internal/dso_conf.h",
6009e6
+     $OPENSSL_PATH . "/../../Include/internal/") ||
6009e6
+   die "Cannot copy dso_conf.h!";
6009e6
 print "Done!\n";
6009e6
 
6009e6
 print "\nProcessing Files Done!\n";
6009e6
-- 
6009e6
2.18.1
6009e6