public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Liming Gao" <liming.gao@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>,
	"matthewfcarlson@gmail.com" <matthewfcarlson@gmail.com>
Subject: Re: [edk2-devel] [PATCH v3 0/3] Use RngLib instead of TimerLib for OpensslLib
Date: Mon, 3 Aug 2020 07:03:59 +0000	[thread overview]
Message-ID: <CY4PR11MB15261EEF9FB62042A9F304D5804D0@CY4PR11MB1526.namprd11.prod.outlook.com> (raw)
In-Reply-To: <MN2PR11MB446184559F10E6EA26B0844DD24E0@MN2PR11MB4461.namprd11.prod.outlook.com>

Hi Matt: 
  With this change, which library instance should be used for the platform? BaseRngLibTimerLib?

  And, this patch introduces the dependency for RngLib. Then, NetworkPkg and FmpDevicePkg package level build will break. Will you update them?

Thanks
Liming
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael D Kinney
Sent: 2020年8月1日 5:17
To: devel@edk2.groups.io; matthewfcarlson@gmail.com; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] [PATCH v3 0/3] Use RngLib instead of TimerLib for OpensslLib

Hi Matt,

1) BaseRngLibTimerLib
  a) The comments incorrectly list delays in ms instead of us.
  b) Did you consider use of GetPerformanceCounterProperties()?
     I also do not seen an explanation of the delay values used.
     (why not smaller or larger values).  At a minimum, the file
     header should state it only works if the rate of the perf
     counter from TimerLib is much greater than 1MHz.
2) BaseRngLibDxe
   a) This is not a lib of type Base.  I recommend the name
      DxeRngLibRngProtocol.
   b) Has a "MU_CHANGE" comment that can be removed
   c) GenerateRandomNumberViaNist800Algorithm() assigns values in
      declaration.  Init should be moved into statements.
   d) How would gBS aver be NULL?  The INF lists the BootServicesTableLib
      as a dependency, so the constructer is always run before the
      services are used.  I think these checks can be removed.
   e) Minor code style issues.  if statements should have { as end of line.

With the addition of DxeRngLibRngProtocol to MdePkg, I think the CryptoPkg DSC can be updated to use this RngLib instance from the Crypto DXE mododule.

Best regards,

Mike

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Matthew 
> Carlson
> Sent: Friday, July 31, 2020 1:27 PM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [PATCH v3 0/3] Use RngLib instead of TimerLib 
> for OpensslLib
> 
> From: Matthew Carlson <macarl@microsoft.com>
> 
> Fixes Bugzilla#1871
> https://github.com/tianocore/edk2/pull/845
> 
> 
> Matthew Carlson (3):
>   CryptoPkg: OpensslLib: Use RngLib to generate entropy in rand_pool
>   MdePkg: TimerRngLib: Added RngLib that uses TimerLib
>   MdePkg: BaseRngLibDxe: Add RngLib that uses RngDxe
> 
>  CryptoPkg/Library/OpensslLib/rand_pool.c
> | 203 ++----------------
>  CryptoPkg/Library/OpensslLib/rand_pool_noise.c
> |  29 ---
>  CryptoPkg/Library/OpensslLib/rand_pool_noise_tsc.c
> |  43 ----
>  MdePkg/Library/BaseRngLibDxe/RngDxeLib.c
> | 216 ++++++++++++++++++++
>  MdePkg/Library/BaseRngLibTimerLib/RngLibTimer.c
> | 154 ++++++++++++++
>  CryptoPkg/CryptoPkg.dsc
> |   1 +
>  CryptoPkg/Library/OpensslLib/OpensslLib.inf
> |  15 +-
>  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> |  15 +-
>  CryptoPkg/Library/OpensslLib/rand_pool_noise.h
> |  29 ---
>  MdePkg/Library/BaseRngLibDxe/BaseRngLibDxe.inf
> |  38 ++++
> 
> MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.in
> f |  38 ++++
> 
> MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.un
> i |  17 ++
>  MdePkg/MdePkg.dsc
> |   5 +-
>  13 files changed, 489 insertions(+), 314 deletions(-)  delete mode 
> 100644 CryptoPkg/Library/OpensslLib/rand_pool_noise.c
>  delete mode 100644
> CryptoPkg/Library/OpensslLib/rand_pool_noise_tsc.c
>  create mode 100644
> MdePkg/Library/BaseRngLibDxe/RngDxeLib.c
>  create mode 100644
> MdePkg/Library/BaseRngLibTimerLib/RngLibTimer.c
>  delete mode 100644
> CryptoPkg/Library/OpensslLib/rand_pool_noise.h
>  create mode 100644
> MdePkg/Library/BaseRngLibDxe/BaseRngLibDxe.inf
>  create mode 100644
> MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.in
> f
>  create mode 100644
> MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.un
> i
> 
> --
> 2.27.0.windows.1
> 
> 
> 





  reply	other threads:[~2020-08-03  7:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-31 20:27 [PATCH v3 0/3] Use RngLib instead of TimerLib for OpensslLib Matthew Carlson
2020-07-31 20:27 ` [PATCH v3 1/3] CryptoPkg: OpensslLib: Use RngLib to generate entropy in rand_pool Matthew Carlson
2020-08-01  0:25   ` Yao, Jiewen
     [not found]   ` <1626FD395A4E4B04.26980@groups.io>
2020-08-13 14:44     ` [edk2-devel] " Yao, Jiewen
     [not found]     ` <162ADB0D165E4BBB.11996@groups.io>
2020-08-13 15:10       ` Yao, Jiewen
2020-07-31 20:27 ` [PATCH v3 2/3] MdePkg: TimerRngLib: Added RngLib that uses TimerLib Matthew Carlson
2020-07-31 20:27 ` [PATCH v3 3/3] MdePkg: BaseRngLibDxe: Add RngLib that uses RngDxe Matthew Carlson
2020-07-31 21:17 ` [edk2-devel] [PATCH v3 0/3] Use RngLib instead of TimerLib for OpensslLib Michael D Kinney
2020-08-03  7:03   ` Liming Gao [this message]
2020-08-03 17:21     ` Sean
2020-08-03 22:20       ` Michael D Kinney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CY4PR11MB15261EEF9FB62042A9F304D5804D0@CY4PR11MB1526.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox