]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/IScsiDxe/IScsiCHAP.h
[Change summary]:
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiCHAP.h
CommitLineData
12618416 1/** @file\r
fab4bd04 2 The header file of CHAP configuration.\r
6a690e23 3\r
f6b7393c 4Copyright (c) 2004 - 2009, Intel Corporation.<BR>\r
7a444476 5All rights reserved. This 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
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
23extern 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
f6b7393c 40\r
41#define ISCSI_CHAP_INITIAL 0 \r
42#define ISCSI_CHAP_STEP_ONE 1\r
43#define ISCSI_CHAP_STEP_TWO 2\r
44#define ISCSI_CHAP_STEP_THREE 3\r
45#define ISCSI_CHAP_STEP_FOUR 4\r
6a690e23 46\r
47#pragma pack(1)\r
48\r
49typedef struct _ISCSI_CHAP_AUTH_CONFIG_NVDATA {\r
50 UINT8 CHAPType;\r
51 CHAR8 CHAPName[ISCSI_CHAP_NAME_MAX_LEN];\r
c2c1e450 52 CHAR8 CHAPSecret[ISCSI_CHAP_SECRET_STORAGE];\r
6a690e23 53 CHAR8 ReverseCHAPName[ISCSI_CHAP_NAME_MAX_LEN];\r
c2c1e450 54 CHAR8 ReverseCHAPSecret[ISCSI_CHAP_SECRET_STORAGE];\r
6a690e23 55} ISCSI_CHAP_AUTH_CONFIG_NVDATA;\r
56\r
57#pragma pack()\r
58\r
fab4bd04 59///\r
60/// ISCSI CHAP Authentication Data\r
61///\r
6a690e23 62typedef struct _ISCSI_CHAP_AUTH_DATA {\r
63 ISCSI_CHAP_AUTH_CONFIG_NVDATA AuthConfig;\r
64 UINT32 InIdentifier;\r
65 UINT8 InChallenge[ISCSI_CHAP_AUTH_MAX_LEN];\r
66 UINT32 InChallengeLength;\r
67 //\r
68 // Calculated CHAP Response (CHAP_R) value\r
69 //\r
70 UINT8 CHAPResponse[ISCSI_CHAP_RSP_LEN];\r
71\r
72 //\r
73 // Auth-data to be sent out for mutual authentication\r
74 //\r
75 UINT32 OutIdentifier;\r
76 UINT8 OutChallenge[ISCSI_CHAP_AUTH_MAX_LEN];\r
77 UINT32 OutChallengeLength;\r
78} ISCSI_CHAP_AUTH_DATA;\r
79\r
12618416 80/**\r
81 This function checks the received iSCSI Login Response during the security\r
82 negotiation stage.\r
83 \r
fab4bd04 84 @param[in] Conn The iSCSI connection.\r
12618416 85\r
86 @retval EFI_SUCCESS The Login Response passed the CHAP validation.\r
12618416 87 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
12618416 88 @retval EFI_PROTOCOL_ERROR Some kind of protocol error happend.\r
963dbb30 89 @retval Others Other errors as indicated.\r
12618416 90**/\r
6a690e23 91EFI_STATUS\r
92IScsiCHAPOnRspReceived (\r
c5de0d55 93 IN ISCSI_CONNECTION *Conn\r
6a690e23 94 );\r
12618416 95/**\r
96 This function fills the CHAP authentication information into the login PDU\r
97 during the security negotiation stage in the iSCSI connection login.\r
98\r
c5de0d55 99 @param[in] Conn The iSCSI connection.\r
100 @param[in, out] Pdu The PDU to send out.\r
12618416 101\r
102 @retval EFI_SUCCESS All check passed and the phase-related CHAP\r
103 authentication info is filled into the iSCSI PDU.\r
12618416 104 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
12618416 105 @retval EFI_PROTOCOL_ERROR Some kind of protocol error happend.\r
12618416 106**/\r
6a690e23 107EFI_STATUS\r
108IScsiCHAPToSendReq (\r
c5de0d55 109 IN ISCSI_CONNECTION *Conn,\r
110 IN OUT NET_BUF *Pdu\r
6a690e23 111 );\r
112\r
113#endif\r