]>
Commit | Line | Data |
---|---|---|
12618416 | 1 | /** @file\r |
fab4bd04 | 2 | The header file of CHAP configuration.\r |
6a690e23 | 3 | \r |
fab4bd04 | 4 | Copyright (c) 2004 - 2007, Intel Corporation.<BR>\r |
7a444476 | 5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
6a690e23 | 12 | \r |
12618416 | 13 | **/\r |
6a690e23 | 14 | \r |
15 | #ifndef _ISCSI_CHAP_H_\r | |
16 | #define _ISCSI_CHAP_H_\r | |
17 | \r | |
18 | #define ISCSI_CHAP_AUTH_INFO_GUID \\r | |
19 | { \\r | |
93e3992d | 20 | 0x786ec0ac, 0x65ae, 0x4d1b, {0xb1, 0x37, 0xd, 0x11, 0xa, 0x48, 0x37, 0x97} \\r |
6a690e23 | 21 | }\r |
22 | \r | |
23 | extern EFI_GUID mIScsiCHAPAuthInfoGuid;\r | |
24 | \r | |
25 | #define ISCSI_AUTH_METHOD_CHAP "CHAP"\r | |
26 | \r | |
27 | #define ISCSI_KEY_CHAP_ALGORITHM "CHAP_A"\r | |
28 | #define ISCSI_KEY_CHAP_IDENTIFIER "CHAP_I"\r | |
29 | #define ISCSI_KEY_CHAP_CHALLENGE "CHAP_C"\r | |
30 | #define ISCSI_KEY_CHAP_NAME "CHAP_N"\r | |
31 | #define ISCSI_KEY_CHAP_RESPONSE "CHAP_R"\r | |
32 | \r | |
33 | #define ISCSI_CHAP_ALGORITHM_MD5 5\r | |
34 | \r | |
35 | #define ISCSI_CHAP_AUTH_MAX_LEN 1024\r | |
fab4bd04 | 36 | ///\r |
37 | /// MD5_HASHSIZE\r | |
38 | ///\r | |
39 | #define ISCSI_CHAP_RSP_LEN 16 \r | |
6a690e23 | 40 | typedef enum {\r |
41 | ISCSI_CHAP_INITIAL,\r | |
42 | ISCSI_CHAP_STEP_ONE,\r | |
43 | ISCSI_CHAP_STEP_TWO,\r | |
44 | ISCSI_CHAP_STEP_THREE,\r | |
45 | ISCSI_CHAP_STEP_FOUR\r | |
46 | } ISCSI_CHAP_STEP;\r | |
47 | \r | |
48 | #pragma pack(1)\r | |
49 | \r | |
50 | typedef struct _ISCSI_CHAP_AUTH_CONFIG_NVDATA {\r | |
51 | UINT8 CHAPType;\r | |
52 | CHAR8 CHAPName[ISCSI_CHAP_NAME_MAX_LEN];\r | |
53 | CHAR8 CHAPSecret[ISCSI_CHAP_SECRET_MAX_LEN];\r | |
54 | CHAR8 ReverseCHAPName[ISCSI_CHAP_NAME_MAX_LEN];\r | |
55 | CHAR8 ReverseCHAPSecret[ISCSI_CHAP_SECRET_MAX_LEN];\r | |
56 | } ISCSI_CHAP_AUTH_CONFIG_NVDATA;\r | |
57 | \r | |
58 | #pragma pack()\r | |
59 | \r | |
fab4bd04 | 60 | ///\r |
61 | /// ISCSI CHAP Authentication Data\r | |
62 | ///\r | |
6a690e23 | 63 | typedef struct _ISCSI_CHAP_AUTH_DATA {\r |
64 | ISCSI_CHAP_AUTH_CONFIG_NVDATA AuthConfig;\r | |
65 | UINT32 InIdentifier;\r | |
66 | UINT8 InChallenge[ISCSI_CHAP_AUTH_MAX_LEN];\r | |
67 | UINT32 InChallengeLength;\r | |
68 | //\r | |
69 | // Calculated CHAP Response (CHAP_R) value\r | |
70 | //\r | |
71 | UINT8 CHAPResponse[ISCSI_CHAP_RSP_LEN];\r | |
72 | \r | |
73 | //\r | |
74 | // Auth-data to be sent out for mutual authentication\r | |
75 | //\r | |
76 | UINT32 OutIdentifier;\r | |
77 | UINT8 OutChallenge[ISCSI_CHAP_AUTH_MAX_LEN];\r | |
78 | UINT32 OutChallengeLength;\r | |
79 | } ISCSI_CHAP_AUTH_DATA;\r | |
80 | \r | |
12618416 | 81 | /**\r |
82 | This function checks the received iSCSI Login Response during the security\r | |
83 | negotiation stage.\r | |
84 | \r | |
fab4bd04 | 85 | @param[in] Conn The iSCSI connection.\r |
12618416 | 86 | \r |
87 | @retval EFI_SUCCESS The Login Response passed the CHAP validation.\r | |
12618416 | 88 | @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r |
12618416 | 89 | @retval EFI_PROTOCOL_ERROR Some kind of protocol error happend.\r |
963dbb30 | 90 | @retval Others Other errors as indicated.\r |
12618416 | 91 | **/\r |
6a690e23 | 92 | EFI_STATUS\r |
93 | IScsiCHAPOnRspReceived (\r | |
c5de0d55 | 94 | IN ISCSI_CONNECTION *Conn\r |
6a690e23 | 95 | );\r |
12618416 | 96 | /**\r |
97 | This function fills the CHAP authentication information into the login PDU\r | |
98 | during the security negotiation stage in the iSCSI connection login.\r | |
99 | \r | |
c5de0d55 | 100 | @param[in] Conn The iSCSI connection.\r |
101 | @param[in, out] Pdu The PDU to send out.\r | |
12618416 | 102 | \r |
103 | @retval EFI_SUCCESS All check passed and the phase-related CHAP\r | |
104 | authentication info is filled into the iSCSI PDU.\r | |
12618416 | 105 | @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r |
12618416 | 106 | @retval EFI_PROTOCOL_ERROR Some kind of protocol error happend.\r |
12618416 | 107 | **/\r |
6a690e23 | 108 | EFI_STATUS\r |
109 | IScsiCHAPToSendReq (\r | |
c5de0d55 | 110 | IN ISCSI_CONNECTION *Conn,\r |
111 | IN OUT NET_BUF *Pdu\r | |
6a690e23 | 112 | );\r |
113 | \r | |
114 | #endif\r |