101 "Magic server to client signing constant";
105 "Pad to make it do more than one iteration";
136 DBGC (
ctx,
"MSCHAPv2 authenticator challenge:\n" );
137 DBGC_HDA (
ctx, 0, challenge,
sizeof ( *challenge ) );
138 DBGC (
ctx,
"MSCHAPv2 peer challenge:\n" );
140 DBGC (
ctx,
"MSCHAPv2 challenge hash:\n" );
162 memset ( phash, 0,
sizeof ( *phash ) );
171 DBGC (
ctx,
"MSCHAPv2 password hash:\n" );
192 DBGC (
ctx,
"MSCHAPv2 password hash hash:\n" );
212 for ( i = (
sizeof ( phash->
expand ) - 1 ) ; i > 0 ; i-- ) {
214 src = ( dst - ( i / 8 ) );
215 *dst = ( ( (
src[-1] << 8 ) |
src[0] ) >> ( i % 8 ) );
217 DBGC (
ctx,
"MSCHAPv2 expanded password hash:\n" );
246 for ( i = 0 ; i < (
sizeof ( phash->
des ) /
247 sizeof ( phash->
des[0] ) ) ; i++ ) {
249 sizeof ( phash->
des[i] ) );
252 sizeof ( chash->
des ) );
254 DBGC (
ctx,
"MSCHAPv2 NT response:\n" );
279 memset ( response, 0,
sizeof ( *response ) );
293 DBGC ( &
ctx,
"MSCHAPv2 challenge response:\n" );
294 DBGC_HDA ( &
ctx, 0, response,
sizeof ( *response ) );
329 sizeof ( response->
nt ) );
333 DBGC ( &
ctx,
"MSCHAPv2 NT response:\n" );
335 DBGC ( &
ctx,
"MSCHAPv2 unnamed intermediate hash:\n" );
349 DBGC ( &
ctx,
"MSCHAPv2 authenticator response hash:\n" );
356 DBGC ( &
ctx,
"MSCHAPv2 authenticator response: S=" );
357 for ( i = 0 ; i <
sizeof ( phash.
sha1 ) ; i++ ) {
struct golan_eq_context ctx
struct arbelprm_rc_send_wqe rc
#define assert(condition)
Assert a condition at run-time.
struct cipher_algorithm des_algorithm
Basic DES algorithm.
#define DES_BLOCKSIZE
DES blocksize.
#define DES_CTX_SIZE
DES context size.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
#define cpu_to_le16(value)
static void digest_init(struct digest_algorithm *digest, void *ctx)
static int cipher_setkey(struct cipher_algorithm *cipher, void *ctx, const void *key, size_t keylen)
static void digest_final(struct digest_algorithm *digest, void *ctx, void *out)
static void digest_update(struct digest_algorithm *digest, void *ctx, const void *data, size_t len)
#define cipher_encrypt(cipher, ctx, src, dst, len)
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * memset(void *dest, int character, size_t len) __nonnull
static struct dynamic_item username
static struct dynamic_item password
struct digest_algorithm md4_algorithm
MD4 algorithm.
#define MD4_CTX_SIZE
MD4 context size.
#define MD4_DIGEST_SIZE
MD4 digest size.
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.
static void mschapv2_hash_hash(union mschapv2_context *ctx, union mschapv2_password_hash *phash)
Hash the MS-CHAPv2 password hash.
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.
static const char mschapv2_magic1[39]
MS-CHAPv2 magic constant 1.
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.
static void mschapv2_password_hash(union mschapv2_context *ctx, const char *password, union mschapv2_password_hash *phash)
Calculate MS-CHAPv2 password hash.
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.
static const char mschapv2_magic2[41]
MS-CHAPv2 magic constant 2.
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.
MS-CHAPv2 authentication.
struct mschapv2_challenge peer
Peer challenge.
char wtf[42]
Authenticator response string.
struct mschapv2_nt_response nt
NT response.
struct digest_algorithm sha1_algorithm
SHA-1 algorithm.
#define SHA1_CTX_SIZE
SHA-1 context size.
size_t strlen(const char *src)
Get length of string.
A message digest algorithm.
An MS-CHAPv2 authenticator response.
char wtf[42]
Authenticator response string.
An MS-CHAPv2 NT response.
An MS-CHAPv2 challenge response.
struct mschapv2_challenge peer
Peer challenge.
struct mschapv2_nt_response nt
NT response.
MS-CHAPv2 challenge hash.
uint8_t sha1[SHA1_DIGEST_SIZE]
SHA-1 digest.
uint8_t des[DES_BLOCKSIZE]
DES plaintext block.
uint8_t md4[MD4_CTX_SIZE]
MD4 digest context.
uint8_t sha1[SHA1_CTX_SIZE]
SHA-1 digest context.
uint8_t des[DES_CTX_SIZE]
DES cipher context.
uint8_t md4[MD4_DIGEST_SIZE]
MD4 digest.
uint8_t expand[3 *DES_BLOCKSIZE]
DES key expansion.
uint8_t des[3][DES_BLOCKSIZE]
DES keys.
uint8_t sha1[SHA1_DIGEST_SIZE]
SHA-1 digest.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.