public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] CryptoPkg/BaseCryptLib: remove unused code for IPF
@ 2019-05-14 14:30 Wang, Jian J
  2019-05-17  1:12 ` Liming Gao
  0 siblings, 1 reply; 3+ messages in thread
From: Wang, Jian J @ 2019-05-14 14:30 UTC (permalink / raw)
  To: devel; +Cc: Liming Gao, Michael D Kinney, Ting Ye

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1805

CryptRandItc.c is only for IPF arch, which has not been supported any
more in edk2. And no module actually reference this file. This patch
just removes it from tree.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
---
 .../Library/BaseCryptLib/Rand/CryptRandItc.c  | 112 ------------------
 1 file changed, 112 deletions(-)
 delete mode 100644 CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c

diff --git a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c b/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c
deleted file mode 100644
index 8699cfeb71..0000000000
--- a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/** @file
-  Pseudorandom Number Generator Wrapper Implementation over OpenSSL.
-
-Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "InternalCryptLib.h"
-#include <openssl/rand.h>
-#include <openssl/evp.h>
-#include <Library/PrintLib.h>
-
-/**
-  Sets up the seed value for the pseudorandom number generator.
-
-  This function sets up the seed value for the pseudorandom number generator.
-  If Seed is not NULL, then the seed passed in is used.
-  If Seed is NULL, then default seed is used.
-
-  @param[in]  Seed      Pointer to seed value.
-                        If NULL, default seed is used.
-  @param[in]  SeedSize  Size of seed value.
-                        If Seed is NULL, this parameter is ignored.
-
-  @retval TRUE   Pseudorandom number generator has enough entropy for random generation.
-  @retval FALSE  Pseudorandom number generator does not have enough entropy for random generation.
-
-**/
-BOOLEAN
-EFIAPI
-RandomSeed (
-  IN  CONST  UINT8  *Seed  OPTIONAL,
-  IN  UINTN         SeedSize
-  )
-{
-  CHAR8  DefaultSeed[128];
-
-  if (SeedSize > INT_MAX) {
-    return FALSE;
-  }
-
-  //
-  // The software PRNG implementation built in OpenSSL depends on message digest algorithm.
-  // Make sure SHA-1 digest algorithm is available here.
-  //
-  if (EVP_add_digest (EVP_sha1 ()) == 0) {
-    return FALSE;
-  }
-
-  //
-  // Seed the pseudorandom number generator with user-supplied value.
-  // NOTE: A cryptographic PRNG must be seeded with unpredictable data.
-  //
-  if (Seed != NULL) {
-    RAND_seed (Seed, (UINT32) SeedSize);
-  } else {
-    //
-    // Retrieve current time.
-    //
-    AsciiSPrint (
-      DefaultSeed,
-      sizeof (DefaultSeed),
-      "UEFI Crypto Library default seed (%ld)",
-      AsmReadItc ()
-      );
-
-    RAND_seed (DefaultSeed, sizeof (DefaultSeed));
-  }
-
-  if (RAND_status () == 1) {
-    return TRUE;
-  }
-
-  return FALSE;
-}
-
-/**
-  Generates a pseudorandom byte stream of the specified size.
-
-  If Output is NULL, then return FALSE.
-
-  @param[out]  Output  Pointer to buffer to receive random value.
-  @param[in]   Size    Size of random bytes to generate.
-
-  @retval TRUE   Pseudorandom byte stream generated successfully.
-  @retval FALSE  Pseudorandom number generator fails to generate due to lack of entropy.
-
-**/
-BOOLEAN
-EFIAPI
-RandomBytes (
-  OUT  UINT8  *Output,
-  IN   UINTN  Size
-  )
-{
-  //
-  // Check input parameters.
-  //
-  if (Output == NULL || Size > INT_MAX) {
-    return FALSE;
-  }
-
-  //
-  // Generate random data.
-  //
-  if (RAND_bytes (Output, (UINT32) Size) != 1) {
-    return FALSE;
-  }
-
-  return TRUE;
-}
-- 
2.17.1.windows.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] CryptoPkg/BaseCryptLib: remove unused code for IPF
  2019-05-14 14:30 [PATCH] CryptoPkg/BaseCryptLib: remove unused code for IPF Wang, Jian J
@ 2019-05-17  1:12 ` Liming Gao
  2019-05-17  5:16   ` Wang, Jian J
  0 siblings, 1 reply; 3+ messages in thread
From: Liming Gao @ 2019-05-17  1:12 UTC (permalink / raw)
  To: Wang, Jian J, devel@edk2.groups.io; +Cc: Kinney, Michael D, Ye, Ting

I see no module consumes this source file. 

The change is good. Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Wang, Jian J
>Sent: Tuesday, May 14, 2019 10:30 PM
>To: devel@edk2.groups.io
>Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D
><michael.d.kinney@intel.com>; Ye, Ting <ting.ye@intel.com>
>Subject: [PATCH] CryptoPkg/BaseCryptLib: remove unused code for IPF
>
>BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1805
>
>CryptRandItc.c is only for IPF arch, which has not been supported any
>more in edk2. And no module actually reference this file. This patch
>just removes it from tree.
>
>Cc: Liming Gao <liming.gao@intel.com>
>Cc: Michael D Kinney <michael.d.kinney@intel.com>
>Cc: Ting Ye <ting.ye@intel.com>
>Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
>---
> .../Library/BaseCryptLib/Rand/CryptRandItc.c  | 112 ------------------
> 1 file changed, 112 deletions(-)
> delete mode 100644 CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c
>
>diff --git a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c
>b/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c
>deleted file mode 100644
>index 8699cfeb71..0000000000
>--- a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c
>+++ /dev/null
>@@ -1,112 +0,0 @@
>-/** @file
>-  Pseudorandom Number Generator Wrapper Implementation over OpenSSL.
>-
>-Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
>-SPDX-License-Identifier: BSD-2-Clause-Patent
>-
>-**/
>-
>-#include "InternalCryptLib.h"
>-#include <openssl/rand.h>
>-#include <openssl/evp.h>
>-#include <Library/PrintLib.h>
>-
>-/**
>-  Sets up the seed value for the pseudorandom number generator.
>-
>-  This function sets up the seed value for the pseudorandom number
>generator.
>-  If Seed is not NULL, then the seed passed in is used.
>-  If Seed is NULL, then default seed is used.
>-
>-  @param[in]  Seed      Pointer to seed value.
>-                        If NULL, default seed is used.
>-  @param[in]  SeedSize  Size of seed value.
>-                        If Seed is NULL, this parameter is ignored.
>-
>-  @retval TRUE   Pseudorandom number generator has enough entropy for
>random generation.
>-  @retval FALSE  Pseudorandom number generator does not have enough
>entropy for random generation.
>-
>-**/
>-BOOLEAN
>-EFIAPI
>-RandomSeed (
>-  IN  CONST  UINT8  *Seed  OPTIONAL,
>-  IN  UINTN         SeedSize
>-  )
>-{
>-  CHAR8  DefaultSeed[128];
>-
>-  if (SeedSize > INT_MAX) {
>-    return FALSE;
>-  }
>-
>-  //
>-  // The software PRNG implementation built in OpenSSL depends on
>message digest algorithm.
>-  // Make sure SHA-1 digest algorithm is available here.
>-  //
>-  if (EVP_add_digest (EVP_sha1 ()) == 0) {
>-    return FALSE;
>-  }
>-
>-  //
>-  // Seed the pseudorandom number generator with user-supplied value.
>-  // NOTE: A cryptographic PRNG must be seeded with unpredictable data.
>-  //
>-  if (Seed != NULL) {
>-    RAND_seed (Seed, (UINT32) SeedSize);
>-  } else {
>-    //
>-    // Retrieve current time.
>-    //
>-    AsciiSPrint (
>-      DefaultSeed,
>-      sizeof (DefaultSeed),
>-      "UEFI Crypto Library default seed (%ld)",
>-      AsmReadItc ()
>-      );
>-
>-    RAND_seed (DefaultSeed, sizeof (DefaultSeed));
>-  }
>-
>-  if (RAND_status () == 1) {
>-    return TRUE;
>-  }
>-
>-  return FALSE;
>-}
>-
>-/**
>-  Generates a pseudorandom byte stream of the specified size.
>-
>-  If Output is NULL, then return FALSE.
>-
>-  @param[out]  Output  Pointer to buffer to receive random value.
>-  @param[in]   Size    Size of random bytes to generate.
>-
>-  @retval TRUE   Pseudorandom byte stream generated successfully.
>-  @retval FALSE  Pseudorandom number generator fails to generate due to
>lack of entropy.
>-
>-**/
>-BOOLEAN
>-EFIAPI
>-RandomBytes (
>-  OUT  UINT8  *Output,
>-  IN   UINTN  Size
>-  )
>-{
>-  //
>-  // Check input parameters.
>-  //
>-  if (Output == NULL || Size > INT_MAX) {
>-    return FALSE;
>-  }
>-
>-  //
>-  // Generate random data.
>-  //
>-  if (RAND_bytes (Output, (UINT32) Size) != 1) {
>-    return FALSE;
>-  }
>-
>-  return TRUE;
>-}
>--
>2.17.1.windows.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] CryptoPkg/BaseCryptLib: remove unused code for IPF
  2019-05-17  1:12 ` Liming Gao
