]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/IScsiDxe/IScsiCHAP.h
update file header
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiCHAP.h
CommitLineData
12618416 1/** @file\r
2 The header file of CHAP configuration\r
6a690e23 3\r
7a444476 4Copyright (c) 2004 - 2007, Intel Corporation\r
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
13Module Name:\r
14\r
15 IScsiCHAP.h\r
16\r
17Abstract:\r
12618416 18 the header file for CHAP\r
19**/\r
6a690e23 20\r
21#ifndef _ISCSI_CHAP_H_\r
22#define _ISCSI_CHAP_H_\r
23\r
24#define ISCSI_CHAP_AUTH_INFO_GUID \\r
25 { \\r
93e3992d 26 0x786ec0ac, 0x65ae, 0x4d1b, {0xb1, 0x37, 0xd, 0x11, 0xa, 0x48, 0x37, 0x97} \\r
6a690e23 27 }\r
28\r
29extern EFI_GUID mIScsiCHAPAuthInfoGuid;\r
30\r
31#define ISCSI_AUTH_METHOD_CHAP "CHAP"\r
32\r
33#define ISCSI_KEY_CHAP_ALGORITHM "CHAP_A"\r
34#define ISCSI_KEY_CHAP_IDENTIFIER "CHAP_I"\r
35#define ISCSI_KEY_CHAP_CHALLENGE "CHAP_C"\r
36#define ISCSI_KEY_CHAP_NAME "CHAP_N"\r
37#define ISCSI_KEY_CHAP_RESPONSE "CHAP_R"\r
38\r
39#define ISCSI_CHAP_ALGORITHM_MD5 5\r
40\r
41#define ISCSI_CHAP_AUTH_MAX_LEN 1024\r
42#define ISCSI_CHAP_RSP_LEN 16 // == MD5_HASHSIZE\r
43typedef enum {\r
44 ISCSI_CHAP_INITIAL,\r
45 ISCSI_CHAP_STEP_ONE,\r
46 ISCSI_CHAP_STEP_TWO,\r
47 ISCSI_CHAP_STEP_THREE,\r
48 ISCSI_CHAP_STEP_FOUR\r
49} ISCSI_CHAP_STEP;\r
50\r
51#pragma pack(1)\r
52\r
53typedef struct _ISCSI_CHAP_AUTH_CONFIG_NVDATA {\r
54 UINT8 CHAPType;\r
55 CHAR8 CHAPName[ISCSI_CHAP_NAME_MAX_LEN];\r
56 CHAR8 CHAPSecret[ISCSI_CHAP_SECRET_MAX_LEN];\r
57 CHAR8 ReverseCHAPName[ISCSI_CHAP_NAME_MAX_LEN];\r
58 CHAR8 ReverseCHAPSecret[ISCSI_CHAP_SECRET_MAX_LEN];\r
59} ISCSI_CHAP_AUTH_CONFIG_NVDATA;\r
60\r
61#pragma pack()\r
62\r
63//\r
64// ISCSI CHAP Authentication Data\r
65//\r
66typedef struct _ISCSI_CHAP_AUTH_DATA {\r
67 ISCSI_CHAP_AUTH_CONFIG_NVDATA AuthConfig;\r
68 UINT32 InIdentifier;\r
69 UINT8 InChallenge[ISCSI_CHAP_AUTH_MAX_LEN];\r
70 UINT32 InChallengeLength;\r
71 //\r
72 // Calculated CHAP Response (CHAP_R) value\r
73 //\r
74 UINT8 CHAPResponse[ISCSI_CHAP_RSP_LEN];\r
75\r
76 //\r
77 // Auth-data to be sent out for mutual authentication\r
78 //\r
79 UINT32 OutIdentifier;\r
80 UINT8 OutChallenge[ISCSI_CHAP_AUTH_MAX_LEN];\r
81 UINT32 OutChallengeLength;\r
82} ISCSI_CHAP_AUTH_DATA;\r
83\r
12618416 84/**\r
85 This function checks the received iSCSI Login Response during the security\r
86 negotiation stage.\r
87 \r
88 @param Conn[in] The iSCSI connection.\r
89\r
90 @param Transit[in] The transit flag of the latest iSCSI Login Response.\r
91\r
92 @retval EFI_SUCCESS The Login Response passed the CHAP validation.\r
93\r
94 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
95\r
96 @retval EFI_PROTOCOL_ERROR Some kind of protocol error happend.\r
97\r
98**/\r
6a690e23 99EFI_STATUS\r
100IScsiCHAPOnRspReceived (\r
101 IN ISCSI_CONNECTION *Conn,\r
102 IN BOOLEAN Transit\r
103 );\r
104\r
12618416 105/**\r
106 This function fills the CHAP authentication information into the login PDU\r
107 during the security negotiation stage in the iSCSI connection login.\r
108\r
109 @param Conn[in] The iSCSI connection.\r
110\r
111 @param Pdu[in] The PDU to send out.\r
112\r
113 @retval EFI_SUCCESS All check passed and the phase-related CHAP\r
114 authentication info is filled into the iSCSI PDU.\r
115\r
116 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
117\r
118 @retval EFI_PROTOCOL_ERROR Some kind of protocol error happend.\r
119\r
120**/\r
6a690e23 121EFI_STATUS\r
122IScsiCHAPToSendReq (\r
123 IN ISCSI_CONNECTION *Conn,\r
124 IN NET_BUF *Pdu\r
125 );\r
126\r
127#endif\r