From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.80]) by mx.groups.io with SMTP id smtpd.web08.8661.1637062394438761488 for ; Tue, 16 Nov 2021 03:33:15 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=1CWylc2q; spf=pass (domain: arm.com, ip: 40.107.22.80, mailfrom: sami.mujawar@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gX0eM7b9WCMQuisisThMzT6IwtTXDlh0drkP40yffZU=; b=1CWylc2q8QJkIwL3C0YvhXbkaiHVxzmTsnx//wQx57kYQhRYrEtoeYL6ndgg6GzHehl3+ToPDZQmM/Rg5F0GHavXdo8Y55susXMxCPNSbZiVu7Bj/cA/b4LDir8kl53lZ2pfE9BPnxf1gcsq6ameKUqp70LsuzDmbji3lMc+6IA= Received: from AS9PR06CA0296.eurprd06.prod.outlook.com (2603:10a6:20b:45a::16) by VI1PR08MB2880.eurprd08.prod.outlook.com (2603:10a6:802:1c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 11:33:03 +0000 Received: from VE1EUR03FT047.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45a:cafe::f1) by AS9PR06CA0296.outlook.office365.com (2603:10a6:20b:45a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Tue, 16 Nov 2021 11:33:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT047.mail.protection.outlook.com (10.152.19.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.20 via Frontend Transport; Tue, 16 Nov 2021 11:33:03 +0000 Received: ("Tessian outbound c61f076cbd30:v110"); Tue, 16 Nov 2021 11:33:02 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0a7f3e78c4684587 X-CR-MTA-TID: 64aa7808 Received: from 86f97ddaf0d9.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0144F4BA-2B38-49DD-9746-20599D0E7309.1; Tue, 16 Nov 2021 11:32:56 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 86f97ddaf0d9.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 16 Nov 2021 11:32:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z+KL9qpg4kbQscVwzrpwtwQaxyOEYA6zPn3y/N518F00ByXiV0dlSCE2mMWbmPRIw1j/qvpIUCr3vs1jH+dKF+DMABAZwLG19+oQoEdtS4VDefh/EelXffaobsMEQjfgfafrR/SYIdgj6+/Mp43u/nAb4Ke5QPFZpGNkiAorUKdTD6HjUBEsClZ8T6FQlFYzAqnC5uz5hnOJpTyZCNkHXTfUiPucvMs90Gp0Uh8BOErNQpHeHhuE356E5i/+n2t4GEv0hHD6+2Xm38qihsof1AiV9HlmE3Cue7iZsCKfMZzNJNPu7U69VPrPvx3efUhRTvWFi065DFJUs4gLYuaRJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gX0eM7b9WCMQuisisThMzT6IwtTXDlh0drkP40yffZU=; b=lhLxfX9kn6j7cskPTS7FsuhhD4Mmj0OHjMZoe8iWGtnFEOyMK6MAasas03JaqHhzWbqmwRwzzmyZw/FE/QjDH+rJS4h5y9//p7Fj7MQe7wgBt5dQd3YdvCIOesQt8NR+P6gK0G0iVTcenrDDd5C8pOgTByfG8JgBHZjBAZHBviYreW136CU8fcMRNZVOpbViJLY56+sXdR0wh4tF8Exhr2C0KgzBix/lTYlGxePEWkX74xbCrFbh6giS6rcHbSAAr4wCzl5uTZmb2EznFdt1WXFV7M6gwWgP67pZtAh9vXoEny0sS51VOG8OODGT+iKieGZfXfR2Le6Sl/NP1bdR2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gX0eM7b9WCMQuisisThMzT6IwtTXDlh0drkP40yffZU=; b=1CWylc2q8QJkIwL3C0YvhXbkaiHVxzmTsnx//wQx57kYQhRYrEtoeYL6ndgg6GzHehl3+ToPDZQmM/Rg5F0GHavXdo8Y55susXMxCPNSbZiVu7Bj/cA/b4LDir8kl53lZ2pfE9BPnxf1gcsq6ameKUqp70LsuzDmbji3lMc+6IA= Received: from AS9PR06CA0305.eurprd06.prod.outlook.com (2603:10a6:20b:45b::24) by AS8PR08MB6964.eurprd08.prod.outlook.com (2603:10a6:20b:349::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Tue, 16 Nov 2021 11:32:54 +0000 Received: from VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45b:cafe::cd) by AS9PR06CA0305.outlook.office365.com (2603:10a6:20b:45b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 11:32:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT032.mail.protection.outlook.com (10.152.18.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4690.20 via Frontend Transport; Tue, 16 Nov 2021 11:32:53 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.20; Tue, 16 Nov 2021 11:32:52 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.20; Tue, 16 Nov 2021 11:32:51 +0000 Received: from E114225.Arm.com (10.1.196.43) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.20 via Frontend Transport; Tue, 16 Nov 2021 11:32:51 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , , , , Subject: [PATCH v2 0/8] Add Raw algorithm support using Arm FW-TRNG interface Date: Tue, 16 Nov 2021 11:32:52 +0000 Message-ID: <20211116113301.31088-1-sami.mujawar@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 25c3b823-835f-4cb8-6d0e-08d9a8f4da05 X-MS-TrafficTypeDiagnostic: AS8PR08MB6964:|VI1PR08MB2880: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 7kpihp/xPW7zQmAh0eaEhm0w5gHZXuapQTP1bbeI9adH6gd+b0p2HD6O5ceQKiVdCAH6wl5Qtvo2ppBq3eUNqfYTnDMeyM6G1UW6rBxPrifRQ3upesxr3PhMd2mbT4pED9gfkg8d1auFcjXlZhifn46HaTIDJV2fhVK3RpSQ+RTpz2GJ8eaW0leLmKTshPsLoJZ2CXksHps3GJcPfr8mTo8Rjsa5yoRBXmmCIaibyidmq1SIILNUO1WScqk9ZjVOfeJjJMG0zLJv1BKUtKJK2ARKw9ozveAgsqSvVA9USmbF4fowTGBiGkDu4nu1afoMfZTe/vxtCnhQemdAcW4CqD+i9JFOjJDUCqRm04nyEAuM0CvXTJRvoppbc60QWblQmq0OYTtE3ooUpN6AYGvxMteqVHb6My/9nnjJn8rflXEkmqw2xM+/LlzXuYNLWMwxPWJ5/TmrXLoz9Al9ygh8qWpS/w6xbRcZnsxF38XszdVB6Rqu6MA3KKwkvYpBg4GjHh9VYNrnaqwTdn7X9rx247EQ+BvPYq4ZAKNPb2E7oTzXsghG0jwSMq+vrSMw8ADaKu2ubwYpziz0SuqUqg5taxfws8NwHQV9f/H26F25DAb2MvKb+5sHK+y7vnWYr+IPaeCwYUF7x6PeslHxXZJbxneuhu+mdiDoSdHxwI8Ew95XElPBg1EFUd0wjepWODgLCO8jsLtLmaAkKrFlAU0xsv5/0ZgSTWtGcOSGrCQaVewHclOAGQ0HsO1co5uJ0/kR1ndBJBDWYrh9sRY9SK1ZVACf/isMhway9mEmRc7P/SzaIL9iCX2GXQNQ0fQwnY334TCBaRQjqAInPuVT7YOILZ6x0ulDiVMYSrI2vCjZK74= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(966005)(7416002)(70586007)(186003)(70206006)(82310400003)(2906002)(356005)(508600001)(81166007)(86362001)(36860700001)(8676002)(4326008)(47076005)(5660300002)(8936002)(26005)(7696005)(36756003)(83380400001)(336012)(44832011)(54906003)(6916009)(426003)(2616005)(316002)(1076003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6964 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT047.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 7967da02-6798-47fd-2c29-08d9a8f4d46b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P1lH3gKKvzeYTiXwcNvB5gM4USS6wTxXr8q+G+Zvq+p2Td/6qxZiXKjASkveG1bMymegRUJ2tBJRZ9NZ6keH6QfVmsubXpT1gurE4UqVLuvh1VTQKIaZdZwcyCdlU91NiOQE+p42peJe0+R0re3T1V7cRWY/4ec29c9ogP8jskzxgxAOnl+mjR+LtY4Vy9sl1CQfq6/Z/z1Vmmp4Cs1mRrY5OGitR6hJ74VDGR9j6oJpioY2Hn9zi9jXWbHg+1yjiXuksBRxu3OKch3GBIquwMk1W3vbhJ/6ZWZxq+4vDgwHQtaWXOJscL47+X0UfXblQGJcXUN2Bn9xtQN+bGLefDew2YJQ/2fFBXvK4GSH5H+nSdzENschoq8GMlJovIZPuYXKZqerseYtWVO5WdOY5HGbVKjU6cnbwL/nhkQlIfWwC5aymaBQ32HKPUTos/O0FP72zQU5ir+acBewCj9lEU5lRMSRJnEtensn0vAnghzvO/dUauGcJ7OU7V9ZAagY06/shtTnjIUQkuSkxyL8Jt9OOKK7O6xCFMDtGCH8Sjv3kQQ1Ovn0COikHE+G6urBoayQJGJz7RHhTlLXAMxd8fpf60Cj02DTMqouaPtyA4Uvuk56nmd1OJ4LiUf+aW9Ukf7+kxTOk67HsyKXoUjMsL/SN+Pul6Pp5rnzdH9qFb/R1FT362kvnhJGg39kJ0h57vwGx286qfBYHagMKuAUKswKlX8RWSfhnFmrvnndVxf5AMpRGeMxxBos6Sfj8H7dy1lcqmZIv59G3osvt2pet0IIWm9oob2sDlp1XVNbS7RQs3TYn2y1vFOv2mjTxl0tYAtVswjxhoNgtXWRzuZAgQ== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(70586007)(36860700001)(70206006)(81166007)(316002)(47076005)(336012)(1076003)(6916009)(186003)(2906002)(54906003)(2616005)(36756003)(4326008)(82310400003)(7696005)(44832011)(8936002)(8676002)(83380400001)(966005)(5660300002)(508600001)(86362001)(26005)(426003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 11:33:03.1891 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 25c3b823-835f-4cb8-6d0e-08d9a8f4da05 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT047.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB2880 Content-Type: text/plain Bugzilla: Bug 3668 (https://bugzilla.tianocore.org/show_bug.cgi?id=3668) The Arm True Random Number Generator Firmware, Interface 1.0, specification defines an interface between an Operating System (OS) executing at EL1 and Firmware (FW) exposing a conditioned entropy source that is provided by a TRNG back end. This v2 patch series updates the following based on the feedback received for the v1 series at https://edk2.groups.io/g/devel/message/81653: - Updates TrngLib definitions to use RETURN_STATUS as the return type from the interface functions as TrngLib is base type library. - Drops the patch "MdePkg: Add definition for NULL GUID" as there is already an equivalent definition provided by gZeroGuid. Thus, the use of gNullGuid has been replaced with gZeroGuid. The V1 patch series: - defines a TRNG library class that provides an interface to access the entropy source on a platform. - implements a TRNG library instance that uses the Arm FW-TRNG interface. - Adds RawAlgorithm support to RngDxe for Arm architecture using the Arm FW-TRNG interface. - Enables RNG support using FW-TRNG interface for Kvmtool Guest/Virtual firmware. The changes can be seen at: https://github.com/samimujawar/edk2/tree/1829_arm_fw_trng_v2 Sami Mujawar (8): MdePkg: Definition for TRNG library class interface ArmPkg: PCD to select conduit for monitor calls ArmPkg: Add Arm Firmware TRNG library MdePkg: Add NULL instance of TRNG Library SecurityPkg: Rename RdRandGenerateEntropy to common name SecurityPkg: Restructure checks in RngGetInfo SecurityPkg: Add RawAlgorithm support using TRNG library ArmVirtPkg: Kvmtool: Add RNG support using FW-TRNG interface ArmPkg/ArmPkg.dec | 5 + ArmPkg/ArmPkg.dsc | 1 + ArmPkg/Library/ArmFwTrngLib/ArmFwTrngDefs.h | 64 +++ ArmPkg/Library/ArmFwTrngLib/ArmFwTrngLib.c | 483 ++++++++++++++++++++ ArmPkg/Library/ArmFwTrngLib/ArmFwTrngLib.inf | 34 ++ ArmVirtPkg/ArmVirtKvmTool.dsc | 10 + ArmVirtPkg/ArmVirtKvmTool.fdf | 5 + MdePkg/Include/Library/TrngLib.h | 121 +++++ MdePkg/Library/BaseTrngLibNull/BaseTrngLibNull.c | 111 +++++ MdePkg/Library/BaseTrngLibNull/BaseTrngLibNull.inf | 30 ++ MdePkg/Library/BaseTrngLibNull/BaseTrngLibNull.uni | 12 + MdePkg/MdePkg.dec | 7 +- MdePkg/MdePkg.dsc | 1 + SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/RngDxe.c | 79 +++- SecurityPkg/RandomNumberGenerator/RngDxe/Arm/RngDxe.c | 163 +++++++ SecurityPkg/RandomNumberGenerator/RngDxe/ArmTrng.c | 61 +++ SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RdRand.c | 13 +- SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RdRand.h | 43 -- SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c | 12 +- SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.c | 13 +- SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf | 14 +- SecurityPkg/RandomNumberGenerator/RngDxe/RngDxeInternals.h | 22 +- SecurityPkg/SecurityPkg.dsc | 8 +- 23 files changed, 1239 insertions(+), 73 deletions(-) create mode 100644 ArmPkg/Library/ArmFwTrngLib/ArmFwTrngDefs.h create mode 100644 ArmPkg/Library/ArmFwTrngLib/ArmFwTrngLib.c create mode 100644 ArmPkg/Library/ArmFwTrngLib/ArmFwTrngLib.inf create mode 100644 MdePkg/Include/Library/TrngLib.h create mode 100644 MdePkg/Library/BaseTrngLibNull/BaseTrngLibNull.c create mode 100644 MdePkg/Library/BaseTrngLibNull/BaseTrngLibNull.inf create mode 100644 MdePkg/Library/BaseTrngLibNull/BaseTrngLibNull.uni create mode 100644 SecurityPkg/RandomNumberGenerator/RngDxe/Arm/RngDxe.c create mode 100644 SecurityPkg/RandomNumberGenerator/RngDxe/ArmTrng.c delete mode 100644 SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RdRand.h -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'