Re: [edk2-devel] [PATCH 3/3] CryptoPkg/openssl: update generated files

2022-05-08 Thread yi1 li
Hi, Changes to this file are automatically generated by perl script. Modified 
them before to follow edk2 code style.

Gerd thinks files generated by process_files.pl from openssl sources should not 
be checked for edk2 code style, I agree with him.
So the changes are back.

-Original Message-
From: Yao, Jiewen  
Sent: Monday, May 9, 2022 11:25 AM
To: Li, Yi1 ; devel@edk2.groups.io
Cc: Wang, Jian J ; Lu, Xiaoyu1 ; 
Jiang, Guomin ; Gerd Hoffmann 
Subject: RE: [PATCH 3/3] CryptoPkg/openssl: update generated files

Thanks for the update.

 think some changes are unnecessary.

> -#define OSSL_CRYPTO_DSO_CONF_H
> -#define DSO_NONE
> -#define DSO_EXTENSION  ".so"
> +# define OSSL_CRYPTO_DSO_CONF_H
> +# define DSO_NONE
> +# define DSO_EXTENSION ".so"

Why you add a space ' ' ?

Can we make it unchanged? 

Thank you
Yao Jiewen




> -Original Message-
> From: Li, Yi1 
> Sent: Monday, May 9, 2022 11:19 AM
> To: devel@edk2.groups.io
> Cc: Li, Yi1 ; Yao, Jiewen ; 
> Wang, Jian J ; Lu, Xiaoyu1 
> ; Jiang, Guomin ; Gerd 
> Hoffmann 
> Subject: [PATCH 3/3] CryptoPkg/openssl: update generated files
> 
> Run process_files.pl with the current openssl submodule version.
> 
> Signed-off-by: Yi Li 
> Cc: Jiewen Yao 
> Cc: Jian J Wang 
> Cc: Xiaoyu Lu 
> Cc: Guomin Jiang 
> Cc: Gerd Hoffmann 
> ---
>  CryptoPkg/Library/Include/crypto/dso_conf.h   |   7 +-
>  .../Library/Include/openssl/opensslconf.h | 266 +-
>  CryptoPkg/Library/OpensslLib/OpensslLib.inf   |  34 ++-
>  .../Library/OpensslLib/OpensslLibCrypto.inf   |  96 ---
>  4 files changed, 210 insertions(+), 193 deletions(-)
> 
> diff --git a/CryptoPkg/Library/Include/crypto/dso_conf.h
> b/CryptoPkg/Library/Include/crypto/dso_conf.h
> index b9c38b416697..95f4db2b1586 100644
> --- a/CryptoPkg/Library/Include/crypto/dso_conf.h
> +++ b/CryptoPkg/Library/Include/crypto/dso_conf.h
> @@ -1,6 +1,5 @@
>  /* WARNING: do not edit! */
>  /* Generated from include/crypto/dso_conf.h.in */
> -
>  /*
>   * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
>   *
> @@ -11,7 +10,7 @@
>   */
> 
>  #ifndef OSSL_CRYPTO_DSO_CONF_H
> -#define OSSL_CRYPTO_DSO_CONF_H
> -#define DSO_NONE
> -#define DSO_EXTENSION  ".so"
> +# define OSSL_CRYPTO_DSO_CONF_H
> +# define DSO_NONE
> +# define DSO_EXTENSION ".so"
>  #endif
> diff --git a/CryptoPkg/Library/Include/openssl/opensslconf.h
> b/CryptoPkg/Library/Include/openssl/opensslconf.h
> index 1485b8c9f108..aaa5c0e54813 100644
> --- a/CryptoPkg/Library/Include/openssl/opensslconf.h
> +++ b/CryptoPkg/Library/Include/openssl/opensslconf.h
> @@ -9,15 +9,41 @@
>   * in the file LICENSE in the source distribution or at
>   * https://www.openssl.org/source/license.html
>   */
> -#include 
> +
>  #include 
> +#include 
> 
>  #ifdef  __cplusplus
>  extern "C" {
>  #endif
> 
> +#if !FixedPcdGetBool (PcdEcEnabled)
> +# ifndef OPENSSL_NO_ECDSA
> +#  define OPENSSL_NO_ECDSA
> +# endif
> +#endif
> +#if !FixedPcdGetBool (PcdEcEnabled)
> +# ifndef OPENSSL_NO_EC
> +#  define OPENSSL_NO_EC
> +# endif
> +#endif
> +#if !FixedPcdGetBool (PcdEcEnabled)
> +# ifndef OPENSSL_NO_SM2
> +#  define OPENSSL_NO_SM2
> +# endif
> +#endif
> +#if !FixedPcdGetBool (PcdEcEnabled)
> +# ifndef OPENSSL_NO_TLS1_3
> +#  define OPENSSL_NO_TLS1_3
> +# endif
> +#endif
> +#if !FixedPcdGetBool (PcdEcEnabled)
> +# ifndef OPENSSL_NO_ECDH
> +#  define OPENSSL_NO_ECDH
> +# endif
> +#endif
>  #ifdef OPENSSL_ALGORITHM_DEFINES
> -  #error OPENSSL_ALGORITHM_DEFINES no longer supported
> +# error OPENSSL_ALGORITHM_DEFINES no longer supported
>  #endif
> 
>  /*
> @@ -25,233 +51,217 @@ extern "C" {
>   */
> 
>  #ifndef OPENSSL_SYS_UEFI
> -#define OPENSSL_SYS_UEFI  1
> +# define OPENSSL_SYS_UEFI 1
>  #endif
> -#define OPENSSL_MIN_API  0x1010L
> +#define OPENSSL_MIN_API 0x1010L
>  #ifndef OPENSSL_NO_BF
> -#define OPENSSL_NO_BF
> +# define OPENSSL_NO_BF
>  #endif
>  #ifndef OPENSSL_NO_BLAKE2
> -#define OPENSSL_NO_BLAKE2
> +# define OPENSSL_NO_BLAKE2
>  #endif
>  #ifndef OPENSSL_NO_CAMELLIA
> -#define OPENSSL_NO_CAMELLIA
> +# define OPENSSL_NO_CAMELLIA
>  #endif
>  #ifndef OPENSSL_NO_CAST
> -#define OPENSSL_NO_CAST
> +# define OPENSSL_NO_CAST
>  #endif
>  #ifndef OPENSSL_NO_CHACHA
> -#define OPENSSL_NO_CHACHA
> +# define OPENSSL_NO_CHACHA
>  #endif
>  #ifndef OPENSSL_NO_CMS
> -#define OPENSSL_NO_CMS
> +# define OPENSSL_NO_CMS
>  #endif
>  #ifndef OPENSSL_NO_CT
> -#define OPENSSL_NO_CT
> +# define OPENSSL_NO_CT
>  #endif
>  #ifndef OPENSSL_NO_DES
> -#define OPENSSL_NO_DES
> +# define OPENSSL_NO_DES
>  #endif
>  #ifndef OPENSSL_NO_DSA
> -#define OPENSSL_NO_DSA
> -#endif
> -#if !FixedPcdGetBool (PcdEcEnabled)
> -  #ifndef OPENSSL_NO_EC
> -#define OPENSSL_NO_EC
> -  #endif
> +# define OPENSSL_NO_DSA
>  #endif
>  #ifndef OPENSSL_NO_IDEA
> -#define OPENSSL_NO_IDEA
> +# define OPENSSL_NO_IDEA
>  #endif
>  #ifndef OPENSSL_NO_MD2
> -#define OPENSSL_NO_MD2
> +# define OPENSSL_NO_MD2
>  #endif
>  #ifndef OPENSSL_NO_MD4
> -#define OPENSSL_NO_MD4
> +# define 

Re: [edk2-devel] [PATCH 3/3] CryptoPkg/openssl: update generated files

2022-05-08 Thread Yao, Jiewen
Thanks for the update.

 think some changes are unnecessary.

> -#define OSSL_CRYPTO_DSO_CONF_H
> -#define DSO_NONE
> -#define DSO_EXTENSION  ".so"
> +# define OSSL_CRYPTO_DSO_CONF_H
> +# define DSO_NONE
> +# define DSO_EXTENSION ".so"

Why you add a space ' ' ?

Can we make it unchanged? 

Thank you
Yao Jiewen




> -Original Message-
> From: Li, Yi1 
> Sent: Monday, May 9, 2022 11:19 AM
> To: devel@edk2.groups.io
> Cc: Li, Yi1 ; Yao, Jiewen ; Wang, Jian
> J ; Lu, Xiaoyu1 ; Jiang, Guomin
> ; Gerd Hoffmann 
> Subject: [PATCH 3/3] CryptoPkg/openssl: update generated files
> 
> Run process_files.pl with the current openssl submodule version.
> 
> Signed-off-by: Yi Li 
> Cc: Jiewen Yao 
> Cc: Jian J Wang 
> Cc: Xiaoyu Lu 
> Cc: Guomin Jiang 
> Cc: Gerd Hoffmann 
> ---
>  CryptoPkg/Library/Include/crypto/dso_conf.h   |   7 +-
>  .../Library/Include/openssl/opensslconf.h | 266 +-
>  CryptoPkg/Library/OpensslLib/OpensslLib.inf   |  34 ++-
>  .../Library/OpensslLib/OpensslLibCrypto.inf   |  96 ---
>  4 files changed, 210 insertions(+), 193 deletions(-)
> 
> diff --git a/CryptoPkg/Library/Include/crypto/dso_conf.h
> b/CryptoPkg/Library/Include/crypto/dso_conf.h
> index b9c38b416697..95f4db2b1586 100644
> --- a/CryptoPkg/Library/Include/crypto/dso_conf.h
> +++ b/CryptoPkg/Library/Include/crypto/dso_conf.h
> @@ -1,6 +1,5 @@
>  /* WARNING: do not edit! */
>  /* Generated from include/crypto/dso_conf.h.in */
> -
>  /*
>   * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
>   *
> @@ -11,7 +10,7 @@
>   */
> 
>  #ifndef OSSL_CRYPTO_DSO_CONF_H
> -#define OSSL_CRYPTO_DSO_CONF_H
> -#define DSO_NONE
> -#define DSO_EXTENSION  ".so"
> +# define OSSL_CRYPTO_DSO_CONF_H
> +# define DSO_NONE
> +# define DSO_EXTENSION ".so"
>  #endif
> diff --git a/CryptoPkg/Library/Include/openssl/opensslconf.h
> b/CryptoPkg/Library/Include/openssl/opensslconf.h
> index 1485b8c9f108..aaa5c0e54813 100644
> --- a/CryptoPkg/Library/Include/openssl/opensslconf.h
> +++ b/CryptoPkg/Library/Include/openssl/opensslconf.h
> @@ -9,15 +9,41 @@
>   * in the file LICENSE in the source distribution or at
>   * https://www.openssl.org/source/license.html
>   */
> -#include 
> +
>  #include 
> +#include 
> 
>  #ifdef  __cplusplus
>  extern "C" {
>  #endif
> 
> +#if !FixedPcdGetBool (PcdEcEnabled)
> +# ifndef OPENSSL_NO_ECDSA
> +#  define OPENSSL_NO_ECDSA
> +# endif
> +#endif
> +#if !FixedPcdGetBool (PcdEcEnabled)
> +# ifndef OPENSSL_NO_EC
> +#  define OPENSSL_NO_EC
> +# endif
> +#endif
> +#if !FixedPcdGetBool (PcdEcEnabled)
> +# ifndef OPENSSL_NO_SM2
> +#  define OPENSSL_NO_SM2
> +# endif
> +#endif
> +#if !FixedPcdGetBool (PcdEcEnabled)
> +# ifndef OPENSSL_NO_TLS1_3
> +#  define OPENSSL_NO_TLS1_3
> +# endif
> +#endif
> +#if !FixedPcdGetBool (PcdEcEnabled)
> +# ifndef OPENSSL_NO_ECDH
> +#  define OPENSSL_NO_ECDH
> +# endif
> +#endif
>  #ifdef OPENSSL_ALGORITHM_DEFINES
> -  #error OPENSSL_ALGORITHM_DEFINES no longer supported
> +# error OPENSSL_ALGORITHM_DEFINES no longer supported
>  #endif
> 
>  /*
> @@ -25,233 +51,217 @@ extern "C" {
>   */
> 
>  #ifndef OPENSSL_SYS_UEFI
> -#define OPENSSL_SYS_UEFI  1
> +# define OPENSSL_SYS_UEFI 1
>  #endif
> -#define OPENSSL_MIN_API  0x1010L
> +#define OPENSSL_MIN_API 0x1010L
>  #ifndef OPENSSL_NO_BF
> -#define OPENSSL_NO_BF
> +# define OPENSSL_NO_BF
>  #endif
>  #ifndef OPENSSL_NO_BLAKE2
> -#define OPENSSL_NO_BLAKE2
> +# define OPENSSL_NO_BLAKE2
>  #endif
>  #ifndef OPENSSL_NO_CAMELLIA
> -#define OPENSSL_NO_CAMELLIA
> +# define OPENSSL_NO_CAMELLIA
>  #endif
>  #ifndef OPENSSL_NO_CAST
> -#define OPENSSL_NO_CAST
> +# define OPENSSL_NO_CAST
>  #endif
>  #ifndef OPENSSL_NO_CHACHA
> -#define OPENSSL_NO_CHACHA
> +# define OPENSSL_NO_CHACHA
>  #endif
>  #ifndef OPENSSL_NO_CMS
> -#define OPENSSL_NO_CMS
> +# define OPENSSL_NO_CMS
>  #endif
>  #ifndef OPENSSL_NO_CT
> -#define OPENSSL_NO_CT
> +# define OPENSSL_NO_CT
>  #endif
>  #ifndef OPENSSL_NO_DES
> -#define OPENSSL_NO_DES
> +# define OPENSSL_NO_DES
>  #endif
>  #ifndef OPENSSL_NO_DSA
> -#define OPENSSL_NO_DSA
> -#endif
> -#if !FixedPcdGetBool (PcdEcEnabled)
> -  #ifndef OPENSSL_NO_EC
> -#define OPENSSL_NO_EC
> -  #endif
> +# define OPENSSL_NO_DSA
>  #endif
>  #ifndef OPENSSL_NO_IDEA
> -#define OPENSSL_NO_IDEA
> +# define OPENSSL_NO_IDEA
>  #endif
>  #ifndef OPENSSL_NO_MD2
> -#define OPENSSL_NO_MD2
> +# define OPENSSL_NO_MD2
>  #endif
>  #ifndef OPENSSL_NO_MD4
> -#define OPENSSL_NO_MD4
> +# define OPENSSL_NO_MD4
>  #endif
>  #ifndef OPENSSL_NO_MDC2
> -#define OPENSSL_NO_MDC2
> +# define OPENSSL_NO_MDC2
>  #endif
>  #ifndef OPENSSL_NO_POLY1305
> -#define OPENSSL_NO_POLY1305
> +# define OPENSSL_NO_POLY1305
>  #endif
>  #ifndef OPENSSL_NO_RC2
> -#define OPENSSL_NO_RC2
> +# define OPENSSL_NO_RC2
>  #endif
>  #ifndef OPENSSL_NO_RC4
> -#define OPENSSL_NO_RC4
> +# define OPENSSL_NO_RC4
>  #endif
>  #ifndef OPENSSL_NO_RC5
> -#define OPENSSL_NO_RC5
> +# define OPENSSL_NO_RC5
>  #endif
>  #ifndef OPENSSL_NO_RMD160
> -#define 

Re: [edk2-devel] [PATCH 1/3] CryptoPkg: Update process_files.pl to automatically add PCD config option

2022-05-08 Thread Yao, Jiewen
Reviewed-by: Jiewen Yao 

> -Original Message-
> From: Li, Yi1 
> Sent: Monday, May 9, 2022 11:19 AM
> To: devel@edk2.groups.io
> Cc: Li, Yi1 ; Yao, Jiewen ; Wang, Jian
> J ; Lu, Xiaoyu1 ; Jiang, Guomin
> ; Gerd Hoffmann 
> Subject: [PATCH 1/3] CryptoPkg: Update process_files.pl to automatically add
> PCD config option
> 
> Recommend from Gerd:
> (2) Keep the EC config option, but update process_files.pl to
>   automatically add the PcdEcEnabled config option handling
>   to the files it generates.
> 
> When remove 'no-ec' from openssl configure list, will automatically remove
> 'OPENSSL_NO_EC', 'OPENSSL_NO_ECDH', 'OPENSSL_NO_ECDSA',
> 'OPENSSL_NO_TLS1_3',
> form header, and add '/ec/.', '/sm2/.' files to INF files.
> 
> Signed-off-by: Yi Li 
> Cc: Jiewen Yao 
> Cc: Jian J Wang 
> Cc: Xiaoyu Lu 
> Cc: Guomin Jiang 
> Cc: Gerd Hoffmann 
> ---
>  CryptoPkg/Library/OpensslLib/process_files.pl | 67 ++-
>  1 file changed, 65 insertions(+), 2 deletions(-)
> 
> diff --git a/CryptoPkg/Library/OpensslLib/process_files.pl
> b/CryptoPkg/Library/OpensslLib/process_files.pl
> index 2ebfbbbca0de..2849f5d9aed0 100755
> --- a/CryptoPkg/Library/OpensslLib/process_files.pl
> +++ b/CryptoPkg/Library/OpensslLib/process_files.pl
> @@ -81,6 +81,19 @@ my $uefi_config;
>  my $extension;
>  my $arch;
>  my @inf;
> +#
> +# Use PCD to conditionally enable certain openssl features.
> +# $conditional_feature contains fetures_names:pcd_name pairs
> +# of conditional features.
> +# @conditional_feature_dir contains relative_path:pcd_name pairs
> +# of conditional features in openssl, MUST correspond to the content
> +# in $conditional_feature.
> +#
> +# Configure list [openssl_configuratio : new_define_list : new_file_list : 
> pcd]
> +# 1. no-ec : {NO_EC, NO_ECDH, NO_ECDSA, NO_TLS1_3, NO_SM2} : {/ec/,
> /sm2/} : PcdEcEnabled
> +#
> +my %conditional_feature = ("EC"=>"PcdEcEnabled", "ECDH"=>"PcdEcEnabled",
> "ECDSA"=>"PcdEcEnabled", "TLS1_3"=>"PcdEcEnabled",
> "SM2"=>"PcdEcEnabled");
> +my %conditional_feature_dir = ("/ec/"=>"PcdEcEnabled",
> "/sm2/"=>"PcdEcEnabled");
> 
>  BEGIN {
>  $inf_file = "OpensslLib.inf";
> @@ -282,7 +295,13 @@ foreach my $product ((@{$unified_info{libraries}},
>  push @sslfilelist, '  $(OPENSSL_PATH)/' . $s . "\r\n";
>  next;
>  }
> -push @cryptofilelist, '  $(OPENSSL_PATH)/' . $s . "\r\n";
> +push @cryptofilelist, '  $(OPENSSL_PATH)/' . $s;
> +foreach (keys(%conditional_feature_dir)) {
> +if ($s =~ $_) {
> +push @cryptofilelist, '  
> |*|*|*|gEfiCryptoPkgTokenSpaceGuid.' .
> $conditional_feature_dir{$_};
> +}
> +}
> +push @cryptofilelist, "\r\n";
>  }
>  }
>  }
> @@ -311,7 +330,13 @@ foreach (@headers){
>  push @sslfilelist, '  $(OPENSSL_PATH)/' . $_ . "\r\n";
>  next;
>}
> -  push @cryptofilelist, '  $(OPENSSL_PATH)/' . $_ . "\r\n";
> +  push @cryptofilelist, '  $(OPENSSL_PATH)/' . $_;
> +  foreach my $conditional_key (keys(%conditional_feature_dir)) {
> +if ($_ =~ $conditional_key) {
> +push @cryptofilelist, '  |*|*|*|gEfiCryptoPkgTokenSpaceGuid.' .
> $conditional_feature_dir{$conditional_key};
> +}
> +  }
> +  push @cryptofilelist, "\r\n";
>  }
> 
> 
> @@ -430,6 +455,44 @@ system(
>  die "Cannot copy dso_conf.h!";
>  print "Done!\n";
> 
> +#
> +# Add conditional feature to opensslconf.h
> +#
> +my $conf_file = "../Include/openssl/opensslconf.h";
> +my @conf_raw = ();
> +my @conditional_define = ();
> +print "\n--> Updating $conf_file ... ";
> +
> +foreach my $feature_name (keys(%conditional_feature)) {
> +push @conditional_define, "#if !FixedPcdGetBool
> ($conditional_feature{$feature_name})\r\n";
> +push @conditional_define, "# ifndef OPENSSL_NO_$feature_name\r\n";
> +push @conditional_define, "#  define OPENSSL_NO_$feature_name\r\n";
> +push @conditional_define, "# endif\r\n#endif\r\n";
> +}
> +
> +open( FD, "<" . $conf_file ) ||
> +die $conf_file;
> +foreach () {
> +# Insert conditional define to the begin of opensslconf.h
> +if ($_ =~ "#ifdef OPENSSL_ALGORITHM_DEFINES") {
> +push @conf_raw, @conditional_define;
> +}
> +push @conf_raw, $_;
> +if ($_ =~ "") {
> +push @conf_raw, "#include \r\n";
> +}
> +}
> +close(FD) ||
> +die $conf_file;
> +
> +open( FD, ">" . $conf_file ) ||
> +die $conf_file;
> +print( FD @conf_raw ) ||
> +die $conf_file;
> +close(FD) ||
> +die $conf_file;
> +print "Done!\n";
> +
>  print "\nProcessing Files Done!\n";
> 
>  exit(0);
> --
> 2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89595): https://edk2.groups.io/g/devel/message/89595
Mute This Topic: https://groups.io/mt/90982453/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub 

