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