]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/IScsiDxe/IScsiCHAP.h
Adopt new IPv4/IPv6 device path for network modules.
[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
c8ad2d7a 4Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
e5eed7d3 5This program and the accompanying materials\r
7a444476 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
6a690e23 18#define ISCSI_AUTH_METHOD_CHAP "CHAP"\r
19\r
20#define ISCSI_KEY_CHAP_ALGORITHM "CHAP_A"\r
21#define ISCSI_KEY_CHAP_IDENTIFIER "CHAP_I"\r
22#define ISCSI_KEY_CHAP_CHALLENGE "CHAP_C"\r
23#define ISCSI_KEY_CHAP_NAME "CHAP_N"\r
24#define ISCSI_KEY_CHAP_RESPONSE "CHAP_R"\r
25\r
26#define ISCSI_CHAP_ALGORITHM_MD5 5\r
27\r
28#define ISCSI_CHAP_AUTH_MAX_LEN 1024\r
fab4bd04 29///\r
30/// MD5_HASHSIZE\r
31///\r
32#define ISCSI_CHAP_RSP_LEN 16 \r
f6b7393c 33\r
34#define ISCSI_CHAP_INITIAL 0 \r
35#define ISCSI_CHAP_STEP_ONE 1\r
36#define ISCSI_CHAP_STEP_TWO 2\r
37#define ISCSI_CHAP_STEP_THREE 3\r
38#define ISCSI_CHAP_STEP_FOUR 4\r
6a690e23 39\r
40#pragma pack(1)\r
41\r
42typedef struct _ISCSI_CHAP_AUTH_CONFIG_NVDATA {\r
43 UINT8 CHAPType;\r
501793fa 44 CHAR8 CHAPName[ISCSI_CHAP_NAME_STORAGE];\r
c2c1e450 45 CHAR8 CHAPSecret[ISCSI_CHAP_SECRET_STORAGE];\r
501793fa 46 CHAR8 ReverseCHAPName[ISCSI_CHAP_NAME_STORAGE];\r
c2c1e450 47 CHAR8 ReverseCHAPSecret[ISCSI_CHAP_SECRET_STORAGE];\r
6a690e23 48} ISCSI_CHAP_AUTH_CONFIG_NVDATA;\r
49\r
50#pragma pack()\r
51\r
fab4bd04 52///\r
53/// ISCSI CHAP Authentication Data\r
54///\r
6a690e23 55typedef struct _ISCSI_CHAP_AUTH_DATA {\r
56 ISCSI_CHAP_AUTH_CONFIG_NVDATA AuthConfig;\r
57 UINT32 InIdentifier;\r
58 UINT8 InChallenge[ISCSI_CHAP_AUTH_MAX_LEN];\r
59 UINT32 InChallengeLength;\r
60 //\r
61 // Calculated CHAP Response (CHAP_R) value\r
62 //\r
63 UINT8 CHAPResponse[ISCSI_CHAP_RSP_LEN];\r
64\r
65 //\r
66 // Auth-data to be sent out for mutual authentication\r
67 //\r
68 UINT32 OutIdentifier;\r
69 UINT8 OutChallenge[ISCSI_CHAP_AUTH_MAX_LEN];\r
70 UINT32 OutChallengeLength;\r
71} ISCSI_CHAP_AUTH_DATA;\r
72\r
12618416 73/**\r
74 This function checks the received iSCSI Login Response during the security\r
75 negotiation stage.\r
76 \r
fab4bd04 77 @param[in] Conn The iSCSI connection.\r
12618416 78\r
79 @retval EFI_SUCCESS The Login Response passed the CHAP validation.\r
12618416 80 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
12618416 81 @retval EFI_PROTOCOL_ERROR Some kind of protocol error happend.\r
963dbb30 82 @retval Others Other errors as indicated.\r
12618416 83**/\r
6a690e23 84EFI_STATUS\r
85IScsiCHAPOnRspReceived (\r
c5de0d55 86 IN ISCSI_CONNECTION *Conn\r
6a690e23 87 );\r
12618416 88/**\r
89 This function fills the CHAP authentication information into the login PDU\r
90 during the security negotiation stage in the iSCSI connection login.\r
91\r
c5de0d55 92 @param[in] Conn The iSCSI connection.\r
93 @param[in, out] Pdu The PDU to send out.\r
12618416 94\r
95 @retval EFI_SUCCESS All check passed and the phase-related CHAP\r
96 authentication info is filled into the iSCSI PDU.\r
12618416 97 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
12618416 98 @retval EFI_PROTOCOL_ERROR Some kind of protocol error happend.\r
12618416 99**/\r
6a690e23 100EFI_STATUS\r
101IScsiCHAPToSendReq (\r
c5de0d55 102 IN ISCSI_CONNECTION *Conn,\r
103 IN OUT NET_BUF *Pdu\r
6a690e23 104 );\r
105\r
106#endif\r