render / rpms / edk2

Forked from rpms/edk2 3 months ago
Clone

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

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