From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) by mx.groups.io with SMTP id smtpd.web10.10990.1620397409736747577 for ; Fri, 07 May 2021 07:23:29 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=p/1sqciV; spf=pass (domain: nuviainc.com, ip: 209.85.210.54, mailfrom: rebecca@nuviainc.com) Received: by mail-ot1-f54.google.com with SMTP id b5-20020a9d5d050000b02902a5883b0f4bso8066114oti.2 for ; Fri, 07 May 2021 07:23:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pHUNY1fagFySqx3HoZmoqHzM9edS8J8UJd7cL3u5xhU=; b=p/1sqciV916+IxbVqaPzVd7l7AHp9Gr5mOyBNnZOEdGLhsB4zbwKh6oXnujzyk9+cL ZiPg17nuAU2lMMqdQ+GVhr4tM1buBMpqLhSoSwZPp2d5Bp6T6Isx11o3AW3vLyyOu5U9 Qt2plWAVOOftOij3nx7N5Y2d0qcU7aR04eY93TjCpq3W1yXPiXu+DSxz3UzX4G4h/S0Q foaAWwhoNejJG+tjWv8nLgV9xdnA3jnq6GveVcjP5RE2xRyxcrKumZcntVaRThAYJtQx U18j8w9CqAw4mGr5obmTfwqNboISSm7UiZmihBB6p0gkNEA7lKHyZWCN5CcVTJW+shMb gj5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pHUNY1fagFySqx3HoZmoqHzM9edS8J8UJd7cL3u5xhU=; b=fwX4Ffy19qjnw8EVLMhS4RHWlNxkrOZs3lAQ0mvN+pI7JmVHRnNSYpKkwCdS2IMojD wxy3CWY+7Nd8AcqDaslx3jyULU2aSolekZbSB95E1IiNKd3Xd7jN9eehn8P8FsA+XHNn xdqN6LfnKYCdSxHeglGaayCCFmM740/0y7Z2ocOdBm4c1qPuSknQqcBkx0PH9w1V9Xve Soo7CIUe/UpYlNmf2rCxVDLhJsFNoyy9Kj7IP1Tcy4Q3i+MWDcSox11wPapLv8a7Kvqt zS8ec6yUxCtYbLfRa42viXgeccc92r0lbtSh6q5mbUUUx0+IBJumVhqVyXaQ3+vaFvH8 A+1Q== X-Gm-Message-State: AOAM530+tT99+rSCAYw9kGjRefhTErau0x4VCSFkqf3APHyBbXh3bUx9 xqKTgspS72Sg0GOLNiShzh2MkuQAQ9S/tNjwDSSQnKobyGB8v2N55uCQ8TOGk/FBG+zx0XsO5AH jVGYJA+SXSYJDQpMhkf+W6PI2cWPLfMc2LPQU82/5VX9t5CoBuXga5XRaqlsGhalYL7l7IA== X-Google-Smtp-Source: ABdhPJy+e6ediqUa23yES9WW0kAN8fcuEiWG3wDsiCSO2zQ1ZDL9U2pHrbVhI3ygAzcc6j7SWrfeNQ== X-Received: by 2002:a9d:6645:: with SMTP id q5mr4104833otm.80.1620397408593; Fri, 07 May 2021 07:23:28 -0700 (PDT) Return-Path: Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id 88sm1215641otx.2.2021.05.07.07.23.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 07:23:28 -0700 (PDT) From: "Rebecca Cran" To: devel@edk2.groups.io, Jiewen Yao , Jian J Wang , Michael D Kinney , Liming Gao , Zhiguang Liu , Ard Biesheuvel , Sami Mujawar Cc: Rebecca Cran Subject: [PATCH v2 0/2] MdePkg,SecurityPkg: Add support to RngDxe and BaseRngLib for AARCH64 RNDR Date: Fri, 7 May 2021 08:23:13 -0600 Message-Id: <20210507142315.679-1-rebecca@nuviainc.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Update MdePkg BaseRngLib and SecurityPkg RngDxe to add support for the AARCH64 RNDR instruction. Changes from v1 to v2: o Added a PCD, gEfiSecurityPkgTokenSpaceGuid.PcdCpuRngSupportedAlgorithm to specify which algorighm the platform supports. o Moved ArmRndr() and ArmRndrrs() into BaseRngLib. o Added Doxygen headers. o Merged X64 and AARCH64 *GetBytes functions into a single RngGetBytes function. o Updated constructors to return EFI_STATUS instead of RETURN_STATUS. o Added ArchIsRngSupported function that gets called before each call to ArchGetRandomNumber*. Rebecca Cran (2): MdePkg/BaseRngLib: Add support for ARMv8.5 RNG instructions SecurityPkg: Add support for RngDxe on AARCH64 MdePkg/MdePkg.dec | 9 +- SecurityPkg/SecurityPkg.dec | 2 + MdePkg/MdePkg.dsc | 4 +- SecurityPkg/SecurityPkg.dsc | 11 +- MdePkg/Library/BaseRngLib/BaseRngLib.inf | 23 ++- SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf | 24 ++- MdePkg/Library/BaseRngLib/AArch64/ArmRng.h | 59 +++++++ MdePkg/Library/BaseRngLib/BaseRngLibInternals.h | 79 +++++++++ SecurityPkg/RandomNumberGenerator/RngDxe/{ => Rand}/AesCore.h | 0 SecurityPkg/RandomNumberGenerator/RngDxe/{ => Rand}/RdRand.h | 17 -- SecurityPkg/RandomNumberGenerator/RngDxe/RngDxeInternals.h | 117 ++++++++++++++ MdePkg/Library/BaseRngLib/AArch64/Rndr.c | 139 ++++++++++++++++ MdePkg/Library/BaseRngLib/BaseRng.c | 87 +++++----- MdePkg/Library/BaseRngLib/Rand/RdRand.c | 131 +++++++++++++++ SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/RngDxe.c | 127 +++++++++++++++ SecurityPkg/RandomNumberGenerator/RngDxe/{ => Rand}/AesCore.c | 0 SecurityPkg/RandomNumberGenerator/RngDxe/{ => Rand}/RdRand.c | 45 +----- SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c | 146 +++++++++++++++++ SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.c | 170 ++++++++------------ MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.S | 31 ++++ MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.asm | 30 ++++ MdePkg/Library/BaseRngLib/AArch64/ArmRng.S | 61 +++++++ MdePkg/Library/BaseRngLib/AArch64/ArmRng.asm | 64 ++++++++ MdePkg/Library/BaseRngLib/BaseRngLib.uni | 6 +- 24 files changed, 1152 insertions(+), 230 deletions(-) create mode 100644 MdePkg/Library/BaseRngLib/AArch64/ArmRng.h create mode 100644 MdePkg/Library/BaseRngLib/BaseRngLibInternals.h rename SecurityPkg/RandomNumberGenerator/RngDxe/{ => Rand}/AesCore.h (100%) rename SecurityPkg/RandomNumberGenerator/RngDxe/{ => Rand}/RdRand.h (72%) create mode 100644 SecurityPkg/RandomNumberGenerator/RngDxe/RngDxeInternals.h create mode 100644 MdePkg/Library/BaseRngLib/AArch64/Rndr.c create mode 100644 MdePkg/Library/BaseRngLib/Rand/RdRand.c create mode 100644 SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/RngDxe.c rename SecurityPkg/RandomNumberGenerator/RngDxe/{ => Rand}/AesCore.c (100%) rename SecurityPkg/RandomNumberGenerator/RngDxe/{ => Rand}/RdRand.c (71%) create mode 100644 SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c create mode 100644 MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.S create mode 100644 MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.asm create mode 100644 MdePkg/Library/BaseRngLib/AArch64/ArmRng.S create mode 100644 MdePkg/Library/BaseRngLib/AArch64/ArmRng.asm -- 2.26.2