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