EAP MS-CHAP-V2 authentication method. More...
#include "ike/ike.h"Go to the source code of this file.
Enumerations | |
| enum | IkeEapMschapv2Code { IKE_EAP_MSCHAPV2_CODE_INVALID = 0, IKE_EAP_MSCHAPV2_CODE_CHALLENGE = 1, IKE_EAP_MSCHAPV2_CODE_RESPONSE = 2, IKE_EAP_MSCHAPV2_CODE_SUCCESS = 3, IKE_EAP_MSCHAPV2_CODE_FAILURE = 4 } |
| MS-CHAP-V2 opcodes. More... | |
Functions | |
| error_t | ikeProcessEapMschapv2Request (IkeSaEntry *sa, const IkeEapMschapv2Packet *request, size_t length) |
| Process EAP MS-CHAP-V2 request. More... | |
| error_t | ikeProcessEapMschapv2Challenge (IkeSaEntry *sa, const IkeEapMschapv2Challenge *challenge, size_t length) |
| Process EAP MS-CHAP-V2 Challenge packet. More... | |
| error_t | ikeProcessEapMschapv2SuccessRequest (IkeSaEntry *sa, const IkeEapMschapv2SuccessRequest *request, size_t length) |
| Process EAP MS-CHAP-V2 Success Request packet. More... | |
| error_t | ikeProcessEapMschapv2FailureRequest (IkeSaEntry *sa, const IkeEapMschapv2FailureRequest *request, size_t length) |
| Process EAP MS-CHAP-V2 Failure Request packet. More... | |
| error_t | ikeFormatEapMschapv2Response (IkeSaEntry *sa, uint8_t *p, size_t *written) |
| Format EAP MS-CHAP-V2 Response packet. More... | |
| error_t | ikeFormatEapMschapv2SuccessResponse (IkeSaEntry *sa, uint8_t *p, size_t *written) |
| Format EAP MS-CHAP-V2 Success Response packet. More... | |
| error_t | ikeFormatEapMschapv2FailureResponse (IkeSaEntry *sa, uint8_t *p, size_t *written) |
| Format EAP MS-CHAP-V2 Failure Response packet. More... | |
| void | ikeEapMschapv2GenerateNtResponse (const uint8_t *authChallenge, const uint8_t *peerChallenge, const char_t *username, const char_t *password, uint8_t *response) |
| GenerateNTResponse routine. More... | |
| void | ikeEapMschapv2ChallengeHash (const uint8_t *peerChallenge, const uint8_t *authChallenge, const char_t *username, uint8_t *challenge) |
| ChallengeHash routine. More... | |
| void | ikeEapMschapv2NtPasswordHash (const char_t *password, uint8_t *passwordHash) |
| NtPasswordHash routine. More... | |
| void | ikeEapMschapv2HashNtPasswordHash (const uint8_t *passwordHash, uint8_t *passwordHashHash) |
| HashNtPasswordHash routine. More... | |
| void | ikeEapMschapv2ChallengeResponse (const uint8_t *challenge, const uint8_t *passwordHash, uint8_t *response) |
| ChallengeResponse routine. More... | |
| void | ikeEapMschapv2GenerateAuthResponse (const char_t *password, const uint8_t *ntResponse, const uint8_t *peerChallenge, const uint8_t *authChallenge, const char_t *username, uint8_t *authResponse) |
| GenerateAuthenticatorResponse routine. More... | |
| bool_t | ikeEapMschapv2CheckAuthResponse (const char_t *password, const uint8_t *ntResponse, const uint8_t *peerChallenge, const uint8_t *authChallenge, const char_t *username, const uint8_t *receivedResponse) |
| CheckAuthenticatorResponse routine. More... | |
| void | ikeEapMschapv2GenerateMasterSessionKey (const char_t *password, const uint8_t *ntResponse, uint8_t *masterSessionKey) |
| Generate master session key. More... | |
| void | ikeEapMschapv2GetMasterKey (const uint8_t *passwordHashHash, const uint8_t *ntResponse, uint8_t *masterKey) |
| GetMasterKey routine. More... | |
| void | ikeEapMschapv2GetAsymmetricStartKey (const uint8_t *masterKey, uint8_t *sessionKey, size_t sessionKeyLen, bool_t isSend) |
| GetAsymmetricStartKey routine. More... | |
Variables | |
| typedef | __packed_struct |
| EAP MS-CHAP-V2 packet. More... | |
| uint8_t | identifier |
| uint16_t | length |
| uint8_t | type |
| uint8_t | opcode |
| IkeEapMschapv2Packet | |
| uint8_t | mschapv2Id |
| uint16_t | msLength |
| uint8_t | valueSize |
| uint8_t | challenge [16] |
| uint8_t | name [] |
| IkeEapMschapv2Challenge | |
| uint8_t | peerChallenge [16] |
| uint8_t | reserved [8] |
| uint8_t | ntResponse [24] |
| uint8_t | flags |
| IkeEapMschapv2Response | |
| uint8_t | message [] |
| IkeEapMschapv2SuccessRequest | |
| IkeEapMschapv2SuccessResponse | |
| IkeEapMschapv2FailureRequest | |
| IkeEapMschapv2FailureResponse | |
| uint8_t | data [] |
| IkeEapMschapv2ChangePassword | |
Detailed Description
EAP MS-CHAP-V2 authentication method.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2022-2026 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneIPSEC Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.6.8
Definition in file ike_eap_mschapv2.h.
Enumeration Type Documentation
◆ IkeEapMschapv2Code
| enum IkeEapMschapv2Code |
MS-CHAP-V2 opcodes.
Definition at line 47 of file ike_eap_mschapv2.h.
Function Documentation
◆ ikeEapMschapv2ChallengeHash()
| void ikeEapMschapv2ChallengeHash | ( | const uint8_t * | peerChallenge, |
| const uint8_t * | authChallenge, | ||
| const char_t * | username, | ||
| uint8_t * | challenge | ||
| ) |
ChallengeHash routine.
- Parameters
-
[in] peerChallenge Peer challenge (16 bytes) [in] authChallenge Authenticator challenge (16 bytes) [in] username NULL-terminated string containing the user name [out] challenge Resulting challenge (8 bytes)
Definition at line 468 of file ike_eap_mschapv2.c.
◆ ikeEapMschapv2ChallengeResponse()
| void ikeEapMschapv2ChallengeResponse | ( | const uint8_t * | challenge, |
| const uint8_t * | passwordHash, | ||
| uint8_t * | response | ||
| ) |
ChallengeResponse routine.
- Parameters
-
[in] challenge Challenge (8 bytes) [in] passwordHash Password hash (16 bytes) [out] response Resulting response (24 bytes)
Definition at line 551 of file ike_eap_mschapv2.c.
◆ ikeEapMschapv2CheckAuthResponse()
| bool_t ikeEapMschapv2CheckAuthResponse | ( | const char_t * | password, |
| const uint8_t * | ntResponse, | ||
| const uint8_t * | peerChallenge, | ||
| const uint8_t * | authChallenge, | ||
| const char_t * | username, | ||
| const uint8_t * | receivedResponse | ||
| ) |
CheckAuthenticatorResponse routine.
- Parameters
-
[in] password NULL-terminated string containing the password [out] ntResponse NT-Response field (24 bytes) [in] peerChallenge Peer challenge (16 bytes) [in] authChallenge Authenticator challenge (16 bytes) [in] username NULL-terminated string containing the user name [in] receivedResponse Received response (42 bytes)
- Returns
- TRUE if the authenticator response is correct, else FASE
Definition at line 690 of file ike_eap_mschapv2.c.
◆ ikeEapMschapv2GenerateAuthResponse()
| void ikeEapMschapv2GenerateAuthResponse | ( | const char_t * | password, |
| const uint8_t * | ntResponse, | ||
| const uint8_t * | peerChallenge, | ||
| const uint8_t * | authChallenge, | ||
| const char_t * | username, | ||
| uint8_t * | authResponse | ||
| ) |
GenerateAuthenticatorResponse routine.
- Parameters
-
[in] password NULL-terminated string containing the password [out] ntResponse NT-Response field (24 bytes) [in] peerChallenge Peer challenge (16 bytes) [in] authChallenge Authenticator challenge (16 bytes) [in] username NULL-terminated string containing the user name [out] authResponse Resulting authenticator response (42 bytes)
Definition at line 595 of file ike_eap_mschapv2.c.
◆ ikeEapMschapv2GenerateMasterSessionKey()
| void ikeEapMschapv2GenerateMasterSessionKey | ( | const char_t * | password, |
| const uint8_t * | ntResponse, | ||
| uint8_t * | masterSessionKey | ||
| ) |
Generate master session key.
- Parameters
-
[in] password NULL-terminated string containing the password [in] ntResponse NT-Response field (24 bytes) [out] masterSessionKey Resulting master session key (64 bytes)
Definition at line 725 of file ike_eap_mschapv2.c.
◆ ikeEapMschapv2GenerateNtResponse()
| void ikeEapMschapv2GenerateNtResponse | ( | const uint8_t * | authChallenge, |
| const uint8_t * | peerChallenge, | ||
| const char_t * | username, | ||
| const char_t * | password, | ||
| uint8_t * | response | ||
| ) |
GenerateNTResponse routine.
- Parameters
-
[in] authChallenge Authenticator challenge (16 bytes) [in] peerChallenge Peer challenge (16 bytes) [in] username NULL-terminated string containing the user name [in] password NULL-terminated string containing the password [out] response Resulting NT-Response field (24 bytes)
Definition at line 439 of file ike_eap_mschapv2.c.
◆ ikeEapMschapv2GetAsymmetricStartKey()
| void ikeEapMschapv2GetAsymmetricStartKey | ( | const uint8_t * | masterKey, |
| uint8_t * | sessionKey, | ||
| size_t | sessionKeyLen, | ||
| bool_t | isSend | ||
| ) |
GetAsymmetricStartKey routine.
- Parameters
-
[in] masterKey Master key (16 bytes) [out] sessionKey Session key [in] sessionKeyLen Length of the session key, in bytes [in] isSend Send or receive direction
Definition at line 809 of file ike_eap_mschapv2.c.
◆ ikeEapMschapv2GetMasterKey()
| void ikeEapMschapv2GetMasterKey | ( | const uint8_t * | passwordHashHash, |
| const uint8_t * | ntResponse, | ||
| uint8_t * | masterKey | ||
| ) |
GetMasterKey routine.
- Parameters
-
[in] passwordHashHash Hash value (16 bytes) [in] ntResponse NT-Response field (24 bytes) [out] masterKey Resulting master key (16 bytes)
Definition at line 771 of file ike_eap_mschapv2.c.
◆ ikeEapMschapv2HashNtPasswordHash()
| void ikeEapMschapv2HashNtPasswordHash | ( | const uint8_t * | passwordHash, |
| uint8_t * | passwordHashHash | ||
| ) |
HashNtPasswordHash routine.
- Parameters
-
[in] passwordHash Password hash (16 bytes) [out] passwordHashHash Resulting hash (16 bytes)
Definition at line 530 of file ike_eap_mschapv2.c.
◆ ikeEapMschapv2NtPasswordHash()
| void ikeEapMschapv2NtPasswordHash | ( | const char_t * | password, |
| uint8_t * | passwordHash | ||
| ) |
NtPasswordHash routine.
- Parameters
-
[in] password NULL-terminated string containing the password [out] passwordHash Password hash (16 bytes)
Definition at line 493 of file ike_eap_mschapv2.c.
◆ ikeFormatEapMschapv2FailureResponse()
| error_t ikeFormatEapMschapv2FailureResponse | ( | IkeSaEntry * | sa, |
| uint8_t * | p, | ||
| size_t * | written | ||
| ) |
Format EAP MS-CHAP-V2 Failure Response packet.
- Parameters
-
[in] sa Pointer to the IKE SA [out] p Buffer where to format the EAP MS-CHAP-V2 packet [out] written Length of the resulting EAP MS-CHAP-V2 packet
- Returns
- Error code
Definition at line 404 of file ike_eap_mschapv2.c.
◆ ikeFormatEapMschapv2Response()
| error_t ikeFormatEapMschapv2Response | ( | IkeSaEntry * | sa, |
| uint8_t * | p, | ||
| size_t * | written | ||
| ) |
Format EAP MS-CHAP-V2 Response packet.
- Parameters
-
[in] sa Pointer to the IKE SA [out] p Buffer where to format the EAP MS-CHAP-V2 packet [out] written Length of the resulting EAP MS-CHAP-V2 packet
- Returns
- Error code
Definition at line 292 of file ike_eap_mschapv2.c.
◆ ikeFormatEapMschapv2SuccessResponse()
| error_t ikeFormatEapMschapv2SuccessResponse | ( | IkeSaEntry * | sa, |
| uint8_t * | p, | ||
| size_t * | written | ||
| ) |
Format EAP MS-CHAP-V2 Success Response packet.
- Parameters
-
[in] sa Pointer to the IKE SA [out] p Buffer where to format the EAP MS-CHAP-V2 packet [out] written Length of the resulting EAP MS-CHAP-V2 packet
- Returns
- Error code
Definition at line 370 of file ike_eap_mschapv2.c.
◆ ikeProcessEapMschapv2Challenge()
| error_t ikeProcessEapMschapv2Challenge | ( | IkeSaEntry * | sa, |
| const IkeEapMschapv2Challenge * | challenge, | ||
| size_t | length | ||
| ) |
Process EAP MS-CHAP-V2 Challenge packet.
- Parameters
-
[in] sa Pointer to the IKE SA [in] challenge Pointer to the EAP MS-CHAP-V2 Challenge packet [in] length Length of the EAP MS-CHAP-V2 Challenge packet, in bytes
- Returns
- Error code
Definition at line 101 of file ike_eap_mschapv2.c.
◆ ikeProcessEapMschapv2FailureRequest()
| error_t ikeProcessEapMschapv2FailureRequest | ( | IkeSaEntry * | sa, |
| const IkeEapMschapv2FailureRequest * | request, | ||
| size_t | length | ||
| ) |
Process EAP MS-CHAP-V2 Failure Request packet.
- Parameters
-
[in] sa Pointer to the IKE SA [in] request Pointer to the EAP MS-CHAP-V2 Failure Request packet [in] length Length of the EAP MS-CHAP-V2 Failure Request packet, in bytes
- Returns
- Error code
Definition at line 254 of file ike_eap_mschapv2.c.
◆ ikeProcessEapMschapv2Request()
| error_t ikeProcessEapMschapv2Request | ( | IkeSaEntry * | sa, |
| const IkeEapMschapv2Packet * | request, | ||
| size_t | length | ||
| ) |
Process EAP MS-CHAP-V2 request.
- Parameters
-
[in] sa Pointer to the IKE SA [in] request Pointer to the EAP MS-CHAP-V2 request [in] length Length of the EAP MS-CHAP-V2 request, in bytes
- Returns
- Error code
Definition at line 52 of file ike_eap_mschapv2.c.
◆ ikeProcessEapMschapv2SuccessRequest()
| error_t ikeProcessEapMschapv2SuccessRequest | ( | IkeSaEntry * | sa, |
| const IkeEapMschapv2SuccessRequest * | request, | ||
| size_t | length | ||
| ) |
Process EAP MS-CHAP-V2 Success Request packet.
- Parameters
-
[in] sa Pointer to the IKE SA [in] request Pointer to the EAP MS-CHAP-V2 Success Request packet [in] length Length of the EAP MS-CHAP-V2 Success Request packet, in bytes
- Returns
- Error code
Definition at line 177 of file ike_eap_mschapv2.c.
Variable Documentation
◆ __packed_struct
| typedef __packed_struct |
EAP MS-CHAP-V2 packet.
EAP MS-CHAP-V2 Change-Password packet.
EAP MS-CHAP-V2 Failure Response packet.
EAP MS-CHAP-V2 Failure Request packet.
EAP MS-CHAP-V2 Success Response packet.
EAP MS-CHAP-V2 Success Request packet.
EAP MS-CHAP-V2 Response packet.
EAP MS-CHAP-V2 Challenge packet.
Definition at line 69 of file ike_eap_mschapv2.h.
◆ challenge
| uint8_t challenge[16] |
Definition at line 93 of file ike_eap_mschapv2.h.
◆ data
| uint8_t data[] |
Definition at line 195 of file ike_eap_mschapv2.h.
◆ flags
| uint8_t flags |
Definition at line 115 of file ike_eap_mschapv2.h.
◆ identifier
| uint8_t identifier |
Definition at line 72 of file ike_eap_mschapv2.h.
◆ IkeEapMschapv2Challenge
| IkeEapMschapv2Challenge |
Definition at line 95 of file ike_eap_mschapv2.h.
◆ IkeEapMschapv2ChangePassword
| IkeEapMschapv2ChangePassword |
Definition at line 196 of file ike_eap_mschapv2.h.
◆ IkeEapMschapv2FailureRequest
| IkeEapMschapv2FailureRequest |
Definition at line 165 of file ike_eap_mschapv2.h.
◆ IkeEapMschapv2FailureResponse
| IkeEapMschapv2FailureResponse |
Definition at line 179 of file ike_eap_mschapv2.h.
◆ IkeEapMschapv2Packet
| IkeEapMschapv2Packet |
Definition at line 76 of file ike_eap_mschapv2.h.
◆ IkeEapMschapv2Response
| IkeEapMschapv2Response |
Definition at line 117 of file ike_eap_mschapv2.h.
◆ IkeEapMschapv2SuccessRequest
| IkeEapMschapv2SuccessRequest |
Definition at line 134 of file ike_eap_mschapv2.h.
◆ IkeEapMschapv2SuccessResponse
| IkeEapMschapv2SuccessResponse |
Definition at line 148 of file ike_eap_mschapv2.h.
◆ length
| uint16_t length |
Definition at line 73 of file ike_eap_mschapv2.h.
◆ message
| uint8_t message[] |
Definition at line 133 of file ike_eap_mschapv2.h.
◆ mschapv2Id
| uint8_t mschapv2Id |
Definition at line 90 of file ike_eap_mschapv2.h.
◆ msLength
| uint16_t msLength |
Definition at line 91 of file ike_eap_mschapv2.h.
◆ name
| uint8_t name[] |
Definition at line 94 of file ike_eap_mschapv2.h.
◆ ntResponse
| uint8_t ntResponse[24] |
Definition at line 114 of file ike_eap_mschapv2.h.
◆ opcode
| uint8_t opcode |
Definition at line 75 of file ike_eap_mschapv2.h.
◆ peerChallenge
| uint8_t peerChallenge[16] |
Definition at line 112 of file ike_eap_mschapv2.h.
◆ reserved
| uint8_t reserved[8] |
Definition at line 113 of file ike_eap_mschapv2.h.
◆ type
| uint8_t type |
Definition at line 74 of file ike_eap_mschapv2.h.
◆ valueSize
| uint8_t valueSize |
Definition at line 92 of file ike_eap_mschapv2.h.
