]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/IScsiDxe/IScsiCHAP.h
1)update function header coding style issue
[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
fab4bd04 4Copyright (c) 2004 - 2007, 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
6a690e23 40typedef 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
50typedef 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 63typedef 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
86 @param[in] Transit The transit flag of the latest iSCSI Login Response.\r
12618416 87\r
88 @retval EFI_SUCCESS The Login Response passed the CHAP validation.\r
12618416 89 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
12618416 90 @retval EFI_PROTOCOL_ERROR Some kind of protocol error happend.\r
963dbb30 91 @retval Others Other errors as indicated.\r
12618416 92**/\r
6a690e23 93EFI_STATUS\r
94IScsiCHAPOnRspReceived (\r
95 IN ISCSI_CONNECTION *Conn,\r
96 IN BOOLEAN Transit\r
97 );\r
98\r
12618416 99/**\r
100 This function fills the CHAP authentication information into the login PDU\r
101 during the security negotiation stage in the iSCSI connection login.\r
102\r
fab4bd04 103 @param[in] Conn The iSCSI connection.\r
104 @param[in] Pdu The PDU to send out.\r
12618416 105\r
106 @retval EFI_SUCCESS All check passed and the phase-related CHAP\r
107 authentication info is filled into the iSCSI PDU.\r
12618416 108 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
12618416 109 @retval EFI_PROTOCOL_ERROR Some kind of protocol error happend.\r
12618416 110**/\r
6a690e23 111EFI_STATUS\r
112IScsiCHAPToSendReq (\r
113 IN ISCSI_CONNECTION *Conn,\r
114 IN NET_BUF *Pdu\r
115 );\r
116\r
117#endif\r