From nobody Mon Apr 29 11:22:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+50432+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50432+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1573538149; cv=none; d=zoho.com; s=zohoarc; b=RxzsLbOWhoGM6GbqP+dwE5z0wt2ys8DqzqcgrVeP1RybHOi0ujeSozu3PvX3erw7QmSVSBiamLZp4o5WmaxtZUYTkC7Pp7PgQGom+FaEV+ONmj99K9RcGu2GKxDK4L0kqdcmkEUnrrRLCDawIne/ee1lLA6O34XLkT7YNRt1KSw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573538149; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=DHVjX2N98fJFk4iLMvm23iT8ltw9SjyFYXfsYA+u5Ww=; b=S0UxvkjoN737eqcfXvtVvA8gg/BdgvUf0qHXWkrzblaKkk7sqCeuP4nltfoDBq0mEWulgBcS7ZAuUDSGMuC0kKzQjcZATK/ueOTAbGuVeZ0UZux8Ge0Mco0y+rYWYzo2sT6iOJyGs6Yzb7b3ty2qxkEdfBbK/TkjqHNK1QmIu9A= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50432+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1573538149702560.8002065052603; Mon, 11 Nov 2019 21:55:49 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id wyE0YY1788612xGgMSuSSg28; Mon, 11 Nov 2019 21:55:48 -0800 X-Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web10.7751.1573538148289784881 for ; Mon, 11 Nov 2019 21:55:48 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Nov 2019 21:55:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,295,1569308400"; d="scan'208";a="404135428" X-Received: from shwdeopenpsi777.ccr.corp.intel.com ([10.239.158.59]) by fmsmga005.fm.intel.com with ESMTP; 11 Nov 2019 21:55:46 -0800 From: "Wang, Jian J" To: devel@edk2.groups.io Cc: Jiewen Yao , Chao Zhang , Michael D Kinney , Liming Gao , Laszlo Ersek , Ard Biesheuvel , Ray Ni Subject: [edk2-devel] [PATCH] SecurityPkg/RngLibNull: add null version of RngLib Date: Tue, 12 Nov 2019 13:55:45 +0800 Message-Id: <20191112055545.3948-1-jian.j.wang@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jian.j.wang@intel.com X-Gm-Message-State: A24yg2QKCOCoGwiWsCg4QKAUx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1573538148; bh=SAPkqud44RZb0Cc/pItHv4AU4qBDBxQHaLW1mnqhRak=; h=Cc:Date:From:Reply-To:Subject:To; b=LmenywLLehhbioW1KyjFrfj+B8DTjwtQ3qLuciTjWDaoks0Z7zoR3L1cPDaLKXvwBaA 2n1PYpDFCrZ9DkSqq0PDuAdnlgz7jJpS1w6xzxpCMj4rE6K+RSsVSGWRuUTvgnl0AmSWD 6fRwSefvRWENgMqLoBC6fo//ieiN5qo3Whg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This is null version of RngLib which is used for those platforms or components which don't need random number. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1871 Cc: Jiewen Yao Cc: Chao Zhang Cc: Michael D Kinney Cc: Liming Gao Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Ray Ni Signed-off-by: Jian J Wang --- .../RngLibNull/RngLibNull.c | 95 +++++++++++++++++++ .../RngLibNull/RngLibNull.inf | 31 ++++++ .../RngLibNull/RngLibNull.uni | 14 +++ 3 files changed, 140 insertions(+) create mode 100644 SecurityPkg/RandomNumberGenerator/RngLibNull/RngLibNull= .c create mode 100644 SecurityPkg/RandomNumberGenerator/RngLibNull/RngLibNull= .inf create mode 100644 SecurityPkg/RandomNumberGenerator/RngLibNull/RngLibNull= .uni diff --git a/SecurityPkg/RandomNumberGenerator/RngLibNull/RngLibNull.c b/Se= curityPkg/RandomNumberGenerator/RngLibNull/RngLibNull.c new file mode 100644 index 0000000000..13677abc84 --- /dev/null +++ b/SecurityPkg/RandomNumberGenerator/RngLibNull/RngLibNull.c @@ -0,0 +1,95 @@ +/** @file + Null version of Random number generator services. + +Copyright (c) 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include + +/** + Generates a 16-bit random number. + + if Rand is NULL, then ASSERT(). + + @param[out] Rand Buffer pointer to store the 16-bit random value. + + @retval TRUE Random number generated successfully. + @retval FALSE Failed to generate the random number. + +**/ +BOOLEAN +EFIAPI +GetRandomNumber16 ( + OUT UINT16 *Rand + ) +{ + ASSERT (FALSE); + return FALSE; +} + +/** + Generates a 32-bit random number. + + if Rand is NULL, then ASSERT(). + + @param[out] Rand Buffer pointer to store the 32-bit random value. + + @retval TRUE Random number generated successfully. + @retval FALSE Failed to generate the random number. + +**/ +BOOLEAN +EFIAPI +GetRandomNumber32 ( + OUT UINT32 *Rand + ) +{ + ASSERT (FALSE); + return FALSE; +} + +/** + Generates a 64-bit random number. + + if Rand is NULL, then ASSERT(). + + @param[out] Rand Buffer pointer to store the 64-bit random value. + + @retval TRUE Random number generated successfully. + @retval FALSE Failed to generate the random number. + +**/ +BOOLEAN +EFIAPI +GetRandomNumber64 ( + OUT UINT64 *Rand + ) +{ + ASSERT (FALSE); + return FALSE; +} + +/** + Generates a 128-bit random number. + + if Rand is NULL, then ASSERT(). + + @param[out] Rand Buffer pointer to store the 128-bit random value. + + @retval TRUE Random number generated successfully. + @retval FALSE Failed to generate the random number. + +**/ +BOOLEAN +EFIAPI +GetRandomNumber128 ( + OUT UINT64 *Rand + ) +{ + ASSERT (FALSE); + return FALSE; +} diff --git a/SecurityPkg/RandomNumberGenerator/RngLibNull/RngLibNull.inf b/= SecurityPkg/RandomNumberGenerator/RngLibNull/RngLibNull.inf new file mode 100644 index 0000000000..f6494cdb82 --- /dev/null +++ b/SecurityPkg/RandomNumberGenerator/RngLibNull/RngLibNull.inf @@ -0,0 +1,31 @@ +## @file +# Null instance of RNG (Random Number Generator) Library. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D RngLibNull + MODULE_UNI_FILE =3D RngLibNull.uni + FILE_GUID =3D CD8991F8-2061-4084-8C9E-9C6F352DC58D + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D RngLib + +# +# VALID_ARCHITECTURES =3D IA32 X64 ARM AARCH64 +# + +[Sources] + RngLibNull.c + +[Packages] + MdePkg/MdePkg.dec + +[LibraryClasses] + BaseLib + DebugLib diff --git a/SecurityPkg/RandomNumberGenerator/RngLibNull/RngLibNull.uni b/= SecurityPkg/RandomNumberGenerator/RngLibNull/RngLibNull.uni new file mode 100644 index 0000000000..40b2ec3fe1 --- /dev/null +++ b/SecurityPkg/RandomNumberGenerator/RngLibNull/RngLibNull.uni @@ -0,0 +1,14 @@ +// /** @file +// Null Instance of RNG (Random Number Generator) Library. +// +// Copyright (c) 2019, Intel Corporation. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Null Instance of = RNG Library" + +#string STR_MODULE_DESCRIPTION #language en-US "Caution: This is = a null version of RNG library and SHOULD NOT be used on any product ever." + --=20 2.17.1.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50432): https://edk2.groups.io/g/devel/message/50432 Mute This Topic: https://groups.io/mt/54019525/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-