|
| 1 | +From cf07238e5fa4f8b1138ac1c9e80530b4d4e59f1c Mon Sep 17 00:00:00 2001 |
| 2 | +From: Pierre Gondois < [email protected]> |
| 3 | +Date: Fri, 11 Aug 2023 16:33:06 +0200 |
| 4 | +Subject: [PATCH] MdePkg/Rng: Add GUID to describe Arm Rndr Rng algorithms |
| 5 | + |
| 6 | +BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4441 |
| 7 | + |
| 8 | +The EFI_RNG_PROTOCOL can rely on the RngLib. The RngLib has multiple |
| 9 | +implementations, some of them are unsafe (e.g. BaseRngLibTimerLib). |
| 10 | +To allow the RngDxe to detect when such implementation is used, |
| 11 | +a GetRngGuid() function is added in a following patch. |
| 12 | + |
| 13 | +Prepare GetRngGuid() return values and add a gEfiRngAlgorithmArmRndr |
| 14 | +to describe a Rng algorithm accessed through Arm's RNDR instruction. |
| 15 | +[1] states that the implementation of this algorithm should be |
| 16 | +compliant to NIST SP900-80. The compliance is not guaranteed. |
| 17 | + |
| 18 | +[1] Arm Architecture Reference Manual Armv8, for A-profile architecture |
| 19 | +sK12.1 'Properties of the generated random number' |
| 20 | + |
| 21 | +Signed-off-by: Pierre Gondois < [email protected]> |
| 22 | +Reviewed-by: Sami Mujawar < [email protected]> |
| 23 | +Reviewed-by: Liming Gao < [email protected]> |
| 24 | +Acked-by: Ard Biesheuvel < [email protected]> |
| 25 | +Tested-by: Kun Qin < [email protected]> |
| 26 | + |
| 27 | +CVE: CVE-2023-45237 |
| 28 | + |
| 29 | +Upstream-Status: Backport [https://github.com/tianocore/edk2/commit/cf07238e5fa4f8b1138ac1c9e80530b4d4e59f1c] |
| 30 | + |
| 31 | +Signed-off-by: Soumya Sambu < [email protected]> |
| 32 | +--- |
| 33 | + MdePkg/Include/Protocol/Rng.h | 10 ++++++++++ |
| 34 | + MdePkg/MdePkg.dec | 1 + |
| 35 | + 2 files changed, 11 insertions(+) |
| 36 | + |
| 37 | +diff --git a/MdePkg/Include/Protocol/Rng.h b/MdePkg/Include/Protocol/Rng.h |
| 38 | +index baf425587b..38bde53240 100644 |
| 39 | +--- a/MdePkg/Include/Protocol/Rng.h |
| 40 | ++++ b/MdePkg/Include/Protocol/Rng.h |
| 41 | +@@ -67,6 +67,15 @@ typedef EFI_GUID EFI_RNG_ALGORITHM; |
| 42 | + { \ |
| 43 | + 0xe43176d7, 0xb6e8, 0x4827, {0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61 } \ |
| 44 | + } |
| 45 | ++/// |
| 46 | ++/// The Arm Architecture states the RNDR that the DRBG algorithm should be compliant |
| 47 | ++/// with NIST SP800-90A, while not mandating a particular algorithm, so as to be |
| 48 | ++/// inclusive of different geographies. |
| 49 | ++/// |
| 50 | ++#define EFI_RNG_ALGORITHM_ARM_RNDR \ |
| 51 | ++ { \ |
| 52 | ++ 0x43d2fde3, 0x9d4e, 0x4d79, {0x02, 0x96, 0xa8, 0x9b, 0xca, 0x78, 0x08, 0x41} \ |
| 53 | ++ } |
| 54 | + |
| 55 | + /** |
| 56 | + Returns information about the random number generation implementation. |
| 57 | +@@ -146,5 +155,6 @@ extern EFI_GUID gEfiRngAlgorithmSp80090Ctr256Guid; |
| 58 | + extern EFI_GUID gEfiRngAlgorithmX9313DesGuid; |
| 59 | + extern EFI_GUID gEfiRngAlgorithmX931AesGuid; |
| 60 | + extern EFI_GUID gEfiRngAlgorithmRaw; |
| 61 | ++extern EFI_GUID gEfiRngAlgorithmArmRndr; |
| 62 | + |
| 63 | + #endif |
| 64 | +diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec |
| 65 | +index 59b405928b..a449dbc556 100644 |
| 66 | +--- a/MdePkg/MdePkg.dec |
| 67 | ++++ b/MdePkg/MdePkg.dec |
| 68 | +@@ -594,6 +594,7 @@ |
| 69 | + gEfiRngAlgorithmX9313DesGuid = { 0x63c4785a, 0xca34, 0x4012, {0xa3, 0xc8, 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46 }} |
| 70 | + gEfiRngAlgorithmX931AesGuid = { 0xacd03321, 0x777e, 0x4d3d, {0xb1, 0xc8, 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9 }} |
| 71 | + gEfiRngAlgorithmRaw = { 0xe43176d7, 0xb6e8, 0x4827, {0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61 }} |
| 72 | ++ gEfiRngAlgorithmArmRndr = { 0x43d2fde3, 0x9d4e, 0x4d79, {0x02, 0x96, 0xa8, 0x9b, 0xca, 0x78, 0x08, 0x41 }} |
| 73 | + |
| 74 | + ## Include/Protocol/AdapterInformation.h |
| 75 | + gEfiAdapterInfoMediaStateGuid = { 0xD7C74207, 0xA831, 0x4A26, {0xB1, 0xF5, 0xD1, 0x93, 0x06, 0x5C, 0xE8, 0xB6 }} |
| 76 | +-- |
| 77 | +2.40.0 |
| 78 | + |
0 commit comments