Re: [edk2-devel] [PATCH 2/3] CryptoPkg/openssl: disable codestyle checks for generated files

2022-05-08 Thread Yao, Jiewen
Reviewed-by: Jiewen Yao 

> -Original Message-
> From: Li, Yi1 
> Sent: Monday, May 9, 2022 11:19 AM
> To: devel@edk2.groups.io
> Cc: Li, Yi1 ; Gerd Hoffmann ; Yao,
> Jiewen ; Wang, Jian J ; Lu,
> Xiaoyu1 ; Jiang, Guomin 
> Subject: [PATCH 2/3] CryptoPkg/openssl: disable codestyle checks for generated
> files
> 
> Files generated by process_files.pl from openssl sources should not be checked
> for edk2 code style.
> 
> Signed-off-by: Gerd Hoffmann 
> Signed-off-by: Yi Li 
> Cc: Jiewen Yao 
> Cc: Jian J Wang 
> Cc: Xiaoyu Lu 
> Cc: Guomin Jiang 
> ---
>  CryptoPkg/CryptoPkg.ci.yaml | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/CryptoPkg/CryptoPkg.ci.yaml b/CryptoPkg/CryptoPkg.ci.yaml
> index 396ca93dbe49..09fba0bcc685 100644
> --- a/CryptoPkg/CryptoPkg.ci.yaml
> +++ b/CryptoPkg/CryptoPkg.ci.yaml
> @@ -26,6 +26,8 @@
>  ## Both file path and directory path are accepted.
>  "IgnoreFiles": [
>  "Library/OpensslLib/openssl",
> +"Library/Include/openssl",
> +"Library/Include/crypto",
>  # The unit testing folder is not to be checked
>  "Test/UnitTest",
>  # This has OpenSSL interfaces that aren't UEFI spec compliant
> @@ -89,5 +91,13 @@
>  "ExtendWords": [],   # words to extend to the dictionary for 
> this
> package
>  "IgnoreStandardPaths": [],   # Standard Plugin defined paths that 
> should be
> ignore
>  "AdditionalIncludePaths": [] # Additional paths to spell check 
> (wildcards
> supported)
> +},
> +
> +# options defined in .pytool/Plugin/UncrustifyCheck
> +"UncrustifyCheck": {
> +"IgnoreFiles": [
> +"opensslconf.h",
> +"dso_conf.h",
> +]
>  }
>  }
> --
> 2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89594): https://edk2.groups.io/g/devel/message/89594
Mute This Topic: https://groups.io/mt/90982454/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 3/3] CryptoPkg/openssl: update generated files

