]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/OpensslLib/process_files.pl
CryptoPkg: Upgrade OpenSSL to 1.1.1d
[mirror_edk2.git] / CryptoPkg / Library / OpensslLib / process_files.pl
old mode 100644 (file)
new mode 100755 (executable)
index 4a60073..bbcfa0d
@@ -2,7 +2,7 @@
 #\r
 # This script runs the OpenSSL Configure script, then processes the\r
 # resulting file list into our local OpensslLib[Crypto].inf and also\r
-# takes a copy of opensslconf.h.\r
+# takes copies of opensslconf.h and dso_conf.h.\r
 #\r
 # This only needs to be done once by a developer when updating to a\r
 # new version of OpenSSL (or changing options, etc.). Normal users\r
@@ -53,6 +53,7 @@ BEGIN {
                 "no-async",\r
                 "no-autoalginit",\r
                 "no-autoerrinit",\r
+                "no-autoload-config",
                 "no-bf",\r
                 "no-blake2",\r
                 "no-camellia",\r
@@ -90,7 +91,10 @@ BEGIN {
                 "no-threads",\r
                 "no-ts",\r
                 "no-ui",\r
-                "no-whirlpool"\r
+                "no-whirlpool",\r
+                # OpenSSL1_1_1b doesn't support default rand-seed-os for UEFI\r
+                # UEFI only support --with-rand-seed=none\r
+                "--with-rand-seed=none"\r
                 ) == 0 ||\r
                     die "OpenSSL Configure failed!\n";\r
 \r
@@ -102,6 +106,14 @@ BEGIN {
                 ) == 0 ||\r
                     die "Failed to generate opensslconf.h!\n";\r
 \r
+            # Generate dso_conf.h per config data\r
+            system(\r
+                "perl -I. -Mconfigdata util/dofile.pl " .\r
+                "crypto/include/internal/dso_conf.h.in " .\r
+                "> include/internal/dso_conf.h"\r
+                ) == 0 ||\r
+                    die "Failed to generate dso_conf.h!\n";\r
+\r
             chdir($basedir) ||\r
                 die "Cannot change to base directory \"" . $basedir . "\"";\r
 \r
@@ -124,6 +136,13 @@ foreach my $product ((@{$unified_info{libraries}},
         foreach my $s (@{$unified_info{sources}->{$o}}) {\r
             next if ($unified_info{generate}->{$s});\r
             next if $s =~ "crypto/bio/b_print.c";\r
+\r
+            # No need to add unused files in UEFI.\r
+            # So it can reduce porting time, compile time, library size.\r
+            next if $s =~ "crypto/rand/randfile.c";\r
+            next if $s =~ "crypto/store/";\r
+            next if $s =~ "crypto/err/err_all.c";\r
+\r
             if ($product =~ "libssl") {\r
                 push @sslfilelist, '  $(OPENSSL_PATH)/' . $s . "\r\n";\r
                 next;\r
@@ -133,6 +152,34 @@ foreach my $product ((@{$unified_info{libraries}},
     }\r
 }\r
 \r
+\r
+#\r
+# Update the perl script to generate the missing header files\r
+#\r
+my @dir_list = ();\r
+for (keys %{$unified_info{dirinfo}}){\r
+  push @dir_list,$_;\r
+}\r
+\r
+my $dir = getcwd();\r
+my @files = ();\r
+my @headers = ();\r
+chdir ("openssl");\r
+foreach(@dir_list){\r
+  @files = glob($_."/*.h");\r
+  push @headers, @files;\r
+}\r
+chdir ($dir);\r
+\r
+foreach (@headers){\r
+  if(/ssl/){\r
+    push @sslfilelist, '  $(OPENSSL_PATH)/' . $_ . "\r\n";\r
+    next;\r
+  }\r
+  push @cryptofilelist, '  $(OPENSSL_PATH)/' . $_ . "\r\n";\r
+}\r
+\r
+\r
 #\r
 # Update OpensslLib.inf with autogenerated file list\r
 #\r
@@ -210,12 +257,17 @@ rename( $new_inf_file, $inf_file ) ||
 print "Done!";\r
 \r
 #\r
-# Copy opensslconf.h generated from OpenSSL Configuration\r
+# Copy opensslconf.h and dso_conf.h generated from OpenSSL Configuration\r
 #\r
 print "\n--> Duplicating opensslconf.h into Include/openssl ... ";\r
 copy($OPENSSL_PATH . "/include/openssl/opensslconf.h",\r
-     $OPENSSL_PATH . "/../../../Include/openssl/") ||\r
+     $OPENSSL_PATH . "/../../Include/openssl/") ||\r
    die "Cannot copy opensslconf.h!";\r
+print "Done!";\r
+print "\n--> Duplicating dso_conf.h into Include/internal ... ";\r
+copy($OPENSSL_PATH . "/include/internal/dso_conf.h",\r
+     $OPENSSL_PATH . "/../../Include/internal/") ||\r
+   die "Cannot copy dso_conf.h!";\r
 print "Done!\n";\r
 \r
 print "\nProcessing Files Done!\n";\r