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