2022-05-08 Thread yi1 li
Run process_files.pl with the current openssl submodule version.

Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
Cc: Gerd Hoffmann 
---
 CryptoPkg/Library/Include/crypto/dso_conf.h   |   7 +-
 .../Library/Include/openssl/opensslconf.h | 266 +-
 CryptoPkg/Library/OpensslLib/OpensslLib.inf   |  34 ++-
 .../Library/OpensslLib/OpensslLibCrypto.inf   |  96 ---
 4 files changed, 210 insertions(+), 193 deletions(-)

diff --git a/CryptoPkg/Library/Include/crypto/dso_conf.h 
b/CryptoPkg/Library/Include/crypto/dso_conf.h
index b9c38b416697..95f4db2b1586 100644
--- a/CryptoPkg/Library/Include/crypto/dso_conf.h
+++ b/CryptoPkg/Library/Include/crypto/dso_conf.h
@@ -1,6 +1,5 @@
 /* WARNING: do not edit! */
 /* Generated from include/crypto/dso_conf.h.in */
-
 /*
  * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
  *
@@ -11,7 +10,7 @@
  */
 
 #ifndef OSSL_CRYPTO_DSO_CONF_H
-#define OSSL_CRYPTO_DSO_CONF_H
-#define DSO_NONE
-#define DSO_EXTENSION  ".so"
+# define OSSL_CRYPTO_DSO_CONF_H
+# define DSO_NONE
+# define DSO_EXTENSION ".so"
 #endif
