From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Wed, 22 May 2019 02:49:50 -0700 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DBDD3305B16F; Wed, 22 May 2019 09:49:44 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-230.rdu2.redhat.com [10.10.120.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id F02472CF79; Wed, 22 May 2019 09:49:41 +0000 (UTC) Subject: Re: [edk2-devel] [Patch V3] OpensslLib: Missing local header files in [Sources] section of .INFs To: devel@edk2.groups.io, xiaoyux.lu@intel.com, "Rodriguez, Christian" Cc: "Wang, Jian J" , "Ye, Ting" , "Zhu, Yonghong" References: <20190521211215.13452-1-christian.rodriguez@intel.com> From: "Laszlo Ersek" Message-ID: Date: Wed, 22 May 2019 11:49:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 22 May 2019 09:49:49 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 05/22/19 11:40, Xiaoyu Lu wrote: > Hi Christian, > > (1) We use OpenSSL configure script disabled some OpenSSL feature. > But I saw you include all .h files from OpenSSL(only excluded some). > Even some header files we don't need (In openssl/crypto/). > Can you rule them out? > I found OpenSSl use configdata.pm to store configure result. > > use configdata qw/%config/; > foreach my $enabledcryptomodule (@{config{"%sdirs"}}) > } > > Is it possible? If this is difficult, then I have no problem. > > (2) see blow. > > (3) I think it's better to separate this patch into two. > Patch1. process_files.pl > Patch2. OpensslLib[Crypto].conf > >> -----Original Message----- >> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of >> Christian Rodriguez >> Sent: Wednesday, May 22, 2019 5:12 AM >> To: devel@edk2.groups.io >> Cc: Wang, Jian J ; Ye, Ting ; Zhu, >> Yonghong >> Subject: [edk2-devel] [Patch V3] OpensslLib: Missing local header files in >> [Sources] section of .INFs >> >> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1821 >> >> In V2: Remove opensslconf.h because it is a script generated header. >> Update OpenSSL autogeneration script for .INFs because some >> OpenSSL local headers are missing from [Sources] section of >> OpensslLib.inf and OpensslLibCrypto.inf. Update OpensslLib.inf and >> OpensslLibCrypto.inf using the updated script. Enforce compilance >> of Edk2 INF Spec 3.9, which states, All HII Unicode format files >> must be listed in [Sources] section. Not functional issue, just compilance. >> >> Signed-off-by: Christian Rodriguez >> Cc: Jian Wang >> Cc: Ting Ye >> Cc: Yonghong Zhu >> --- >> CryptoPkg/Library/OpensslLib/OpensslLib.inf | 173 >> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> +++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 167 >> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> +++++++++++++++++++++++++++++++++++++++++++++++++ >> CryptoPkg/Library/OpensslLib/process_files.pl | 50 >> ++++++++++++++++++++++++++++++++++++++++++++++++-- >> 3 files changed, 388 insertions(+), 2 deletions(-) >> >> diff --git a/CryptoPkg/Library/OpensslLib/process_files.pl >> b/CryptoPkg/Library/OpensslLib/process_files.pl >> index f6e1f43641..9cad6d3ebd 100755 >> --- a/CryptoPkg/Library/OpensslLib/process_files.pl >> +++ b/CryptoPkg/Library/OpensslLib/process_files.pl >> @@ -115,12 +115,18 @@ BEGIN { >> # Retrieve file lists from OpenSSL configdata >> # >> use configdata qw/%unified_info/; >> +use Cwd qw(cwd getcwd); >> +use Cwd; >> >> my @cryptofilelist = (); >> my @sslfilelist = (); >> +my %includedirset = (); >> foreach my $product ((@{$unified_info{libraries}}, >> @{$unified_info{engines}})) { >> foreach my $o (@{$unified_info{sources}->{$product}}) { >> + foreach my $inc (@{%{$unified_info{includes}}{$o}}) { >> + $includedirset{$inc} = 1; >> + } >> foreach my $s (@{$unified_info{sources}->{$o}}) { >> next if ($unified_info{generate}->{$s}); >> next if $s =~ "crypto/bio/b_print.c"; >> @@ -133,6 +139,46 @@ foreach my $product ((@{$unified_info{libraries}}, >> } >> } >> >> +my $fullpathcwd = getcwd . '/' . $OPENSSL_PATH . '/'; >> +my $cwdpath = getcwd . '/'; >> +my @sslincludefilelist = (); >> +my @cryptoincludefilelist = (); >> +# Current working directory header files >> +foreach my $file (split (/\n/, `find . -maxdepth 1 -name "*.h"`)) { >> + # Normalize path >> + my @filearray = split("$cwdpath", Cwd::realpath($file)); >> + my $pathstring = $filearray[1]; >> + my $path = ' ' . $pathstring . "\r\n"; >> + push @cryptoincludefilelist, $path; >> +} >> +# Header files below $OPENSSL_PATH >> +foreach my $dir (keys %includedirset) { > > (2) If run process_files.pl twice, it possible generate different *.inf > files(*.h files is disordered). "keys %includedirset" is disordered. > I don't know whether this is a problem. Sounds like a good point to me -- in particular if the current file list generation for the INF files is "stable", then it should stay so even if we generate more files for those sources sections. Thanks, Laszlo > >> + foreach my $file (split (/\n/, `find $OPENSSL_PATH/$dir/ -name >> "*.h"`)) { >> + # Normalize path >> + my @filearray = split("$fullpathcwd", Cwd::realpath($file)); >> + my $pathstring = $filearray[1]; >> + my $path = ' $(OPENSSL_PATH)/' . $pathstring . "\r\n"; >> + # Don't reuse duplicates >> + next if ( $path ~~ @cryptoincludefilelist ); >> + next if ( $path ~~ @sslincludefilelist ); >> + # Ignore these types >> + next if ( $path =~ "test" ); >> + next if ( $path =~ "apps" ); >> + next if ( $path =~ "engines" ); >> + next if ( $path =~ "fuzz" ); >> + next if ( $path =~ "os-dep" ); >> + next if ( $path =~ "e_os.h" ); >> + next if ( $path =~ "opensslconf.h"); >> + # Seperate Ssl only headers >> + if ( $path =~ "/ssl/" ) { >> + push @sslincludefilelist, $path; >> + next; >> + } >> + push @cryptoincludefilelist, $path; >> + } >> +} >> + >> + >> # >> # Update OpensslLib.inf with autogenerated file list >> # >> @@ -141,7 +187,7 @@ my $subbing = 0; >> print "\n--> Updating OpensslLib.inf ... "; >> foreach (@inf) { >> if ( $_ =~ "# Autogenerated files list starts here" ) { >> - push @new_inf, $_, @cryptofilelist, @sslfilelist; >> + push @new_inf, $_, @cryptofilelist, @sslfilelist, >> @cryptoincludefilelist, @sslincludefilelist; >> $subbing = 1; >> next; >> } >> @@ -184,7 +230,7 @@ $subbing = 0; >> print "\n--> Updating OpensslLibCrypto.inf ... "; >> foreach (@inf) { >> if ( $_ =~ "# Autogenerated files list starts here" ) { >> - push @new_inf, $_, @cryptofilelist; >> + push @new_inf, $_, @cryptofilelist, @cryptoincludefilelist; >> $subbing = 1; >> next; >> } >> -- >> 2.19.1.windows.1 >> >> >> > > > >