]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/IScsiDxe/IScsiCHAP.h
NetworkPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / NetworkPkg / IScsiDxe / IScsiCHAP.h
CommitLineData
4c5a5e0c 1/** @file\r
2 The header file of CHAP configuration.\r
3\r
f75a7f56 4Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
ecf98fbc 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
4c5a5e0c 6\r
7**/\r
8\r
9#ifndef _ISCSI_CHAP_H_\r
10#define _ISCSI_CHAP_H_\r
11\r
4c5a5e0c 12#define ISCSI_AUTH_METHOD_CHAP "CHAP"\r
13\r
14#define ISCSI_KEY_CHAP_ALGORITHM "CHAP_A"\r
15#define ISCSI_KEY_CHAP_IDENTIFIER "CHAP_I"\r
16#define ISCSI_KEY_CHAP_CHALLENGE "CHAP_C"\r
17#define ISCSI_KEY_CHAP_NAME "CHAP_N"\r
18#define ISCSI_KEY_CHAP_RESPONSE "CHAP_R"\r
19\r
20#define ISCSI_CHAP_ALGORITHM_MD5 5\r
21\r
22#define ISCSI_CHAP_AUTH_MAX_LEN 1024\r
23///\r
24/// MD5_HASHSIZE\r
25///\r
f75a7f56 26#define ISCSI_CHAP_RSP_LEN 16\r
4c5a5e0c 27\r
28#define ISCSI_CHAP_STEP_ONE 1\r
29#define ISCSI_CHAP_STEP_TWO 2\r
30#define ISCSI_CHAP_STEP_THREE 3\r
31#define ISCSI_CHAP_STEP_FOUR 4\r
32\r
33\r
34#pragma pack(1)\r
35\r
36typedef struct _ISCSI_CHAP_AUTH_CONFIG_NVDATA {\r
37 UINT8 CHAPType;\r
38 CHAR8 CHAPName[ISCSI_CHAP_NAME_STORAGE];\r
39 CHAR8 CHAPSecret[ISCSI_CHAP_SECRET_STORAGE];\r
40 CHAR8 ReverseCHAPName[ISCSI_CHAP_NAME_STORAGE];\r
41 CHAR8 ReverseCHAPSecret[ISCSI_CHAP_SECRET_STORAGE];\r
42} ISCSI_CHAP_AUTH_CONFIG_NVDATA;\r
43\r
44#pragma pack()\r
45\r
46///\r
47/// ISCSI CHAP Authentication Data\r
48///\r
49typedef struct _ISCSI_CHAP_AUTH_DATA {\r
50 ISCSI_CHAP_AUTH_CONFIG_NVDATA *AuthConfig;\r
51 UINT32 InIdentifier;\r
52 UINT8 InChallenge[ISCSI_CHAP_AUTH_MAX_LEN];\r
53 UINT32 InChallengeLength;\r
54 //\r
55 // Calculated CHAP Response (CHAP_R) value.\r
56 //\r
57 UINT8 CHAPResponse[ISCSI_CHAP_RSP_LEN];\r
58\r
59 //\r
60 // Auth-data to be sent out for mutual authentication.\r
61 //\r
62 UINT32 OutIdentifier;\r
63 UINT8 OutChallenge[ISCSI_CHAP_AUTH_MAX_LEN];\r
64 UINT32 OutChallengeLength;\r
65} ISCSI_CHAP_AUTH_DATA;\r
66\r
67/**\r
68 This function checks the received iSCSI Login Response during the security\r
69 negotiation stage.\r
70\r
71 @param[in] Conn The iSCSI connection.\r
72\r
73 @retval EFI_SUCCESS The Login Response passed the CHAP validation.\r
74 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
75 @retval EFI_PROTOCOL_ERROR Some kind of protocol error occurred.\r
76 @retval Others Other errors as indicated.\r
77\r
78**/\r
79EFI_STATUS\r
80IScsiCHAPOnRspReceived (\r
81 IN ISCSI_CONNECTION *Conn\r
82 );\r
83/**\r
84 This function fills the CHAP authentication information into the login PDU\r
85 during the security negotiation stage in the iSCSI connection login.\r
86\r
87 @param[in] Conn The iSCSI connection.\r
88 @param[in, out] Pdu The PDU to send out.\r
89\r
90 @retval EFI_SUCCESS All check passed and the phase-related CHAP\r
91 authentication info is filled into the iSCSI PDU.\r
92 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
93 @retval EFI_PROTOCOL_ERROR Some kind of protocol error occurred.\r
94\r
95**/\r
96EFI_STATUS\r
97IScsiCHAPToSendReq (\r
98 IN ISCSI_CONNECTION *Conn,\r
99 IN OUT NET_BUF *Pdu\r
100 );\r
101\r
102#endif\r