diff --git a/CryptoPkg/Library/Include/openssl/opensslconf.h 
b/CryptoPkg/Library/Include/openssl/opensslconf.h
index 1485b8c9f108..aaa5c0e54813 100644
--- a/CryptoPkg/Library/Include/openssl/opensslconf.h
+++ b/CryptoPkg/Library/Include/openssl/opensslconf.h
@@ -9,15 +9,41 @@
  * in the file LICENSE in the source distribution or at
  * https://www.openssl.org/source/license.html
  */
-#include 
+
 #include 
+#include 
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
+#if !FixedPcdGetBool (PcdEcEnabled)
+# ifndef OPENSSL_NO_ECDSA
+#  define OPENSSL_NO_ECDSA
+# endif
+#endif
+#if !FixedPcdGetBool (PcdEcEnabled)
+# ifndef OPENSSL_NO_EC
+#  define OPENSSL_NO_EC
+# endif
+#endif
+#if !FixedPcdGetBool (PcdEcEnabled)
+# ifndef OPENSSL_NO_SM2
+#  define OPENSSL_NO_SM2
+# endif
+#endif
+#if !FixedPcdGetBool (PcdEcEnabled)
+# ifndef OPENSSL_NO_TLS1_3
+#  define OPENSSL_NO_TLS1_3
+# endif
+#endif
+#if !FixedPcdGetBool (PcdEcEnabled)
+# ifndef OPENSSL_NO_ECDH
+#  define OPENSSL_NO_ECDH
+# endif
+#endif
 #ifdef OPENSSL_ALGORITHM_DEFINES
-  #error OPENSSL_ALGORITHM_DEFINES no longer supported
+# error OPENSSL_ALGORITHM_DEFINES no longer supported
 #endif
 
 /*
@@ -25,233 +51,217 @@ extern "C" {
  */
 
 #ifndef OPENSSL_SYS_UEFI
-#define OPENSSL_SYS_UEFI  1
+# define OPENSSL_SYS_UEFI 1
 #endif
-#define OPENSSL_MIN_API  0x1010L
+#define OPENSSL_MIN_API 0x1010L
 #ifndef OPENSSL_NO_BF
-#define OPENSSL_NO_BF
+# define OPENSSL_NO_BF
 #endif
 #ifndef OPENSSL_NO_BLAKE2
-#define OPENSSL_NO_BLAKE2
+# define OPENSSL_NO_BLAKE2
 #endif
 #ifndef OPENSSL_NO_CAMELLIA
-#define OPENSSL_NO_CAMELLIA
+# define OPENSSL_NO_CAMELLIA
 #endif
 #ifndef OPENSSL_NO_CAST
-#define OPENSSL_NO_CAST
+# define OPENSSL_NO_CAST
 #endif
 #ifndef OPENSSL_NO_CHACHA
-#define OPENSSL_NO_CHACHA
+# define OPENSSL_NO_CHACHA
 #endif
 #ifndef OPENSSL_NO_CMS
-#define OPENSSL_NO_CMS
+# define OPENSSL_NO_CMS
 #endif
 #ifndef OPENSSL_NO_CT
-#define OPENSSL_NO_CT
+# define OPENSSL_NO_CT
 #endif
 #ifndef OPENSSL_NO_DES
-#define OPENSSL_NO_DES
+# define OPENSSL_NO_DES
 #endif
 #ifndef OPENSSL_NO_DSA
-#define OPENSSL_NO_DSA
-#endif
-#if !FixedPcdGetBool (PcdEcEnabled)
-  #ifndef OPENSSL_NO_EC
-#define OPENSSL_NO_EC
-  #endif
+# define OPENSSL_NO_DSA
 #endif
 #ifndef OPENSSL_NO_IDEA
-#define OPENSSL_NO_IDEA
+# define OPENSSL_NO_IDEA
 #endif
 #ifndef OPENSSL_NO_MD2
-#define OPENSSL_NO_MD2
+# define OPENSSL_NO_MD2
 #endif
 #ifndef OPENSSL_NO_MD4
-#define OPENSSL_NO_MD4
+# define OPENSSL_NO_MD4
 #endif
 #ifndef OPENSSL_NO_MDC2
-#define OPENSSL_NO_MDC2
+# define OPENSSL_NO_MDC2
 #endif
 #ifndef OPENSSL_NO_POLY1305
-#define OPENSSL_NO_POLY1305
+# define OPENSSL_NO_POLY1305
 #endif
 #ifndef OPENSSL_NO_RC2
-#define OPENSSL_NO_RC2
+# define OPENSSL_NO_RC2
 #endif
 #ifndef OPENSSL_NO_RC4
-#define OPENSSL_NO_RC4
+# define OPENSSL_NO_RC4
 #endif
 #ifndef OPENSSL_NO_RC5
-#define OPENSSL_NO_RC5
+# define OPENSSL_NO_RC5
 #endif
 #ifndef OPENSSL_NO_RMD160
-#define OPENSSL_NO_RMD160
+# define OPENSSL_NO_RMD160
 #endif
 #ifndef OPENSSL_NO_SEED
