2 The header file of CHAP configuration.
4 Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #define _ISCSI_CHAP_H_
12 #define ISCSI_AUTH_METHOD_CHAP "CHAP"
14 #define ISCSI_KEY_CHAP_ALGORITHM "CHAP_A"
15 #define ISCSI_KEY_CHAP_IDENTIFIER "CHAP_I"
16 #define ISCSI_KEY_CHAP_CHALLENGE "CHAP_C"
17 #define ISCSI_KEY_CHAP_NAME "CHAP_N"
18 #define ISCSI_KEY_CHAP_RESPONSE "CHAP_R"
20 #define ISCSI_CHAP_ALGORITHM_MD5 5
22 #define ISCSI_CHAP_AUTH_MAX_LEN 1024
26 #define ISCSI_CHAP_RSP_LEN 16
28 #define ISCSI_CHAP_STEP_ONE 1
29 #define ISCSI_CHAP_STEP_TWO 2
30 #define ISCSI_CHAP_STEP_THREE 3
31 #define ISCSI_CHAP_STEP_FOUR 4
36 typedef struct _ISCSI_CHAP_AUTH_CONFIG_NVDATA
{
38 CHAR8 CHAPName
[ISCSI_CHAP_NAME_STORAGE
];
39 CHAR8 CHAPSecret
[ISCSI_CHAP_SECRET_STORAGE
];
40 CHAR8 ReverseCHAPName
[ISCSI_CHAP_NAME_STORAGE
];
41 CHAR8 ReverseCHAPSecret
[ISCSI_CHAP_SECRET_STORAGE
];
42 } ISCSI_CHAP_AUTH_CONFIG_NVDATA
;
47 /// ISCSI CHAP Authentication Data
49 typedef struct _ISCSI_CHAP_AUTH_DATA
{
50 ISCSI_CHAP_AUTH_CONFIG_NVDATA
*AuthConfig
;
52 UINT8 InChallenge
[ISCSI_CHAP_AUTH_MAX_LEN
];
53 UINT32 InChallengeLength
;
55 // Calculated CHAP Response (CHAP_R) value.
57 UINT8 CHAPResponse
[ISCSI_CHAP_RSP_LEN
];
60 // Auth-data to be sent out for mutual authentication.
63 UINT8 OutChallenge
[ISCSI_CHAP_AUTH_MAX_LEN
];
64 UINT32 OutChallengeLength
;
65 } ISCSI_CHAP_AUTH_DATA
;
68 This function checks the received iSCSI Login Response during the security
71 @param[in] Conn The iSCSI connection.
73 @retval EFI_SUCCESS The Login Response passed the CHAP validation.
74 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
75 @retval EFI_PROTOCOL_ERROR Some kind of protocol error occurred.
76 @retval Others Other errors as indicated.
80 IScsiCHAPOnRspReceived (
81 IN ISCSI_CONNECTION
*Conn
84 This function fills the CHAP authentication information into the login PDU
85 during the security negotiation stage in the iSCSI connection login.
87 @param[in] Conn The iSCSI connection.
88 @param[in, out] Pdu The PDU to send out.
90 @retval EFI_SUCCESS All check passed and the phase-related CHAP
91 authentication info is filled into the iSCSI
93 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
94 @retval EFI_PROTOCOL_ERROR Some kind of protocol error occurred.
99 IN ISCSI_CONNECTION
*Conn
,