]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg: Clean up unused files in RngDxe
authorThomas Palmer <thomas.palmer@hpe.com>
Fri, 9 Oct 2015 06:03:34 +0000 (06:03 +0000)
committerqlong <qlong@Edk2>
Fri, 9 Oct 2015 06:03:34 +0000 (06:03 +0000)
Clean up files in RngDxe/IA32 and RngDxe/X64 that are subsumed
by files in BaseRngLib.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18592 6f19259b-4bc3-4df7-8a09-765794883524

SecurityPkg/RandomNumberGenerator/RngDxe/IA32/AsmRdRand.asm [deleted file]
SecurityPkg/RandomNumberGenerator/RngDxe/IA32/GccRdRand.c [deleted file]
SecurityPkg/RandomNumberGenerator/RngDxe/IA32/RdRandWord.c [deleted file]
SecurityPkg/RandomNumberGenerator/RngDxe/X64/AsmRdRand.asm [deleted file]
SecurityPkg/RandomNumberGenerator/RngDxe/X64/GccRdRand.c [deleted file]
SecurityPkg/RandomNumberGenerator/RngDxe/X64/RdRandWord.c [deleted file]

diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/IA32/AsmRdRand.asm b/SecurityPkg/RandomNumberGenerator/RngDxe/IA32/AsmRdRand.asm
deleted file mode 100644 (file)
index 37b3830..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-;------------------------------------------------------------------------------\r
-;\r
-; Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
-; This program and the accompanying materials\r
-; are licensed and made available under the terms and conditions of the BSD License\r
-; which accompanies this distribution.  The full text of the license may be found at\r
-; http://opensource.org/licenses/bsd-license.php.\r
-;\r
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-;\r
-; Module Name:\r
-;\r
-;   AsmRdRand.Asm\r
-;\r
-; Abstract:\r
-;\r
-;   Implementation for 16-, and 32- invocations of RDRAND instruction under 32bit platform.\r
-;\r
-; Notes:\r
-;\r
-;   Visual Studio coding practices do not use inline asm since multiple compilers and \r
-;   architectures are supported assembler not recognizing rdrand instruction so using DB's.\r
-;\r
-;------------------------------------------------------------------------------\r
-\r
-    .586P\r
-    .model flat, C\r
-    .code\r
\r
-;------------------------------------------------------------------------------\r
-;  Generate a 16 bit random number\r
-;  Return TRUE if Rand generated successfully, or FALSE if not\r
-;\r
-;  BOOLEAN EFIAPI RdRand16Step (UINT16 *Rand);   ECX\r
-;------------------------------------------------------------------------------\r
-RdRand16Step  PROC\r
-    ; rdrand   ax                  ; generate a 16 bit RN into ax, CF=1 if RN generated ok, otherwise CF=0\r
-    db     0fh, 0c7h, 0f0h         ; rdrand r16:  "0f c7 /6  ModRM:r/m(w)"\r
-    jb     rn16_ok                 ; jmp if CF=1\r
-    xor    eax, eax                ; reg=0 if CF=0\r
-    ret                            ; return with failure status\r
-rn16_ok:\r
-    mov    [ecx], ax\r
-    mov    eax, 1\r
-    ret\r
-RdRand16Step ENDP\r
-\r
-;------------------------------------------------------------------------------\r
-;  Generate a 32 bit random number\r
-;    Return TRUE if Rand generated successfully, or FALSE if not\r
-;\r
-;  BOOLEAN EFIAPI RdRand32Step (UINT32 *Rand);   ECX\r
-;------------------------------------------------------------------------------\r
-RdRand32Step  PROC\r
-    ; rdrand   eax                 ; generate a 32 bit RN into eax, CF=1 if RN generated ok, otherwise CF=0\r
-    db     0fh, 0c7h, 0f0h         ; rdrand r32:  "0f c7 /6  ModRM:r/m(w)"\r
-    jb     rn32_ok                 ; jmp if CF=1\r
-    xor    eax, eax                ; reg=0 if CF=0\r
-    ret                            ; return with failure status\r
-rn32_ok:\r
-    mov    [ecx], eax\r
-    mov    eax,  1\r
-    ret\r
-RdRand32Step  ENDP\r
-\r
-    END\r
diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/IA32/GccRdRand.c b/SecurityPkg/RandomNumberGenerator/RngDxe/IA32/GccRdRand.c
deleted file mode 100644 (file)
index f42302a..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/** @file\r
-  RDRAND Support Routines for GCC environment.\r
-\r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-/**\r
-  Generates a 16-bit random number through RDRAND instruction.\r
-\r
-  @param[out]  Rand          Buffer pointer to store the random result.\r
-\r
-  @retval TRUE               RDRAND call was successful.\r
-  @retval FALSE              Failed attempts to call RDRAND.\r
-\r
-**/\r
-BOOLEAN\r
-EFIAPI\r
-RdRand16Step (\r
-  OUT UINT16       *Rand\r
-  )\r
-{\r
-  UINT8  Carry;\r
-\r
-  //\r
-  // Uses byte code for RDRAND instruction,\r
-  // in case that GCC version has no direct support on RDRAND assembly.\r
-  //\r
-  __asm__ __volatile__ (\r
-    ".byte 0x66; .byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1"\r
-    :"=a"  (*Rand), \r
-     "=qm" (Carry)\r
-    ); \r
-\r
-  return (BOOLEAN) Carry;\r
-}\r
-\r
-/**\r
-  Generates a 32-bit random number through RDRAND instruction.\r
-\r
-  @param[out]  Rand          Buffer pointer to store the random result.\r
-\r
-  @retval TRUE               RDRAND call was successful.\r
-  @retval FALSE              Failed attempts to call RDRAND.\r
-\r
-**/\r
-BOOLEAN\r
-EFIAPI\r
-RdRand32Step (\r
-  OUT UINT32       *Rand\r
-  )\r
-{\r
-  UINT8  Carry;\r
-\r
-  __asm__ __volatile__ (\r
-    ".byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1"\r
-    :"=a"  (*Rand), \r
-     "=qm" (Carry)\r
-    );\r
-\r
-  return (BOOLEAN) Carry;\r
-}
\ No newline at end of file
diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/IA32/RdRandWord.c b/SecurityPkg/RandomNumberGenerator/RngDxe/IA32/RdRandWord.c
deleted file mode 100644 (file)
index 125c53b..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/** @file\r
-  RDRAND Support Routines.\r
-\r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "RdRand.h"\r
-\r
-/**\r
-  Generates a 64-bit random number through RDRAND instruction.\r
-\r
-  @param[out]  Rand          Buffer pointer to store the random result.\r
-\r
-  @retval TRUE               RDRAND call was successful.\r
-  @retval FALSE              Failed attempts to call RDRAND.\r
-\r
-**/\r
-BOOLEAN\r
-EFIAPI\r
-RdRand64Step  (\r
-  OUT UINT64   *Rand\r
-  )\r
-{\r
-  UINT32  RandLow;\r
-  UINT32  RandHigh;\r
-\r
-  //\r
-  // Generating a 64-bit rand on a 32-bit system by \r
-  // mapping two 32-bit RDRAND instructions.\r
-  //\r
-  if (!RdRand32Step (&RandLow)) {\r
-    return FALSE;\r
-  }\r
-  if (!RdRand32Step (&RandHigh)) {\r
-    return FALSE;\r
-  }\r
-\r
-  *Rand = (UINT64) RandLow | LShiftU64 ((UINT64)RandHigh, 32);\r
-\r
-  return TRUE;\r
-}\r
-\r
-/**\r
-  Calls RDRAND to request a word-length random number.\r
-\r
-  @param[out]  Rand          Buffer pointer to store the random number.\r
-  @param[in]   NeedRetry     Determine whether or not to loop retry.\r
-\r
-  @retval EFI_SUCCESS        Random word generation succeeded.\r
-  @retval EFI_NOT_READY      Failed to request random word.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-RdRandWord (\r
-  OUT UINTN        *Rand,\r
-  IN BOOLEAN       NeedRetry\r
-  )\r
-{\r
-  return RdRand32 (Rand, NeedRetry);\r
-}\r
-\r
-/**\r
-  Calls RDRAND to request multiple word-length random numbers.\r
-\r
-  @param[in]   Length        Size of the buffer, in words, to fill with.\r
-  @param[out]  RandBuffer    Pointer to the buffer to store the random result.\r
-\r
-  @retval EFI_SUCCESS        Random words generation succeeded.\r
-  @retval EFI_NOT_READY      Failed to request random words.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-RdRandGetWords (\r
-  IN UINTN         Length,\r
-  OUT UINTN        *RandBuffer\r
-  )\r
-{\r
-  EFI_STATUS  Status;\r
-  UINT32      Index;\r
-\r
-  for (Index = 0; Index < Length; Index++) {\r
-    //\r
-    // Obtain one word-length (32-bit) Random Number with possible retry-loop.\r
-    //\r
-    Status = RdRand32 (RandBuffer, TRUE);\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
-    \r
-    RandBuffer++;\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/X64/AsmRdRand.asm b/SecurityPkg/RandomNumberGenerator/RngDxe/X64/AsmRdRand.asm
deleted file mode 100644 (file)
index 8a4fe65..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-;------------------------------------------------------------------------------\r
-;\r
-; Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
-; This program and the accompanying materials\r
-; are licensed and made available under the terms and conditions of the BSD License\r
-; which accompanies this distribution.  The full text of the license may be found at\r
-; http://opensource.org/licenses/bsd-license.php.\r
-;\r
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-;\r
-; Module Name:\r
-;\r
-;   AsmRdRand.Asm\r
-;\r
-; Abstract:\r
-;\r
-;   Implementation for 16-, 32-, and 64-bit invocations of RDRAND instruction under 64bit platform.\r
-;\r
-; Notes:\r
-;\r
-;   Visual Studio coding practices do not use inline asm since multiple compilers and \r
-;   architectures are supported assembler not recognizing rdrand instruction so using DB's.\r
-;\r
-;------------------------------------------------------------------------------\r
-\r
-    .code\r
\r
-;------------------------------------------------------------------------------\r
-;  Generate a 16 bit random number\r
-;  Return TRUE if Rand generated successfully, or FALSE if not\r
-;\r
-;  BOOLEAN EFIAPI RdRand16Step (UINT16 *Rand);   RCX\r
-;------------------------------------------------------------------------------\r
-RdRand16Step  PROC\r
-    ; rdrand   ax                  ; generate a 16 bit RN into ax, CF=1 if RN generated ok, otherwise CF=0\r
-    db     0fh, 0c7h, 0f0h         ; rdrand r16:  "0f c7 /6  ModRM:r/m(w)"\r
-    jb     rn16_ok                 ; jmp if CF=1\r
-    xor    rax, rax                ; reg=0 if CF=0\r
-    ret                            ; return with failure status\r
-rn16_ok:\r
-    mov    [rcx], ax\r
-    mov    rax, 1\r
-    ret\r
-RdRand16Step ENDP\r
-\r
-;------------------------------------------------------------------------------\r
-;  Generate a 32 bit random number\r
-;    Return TRUE if Rand generated successfully, or FALSE if not\r
-;\r
-;  BOOLEAN EFIAPI RdRand32Step (UINT32 *Rand);   RCX\r
-;------------------------------------------------------------------------------\r
-RdRand32Step  PROC\r
-    ; rdrand   eax                 ; generate a 32 bit RN into eax, CF=1 if RN generated ok, otherwise CF=0\r
-    db     0fh, 0c7h, 0f0h         ; rdrand r32:  "0f c7 /6  ModRM:r/m(w)"\r
-    jb     rn32_ok                 ; jmp if CF=1\r
-    xor    rax, rax                ; reg=0 if CF=0\r
-    ret                            ; return with failure status\r
-rn32_ok:\r
-    mov    [rcx], eax\r
-    mov    rax,  1\r
-    ret\r
-RdRand32Step ENDP\r
-\r
-;------------------------------------------------------------------------------\r
-;  Generate a 64 bit random number\r
-;    Return TRUE if RN generated successfully, or FALSE if not\r
-;\r
-;  BOOLEAN EFIAPI RdRand64Step (UINT64 *Random);   RCX\r
-;------------------------------------------------------------------------------\r
-RdRand64Step  PROC\r
-    ; rdrand   rax                 ; generate a 64 bit RN into rax, CF=1 if RN generated ok, otherwise CF=0\r
-    db     048h, 0fh, 0c7h, 0f0h   ; rdrand r64: "REX.W + 0F C7 /6 ModRM:r/m(w)" \r
-    jb     rn64_ok                 ; jmp if CF=1\r
-    xor    rax, rax                ; reg=0 if CF=0\r
-    ret                            ; return with failure status\r
-rn64_ok:\r
-    mov    [rcx], rax\r
-    mov    rax, 1\r
-    ret\r
-RdRand64Step ENDP\r
-\r
-    END\r
diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/X64/GccRdRand.c b/SecurityPkg/RandomNumberGenerator/RngDxe/X64/GccRdRand.c
deleted file mode 100644 (file)
index d28336d..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/** @file\r
-  RDRAND Support Routines for GCC environment.\r
-\r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-/**\r
-  Generates a 16-bit random number through RDRAND instruction.\r
-\r
-  @param[out]  Rand          Buffer pointer to store the random result.\r
-\r
-  @retval TRUE               RDRAND call was successful.\r
-  @retval FALSE              Failed attempts to call RDRAND.\r
-\r
-**/\r
-BOOLEAN\r
-EFIAPI\r
-RdRand16Step (\r
-  OUT UINT16       *Rand\r
-  )\r
-{\r
-  UINT8  Carry;\r
-\r
-  //\r
-  // Uses byte code for RDRAND instruction,\r
-  // in case that GCC version has no direct support on RDRAND assembly.\r
-  //\r
-  __asm__ __volatile__ (\r
-    ".byte 0x66; .byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1"\r
-    :"=a"  (*Rand),\r
-     "=qm" (Carry)\r
-    ); \r
-\r
-  return (BOOLEAN) Carry;\r
-}\r
-\r
-/**\r
-  Generates a 32-bit random number through RDRAND instruction.\r
-\r
-  @param[out]  Rand          Buffer pointer to store the random result.\r
-\r
-  @retval TRUE               RDRAND call was successful.\r
-  @retval FALSE              Failed attempts to call RDRAND.\r
-\r
-**/\r
-BOOLEAN\r
-EFIAPI\r
-RdRand32Step (\r
-  OUT UINT32       *Rand\r
-  )\r
-{\r
-  UINT8  Carry;\r
-\r
-  __asm__ __volatile__ (\r
-    ".byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1"\r
-    :"=a"  (*Rand), \r
-     "=qm" (Carry)\r
-    );\r
-\r
-  return (BOOLEAN) Carry;\r
-}\r
-\r
-/**\r
-  Generates a 64-bit random number through RDRAND instruction.\r
-\r
-  @param[out]  Rand          Buffer pointer to store the random result.\r
-\r
-  @retval TRUE               RDRAND call was successful.\r
-  @retval FALSE              Failed attempts to call RDRAND.\r
-\r
-**/\r
-BOOLEAN\r
-EFIAPI\r
-RdRand64Step  (\r
-  OUT UINT64   *Rand\r
-  )\r
-{\r
-  UINT8  Carry;\r
-\r
-  __asm__ __volatile__ (\r
-    ".byte 0x48; .byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1"\r
-    :"=a"  (*Rand), \r
-     "=qm" (Carry)\r
-    );\r
-  \r
-  return (BOOLEAN) Carry;\r
-}\r
diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/X64/RdRandWord.c b/SecurityPkg/RandomNumberGenerator/RngDxe/X64/RdRandWord.c
deleted file mode 100644 (file)
index 946e5ba..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/** @file\r
-  RDRAND Support Routines.\r
-\r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "RdRand.h"\r
-\r
-/**\r
-  Calls RDRAND to request a word-length random number.\r
-\r
-  @param[out]  Rand          Buffer pointer to store the random number.\r
-  @param[in]   NeedRetry     Determine whether or not to loop retry.\r
-\r
-  @retval EFI_SUCCESS        Random word generation succeeded.\r
-  @retval EFI_NOT_READY      Failed to request random word.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-RdRandWord (\r
-  OUT UINTN        *Rand,\r
-  IN BOOLEAN       NeedRetry\r
-  )\r
-{\r
-  return RdRand64 (Rand, NeedRetry);\r
-}\r
-\r
-/**\r
-  Calls RDRAND to request multiple word-length random numbers.\r
-\r
-  @param[in]   Length        Size of the buffer, in words, to fill with.\r
-  @param[out]  RandBuffer    Pointer to the buffer to store the random result.\r
-\r
-  @retval EFI_SUCCESS        Random words generation succeeded.\r
-  @retval EFI_NOT_READY      Failed to request random words.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-RdRandGetWords (\r
-  IN UINTN         Length,\r
-  OUT UINTN        *RandBuffer\r
-  )\r
-{\r
-  EFI_STATUS  Status;\r
-  UINT32      Index;\r
-\r
-  for (Index = 0; Index < Length; Index++) {\r
-    //\r
-    // Obtain one word-length (64-bit) Random Number with possible retry-loop.\r
-    //\r
-    Status = RdRand64 (RandBuffer, TRUE);\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
-    \r
-    RandBuffer++;\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}
\ No newline at end of file