1 /** @file
2   EFI_AUTHENTICATION_INFO_PROTOCOL as defined in UEFI 2.0.
3   This protocol is used on any device handle to obtain authentication information
4   associated with the physical or logical device.
5 
6 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8 
9 **/
10 
11 #ifndef __AUTHENTICATION_INFO_H__
12 #define __AUTHENTICATION_INFO_H__
13 
14 #define EFI_AUTHENTICATION_INFO_PROTOCOL_GUID \
15   { \
16     0x7671d9d0, 0x53db, 0x4173, {0xaa, 0x69, 0x23, 0x27, 0xf2, 0x1f, 0x0b, 0xc7 } \
17   }
18 
19 #define EFI_AUTHENTICATION_CHAP_RADIUS_GUID \
20   { \
21     0xd6062b50, 0x15ca, 0x11da, {0x92, 0x19, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } \
22   }
23 
24 #define EFI_AUTHENTICATION_CHAP_LOCAL_GUID \
25   { \
26     0xc280c73e, 0x15ca, 0x11da, {0xb0, 0xca, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } \
27   }
28 
29 typedef struct _EFI_AUTHENTICATION_INFO_PROTOCOL EFI_AUTHENTICATION_INFO_PROTOCOL;
30 
31 #pragma pack(1)
32 typedef struct {
33   ///
34   /// Authentication Type GUID.
35   ///
36   EFI_GUID         Guid;
37 
38   ///
39   /// Length of this structure in bytes.
40   ///
41   UINT16           Length;
42 } AUTH_NODE_HEADER;
43 
44 typedef struct {
45   AUTH_NODE_HEADER Header;
46 
47   ///
48   /// RADIUS Server IPv4 or IPv6 Address.
49   ///
50   UINT8            RadiusIpAddr[16];         ///< IPv4 or IPv6 address.
51 
52   ///
53   /// Reserved for future use.
54   ///
55   UINT16           Reserved;
56 
57   ///
58   /// Network Access Server IPv4 or IPv6 Address (OPTIONAL).
59   ///
60   UINT8            NasIpAddr[16];            ///< IPv4 or IPv6 address.
61 
62   ///
63   /// Network Access Server Secret Length in bytes (OPTIONAL).
64   ///
65   UINT16           NasSecretLength;
66 
67   ///
68   /// Network Access Server Secret (OPTIONAL).
69   ///
70   UINT8            NasSecret[1];
71 
72   ///
73   /// CHAP Initiator Secret Length in bytes on offset NasSecret + NasSecretLength.
74   ///
75   /// UINT16           ChapSecretLength;
76   ///
77   /// CHAP Initiator Secret.
78   ///
79   /// UINT8            ChapSecret[];
80   ///
81   /// CHAP Initiator Name Length in bytes on offset ChapSecret + ChapSecretLength.
82   ///
83   /// UINT16           ChapNameLength;
84   ///
85   /// CHAP Initiator Name.
86   ///
87   /// UINT8            ChapName[];
88   ///
89   /// Reverse CHAP Name Length in bytes on offset ChapName + ChapNameLength.
90   ///
91   /// UINT16           ReverseChapNameLength;
92   ///
93   /// Reverse CHAP Name.
94   ///
95   /// UINT8            ReverseChapName[];
96   ///
97   /// Reverse CHAP Secret Length in bytes on offseet ReverseChapName + ReverseChapNameLength.
98   ///
99   /// UINT16           ReverseChapSecretLength;
100   ///
101   /// Reverse CHAP Secret.
102   ///
103   /// UINT8            ReverseChapSecret[];
104   ///
105 } CHAP_RADIUS_AUTH_NODE;
106 
107 typedef struct {
108   AUTH_NODE_HEADER Header;
109 
110   ///
111   /// Reserved for future use.
112   ///
113   UINT16           Reserved;
114 
115   ///
116   /// User Secret Length in bytes.
117   ///
118   UINT16           UserSecretLength;
119 
120   ///
121   /// User Secret.
122   ///
123   UINT8            UserSecret[1];
124 
125   ///
126   /// User Name Length in bytes on offset UserSecret + UserSecretLength.
127   ///
128   /// UINT16           UserNameLength;
129   ///
130   /// User Name.
131   ///
132   /// UINT8            UserName[];
133   ///
134   /// CHAP Initiator Secret Length in bytes on offset UserName + UserNameLength.
135   ///
136   /// UINT16           ChapSecretLength;
137   ///
138   /// CHAP Initiator Secret.
139   ///
140   /// UINT8            ChapSecret[];
141   ///
142   /// CHAP Initiator Name Length in bytes on offset ChapSecret + ChapSecretLength.
143   ///
144   /// UINT16           ChapNameLength;
145   ///
146   /// CHAP Initiator Name.
147   ///
148   /// UINT8            ChapName[];
149   ///
150   /// Reverse CHAP Name Length in bytes on offset ChapName + ChapNameLength.
151   ///
152   /// UINT16           ReverseChapNameLength;
153   ///
154   /// Reverse CHAP Name.
155   ///
156   /// UINT8            ReverseChapName[];
157   ///
158   /// Reverse CHAP Secret Length in bytes on offset ReverseChapName + ReverseChapNameLength.
159   ///
160   /// UINT16           ReverseChapSecretLength;
161   ///
162   /// Reverse CHAP Secret.
163   ///
164   /// UINT8            ReverseChapSecret[];
165   ///
166 } CHAP_LOCAL_AUTH_NODE;
167 #pragma pack()
168 
169 /**
170   Retrieves the authentication information associated with a particular controller handle.
171 
172   @param[in]  This                  The pointer to the EFI_AUTHENTICATION_INFO_PROTOCOL.
173   @param[in]  ControllerHandle      The handle to the Controller.
174   @param[out] Buffer                The pointer to the authentication information. This function is
175                                     responsible for allocating the buffer and it is the caller's
176                                     responsibility to free buffer when the caller is finished with buffer.
177 
178   @retval EFI_SUCCESS           Successfully retrieved authentication information
179                                 for the given ControllerHandle.
180   @retval EFI_INVALID_PARAMETER No matching authentication information found for
181                                 the given ControllerHandle.
182   @retval EFI_DEVICE_ERROR      The authentication information could not be retrieved
183                                 due to a hardware error.
184 
185 **/
186 typedef
187 EFI_STATUS
188 (EFIAPI *EFI_AUTHENTICATION_INFO_PROTOCOL_GET)(
189   IN  EFI_AUTHENTICATION_INFO_PROTOCOL *This,
190   IN  EFI_HANDLE                       ControllerHandle,
191   OUT VOID                             **Buffer
192   );
193 
194 /**
195   Set the authentication information for a given controller handle.
196 
197   @param[in]  This                 The pointer to the EFI_AUTHENTICATION_INFO_PROTOCOL.
198   @param[in]  ControllerHandle     The handle to the Controller.
199   @param[in]  Buffer               The pointer to the authentication information.
200 
201   @retval EFI_SUCCESS          Successfully set authentication information for the
202                                given ControllerHandle.
203   @retval EFI_UNSUPPORTED      If the platform policies do not allow setting of
204                                the authentication information.
205   @retval EFI_DEVICE_ERROR     The authentication information could not be configured
206                                due to a hardware error.
207   @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data.
208 
209 **/
210 typedef
211 EFI_STATUS
212 (EFIAPI *EFI_AUTHENTICATION_INFO_PROTOCOL_SET)(
213   IN EFI_AUTHENTICATION_INFO_PROTOCOL  *This,
214   IN EFI_HANDLE                        ControllerHandle,
215   IN VOID                              *Buffer
216   );
217 
218 ///
219 /// This protocol is used on any device handle to obtain authentication
220 /// information associated with the physical or logical device.
221 ///
222 struct _EFI_AUTHENTICATION_INFO_PROTOCOL {
223   EFI_AUTHENTICATION_INFO_PROTOCOL_GET Get;
224   EFI_AUTHENTICATION_INFO_PROTOCOL_SET Set;
225 };
226 
227 extern EFI_GUID gEfiAuthenticationInfoProtocolGuid;
228 extern EFI_GUID gEfiAuthenticationChapRadiusGuid;
229 extern EFI_GUID gEfiAuthenticationChapLocalGuid;
230 
231 #endif
232