]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/BaseCryptLibRuntimeCryptProtocol/Pk/CryptDhNull.c
Add interfaces to several library instances of BaseCryptLib.
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLibRuntimeCryptProtocol / Pk / CryptDhNull.c
diff --git a/CryptoPkg/Library/BaseCryptLibRuntimeCryptProtocol/Pk/CryptDhNull.c b/CryptoPkg/Library/BaseCryptLibRuntimeCryptProtocol/Pk/CryptDhNull.c
new file mode 100644 (file)
index 0000000..35045db
--- /dev/null
@@ -0,0 +1,156 @@
+/** @file\r
+  Diffie-Hellman Wrapper Implementation which does not provide\r
+  real capabilities.\r
+\r
+Copyright (c) 2012, 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 "InternalCryptLib.h"\r
+\r
+/**\r
+  Allocates and Initializes one Diffie-Hellman Context for subsequent use.\r
+\r
+  @return  Pointer to the Diffie-Hellman Context that has been initialized.\r
+           If the interface is not supported, DhNew() returns NULL.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+DhNew (\r
+  VOID\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return NULL;\r
+}\r
+\r
+/**\r
+  Release the specified DH context.\r
+\r
+  If the interface is not supported, then ASSERT().\r
+\r
+  @param[in]  DhContext  Pointer to the DH context to be released.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+DhFree (\r
+  IN  VOID  *DhContext\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+  Generates DH parameter.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in, out]  DhContext    Pointer to the DH context.\r
+  @param[in]       Generator    Value of generator.\r
+  @param[in]       PrimeLength  Length in bits of prime to be generated.\r
+  @param[out]      Prime        Pointer to the buffer to receive the generated prime number.\r
+\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+DhGenerateParameter (\r
+  IN OUT  VOID   *DhContext,\r
+  IN      UINTN  Generator,\r
+  IN      UINTN  PrimeLength,\r
+  OUT     UINT8  *Prime\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r
+\r
+/**\r
+  Sets generator and prime parameters for DH.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in, out]  DhContext    Pointer to the DH context.\r
+  @param[in]       Generator    Value of generator.\r
+  @param[in]       PrimeLength  Length in bits of prime to be generated.\r
+  @param[in]       Prime        Pointer to the prime number.\r
+\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+DhSetParameter (\r
+  IN OUT  VOID         *DhContext,\r
+  IN      UINTN        Generator,\r
+  IN      UINTN        PrimeLength,\r
+  IN      CONST UINT8  *Prime\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE; \r
+}\r
+\r
+/**\r
+  Generates DH public key.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in, out]  DhContext      Pointer to the DH context.\r
+  @param[out]      PublicKey      Pointer to the buffer to receive generated public key.\r
+  @param[in, out]  PublicKeySize  On input, the size of PublicKey buffer in bytes.\r
+                                  On output, the size of data returned in PublicKey buffer in bytes.\r
+\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+DhGenerateKey (\r
+  IN OUT  VOID   *DhContext,\r
+  OUT     UINT8  *PublicKey,\r
+  IN OUT  UINTN  *PublicKeySize\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r
+\r
+/**\r
+  Computes exchanged common key.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in, out]  DhContext          Pointer to the DH context.\r
+  @param[in]       PeerPublicKey      Pointer to the peer's public key.\r
+  @param[in]       PeerPublicKeySize  Size of peer's public key in bytes.\r
+  @param[out]      Key                Pointer to the buffer to receive generated key.\r
+  @param[in, out]  KeySize            On input, the size of Key buffer in bytes.\r
+                                      On output, the size of data returned in Key buffer in bytes.\r
+\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+DhComputeKey (\r
+  IN OUT  VOID         *DhContext,\r
+  IN      CONST UINT8  *PeerPublicKey,\r
+  IN      UINTN        PeerPublicKeySize,\r
+  OUT     UINT8        *Key,\r
+  IN OUT  UINTN        *KeySize\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r