summaryrefslogtreecommitdiffstats
path: root/CryptoPkg
diff options
context:
space:
mode:
Diffstat (limited to 'CryptoPkg')
-rwxr-xr-xCryptoPkg/Library/OpensslLib/process_files.pl93
1 files changed, 87 insertions, 6 deletions
diff --git a/CryptoPkg/Library/OpensslLib/process_files.pl b/CryptoPkg/Library/OpensslLib/process_files.pl
index 7e18c9f52d..fba97e7c39 100755
--- a/CryptoPkg/Library/OpensslLib/process_files.pl
+++ b/CryptoPkg/Library/OpensslLib/process_files.pl
@@ -15,6 +15,15 @@
# ./process_files.pl
# ./process_files.pl X64
# ./process_files.pl [Arch]
+#
+# Follow the command below to update the INF file:
+# 1. OpensslLib.inf ,OpensslLibCrypto.inf and OpensslLibFull.inf
+# ./process_files.pl
+# 2. OpensslLibAccel.inf and OpensslLibFullAccel.inf
+# ./process_files.pl X64
+# ./process_files.pl X64Gcc
+# ./process_files.pl IA32
+# ./process_files.pl IA32Gcc
use strict;
use Cwd;
@@ -79,6 +88,7 @@ my $inf_file;
my $OPENSSL_PATH;
my $uefi_config;
my $extension;
+my $compile;
my $arch;
my @inf;
@@ -90,31 +100,32 @@ BEGIN {
if (defined $arch) {
if (uc ($arch) eq "X64") {
$arch = "X64";
- $inf_file = "OpensslLibX64.inf";
$uefi_config = "UEFI-x86_64";
$extension = "nasm";
+ $compile = "MSFT";
$comment_character = ";";
} elsif (uc ($arch) eq "X64GCC") {
$arch = "X64Gcc";
- $inf_file = "OpensslLibX64Gcc.inf";
$uefi_config = "UEFI-x86_64-GCC";
$extension = "S";
+ $compile = "GCC";
$comment_character = "#";
} elsif (uc ($arch) eq "IA32") {
$arch = "IA32";
- $inf_file = "OpensslLibIa32.inf";
$uefi_config = "UEFI-x86";
$extension = "nasm";
+ $compile = "MSFT";
$comment_character = ";";
} elsif (uc ($arch) eq "IA32GCC") {
$arch = "IA32Gcc";
- $inf_file = "OpensslLibIa32Gcc.inf";
$uefi_config = "UEFI-x86-GCC";
$extension = "S";
+ $compile = "GCC";
$comment_character = "#";
} else {
die "Unsupported architecture \"" . $arch . "\"!";
}
+ $inf_file = "OpensslLibAccel.inf";
if ($extension eq "nasm") {
if (`nasm -v 2>&1`) {
#Presence of nasm executable will trigger inclusion of AVX instructions
@@ -256,6 +267,7 @@ foreach my $f (@{$config{lib_defines}}) {
my @cryptofilelist = ();
my @sslfilelist = ();
+my @ecfilelist = ();
my @asmfilelist = ();
my @asmbuild = ();
foreach my $product ((@{$unified_info{libraries}},
@@ -286,10 +298,14 @@ foreach my $product ((@{$unified_info{libraries}},
$buildstring .= " ./$arch/$path$s.$extension";
make_path ("./$arch/$path");
push @asmbuild, "$buildstring\n";
- push @asmfilelist, " $arch/$path$s.$extension\r\n";
+ push @asmfilelist, " $arch/$path$s.$extension |$compile\r\n";
}
next;
}
+ if ($s =~ "/ec/" || $s =~ "/sm2/") {
+ push @ecfilelist, ' $(OPENSSL_PATH)/' . $s . "\r\n";
+ next;
+ }
if ($product =~ "libssl") {
push @sslfilelist, ' $(OPENSSL_PATH)/' . $s . "\r\n";
next;
@@ -323,6 +339,10 @@ foreach (@headers){
push @sslfilelist, ' $(OPENSSL_PATH)/' . $_ . "\r\n";
next;
}
+ if ($_ =~ "/ec/" || $_ =~ "/sm2/") {
+ push @ecfilelist, ' $(OPENSSL_PATH)/' . $_ . "\r\n";
+ next;
+ }
push @cryptofilelist, ' $(OPENSSL_PATH)/' . $_ . "\r\n";
}
@@ -351,10 +371,18 @@ foreach (@inf) {
next;
}
if ( $_ =~ "# Autogenerated files list starts here" ) {
- push @new_inf, $_, @asmfilelist, @cryptofilelist, @sslfilelist;
+ push @new_inf, $_, @cryptofilelist, @sslfilelist;
$subbing = 1;
next;
}
+ if (defined $arch) {
+ my $arch_asmfile_flag = "# Autogenerated " . $arch . " files list starts here";
+ if ($_ =~ $arch_asmfile_flag) {
+ push @new_inf, $_, @asmfilelist;
+ $subbing = 1;
+ next;
+ }
+ }
if ( $_ =~ "# Autogenerated files list ends here" ) {
push @new_inf, $_;
$subbing = 0;
@@ -422,6 +450,59 @@ if (!defined $arch) {
}
#
+# Update OpensslLibFull.inf with autogenerated file list
+#
+if (!defined $arch) {
+ $inf_file = "OpensslLibFull.inf";
+} else {
+ $inf_file = "OpensslLibFullAccel.inf";
+}
+# Read the contents of the inf file
+@inf = ();
+@new_inf = ();
+open( FD, "<" . $inf_file ) ||
+ die "Cannot open \"" . $inf_file . "\"!";
+@inf = (<FD>);
+close(FD) ||
+ die "Cannot close \"" . $inf_file . "\"!";
+$subbing = 0;
+print "\n--> Updating $inf_file ... ";
+foreach (@inf) {
+ if ( $_ =~ "# Autogenerated files list starts here" ) {
+ push @new_inf, $_, @cryptofilelist, @sslfilelist, @ecfilelist;
+ $subbing = 1;
+ next;
+ }
+ if (defined $arch) {
+ my $arch_asmfile_flag = "# Autogenerated " . $arch . " files list starts here";
+ if ($_ =~ $arch_asmfile_flag) {
+ push @new_inf, $_, @asmfilelist;
+ $subbing = 1;
+ next;
+ }
+ }
+ if ( $_ =~ "# Autogenerated files list ends here" ) {
+ push @new_inf, $_;
+ $subbing = 0;
+ next;
+ }
+
+ push @new_inf, $_
+ unless ($subbing);
+}
+
+$new_inf_file = $inf_file . ".new";
+open( FD, ">" . $new_inf_file ) ||
+ die $new_inf_file;
+print( FD @new_inf ) ||
+ die $new_inf_file;
+close(FD) ||
+ die $new_inf_file;
+rename( $new_inf_file, $inf_file ) ||
+ die "rename $inf_file";
+print "Done!";
+
+#
# Copy opensslconf.h and dso_conf.h generated from OpenSSL Configuration
#
print "\n--> Duplicating opensslconf.h into Include/openssl ... ";