@ 2019-05-17  5:16   ` Wang, Jian J
  0 siblings, 0 replies; 3+ messages in thread
From: Wang, Jian J @ 2019-05-17  5:16 UTC (permalink / raw)
  To: Gao, Liming, devel@edk2.groups.io; +Cc: Kinney, Michael D, Ye, Ting

Thanks. Pushed at c2eab535c6790b8db5e9039e3d8886980b390389.

Regards,
Jian


> -----Original Message-----
> From: Gao, Liming
> Sent: Friday, May 17, 2019 9:12 AM
> To: Wang, Jian J <jian.j.wang@intel.com>; devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Ye, Ting
> <ting.ye@intel.com>
> Subject: RE: [PATCH] CryptoPkg/BaseCryptLib: remove unused code for IPF
> 
> I see no module consumes this source file.
> 
> The change is good. Reviewed-by: Liming Gao <liming.gao@intel.com>
> 
> >-----Original Message-----
> >From: Wang, Jian J
> >Sent: Tuesday, May 14, 2019 10:30 PM
> >To: devel@edk2.groups.io
> >Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D
> ><michael.d.kinney@intel.com>; Ye, Ting <ting.ye@intel.com>
> >Subject: [PATCH] CryptoPkg/BaseCryptLib: remove unused code for IPF
> >
> >BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1805
> >
> >CryptRandItc.c is only for IPF arch, which has not been supported any
> >more in edk2. And no module actually reference this file. This patch
> >just removes it from tree.
> >
> >Cc: Liming Gao <liming.gao@intel.com>
> >Cc: Michael D Kinney <michael.d.kinney@intel.com>
> >Cc: Ting Ye <ting.ye@intel.com>
> >Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
> >---
> > .../Library/BaseCryptLib/Rand/CryptRandItc.c  | 112 ------------------
> > 1 file changed, 112 deletions(-)
> > delete mode 100644 CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c
> >
> >diff --git a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c
> >b/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c
> >deleted file mode 100644
> >index 8699cfeb71..0000000000
> >--- a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c
> >+++ /dev/null
> >@@ -1,112 +0,0 @@
> >-/** @file
> >-  Pseudorandom Number Generator Wrapper Implementation over OpenSSL.
> >-
> >-Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
> >-SPDX-License-Identifier: BSD-2-Clause-Patent
> >-
> >-**/
> >-
> >-#include "InternalCryptLib.h"
> >-#include <openssl/rand.h>
> >-#include <openssl/evp.h>
> >-#include <Library/PrintLib.h>
> >-
> >-/**
> >-  Sets up the seed value for the pseudorandom number generator.
> >-
> >-  This function sets up the seed value for the pseudorandom number
> >generator.
> >-  If Seed is not NULL, then the seed passed in is used.
> >-  If Seed is NULL, then default seed is used.
> >-
> >-  @param[in]  Seed      Pointer to seed value.
> >-                        If NULL, default seed is used.
> >-  @param[in]  SeedSize  Size of seed value.
> >-                        If Seed is NULL, this parameter is ignored.
> >-
> >-  @retval TRUE   Pseudorandom number generator has enough entropy for
> >random generation.
> >-  @retval FALSE  Pseudorandom number generator does not have enough
> >entropy for random generation.
> >-
> >-**/
> >-BOOLEAN
> >-EFIAPI
> >-RandomSeed (
> >-  IN  CONST  UINT8  *Seed  OPTIONAL,
> >-  IN  UINTN         SeedSize
> >-  )
> >-{
> >-  CHAR8  DefaultSeed[128];
> >-
> >-  if (SeedSize > INT_MAX) {
> >-    return FALSE;
> >-  }
> >-
> >-  //
> >-  // The software PRNG implementation built in OpenSSL depends on
> >message digest algorithm.
> >-  // Make sure SHA-1 digest algorithm is available here.
> >-  //
> >-  if (EVP_add_digest (EVP_sha1 ()) == 0) {
> >-    return FALSE;
> >-  }
> >-
> >-  //
> >-  // Seed the pseudorandom number generator with user-supplied value.
> >-  // NOTE: A cryptographic PRNG must be seeded with unpredictable data.
> >-  //
> >-  if (Seed != NULL) {
> >-    RAND_seed (Seed, (UINT32) SeedSize);
> >-  } else {
> >-    //
> >-    // Retrieve current time.
> >-    //
> >-    AsciiSPrint (
> >-      DefaultSeed,
> >-      sizeof (DefaultSeed),
> >-      "UEFI Crypto Library default seed (%ld)",
> >-      AsmReadItc ()
> >-      );
> >-
> >-    RAND_seed (DefaultSeed, sizeof (DefaultSeed));
> >-  }
> >-
> >-  if (RAND_status () == 1) {
> >-    return TRUE;
> >-  }
> >-
> >-  return FALSE;
> >-}
> >-
> >-/**
> >-  Generates a pseudorandom byte stream of the specified size.
> >-
> >-  If Output is NULL, then return FALSE.
> >-
> >-  @param[out]  Output  Pointer to buffer to receive random value.
> >-  @param[in]   Size    Size of random bytes to generate.
> >-
> >-  @retval TRUE   Pseudorandom byte stream generated successfully.
> >-  @retval FALSE  Pseudorandom number generator fails to generate due to
> >lack of entropy.
> >-
> >-**/
> >-BOOLEAN
> >-EFIAPI
> >-RandomBytes (
> >-  OUT  UINT8  *Output,
> >-  IN   UINTN  Size
> >-  )
> >-{
> >-  //
> >-  // Check input parameters.
> >-  //
> >-  if (Output == NULL || Size > INT_MAX) {
> >-    return FALSE;
> >-  }
> >-
> >-  //
> >-  // Generate random data.
> >-  //
> >-  if (RAND_bytes (Output, (UINT32) Size) != 1) {
> >-    return FALSE;
> >-  }
> >-
> >-  return TRUE;
> >-}
> >--
> >2.17.1.windows.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-17  5:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-14 14:30 [PATCH] CryptoPkg/BaseCryptLib: remove unused code for IPF Wang, Jian J
2019-05-17  1:12 ` Liming Gao
2019-05-17  5:16   ` Wang, Jian J

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox