TianoCore EDK2 master
Loading...
Searching...
No Matches
IScsiCHAP.c File Reference
#include "IScsiImpl.h"

Go to the source code of this file.

Functions

EFI_STATUS IScsiCHAPCalculateResponse (IN UINT32 ChapIdentifier, IN CHAR8 *ChapSecret, IN UINT32 SecretLength, IN UINT8 *ChapChallenge, IN UINT32 ChallengeLength, IN CONST CHAP_HASH *Hash, OUT UINT8 *ChapResponse)
 
EFI_STATUS IScsiCHAPAuthTarget (IN ISCSI_CHAP_AUTH_DATA *AuthData, IN UINT8 *TargetResponse)
 
EFI_STATUS IScsiCHAPOnRspReceived (IN ISCSI_CONNECTION *Conn)
 
EFI_STATUS IScsiCHAPToSendReq (IN ISCSI_CONNECTION *Conn, IN OUT NET_BUF *Pdu)
 
VOID IScsiCHAPInitHashList (VOID)
 

Variables

STATIC CONST CHAP_HASH mChapHash []
 
STATIC CHAR8 mChapHashListString [3+(1+3) *(ARRAY_SIZE(mChapHash) - 1)+1+1]
 

Detailed Description

This file is for Challenge-Handshake Authentication Protocol (CHAP) Configuration.

Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file IScsiCHAP.c.

Function Documentation

◆ IScsiCHAPAuthTarget()

EFI_STATUS IScsiCHAPAuthTarget ( IN ISCSI_CHAP_AUTH_DATA AuthData,
IN UINT8 *  TargetResponse 
)

The initiator checks the CHAP response replied by target against its own calculation of the expected hash value.

Parameters
[in]AuthDataiSCSI CHAP authentication data.
[in]TargetResponseThe response from target.
Return values
EFI_SUCCESSThe response from target passed authentication.
EFI_SECURITY_VIOLATIONThe response from target was not expected value.
OthersOther errors as indicated.

Definition at line 164 of file IScsiCHAP.c.

◆ IScsiCHAPCalculateResponse()

EFI_STATUS IScsiCHAPCalculateResponse ( IN UINT32  ChapIdentifier,
IN CHAR8 *  ChapSecret,
IN UINT32  SecretLength,
IN UINT8 *  ChapChallenge,
IN UINT32  ChallengeLength,
IN CONST CHAP_HASH Hash,
OUT UINT8 *  ChapResponse 
)

Initiator calculates its own expected hash value.

Parameters
[in]ChapIdentifieriSCSI CHAP identifier sent by authenticator.
[in]ChapSecretiSCSI CHAP secret of the authenticator.
[in]SecretLengthThe length of iSCSI CHAP secret.
[in]ChapChallengeThe challenge message sent by authenticator.
[in]ChallengeLengthThe length of iSCSI CHAP challenge message.
[in]HashPointer to the CHAP_HASH structure that determines the hashing algorithm to use. The caller is responsible for making Hash point to an "mChapHash" element.
[out]ChapResponseThe calculation of the expected hash value.
Return values
EFI_SUCCESSThe expected hash value was calculatedly successfully.
EFI_PROTOCOL_ERRORThe length of the secret should be at least the length of the hash value for the hashing algorithm chosen.
EFI_PROTOCOL_ERRORHash operation fails.
EFI_OUT_OF_RESOURCESFailure to allocate resource to complete hashing.

Definition at line 85 of file IScsiCHAP.c.

◆ IScsiCHAPInitHashList()

VOID IScsiCHAPInitHashList ( VOID  )

Initialize the CHAP_A=<A1,A2...> value string for the entire driver, to be sent by the initiator in ISCSI_CHAP_STEP_ONE.

This function sanity-checks the internal table of supported CHAP hashing algorithms, as well.

Definition at line 635 of file IScsiCHAP.c.

◆ IScsiCHAPOnRspReceived()

EFI_STATUS IScsiCHAPOnRspReceived ( IN ISCSI_CONNECTION Conn)

This function checks the received iSCSI Login Response during the security negotiation stage.

Parameters
[in]ConnThe iSCSI connection.
Return values
EFI_SUCCESSThe Login Response passed the CHAP validation.
EFI_OUT_OF_RESOURCESFailed to allocate memory.
EFI_PROTOCOL_ERRORSome kind of protocol error occurred.
OthersOther errors as indicated.

Definition at line 215 of file IScsiCHAP.c.

◆ IScsiCHAPToSendReq()

EFI_STATUS IScsiCHAPToSendReq ( IN ISCSI_CONNECTION Conn,
IN OUT NET_BUF Pdu 
)

This function fills the CHAP authentication information into the login PDU during the security negotiation stage in the iSCSI connection login.

Parameters
[in]ConnThe iSCSI connection.
[in,out]PduThe PDU to send out.
Return values
EFI_SUCCESSAll check passed and the phase-related CHAP authentication info is filled into the iSCSI PDU.
EFI_OUT_OF_RESOURCESFailed to allocate memory.
EFI_PROTOCOL_ERRORSome kind of protocol error occurred.

Definition at line 470 of file IScsiCHAP.c.

Variable Documentation

◆ mChapHash

STATIC CONST CHAP_HASH mChapHash[]
Initial value:
= {
{
ISCSI_CHAP_ALGORITHM_SHA256,
},
}
UINTN EFIAPI Sha256GetContextSize(VOID)
Definition: CryptSha256.c:20
BOOLEAN EFIAPI Sha256Init(OUT VOID *Sha256Context)
Definition: CryptSha256.c:44
BOOLEAN EFIAPI Sha256Final(IN OUT VOID *Sha256Context, OUT UINT8 *HashValue)
Definition: CryptSha256.c:161
#define SHA256_DIGEST_SIZE
Definition: BaseCryptLib.h:44
BOOLEAN EFIAPI Sha256Update(IN OUT VOID *Sha256Context, IN CONST VOID *Data, IN UINTN DataSize)
Definition: CryptSha256.c:113

Definition at line 18 of file IScsiCHAP.c.

◆ mChapHashListString

STATIC CHAR8 mChapHashListString[ 3+(1+3) *(ARRAY_SIZE(mChapHash) - 1)+ 1+ 1]

Definition at line 48 of file IScsiCHAP.c.