]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Hash2DxeCrypto/Driver.h
Add UEFI2.5 HASH protocol implementation.
[mirror_edk2.git] / SecurityPkg / Hash2DxeCrypto / Driver.h
CommitLineData
724dcbb2
JY
1/** @file\r
2 This is definition for service binding for Hash driver.\r
3\r
4Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials are licensed and made available under\r
6the terms and conditions of the BSD License that accompanies this distribution.\r
7The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php.\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _HASH2_DRIVER_H_\r
16#define _HASH2_DRIVER_H_\r
17\r
18#include <Uefi.h>\r
19\r
20#include <Protocol/ServiceBinding.h>\r
21#include <Protocol/Hash2.h>\r
22\r
23#include <Library/BaseLib.h>\r
24#include <Library/BaseMemoryLib.h>\r
25#include <Library/DebugLib.h>\r
26#include <Library/MemoryAllocationLib.h>\r
27#include <Library/UefiBootServicesTableLib.h>\r
28#include <Library/UefiRuntimeServicesTableLib.h>\r
29#include <Library/DevicePathLib.h>\r
30#include <Library/UefiLib.h>\r
31\r
32#define HASH2_SERVICE_DATA_SIGNATURE SIGNATURE_32 ('H', 'S', '2', 'S')\r
33\r
34typedef struct {\r
35 UINT32 Signature;\r
36 EFI_HANDLE ServiceHandle;\r
37 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r
38\r
39 LIST_ENTRY ChildrenList;\r
40} HASH2_SERVICE_DATA;\r
41\r
42#define HASH2_SERVICE_DATA_FROM_THIS(a) \\r
43 CR ( \\r
44 (a), \\r
45 HASH2_SERVICE_DATA, \\r
46 ServiceBinding, \\r
47 HASH2_SERVICE_DATA_SIGNATURE \\r
48 )\r
49\r
50#define HASH2_INSTANCE_DATA_SIGNATURE SIGNATURE_32 ('H', 's', '2', 'I')\r
51\r
52typedef struct {\r
53 UINT32 Signature;\r
54 HASH2_SERVICE_DATA *Hash2ServiceData;\r
55 EFI_HANDLE Handle;\r
56 LIST_ENTRY InstEntry;\r
57 EFI_HASH2_PROTOCOL Hash2Protocol;\r
58 VOID *HashContext;\r
59 VOID *HashInfoContext;\r
60} HASH2_INSTANCE_DATA;\r
61\r
62#define HASH2_INSTANCE_DATA_FROM_THIS(a) \\r
63 CR ( \\r
64 (a), \\r
65 HASH2_INSTANCE_DATA, \\r
66 Hash2Protocol, \\r
67 HASH2_INSTANCE_DATA_SIGNATURE \\r
68 )\r
69\r
70#define HASH2_INSTANCE_DATA_FROM_LINK(a) \\r
71 CR ( \\r
72 (a), \\r
73 HASH2_INSTANCE_DATA, \\r
74 InstEntry, \\r
75 HASH2_INSTANCE_DATA_SIGNATURE \\r
76 )\r
77\r
78/**\r
79 Creates a child handle with a set of I/O services.\r
80\r
81 @param[in] This Protocol instance pointer.\r
82 @param[in, out] ChildHandle Pointer to the handle of the child to create. If\r
83 it is NULL, then a new handle is created. If\r
84 it is not NULL, then the I/O services are added\r
85 to the existing child handle.\r
86\r
87 @retval EFI_SUCCES The protocol was added to ChildHandle.\r
88 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
89 @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to\r
90 create the child.\r
91 @retval Others The child handle was not created.\r
92\r
93**/\r
94EFI_STATUS\r
95EFIAPI\r
96Hash2ServiceBindingCreateChild (\r
97 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
98 IN OUT EFI_HANDLE *ChildHandle\r
99 );\r
100\r
101/**\r
102 Destroys a child handle with a set of I/O services.\r
103\r
104 The DestroyChild() function does the opposite of CreateChild(). It removes a\r
105 protocol that was installed by CreateChild() from ChildHandle. If the removed\r
106 protocol is the last protocol on ChildHandle, then ChildHandle is destroyed.\r
107\r
108 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL\r
109 instance.\r
110 @param[in] ChildHandle Handle of the child to destroy.\r
111\r
112 @retval EFI_SUCCES The protocol was removed from ChildHandle.\r
113 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that\r
114 is being removed.\r
115 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
116 @retval EFI_ACCESS_DENIED The protocol could not be removed from the\r
117 ChildHandle because its services are being\r
118 used.\r
119 @retval Others The child handle was not destroyed.\r
120\r
121**/\r
122EFI_STATUS\r
123EFIAPI\r
124Hash2ServiceBindingDestroyChild (\r
125 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
126 IN EFI_HANDLE ChildHandle\r
127 );\r
128\r
129extern EFI_HASH2_PROTOCOL mHash2Protocol;\r
130\r
131#endif\r