-#define OPENSSL_NO_SEED
-#endif
-#ifndef OPENSSL_NO_SM2
-#define OPENSSL_NO_SM2
+# define OPENSSL_NO_SEED
 #endif
 #ifndef OPENSSL_NO_SRP
-#define OPENSSL_NO_SRP
+# define OPENSSL_NO_SRP
 #endif
 #ifndef OPENSSL_NO_TS
-#define OPENSSL_NO_TS
+# define OPENSSL_NO_TS
 #endif
 #ifndef OPENSSL_NO_WHIRLPOOL
-#define OPENSSL_NO_WHIRLPOOL
+# define OPENSSL_NO_WHIRLPOOL
 #endif
 #ifndef OPENSSL_RAND_SEED_NONE
-#define OPENSSL_RAND_SEED_NONE
+# define OPENSSL_RAND_SEED_NONE
 #endif
 #ifndef OPENSSL_NO_AFALGENG
-#define OPENSSL_NO_AFALGENG
+# define OPENSSL_NO_AFALGENG
 #endif
 #ifndef OPENSSL_NO_APPS
-#define OPENSSL_NO_APPS
+# define OPENSSL_NO_APPS
 #endif
 #ifndef OPENSSL_NO_ASAN
-#define OPENSSL_NO_ASAN
+# define OPENSSL_NO_ASAN
 #endif
 #ifndef OPENSSL_NO_ASYNC
-#define OPENSSL_NO_ASYNC
+# define OPENSSL_NO_ASYNC
 #endif
 #ifndef 

[edk2-devel] [PATCH 2/3] CryptoPkg/openssl: disable codestyle checks for generated files

2022-05-08 Thread yi1 li
Files generated by process_files.pl from openssl sources should not be checked 
for edk2 code style.

Signed-off-by: Gerd Hoffmann 
Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
---
 CryptoPkg/CryptoPkg.ci.yaml | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/CryptoPkg/CryptoPkg.ci.yaml b/CryptoPkg/CryptoPkg.ci.yaml
index 396ca93dbe49..09fba0bcc685 100644
--- a/CryptoPkg/CryptoPkg.ci.yaml
+++ b/CryptoPkg/CryptoPkg.ci.yaml
@@ -26,6 +26,8 @@
 ## Both file path and directory path are accepted.
 "IgnoreFiles": [
 "Library/OpensslLib/openssl",
+"Library/Include/openssl",
+"Library/Include/crypto",
 # The unit testing folder is not to be checked
 "Test/UnitTest",
 # This has OpenSSL interfaces that aren't UEFI spec compliant
@@ -89,5 +91,13 @@
 "ExtendWords": [],   # words to extend to the dictionary for 
this package
 "IgnoreStandardPaths": [],   # Standard Plugin defined paths that 
should be ignore
 "AdditionalIncludePaths": [] # Additional paths to spell check 
(wildcards supported)
+},
+
+# options defined in .pytool/Plugin/UncrustifyCheck
+"UncrustifyCheck": {
+"IgnoreFiles": [
+"opensslconf.h",
+"dso_conf.h",
+]
 }
 }
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89592): https://edk2.groups.io/g/devel/message/89592
Mute This Topic: https://groups.io/mt/90982454/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/3] CryptoPkg: Update process_files.pl to automatically add PCD config option

2022-05-08 Thread yi1 li
Recommend from Gerd:
(2) Keep the EC config option, but update process_files.pl to
  automatically add the PcdEcEnabled config option handling
  to the files it generates.

When remove 'no-ec' from openssl configure list, will automatically remove
'OPENSSL_NO_EC', 'OPENSSL_NO_ECDH', 'OPENSSL_NO_ECDSA', 'OPENSSL_NO_TLS1_3',
form header, and add '/ec/.', '/sm2/.' files to INF files.

Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
Cc: Gerd Hoffmann 
---
 CryptoPkg/Library/OpensslLib/process_files.pl | 67 ++-
 1 file changed, 65 insertions(+), 2 deletions(-)

diff --git a/CryptoPkg/Library/OpensslLib/process_files.pl 
b/CryptoPkg/Library/OpensslLib/process_files.pl
index 2ebfbbbca0de..2849f5d9aed0 100755
--- a/CryptoPkg/Library/OpensslLib/process_files.pl
+++ b/CryptoPkg/Library/OpensslLib/process_files.pl
@@ -81,6 +81,19 @@ my $uefi_config;
 my $extension;
 my $arch;
 my @inf;
+#
+# Use PCD to conditionally enable certain openssl features.
+# $conditional_feature contains fetures_names:pcd_name pairs
+# of conditional features.
+# @conditional_feature_dir contains relative_path:pcd_name pairs
+# of conditional features in openssl, MUST correspond to the content
+# in $conditional_feature.
+#
+# Configure list [openssl_configuratio : new_define_list : new_file_list : pcd]
+# 1. no-ec : {NO_EC, NO_ECDH, NO_ECDSA, NO_TLS1_3, NO_SM2} : {/ec/, /sm2/} : 
PcdEcEnabled
+#
+my %conditional_feature = ("EC"=>"PcdEcEnabled", "ECDH"=>"PcdEcEnabled", 
"ECDSA"=>"PcdEcEnabled", "TLS1_3"=>"PcdEcEnabled", "SM2"=>"PcdEcEnabled");
+my %conditional_feature_dir = ("/ec/"=>"PcdEcEnabled", 
"/sm2/"=>"PcdEcEnabled");
 
 BEGIN {
 $inf_file = "OpensslLib.inf";
@@ -282,7 +295,13 @@ foreach my $product ((@{$unified_info{libraries}},
 push @sslfilelist, '  $(OPENSSL_PATH)/' . $s . "\r\n";
 next;
 }
-push @cryptofilelist, '  $(OPENSSL_PATH)/' . $s . "\r\n";
+push @cryptofilelist, '  $(OPENSSL_PATH)/' . $s;
+foreach (keys(%conditional_feature_dir)) {
+if ($s =~ $_) {
+push @cryptofilelist, '  
|*|*|*|gEfiCryptoPkgTokenSpaceGuid.' . $conditional_feature_dir{$_};
+}
+}
+push @cryptofilelist, "\r\n";
 }
 }
 }
@@ -311,7 +330,13 @@ foreach (@headers){
 push @sslfilelist, '  $(OPENSSL_PATH)/' . $_ . "\r\n";
 next;
   }
-  push @cryptofilelist, '  $(OPENSSL_PATH)/' . $_ . "\r\n";
+  push @cryptofilelist, '  $(OPENSSL_PATH)/' . $_;
+  foreach my $conditional_key (keys(%conditional_feature_dir)) {
+if ($_ =~ $conditional_key) {
+push @cryptofilelist, '  |*|*|*|gEfiCryptoPkgTokenSpaceGuid.' . 
$conditional_feature_dir{$conditional_key};
+}
+  }
+  push @cryptofilelist, "\r\n";
 }
 
 
@@ -430,6 +455,44 @@ system(
 die "Cannot copy dso_conf.h!";
 print "Done!\n";
 
+#
+# Add conditional feature to opensslconf.h
+#
+my $conf_file = "../Include/openssl/opensslconf.h";
+my @conf_raw = ();
+my @conditional_define = ();
+print "\n--> Updating $conf_file ... ";
+
+foreach my $feature_name (keys(%conditional_feature)) {
+push @conditional_define, "#if !FixedPcdGetBool 
($conditional_feature{$feature_name})\r\n";
+push @conditional_define, "# ifndef OPENSSL_NO_$feature_name\r\n";
+push @conditional_define, "#  define OPENSSL_NO_$feature_name\r\n";
+push @conditional_define, "# endif\r\n#endif\r\n";
+}
+
+open( FD, "<" . $conf_file ) ||
+die $conf_file;
+foreach () {
+# Insert conditional define to the begin of opensslconf.h
+if ($_ =~ "#ifdef OPENSSL_ALGORITHM_DEFINES") {
+push @conf_raw, @conditional_define;
+}
+push @conf_raw, $_;
+if ($_ =~ "") {
+push @conf_raw, "#include \r\n";
+}
+}
+close(FD) ||
+die $conf_file;
+
+open( FD, ">" . $conf_file ) ||
+die $conf_file;
+print( FD @conf_raw ) ||
+die $conf_file;
+close(FD) ||
+die $conf_file;
+print "Done!\n";
+
 print "\nProcessing Files Done!\n";
 
 exit(0);
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89591): https://edk2.groups.io/g/devel/message/89591
Mute This Topic: https://groups.io/mt/90982453/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 0/3] CryptoPkg/openssl: Enable EC conditionally.

