]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/IScsiDxe/IScsiCHAP.h
Add IScsiDxe driver to NetworkPkg in order to support iSCSI over IPv6 stack and iSCSI...
[mirror_edk2.git] / NetworkPkg / IScsiDxe / IScsiCHAP.h
1 /** @file
2 The header file of CHAP configuration.
3
4 Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _ISCSI_CHAP_H_
16 #define _ISCSI_CHAP_H_
17
18 #define ISCSI_CHAP_AUTH_INFO_GUID \
19 { \
20 0x786ec0ac, 0x65ae, 0x4d1b, { 0xb1, 0x37, 0xd, 0x11, 0xa, 0x48, 0x37, 0x97 }\
21 }
22
23 #define ISCSI_AUTH_METHOD_CHAP "CHAP"
24
25 #define ISCSI_KEY_CHAP_ALGORITHM "CHAP_A"
26 #define ISCSI_KEY_CHAP_IDENTIFIER "CHAP_I"
27 #define ISCSI_KEY_CHAP_CHALLENGE "CHAP_C"
28 #define ISCSI_KEY_CHAP_NAME "CHAP_N"
29 #define ISCSI_KEY_CHAP_RESPONSE "CHAP_R"
30
31 #define ISCSI_CHAP_ALGORITHM_MD5 5
32
33 #define ISCSI_CHAP_AUTH_MAX_LEN 1024
34 ///
35 /// MD5_HASHSIZE
36 ///
37 #define ISCSI_CHAP_RSP_LEN 16
38
39 #define ISCSI_CHAP_STEP_ONE 1
40 #define ISCSI_CHAP_STEP_TWO 2
41 #define ISCSI_CHAP_STEP_THREE 3
42 #define ISCSI_CHAP_STEP_FOUR 4
43
44
45 #pragma pack(1)
46
47 typedef struct _ISCSI_CHAP_AUTH_CONFIG_NVDATA {
48 UINT8 CHAPType;
49 CHAR8 CHAPName[ISCSI_CHAP_NAME_STORAGE];
50 CHAR8 CHAPSecret[ISCSI_CHAP_SECRET_STORAGE];
51 CHAR8 ReverseCHAPName[ISCSI_CHAP_NAME_STORAGE];
52 CHAR8 ReverseCHAPSecret[ISCSI_CHAP_SECRET_STORAGE];
53 } ISCSI_CHAP_AUTH_CONFIG_NVDATA;
54
55 #pragma pack()
56
57 ///
58 /// ISCSI CHAP Authentication Data
59 ///
60 typedef struct _ISCSI_CHAP_AUTH_DATA {
61 ISCSI_CHAP_AUTH_CONFIG_NVDATA *AuthConfig;
62 UINT32 InIdentifier;
63 UINT8 InChallenge[ISCSI_CHAP_AUTH_MAX_LEN];
64 UINT32 InChallengeLength;
65 //
66 // Calculated CHAP Response (CHAP_R) value.
67 //
68 UINT8 CHAPResponse[ISCSI_CHAP_RSP_LEN];
69
70 //
71 // Auth-data to be sent out for mutual authentication.
72 //
73 UINT32 OutIdentifier;
74 UINT8 OutChallenge[ISCSI_CHAP_AUTH_MAX_LEN];
75 UINT32 OutChallengeLength;
76 } ISCSI_CHAP_AUTH_DATA;
77
78 /**
79 This function checks the received iSCSI Login Response during the security
80 negotiation stage.
81
82 @param[in] Conn The iSCSI connection.
83
84 @retval EFI_SUCCESS The Login Response passed the CHAP validation.
85 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
86 @retval EFI_PROTOCOL_ERROR Some kind of protocol error occurred.
87 @retval Others Other errors as indicated.
88
89 **/
90 EFI_STATUS
91 IScsiCHAPOnRspReceived (
92 IN ISCSI_CONNECTION *Conn
93 );
94 /**
95 This function fills the CHAP authentication information into the login PDU
96 during the security negotiation stage in the iSCSI connection login.
97
98 @param[in] Conn The iSCSI connection.
99 @param[in, out] Pdu The PDU to send out.
100
101 @retval EFI_SUCCESS All check passed and the phase-related CHAP
102 authentication info is filled into the iSCSI PDU.
103 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
104 @retval EFI_PROTOCOL_ERROR Some kind of protocol error occurred.
105
106 **/
107 EFI_STATUS
108 IScsiCHAPToSendReq (
109 IN ISCSI_CONNECTION *Conn,
110 IN OUT NET_BUF *Pdu
111 );
112
113 #endif