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