2022-05-08 Thread yi1 li
Recommend for Gerd:
(2) Keep the EC config option, but update process_files.pl to
  automatically add the PcdEcEnabled config option handling
  to the files it generates.

This patch set does (2).

When remove 'no-ec' from openssl configure list, will automatically remove
'OPENSSL_NO_EC', 'OPENSSL_NO_ECDH', 'OPENSSL_NO_ECDSA', 'OPENSSL_NO_TLS1_3',
'OPENSSL_NO_SM2', form header, and add '/ec/.', '/sm2/.' files to INF files.

Signed-off-by: Yi Li 
Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
Cc: Gerd Hoffmann 

Yi Li (3):
  CryptoPkg: Update process_files.pl to automatically add PCD config
option
  CryptoPkg/openssl: disable codestyle checks for generated files
  CryptoPkg/openssl: update generated files

 CryptoPkg/CryptoPkg.ci.yaml   |  10 +
 CryptoPkg/Library/Include/crypto/dso_conf.h   |   7 +-
 .../Library/Include/openssl/opensslconf.h | 261 +-
 CryptoPkg/Library/OpensslLib/OpensslLib.inf   |  34 ++-
 .../Library/OpensslLib/OpensslLibCrypto.inf   |  96 ---
 CryptoPkg/Library/OpensslLib/process_files.pl |  68 -
 6 files changed, 281 insertions(+), 195 deletions(-)

-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89590): https://edk2.groups.io/g/devel/message/89590
Mute This Topic: https://groups.io/mt/90982452/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 0/5] CryptoPkg/openssl: enable EC unconditionally.

2022-05-08 Thread Yao, Jiewen
Thank you Gerd.

I collected feedback from Intel BIOS team, both client and server, both old 
platform and new platform.

In general, the new platform will leave enough space for crypto improvement. 
Size is not a big issue. The delta is acceptable.

However, the old launched platforms only has limited flash space. This patch 
will break the current build because of size increase. Option (1) is not 
acceptable.

In conclusion:
For OvmfPkg update: Acked-by: Jiewen Yao 
For SecurityPkg update: I recommend we consider option (2).

  (1) Drop the idea to make EC configurable and just enable it
  unconditionally.  I think long-term there is no way around
  this anyway as EC is a hard requirement for TLS 1.3.
  (2) Keep the EC config option, but update process_files.pl to
  automatically add the PcdEcEnabled config option handling
  to the files it generates.

Thank you
Yao Jiewen


> -Original Message-
> From: Gerd Hoffmann 
> Sent: Thursday, May 5, 2022 5:16 PM
> To: devel@edk2.groups.io
> Cc: Yao, Jiewen ; Pawel Polawski
> ; Li, Yi1 ; Oliver Steffen
> ; Wang, Jian J ; Ard Biesheuvel
> ; Jiang, Guomin ; Lu,
> Xiaoyu1 ; Justen, Jordan L 
> Subject: Re: [edk2-devel] [PATCH 0/5] CryptoPkg/openssl: enable EC
> unconditionally.
> 
>   Hi,
> 
> > > I am not convinced that "EC is hard requirement for EDKII" just because 
> > > "EC
> is a hard requirement for TLS 1.3". My reason below:
> > > A) TLS1.3 is only for DXE, but enabling ECC unconditionally may impact
> PEI/DXE. (Unless size of PEI/SMM is unchanged).
> >
> > Well, the PcdEcEnabled switch we have in the tree right now enables or
> > disables EC for everybody, it doesn't support enabling EC for DXE only.
> >
> > In we want change that we'll need two different *.inf files I guess,
> > one for openssl with ec and one for openssl without ec.
> >
> > I'll check the effect on image sizes.
> 
> Here we go:
> 
> --- master.stats  2022-05-05 10:05:03.791368600 +0200
> +++ openssl-ec.stats  2022-05-05 10:35:44.429412053 +0200
> @@ -137,8 +137,8 @@
>124410 BdsDxe
>145534 DxeCore
>148078 UiApp
> -  400158 SecureBootConfigDxe
> -  472950 SecurityStubDxe
> -  532626 VariableSmm
> -  658174 TlsDxe
> +  575390 SecureBootConfigDxe
> +  643062 SecurityStubDxe
> +  700562 VariableSmm
> +  847422 TlsDxe
>946646 Shell
> 
> So no effect on PEI size but SMM is affected.
> 
> take care,
>   Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89589): https://edk2.groups.io/g/devel/message/89589
Mute This Topic: https://groups.io/mt/90832153/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] [edk2-staging] BaseTools:Remove useless FMMT entry file

2022-05-08 Thread Yuwei Chen
FMMT can be directly used as its compiled binary path saved in PATH,
the FMMT in BaseTools/BinWrappers/PosixLike is useless now.

This patch remove the useless file.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/BinWrappers/PosixLike/FMMT | 29 
 1 file changed, 29 deletions(-)
 delete mode 100755 BaseTools/BinWrappers/PosixLike/FMMT

diff --git a/BaseTools/BinWrappers/PosixLike/FMMT 
b/BaseTools/BinWrappers/PosixLike/FMMT
deleted file mode 100755
index 0945d86d92..00
--- a/BaseTools/BinWrappers/PosixLike/FMMT
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env bash
-
-full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
-dir=$(dirname "$full_cmd")
-cmd=${full_cmd##*/}
-
-if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
-then
-  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
-elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
-then
-  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
-  then
-echo "BaseTools C Tool binary was not found ($cmd)"
-echo "You may need to run:"
-echo "  make -C $EDK_TOOLS_PATH/Source/C"
-  else
-exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
-  fi
-elif [ -e "$dir/../../Source/C/bin/$cmd" ]
-then
-  exec "$dir/../../Source/C/bin/$cmd" "$@"
-else
-  echo "Unable to find the real '$cmd' to run"
-  echo "This message was printed by"
-  echo "  $0"
-  exit 127
-fi
-
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89588): https://edk2.groups.io/g/devel/message/89588
Mute This Topic: https://groups.io/mt/90980955/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] [edk2-staging] BaseTools: Modify FMMT GNUmakefile

2022-05-08 Thread Yuwei Chen
Currently the path of compiled FMMT binary is not saved in PATH,
this patch modified FMMT binary path for directly using.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/C/FMMT/GNUmakefile  |  2 +-
 BaseTools/Source/C/FMMT/app.makefile | 25 +
 2 files changed, 26 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 BaseTools/Source/C/FMMT/GNUmakefile
 create mode 100755 BaseTools/Source/C/FMMT/app.makefile

diff --git a/BaseTools/Source/C/FMMT/GNUmakefile 
b/BaseTools/Source/C/FMMT/GNUmakefile
old mode 100644
new mode 100755
index 81b99f25db..d0ea601f8e
--- a/BaseTools/Source/C/FMMT/GNUmakefile
+++ b/BaseTools/Source/C/FMMT/GNUmakefile
@@ -12,5 +12,5 @@ LIBS = -lCommon
 
 OBJECTS = FmmtLib.o Rebase.o FirmwareModuleManagement.o
 
