1 /** @file
2 
3 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
4 
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions
7 of the BSD License which accompanies this distribution.  The
8 full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10 
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 #include <Uefi.h>
17 #include <Library/DebugLib.h>
18 
19 /**
20   This function will save confidential information to lockbox.
21 
22   @param Guid       the guid to identify the confidential information
23   @param Buffer     the address of the confidential information
24   @param Length     the length of the confidential information
25 
26   @retval RETURN_SUCCESS            the information is saved successfully.
27   @retval RETURN_INVALID_PARAMETER  the Guid is NULL, or Buffer is NULL, or Length is 0
28   @retval RETURN_ALREADY_STARTED    the requested GUID already exist.
29   @retval RETURN_OUT_OF_RESOURCES   no enough resource to save the information.
30   @retval RETURN_ACCESS_DENIED      it is too late to invoke this interface
31   @retval RETURN_NOT_STARTED        it is too early to invoke this interface
32   @retval RETURN_UNSUPPORTED        the service is not supported by implementaion.
33 **/
34 RETURN_STATUS
35 EFIAPI
SaveLockBox(IN GUID * Guid,IN VOID * Buffer,IN UINTN Length)36 SaveLockBox (
37   IN  GUID                        *Guid,
38   IN  VOID                        *Buffer,
39   IN  UINTN                       Length
40   )
41 {
42   return RETURN_SUCCESS;
43 }
44 
45 /**
46   This function will set lockbox attributes.
47 
48   @param Guid       the guid to identify the confidential information
49   @param Attributes the attributes of the lockbox
50 
51   @retval RETURN_SUCCESS            the information is saved successfully.
52   @retval RETURN_INVALID_PARAMETER  attributes is invalid.
53   @retval RETURN_NOT_FOUND          the requested GUID not found.
54   @retval RETURN_ACCESS_DENIED      it is too late to invoke this interface
55   @retval RETURN_NOT_STARTED        it is too early to invoke this interface
56   @retval RETURN_UNSUPPORTED        the service is not supported by implementaion.
57 **/
58 RETURN_STATUS
59 EFIAPI
SetLockBoxAttributes(IN GUID * Guid,IN UINT64 Attributes)60 SetLockBoxAttributes (
61   IN  GUID                        *Guid,
62   IN  UINT64                      Attributes
63   )
64 {
65   return RETURN_SUCCESS;
66 }
67 
68 /**
69   This function will update confidential information to lockbox.
70 
71   @param Guid   the guid to identify the original confidential information
72   @param Offset the offset of the original confidential information
73   @param Buffer the address of the updated confidential information
74   @param Length the length of the updated confidential information
75 
76   @retval RETURN_SUCCESS            the information is saved successfully.
77   @retval RETURN_INVALID_PARAMETER  the Guid is NULL, or Buffer is NULL, or Length is 0.
78   @retval RETURN_NOT_FOUND          the requested GUID not found.
79   @retval RETURN_BUFFER_TOO_SMALL   the original buffer to too small to hold new information.
80   @retval RETURN_ACCESS_DENIED      it is too late to invoke this interface
81   @retval RETURN_NOT_STARTED        it is too early to invoke this interface
82   @retval RETURN_UNSUPPORTED        the service is not supported by implementaion.
83 **/
84 RETURN_STATUS
85 EFIAPI
UpdateLockBox(IN GUID * Guid,IN UINTN Offset,IN VOID * Buffer,IN UINTN Length)86 UpdateLockBox (
87   IN  GUID                        *Guid,
88   IN  UINTN                       Offset,
89   IN  VOID                        *Buffer,
90   IN  UINTN                       Length
91   )
92 {
93   return RETURN_SUCCESS;
94 }
95 
96 /**
97   This function will restore confidential information from lockbox.
98 
99   @param Guid   the guid to identify the confidential information
100   @param Buffer the address of the restored confidential information
101                 NULL means restored to original address, Length MUST be NULL at same time.
102   @param Length the length of the restored confidential information
103 
104   @retval RETURN_SUCCESS            the information is restored successfully.
105   @retval RETURN_INVALID_PARAMETER  the Guid is NULL, or one of Buffer and Length is NULL.
106   @retval RETURN_WRITE_PROTECTED    Buffer and Length are NULL, but the LockBox has no
107                                     LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE attribute.
108   @retval RETURN_BUFFER_TOO_SMALL   the Length is too small to hold the confidential information.
109   @retval RETURN_NOT_FOUND          the requested GUID not found.
110   @retval RETURN_NOT_STARTED        it is too early to invoke this interface
111   @retval RETURN_ACCESS_DENIED      not allow to restore to the address
112   @retval RETURN_UNSUPPORTED        the service is not supported by implementaion.
113 **/
114 RETURN_STATUS
115 EFIAPI
RestoreLockBox(IN GUID * Guid,IN VOID * Buffer,OPTIONAL IN OUT UINTN * Length OPTIONAL)116 RestoreLockBox (
117   IN  GUID                        *Guid,
118   IN  VOID                        *Buffer, OPTIONAL
119   IN  OUT UINTN                   *Length  OPTIONAL
120   )
121 {
122   return RETURN_SUCCESS;
123 }
124 
125 /**
126   This function will restore confidential information from all lockbox which have RestoreInPlace attribute.
127 
128   @retval RETURN_SUCCESS            the information is restored successfully.
129   @retval RETURN_NOT_STARTED        it is too early to invoke this interface
130   @retval RETURN_UNSUPPORTED        the service is not supported by implementaion.
131 **/
132 RETURN_STATUS
133 EFIAPI
RestoreAllLockBoxInPlace(VOID)134 RestoreAllLockBoxInPlace (
135   VOID
136   )
137 {
138   return RETURN_SUCCESS;
139 }
140