]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Hash2DxeCrypto/Driver.h
Add UEFI2.5 HASH protocol implementation.
[mirror_edk2.git] / SecurityPkg / Hash2DxeCrypto / Driver.h
diff --git a/SecurityPkg/Hash2DxeCrypto/Driver.h b/SecurityPkg/Hash2DxeCrypto/Driver.h
new file mode 100644 (file)
index 0000000..771aedc
--- /dev/null
@@ -0,0 +1,131 @@
+/** @file\r
+  This is definition for service binding for Hash driver.\r
+\r
+Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available under\r
+the terms and conditions of the BSD License that accompanies this distribution.\r
+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
+#ifndef _HASH2_DRIVER_H_\r
+#define _HASH2_DRIVER_H_\r
+\r
+#include <Uefi.h>\r
+\r
+#include <Protocol/ServiceBinding.h>\r
+#include <Protocol/Hash2.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+#include <Library/DevicePathLib.h>\r
+#include <Library/UefiLib.h>\r
+\r
+#define HASH2_SERVICE_DATA_SIGNATURE  SIGNATURE_32 ('H', 'S', '2', 'S')\r
+\r
+typedef struct {\r
+  UINT32                        Signature;\r
+  EFI_HANDLE                    ServiceHandle;\r
+  EFI_SERVICE_BINDING_PROTOCOL  ServiceBinding;\r
+\r
+  LIST_ENTRY                    ChildrenList;\r
+} HASH2_SERVICE_DATA;\r
+\r
+#define HASH2_SERVICE_DATA_FROM_THIS(a) \\r
+  CR ( \\r
+  (a), \\r
+  HASH2_SERVICE_DATA, \\r
+  ServiceBinding, \\r
+  HASH2_SERVICE_DATA_SIGNATURE \\r
+  )\r
+\r
+#define HASH2_INSTANCE_DATA_SIGNATURE   SIGNATURE_32 ('H', 's', '2', 'I')\r
+\r
+typedef struct {\r
+  UINT32                           Signature;\r
+  HASH2_SERVICE_DATA               *Hash2ServiceData;\r
+  EFI_HANDLE                       Handle;\r
+  LIST_ENTRY                       InstEntry;\r
+  EFI_HASH2_PROTOCOL               Hash2Protocol;\r
+  VOID                             *HashContext;\r
+  VOID                             *HashInfoContext;\r
+} HASH2_INSTANCE_DATA;\r
+\r
+#define HASH2_INSTANCE_DATA_FROM_THIS(a) \\r
+  CR ( \\r
+  (a), \\r
+  HASH2_INSTANCE_DATA, \\r
+  Hash2Protocol, \\r
+  HASH2_INSTANCE_DATA_SIGNATURE \\r
+  )\r
+\r
+#define HASH2_INSTANCE_DATA_FROM_LINK(a) \\r
+  CR ( \\r
+  (a), \\r
+  HASH2_INSTANCE_DATA, \\r
+  InstEntry, \\r
+  HASH2_INSTANCE_DATA_SIGNATURE \\r
+  )\r
+\r
+/**\r
+  Creates a child handle with a set of I/O services.\r
+\r
+  @param[in]       This              Protocol instance pointer.\r
+  @param[in, out]  ChildHandle       Pointer to the handle of the child to create. If\r
+                                     it is NULL, then a new handle is created. If\r
+                                     it is not NULL, then the I/O services are added\r
+                                     to the existing child handle.\r
+\r
+  @retval EFI_SUCCES                 The protocol was added to ChildHandle.\r
+  @retval EFI_INVALID_PARAMETER      ChildHandle is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES       There are not enough resources availabe to\r
+                                     create the child.\r
+  @retval Others                     The child handle was not created.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Hash2ServiceBindingCreateChild (\r
+  IN     EFI_SERVICE_BINDING_PROTOCOL    *This,\r
+  IN OUT EFI_HANDLE                      *ChildHandle\r
+  );\r
+\r
+/**\r
+  Destroys a child handle with a set of I/O services.\r
+\r
+  The DestroyChild() function does the opposite of CreateChild(). It removes a\r
+  protocol that was installed by CreateChild() from ChildHandle. If the removed\r
+  protocol is the last protocol on ChildHandle, then ChildHandle is destroyed.\r
+\r
+  @param[in]  This               Pointer to the EFI_SERVICE_BINDING_PROTOCOL\r
+                                 instance.\r
+  @param[in]  ChildHandle        Handle of the child to destroy.\r
+\r
+  @retval EFI_SUCCES             The protocol was removed from ChildHandle.\r
+  @retval EFI_UNSUPPORTED        ChildHandle does not support the protocol that\r
+                                 is being removed.\r
+  @retval EFI_INVALID_PARAMETER  ChildHandle is NULL.\r
+  @retval EFI_ACCESS_DENIED      The protocol could not be removed from the\r
+                                 ChildHandle because its services are being\r
+                                 used.\r
+  @retval Others                 The child handle was not destroyed.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Hash2ServiceBindingDestroyChild (\r
+  IN EFI_SERVICE_BINDING_PROTOCOL    *This,\r
+  IN EFI_HANDLE                      ChildHandle\r
+  );\r
+\r
+extern EFI_HASH2_PROTOCOL mHash2Protocol;\r
+\r
+#endif\r