-include $(MAKEROOT)/Makefiles/app.makefile
+include $(MAKEROOT)/FMMT/app.makefile
 
diff --git a/BaseTools/Source/C/FMMT/app.makefile 
b/BaseTools/Source/C/FMMT/app.makefile
new file mode 100755
index 00..130528a97e
--- /dev/null
+++ b/BaseTools/Source/C/FMMT/app.makefile
@@ -0,0 +1,25 @@
+## @file
+# Makefiles
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+MAKEROOT ?= ../..
+LINUX_BIN_PATH = ../../../Bin/Linux-x86_64
+
+include $(MAKEROOT)/Makefiles/header.makefile
+
+APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
+
+.PHONY:all
+all: $(MAKEROOT)/bin $(APPLICATION)
+
+$(APPLICATION): $(OBJECTS)
+   $(LINKER) -o $(APPLICATION) $(BUILD_LFLAGS) $(OBJECTS) 
-L$(MAKEROOT)/libs $(LIBS)
+   -mkdir -p $(LINUX_BIN_PATH)
+   cp -r $(APPLICATION) $(LINUX_BIN_PATH)
+
+$(OBJECTS): $(MAKEROOT)/Include/Common/BuildVersion.h
+
+include $(MAKEROOT)/Makefiles/footer.makefile
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89587): https://edk2.groups.io/g/devel/message/89587
Mute This Topic: https://groups.io/mt/90980949/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] Remove useless FMMT entry file

2022-05-08 Thread Yuwei Chen
FMMT can be directly used as its compiled binary path saved in PATH,
the FMMT in BaseTools/BinWrappers/PosixLike is useless now.

This patch remove the useless file.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/BinWrappers/PosixLike/FMMT | 29 
 1 file changed, 29 deletions(-)
 delete mode 100755 BaseTools/BinWrappers/PosixLike/FMMT

diff --git a/BaseTools/BinWrappers/PosixLike/FMMT 
b/BaseTools/BinWrappers/PosixLike/FMMT
deleted file mode 100755
index 0945d86d92..00
--- a/BaseTools/BinWrappers/PosixLike/FMMT
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env bash
-
-full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
-dir=$(dirname "$full_cmd")
-cmd=${full_cmd##*/}
-
-if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
-then
-  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
-elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
-then
-  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
-  then
-echo "BaseTools C Tool binary was not found ($cmd)"
-echo "You may need to run:"
-echo "  make -C $EDK_TOOLS_PATH/Source/C"
-  else
-exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
-  fi
-elif [ -e "$dir/../../Source/C/bin/$cmd" ]
-then
-  exec "$dir/../../Source/C/bin/$cmd" "$@"
-else
-  echo "Unable to find the real '$cmd' to run"
-  echo "This message was printed by"
-  echo "  $0"
-  exit 127
-fi
-
-- 
2.26.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89586): https://edk2.groups.io/g/devel/message/89586
Mute This Topic: https://groups.io/mt/90980660/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] BaseTools: Modify FMMT GNUmakefile

2022-05-08 Thread Yuwei Chen
Currently the path of compiled FMMT binary is not saved in PATH,
this patch modified FMMT binary path for directly using.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/C/FMMT/GNUmakefile  |  2 +-
 BaseTools/Source/C/FMMT/app.makefile | 25 +
 2 files changed, 26 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 BaseTools/Source/C/FMMT/GNUmakefile
 create mode 100755 BaseTools/Source/C/FMMT/app.makefile

diff --git a/BaseTools/Source/C/FMMT/GNUmakefile 
b/BaseTools/Source/C/FMMT/GNUmakefile
old mode 100644
new mode 100755
index 81b99f25db..d0ea601f8e
--- a/BaseTools/Source/C/FMMT/GNUmakefile
+++ b/BaseTools/Source/C/FMMT/GNUmakefile
@@ -12,5 +12,5 @@ LIBS = -lCommon
 
 OBJECTS = FmmtLib.o Rebase.o FirmwareModuleManagement.o
 
-include $(MAKEROOT)/Makefiles/app.makefile
+include $(MAKEROOT)/FMMT/app.makefile
 
diff --git a/BaseTools/Source/C/FMMT/app.makefile 
b/BaseTools/Source/C/FMMT/app.makefile
new file mode 100755
index 00..130528a97e
--- /dev/null
+++ b/BaseTools/Source/C/FMMT/app.makefile
@@ -0,0 +1,25 @@
+## @file
+# Makefiles
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+MAKEROOT ?= ../..
+LINUX_BIN_PATH = ../../../Bin/Linux-x86_64
+
+include $(MAKEROOT)/Makefiles/header.makefile
+
+APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
+
+.PHONY:all
+all: $(MAKEROOT)/bin $(APPLICATION)
+
+$(APPLICATION): $(OBJECTS)
+   $(LINKER) -o $(APPLICATION) $(BUILD_LFLAGS) $(OBJECTS) 
-L$(MAKEROOT)/libs $(LIBS)
+   -mkdir -p $(LINUX_BIN_PATH)
+   cp -r $(APPLICATION) $(LINUX_BIN_PATH)
+
+$(OBJECTS): $(MAKEROOT)/Include/Common/BuildVersion.h
+
+include $(MAKEROOT)/Makefiles/footer.makefile
-- 
2.26.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89585): https://edk2.groups.io/g/devel/message/89585
Mute This Topic: https://groups.io/mt/90980657/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 10/10] BaseTools: Remove RVCT support

2022-05-08 Thread Bob Feng
Reviewed-by: Bob Feng 

-Original Message-
From: Rebecca Cran  
Sent: Wednesday, May 4, 2022 2:48 AM
To: devel@edk2.groups.io; Leif Lindholm ; Ard 
Biesheuvel ; Sami Mujawar ; 
Gerd Hoffmann ; Feng, Bob C ; Gao, 
Liming ; Chen, Christine ; Yao, 
Jiewen ; Wang, Jian J ; Lu, 
Xiaoyu1 ; Jiang, Guomin ; Chang, 
Abner ; Schaefer, Daniel ; Ni, 
Ray ; Kinney, Michael D ; Liu, 
Zhiguang ; Maciej Rabeda 
; Wu, Jiaxin ; Fu, Siyuan 
; Justen, Jordan L ; Anthony 
Perard ; Julien Grall 
Cc: Rebecca Cran 
Subject: [PATCH 10/10] BaseTools: Remove RVCT support

RVCT is obsolete and no longer used.
Remove support for it.

Signed-off-by: Rebecca Cran 
---
 BaseTools/Conf/build_rule.template   |  42 ++
 BaseTools/Conf/tools_def.template| 157 
 BaseTools/Scripts/Rvct-Align32.sct   |  19 ---
 BaseTools/Scripts/Rvct-Align4K.sct   |  19 ---
 BaseTools/Source/C/Include/Common/BaseTypes.h|  10 +-
 BaseTools/Source/Python/AutoGen/BuildEngine.py   |   2 +-
 BaseTools/Source/Python/AutoGen/GenMake.py   |   2 +-
 BaseTools/Source/Python/AutoGen/ModuleAutoGen.py |  17 +--
 BaseTools/Source/Python/UPT/Library/DataType.py  |   1 -
 9 files changed, 16 insertions(+), 253 deletions(-)

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
index 435662351213..5895b48fd88d 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -128,8 +128,7 @@
 
 "$(CC)" /Fo${dst} $(DEPS_FLAGS) $(CC_FLAGS) $(INC) ${src}
 
-
-# For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
+
 "$(CC)" $(DEPS_FLAGS) $(CC_FLAGS) -c -o ${dst} $(INC) ${src}
 
 
@@ -145,7 +144,7 @@
 
 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
 
