0095d17
From 72c050576a41a14915f02a2c243cd41b22ad2384 Mon Sep 17 00:00:00 2001
59c3cdc
From: Laszlo Ersek <lersek@redhat.com>
59c3cdc
Date: Sat, 16 Nov 2019 17:11:27 +0100
0095d17
Subject: [PATCH 12/17] CryptoPkg/OpensslLib: list RHEL8-specific OpenSSL files
ced5d89
 in the INFs (RH)
59c3cdc
59c3cdc
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
59c3cdc
RHEL-8.5/20210520-e1999b264f1f [edk2-stable202105] rebase:
59c3cdc
59c3cdc
- Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1938257
59c3cdc
59c3cdc
- Recreate the patch based on downstream commits:
59c3cdc
59c3cdc
  - 56c4bb81b311 ("CryptoPkg/OpensslLib: list RHEL8-specific OpenSSL files
59c3cdc
                  in the INFs (RH)", 2020-06-05),
59c3cdc
  - e81751a1c303 ("CryptoPkg/OpensslLib: Upgrade OpenSSL to 1.1.1g",
59c3cdc
                  2020-11-23),
59c3cdc
  - 3e3fe5e62079 ("redhat: bump OpenSSL dist-git submodule to 1.1.1g+ /
59c3cdc
                  RHEL-8.4", 2020-11-23).
59c3cdc
59c3cdc
  (1) At e81751a1c303, downstream edk2 was in sync with upstream edk2
59c3cdc
      consuming OpenSSL 1.1.1g (upstream edk2 commit 8c30327debb2
59c3cdc
      ("CryptoPkg/OpensslLib: Upgrade OpenSSL to 1.1.1g", 2020-07-25)).
59c3cdc
59c3cdc
      Since commit 8c30327debb2, upstream edk2 modified the OpensslLib INF
59c3cdc
      files, namely
59c3cdc
59c3cdc
      - CryptoPkg/Library/OpensslLib/OpensslLib.inf
59c3cdc
      - CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
59c3cdc
59c3cdc
      in the following commits only:
59c3cdc
59c3cdc
      - be01087e0780 ("CryptoPkg/Library: Remove the redundant build
59c3cdc
        option", 2020-08-12), which did not affect the source file list at
59c3cdc
        all,
59c3cdc
59c3cdc
      - b5701a4c7a0f ("CryptoPkg: OpensslLib: Use RngLib to generate
59c3cdc
        entropy in rand_pool", 2020-09-18), which replaced some of the
59c3cdc
        *edk2-specific* "rand_pool_noise" source files with an RngLib
59c3cdc
        dependency.
59c3cdc
59c3cdc
      This means that the list of required, actual OpenSSL source files
59c3cdc
      has not changed in upstream edk2 since our downstream edk2 commit
59c3cdc
      e81751a1c303.
59c3cdc
59c3cdc
  (2) At commit 3e3fe5e62079 (the direct child of e81751a1c303),
59c3cdc
      downstream edk2's OpenSSL dependency was satisfied with RHEL-8
59c3cdc
      OpenSSL at dist-git commit bdd048e929dc ("Two fixes that will be
59c3cdc
      shipped in RHEL-8.3.0.z", 2020-10-23).
59c3cdc
59c3cdc
      Since commit bdd048e929dc, RHEL-8 OpenSSL dist-git advanced
59c3cdc
      (fast-forwarded) to commit a75722161d20 ("Update to version 1.1.1k",
59c3cdc
      2021-05-25), which is the current head of the rhel-8.5.0 branch.
59c3cdc
      (See also <https://bugzilla.redhat.com/show_bug.cgi?id=1938257#c6>.)
59c3cdc
59c3cdc
      At both dist-git bdd048e929dc and dist-git a75722161d20, I built the
59c3cdc
      respective RHEL-8 OpenSSL *source* RPM, and prepped the respective
59c3cdc
      source tree, with "rpmbuild -bp". Subsequently I compared the
59c3cdc
      prepped source trees recursively.
59c3cdc
59c3cdc
      - The following files disappeared:
59c3cdc
59c3cdc
        - 29 backup files created by "patch",
59c3cdc
59c3cdc
        - the assembly generator perl script called
59c3cdc
          "ecp_nistz256-avx2.pl", which is not used during the build.
59c3cdc
59c3cdc
      - The following new files appeared:
59c3cdc
59c3cdc
        - 18 files directly or indirectly under the "test" subdirectory,
59c3cdc
          which are not used during the build,
59c3cdc
59c3cdc
        - 5 backup files created by "patch",
59c3cdc
59c3cdc
        - 2 DCL scripts used when building OpenSSL on OpenVMS.
59c3cdc
59c3cdc
      This means that the total list of RHEL-8 OpenSSL source files has
59c3cdc
      not changed in RHEL-8 OpenSSL dist-git since our downstream edk2
59c3cdc
      commit 3e3fe5e62079.
59c3cdc
59c3cdc
  As a result, copy the "RHEL8-specific OpenSSL file list" sections
59c3cdc
  verbatim from the INF files, at downstream commit e81751a1c303. (I used
59c3cdc
  the "git checkout -p e81751a1c303 -- Library/OpensslLib/OpensslLib.inf
59c3cdc
  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf" command.)
59c3cdc
59c3cdc
Notes about the RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] ->
59c3cdc
RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] rebase:
59c3cdc
59c3cdc
- "OpensslLib.inf":
59c3cdc
59c3cdc
  - Automatic leading context refresh against upstream commit c72ca4666886
59c3cdc
    ("CryptoPkg/OpensslLib: Add "sort" keyword to header file parsing
59c3cdc
    loop", 2020-03-10).
59c3cdc
59c3cdc
  - Manual trailing context refresh against upstream commit b49a6c8f80d9
59c3cdc
    ("CryptoPkg/OpensslLib: improve INF file consistency", 2019-12-02).
59c3cdc
59c3cdc
- "OpensslLibCrypto.inf":
59c3cdc
59c3cdc
  - Automatic leading context refresh against upstream commits
59c3cdc
    8906f076de35 ("CryptoPkg/OpensslLib: Add missing header files in INF
59c3cdc
    file", 2019-08-16) and 9f4fbd56d430 ("CryptoPkg/OpensslLib: Update
59c3cdc
    process_files.pl to generate .h files", 2019-10-30).
59c3cdc
59c3cdc
Notes about the RHEL-8.1/20190308-89910a39dcfd [edk2-stable201903] ->
59c3cdc
RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] rebase:
59c3cdc
59c3cdc
- new patch
59c3cdc
59c3cdc
The downstream changes in RHEL8's OpenSSL package, for example in
59c3cdc
"openssl-1.1.1-evp-kdf.patch", introduce new files, and even move some
59c3cdc
preexistent code into those new files. In order to avoid undefined
59c3cdc
references in link editing, we have to list the new files.
59c3cdc
59c3cdc
Note: "process_files.pl" is not re-run at this time manually, because
59c3cdc
59c3cdc
(a) "process_files.pl" would pollute the file list (and some of the
59c3cdc
    auto-generated header files) with RHEL8-specific FIPS artifacts, which
59c3cdc
    are explicitly unwanted in edk2,
59c3cdc
59c3cdc
(b) The RHEL OpenSSL maintainer, Tomas Mraz, identified this specific set
59c3cdc
    of files in <https://bugzilla.redhat.com/show_bug.cgi?id=1749693#c10>,
59c3cdc
    and will help with future changes too.
59c3cdc
59c3cdc
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
59c3cdc
(cherry picked from commit 57bd3f146590df8757865d8f2cdd1db3cf3f4d40)
59c3cdc
(cherry picked from commit 56c4bb81b311dfcee6a34c81d3e4feeda7f88995)
59c3cdc
---
59c3cdc
 CryptoPkg/Library/OpensslLib/OpensslLib.inf       | 11 +++++++++++
59c3cdc
 CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 11 +++++++++++
59c3cdc
 2 files changed, 22 insertions(+)
59c3cdc
59c3cdc
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
0095d17
index 60c6c24b0a67..e446b51e66cd 100644
59c3cdc
--- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
59c3cdc
+++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
0095d17
@@ -575,6 +575,17 @@ [Sources]
59c3cdc
   $(OPENSSL_PATH)/ssl/statem/statem.h
59c3cdc
   $(OPENSSL_PATH)/ssl/statem/statem_local.h
59c3cdc
 # Autogenerated files list ends here
59c3cdc
+# RHEL8-specific OpenSSL file list starts here
59c3cdc
+  $(OPENSSL_PATH)/crypto/evp/kdf_lib.c
59c3cdc
+  $(OPENSSL_PATH)/crypto/evp/pkey_kdf.c
59c3cdc
+  $(OPENSSL_PATH)/crypto/kdf/kbkdf.c
59c3cdc
+  $(OPENSSL_PATH)/crypto/kdf/kdf_local.h
59c3cdc
+  $(OPENSSL_PATH)/crypto/kdf/kdf_util.c
59c3cdc
+  $(OPENSSL_PATH)/crypto/kdf/krb5kdf.c
59c3cdc
+  $(OPENSSL_PATH)/crypto/kdf/pbkdf2.c
59c3cdc
+  $(OPENSSL_PATH)/crypto/kdf/sshkdf.c
59c3cdc
+  $(OPENSSL_PATH)/crypto/kdf/sskdf.c
59c3cdc
+# RHEL8-specific OpenSSL file list ends here
59c3cdc
   buildinf.h
59c3cdc
   ossl_store.c
59c3cdc
   rand_pool.c
59c3cdc
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
0095d17
index c4eaea888c1a..c207dc8f4cfd 100644
59c3cdc
--- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
59c3cdc
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
0095d17
@@ -525,6 +525,17 @@ [Sources]
59c3cdc
   $(OPENSSL_PATH)/crypto/x509v3/standard_exts.h
59c3cdc
   $(OPENSSL_PATH)/crypto/x509v3/v3_admis.h
59c3cdc
 # Autogenerated files list ends here
59c3cdc
+# RHEL8-specific OpenSSL file list starts here
59c3cdc
+  $(OPENSSL_PATH)/crypto/evp/kdf_lib.c
59c3cdc
+  $(OPENSSL_PATH)/crypto/evp/pkey_kdf.c
59c3cdc
+  $(OPENSSL_PATH)/crypto/kdf/kbkdf.c
59c3cdc
+  $(OPENSSL_PATH)/crypto/kdf/kdf_local.h
59c3cdc
+  $(OPENSSL_PATH)/crypto/kdf/kdf_util.c
59c3cdc
+  $(OPENSSL_PATH)/crypto/kdf/krb5kdf.c
59c3cdc
+  $(OPENSSL_PATH)/crypto/kdf/pbkdf2.c
59c3cdc
+  $(OPENSSL_PATH)/crypto/kdf/sshkdf.c
59c3cdc
+  $(OPENSSL_PATH)/crypto/kdf/sskdf.c
59c3cdc
+# RHEL8-specific OpenSSL file list ends here
59c3cdc
   buildinf.h
59c3cdc
   ossl_store.c
59c3cdc
   rand_pool.c
59c3cdc
-- 
0095d17
2.38.1
59c3cdc