|
iPXE
|
MS-CHAPv2 authentication. More...
#include <stdio.h>#include <string.h>#include <byteswap.h>#include <ipxe/md4.h>#include <ipxe/sha1.h>#include <ipxe/des.h>#include <ipxe/mschapv2.h>Go to the source code of this file.
Data Structures | |
| union | mschapv2_context |
| MS-CHAPv2 context block. More... | |
| union | mschapv2_challenge_hash |
| MS-CHAPv2 challenge hash. More... | |
| union | mschapv2_password_hash |
| MS-CHAPv2 password hash. More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| static void | mschapv2_challenge_hash (union mschapv2_context *ctx, const struct mschapv2_challenge *challenge, const struct mschapv2_challenge *peer, const char *username, union mschapv2_challenge_hash *chash) |
| Calculate MS-CHAPv2 challenge hash. More... | |
| static void | mschapv2_password_hash (union mschapv2_context *ctx, const char *password, union mschapv2_password_hash *phash) |
| Calculate MS-CHAPv2 password hash. More... | |
| static void | mschapv2_hash_hash (union mschapv2_context *ctx, union mschapv2_password_hash *phash) |
| Hash the MS-CHAPv2 password hash. More... | |
| static void | mschapv2_expand_hash (union mschapv2_context *ctx, union mschapv2_password_hash *phash) |
| Expand MS-CHAPv2 password hash by inserting DES dummy parity bits. More... | |
| static void | mschapv2_challenge_response (union mschapv2_context *ctx, const union mschapv2_challenge_hash *chash, const union mschapv2_password_hash *phash, struct mschapv2_nt_response *nt) |
| Calculate MS-CHAPv2 challenge response. More... | |
| void | mschapv2_response (const char *username, const char *password, const struct mschapv2_challenge *challenge, const struct mschapv2_challenge *peer, struct mschapv2_response *response) |
| Calculate MS-CHAPv2 challenge response. More... | |
| void | mschapv2_auth (const char *username, const char *password, const struct mschapv2_challenge *challenge, const struct mschapv2_response *response, struct mschapv2_auth *auth) |
| Calculate MS-CHAPv2 authenticator response. More... | |
Variables | |
| static const char | mschapv2_magic1 [39] |
| MS-CHAPv2 magic constant 1. More... | |
| static const char | mschapv2_magic2 [41] |
| MS-CHAPv2 magic constant 2. More... | |
MS-CHAPv2 authentication.
The algorithms used for MS-CHAPv2 authentication are defined in RFC 2759 section 8.
Definition in file mschapv2.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Calculate MS-CHAPv2 challenge hash.
| ctx | Context block |
| challenge | Authenticator challenge |
| peer | Peer challenge |
| username | User name (or NULL to use empty string) |
| chash | Challenge hash to fill in |
This is the ChallengeHash() function as documented in RFC 2759 section 8.2.
Definition at line 119 of file mschapv2.c.
References ctx, DBGC, DBGC_HDA, mschapv2_challenge_hash::des, digest_final(), digest_init(), digest_update(), peer, mschapv2_challenge_hash::sha1, sha1_algorithm, strlen(), and username.
Referenced by mschapv2_auth(), and mschapv2_response().
|
static |
Calculate MS-CHAPv2 password hash.
| ctx | Context block |
| password | Password (or NULL to use empty string) |
| phash | Password hash to fill in |
This is the NtPasswordHash() function as documented in RFC 2759 section 8.3.
Definition at line 153 of file mschapv2.c.
References cpu_to_le16, ctx, DBGC, DBGC_HDA, digest_final(), digest_init(), digest_update(), mschapv2_password_hash::md4, md4_algorithm, memset(), password, and wc.
Referenced by mschapv2_auth(), and mschapv2_response().
|
static |
Hash the MS-CHAPv2 password hash.
| ctx | Context block |
| phash | Password hash to be rehashed |
This is the HashNtPasswordHash() function as documented in RFC 2759 section 8.4.
Definition at line 183 of file mschapv2.c.
References ctx, DBGC, DBGC_HDA, digest_final(), digest_init(), digest_update(), mschapv2_password_hash::md4, and md4_algorithm.
Referenced by mschapv2_auth().
|
static |
Expand MS-CHAPv2 password hash by inserting DES dummy parity bits.
| ctx | Context block |
| phash | Password hash to expand |
This is part of the DesEncrypt() function as documented in RFC 2759 section 8.6.
Definition at line 204 of file mschapv2.c.
References ctx, DBGC, DBGC_HDA, mschapv2_password_hash::expand, and src.
Referenced by mschapv2_response().
|
static |
Calculate MS-CHAPv2 challenge response.
| ctx | Context block |
| chash | Challenge hash |
| phash | Password hash (after expansion) |
| nt | NT response to fill in |
This is the ChallengeResponse() function as documented in RFC 2759 section 8.5.
Definition at line 232 of file mschapv2.c.
References assert(), mschapv2_nt_response::block, cipher_encrypt, cipher_setkey(), ctx, DBGC, DBGC_HDA, mschapv2_challenge_hash::des, mschapv2_password_hash::des, des_algorithm, nt, and rc.
Referenced by mschapv2_response().
| void mschapv2_response | ( | const char * | username, |
| const char * | password, | ||
| const struct mschapv2_challenge * | challenge, | ||
| const struct mschapv2_challenge * | peer, | ||
| struct mschapv2_response * | response | ||
| ) |
Calculate MS-CHAPv2 challenge response.
| username | User name (or NULL to use empty string) |
| password | Password (or NULL to use empty string) |
| challenge | Authenticator challenge |
| peer | Peer challenge |
| response | Challenge response to fill in |
This is essentially the GenerateNTResponse() function as documented in RFC 2759 section 8.1.
Definition at line 269 of file mschapv2.c.
References ctx, DBGC, DBGC_HDA, memcpy(), memset(), mschapv2_challenge_hash(), mschapv2_challenge_response(), mschapv2_expand_hash(), mschapv2_password_hash(), mschapv2_response::nt, password, mschapv2_response::peer, peer, and username.
Referenced by eap_rx_mschapv2_request(), and mschapv2_okx().
| void mschapv2_auth | ( | const char * | username, |
| const char * | password, | ||
| const struct mschapv2_challenge * | challenge, | ||
| const struct mschapv2_response * | response, | ||
| struct mschapv2_auth * | auth | ||
| ) |
Calculate MS-CHAPv2 authenticator response.
| username | User name (or NULL to use empty string) |
| password | Password (or NULL to use empty string) |
| challenge | Authenticator challenge |
| response | Challenge response |
| auth | Authenticator response to fill in |
This is essentially the GenerateAuthenticatorResponse() function as documented in RFC 2759 section 8.7.
Definition at line 308 of file mschapv2.c.
References ctx, DBGC, DBGC_HDA, mschapv2_challenge_hash::des, digest_final(), digest_init(), digest_update(), mschapv2_password_hash::md4, mschapv2_challenge_hash(), mschapv2_hash_hash(), mschapv2_magic1, mschapv2_magic2, mschapv2_password_hash(), mschapv2_response::nt, password, mschapv2_response::peer, mschapv2_password_hash::sha1, sha1_algorithm, snprintf(), tmp, username, wtf, and mschapv2_auth::wtf.
Referenced by mschapv2_okx().
|
static |
MS-CHAPv2 magic constant 1.
Definition at line 99 of file mschapv2.c.
Referenced by mschapv2_auth().
|
static |
MS-CHAPv2 magic constant 2.
Definition at line 103 of file mschapv2.c.
Referenced by mschapv2_auth().
1.8.15