-
+
 "$(CC)" $(CC_FLAGS) $(CC_XIPFLAGS) -c -o ${dst} $(INC) ${src}
 
 [C-Header-File]
@@ -157,7 +156,7 @@
 
 
 [Assembly-Code-File.COMMON.COMMON]
-
+
 ?.asm, ?.Asm, ?.ASM
 
 
@@ -175,16 +174,15 @@
 Trim --source-code --convert-hex --trim-long -o 
${d_path}(+)${s_base}. ${d_path}(+)${s_base}.ii
 "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) 
${d_path}(+)${s_base}.
 
-
+
 Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
 "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > 
${d_path}(+)${s_base}.ii
 Trim --trim-long --source-code -o ${d_path}(+)${s_base}. 
${d_path}(+)${s_base}.ii
-# For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
 "$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.
 
 [Assembly-Code-File.COMMON.ARM,Assembly-Code-File.COMMON.AARCH64]
 # Remove --convert-hex for ARM as it breaks MSFT assemblers
-
+
 ?.asm, ?.Asm, ?.ASM
 
 
@@ -208,11 +206,10 @@
 Trim --source-code --trim-long -o ${d_path}(+)${s_base}. 
${d_path}(+)${s_base}.ii
 "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) 
${d_path}(+)${s_base}.
 
-
+
 Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
 "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > 
${d_path}(+)${s_base}.ii
 Trim --trim-long --source-code -o ${d_path}(+)${s_base}. 
${d_path}(+)${s_base}.ii
-# For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
 "$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.
 
 [Nasm-Assembly-Code-File.COMMON.COMMON]
@@ -276,13 +273,6 @@
 $(RM) ${dst}
 "$(SLINK)" cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)
 
-
-"$(SLINK)" $(SLINK_FLAGS) ${dst} --via $(OBJECT_FILES_LIST)
-
-
-# $(OBJECT_FILES_LIST) has wrong paths for cygwin
-"$(SLINK)" $(SLINK_FLAGS) ${dst} $(OBJECT_FILES)
-
 
 "$(SLINK)" $(SLINK_FLAGS) ${dst} -filelist $(OBJECT_FILES_LIST)
 
@@ -307,13 +297,6 @@
 "$(DLINK)" -o ${dst} $(DLINK_FLAGS) 
-Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(CC_FLAGS) 
$(DLINK2_FLAGS)
 "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
 
-
-"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via 
$(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
-
-
-#$(STATIC_LIBRARY_FILES_LIST) has wrong paths for cygwin
-"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) 
$(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)
-
 
 "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) -filelist 
$(STATIC_LIBRARY_FILES_LIST)  $(DLINK2_FLAGS)
 
@@ -349,13 +332,6 @@
 
 "$(DLINK)" $(DLINK_FLAGS) 
-Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(DLINK2_FLAGS)
 
-
-"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via 
$(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
-
-
-#$(STATIC_LIBRARY_FILES_LIST) has the wrong paths for cygwin
-"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) 
$(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)
-

Re: [edk2-devel] [Patch V2] UefiPayloadPkg: Fix the UPL build failure

2022-05-08 Thread Guo Dong


Reviewed-by: Guo Dong 

-Original Message-
From: Tan, Dun  
Sent: Friday, May 6, 2022 8:58 PM
To: devel@edk2.groups.io
Cc: Ni, Ray ; Dong, Guo ; You, Benjamin 
; Rhodes, Sean 
Subject: [Patch V2] UefiPayloadPkg: Fix the UPL build failure

Add double quotes to LlvmObjcopyPath.
Blank space in LlvmObjcopyPath will cause build failure.
This build failure is introduced by 2306555bf908 (
"UefiPayloadPkg: Fix IA32 entry build failure").

Signed-off-by: Dun Tan 
Cc: Ray Ni 
Cc: Guo Dong 
Cc: Benjamin You 
Cc: Sean Rhodes 
---
 UefiPayloadPkg/UniversalPayloadBuild.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index 8af381336d..50335d4316 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -111,9 +111,9 @@ def BuildUniversalPayload(Args, MacroList):
 #
 # Copy the DXEFV as a section in elf format Universal Payload entry.
 #
-remove_section = f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} 
--remove-section .upld_info --remove-section .upld.uefi_fv {EntryOutputDir}"
-add_section= f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} 
--add-section .upld_info={UpldInfoFile} --add-section 
.upld.uefi_fv={FvOutputDir} {EntryOutputDir}"
-set_section= f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} 
--set-section-alignment .upld.upld_info=16 --set-section-alignment 
.upld.uefi_fv=16 {EntryOutputDir}"
+remove_section = f'"{LlvmObjcopyPath}" -I {ObjCopyFlag} -O {ObjCopyFlag} 
--remove-section .upld_info --remove-section .upld.uefi_fv {EntryOutputDir}'
+add_section= f'"{LlvmObjcopyPath}" -I {ObjCopyFlag} -O {ObjCopyFlag} 
--add-section .upld_info={UpldInfoFile} --add-section 
.upld.uefi_fv={FvOutputDir} {EntryOutputDir}'
+set_section= f'"{LlvmObjcopyPath}" -I {ObjCopyFlag} -O {ObjCopyFlag} 
--set-section-alignment .upld.upld_info=16 --set-section-alignment 
.upld.uefi_fv=16 {EntryOutputDir}'
 RunCommand(remove_section)
 RunCommand(add_section)
 RunCommand(set_section)
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89583): https://edk2.groups.io/g/devel/message/89583
Mute This Topic: https://groups.io/mt/90948162/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




回复: [edk2-devel] [PATCH] MdeModulePkg/PCD: Pcd initialize DXE have assert

2022-05-08 Thread gaoliming
Guo:
  This change is good to me. Reviewed-by: Liming Gao 

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表
> guo@intel.com
> 发送时间: 2022年5月6日 5:30
> 收件人: devel@edk2.groups.io
> 抄送: Gua Guo 
> 主题: [edk2-devel] [PATCH] MdeModulePkg/PCD: Pcd initialize DXE have
> assert
> 
> From: Gua Guo 
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3917
> 
> When PlatformPkg.dsc has multiple SKU IDs but didn't exist delta PCD,
> System will hang on BuildPcdDxeDataBase.
> 
> Ideally, if didn't exist delta PCD by different SKU ID,
> UpdatePcdDatabase () shouldn't return EFI_NOT_FOUND.
> 
> Signed-off-by: Gua Guo 
> ---
>  MdeModulePkg/Universal/PCD/Dxe/Service.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/MdeModulePkg/Universal/PCD/Dxe/Service.c
> b/MdeModulePkg/Universal/PCD/Dxe/Service.c
> index 3965846b93..5ade8d988b 100644
> --- a/MdeModulePkg/Universal/PCD/Dxe/Service.c
> +++ b/MdeModulePkg/Universal/PCD/Dxe/Service.c
> @@ -817,6 +817,11 @@ UpdatePcdDatabase (
>//
> 
>Index= (mPcdDatabase.DxeDb->Length + 7) & (~7);
> 
>SkuDelta = NULL;
> 
> +
> 
> +  if (Index == mDxePcdDbSize) {
> 
> +return EFI_SUCCESS;
> 
> +  }
> 
> +
> 
>while (Index < mDxePcdDbSize) {
> 
>  SkuDelta = (PCD_DATABASE_SKU_DELTA *)((UINT8 *)mDxePcdDbBinary
> + Index);
> 
>  if ((SkuDelta->SkuId == SkuId) && (SkuDelta->SkuIdCompared == 0)) {
> 
> --
> 2.31.1.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#89557): https://edk2.groups.io/g/devel/message/89557
> Mute This Topic: https://groups.io/mt/90934230/4905953
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaolim...@byosoft.com.cn]
> -=-=-=-=-=-=
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89582): https://edk2.groups.io/g/devel/message/89582
Mute This Topic: https://groups.io/mt/90971174/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-