100 "Magic server to client signing constant";
104 "Pad to make it do more than one iteration";
135 DBGC (
ctx,
"MSCHAPv2 authenticator challenge:\n" );
136 DBGC_HDA (
ctx, 0, challenge,
sizeof ( *challenge ) );
137 DBGC (
ctx,
"MSCHAPv2 peer challenge:\n" );
139 DBGC (
ctx,
"MSCHAPv2 challenge hash:\n" );
161 memset ( phash, 0,
sizeof ( *phash ) );
170 DBGC (
ctx,
"MSCHAPv2 password hash:\n" );
191 DBGC (
ctx,
"MSCHAPv2 password hash hash:\n" );
211 for ( i = (
sizeof ( phash->
expand ) - 1 ) ; i > 0 ; i-- ) {
213 src = ( dst - ( i / 8 ) );
214 *dst = ( ( (
src[-1] << 8 ) |
src[0] ) >> ( i % 8 ) );
216 DBGC (
ctx,
"MSCHAPv2 expanded password hash:\n" );
245 for ( i = 0 ; i < (
sizeof ( phash->
des ) /
246 sizeof ( phash->
des[0] ) ) ; i++ ) {
248 sizeof ( phash->
des[i] ) );
251 sizeof ( chash->
des ) );
253 DBGC (
ctx,
"MSCHAPv2 NT response:\n" );
278 memset ( response, 0,
sizeof ( *response ) );
292 DBGC ( &
ctx,
"MSCHAPv2 challenge response:\n" );
293 DBGC_HDA ( &
ctx, 0, response,
sizeof ( *response ) );
328 sizeof ( response->
nt ) );
332 DBGC ( &
ctx,
"MSCHAPv2 NT response:\n" );
334 DBGC ( &
ctx,
"MSCHAPv2 unnamed intermediate hash:\n" );
348 DBGC ( &
ctx,
"MSCHAPv2 authenticator response hash:\n" );
355 DBGC ( &
ctx,
"MSCHAPv2 authenticator response: S=" );
356 for ( i = 0 ; i <
sizeof ( phash.
sha1 ) ; i++ ) {
#define MD4_DIGEST_SIZE
MD4 digest size.
struct arbelprm_rc_send_wqe rc
static void digest_update(struct digest_algorithm *digest, void *ctx, const void *data, size_t len)
static __always_inline void off_t int c
static const char mschapv2_magic1[39]
MS-CHAPv2 magic constant 1.
static void mschapv2_hash_hash(union mschapv2_context *ctx, union mschapv2_password_hash *phash)
Hash the MS-CHAPv2 password hash.
MS-CHAPv2 challenge hash.
uint8_t des[3][DES_BLOCKSIZE]
DES keys.
static void digest_final(struct digest_algorithm *digest, void *ctx, void *out)
uint8_t sha1[SHA1_DIGEST_SIZE]
SHA-1 digest.
struct golan_eq_context ctx
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.
struct cipher_algorithm des_algorithm
Basic DES algorithm.
#define DES_CTX_SIZE
DES context size.
#define cipher_encrypt(cipher, ctx, src, dst, len)
void * memcpy(void *dest, const void *src, size_t len) __nonnull
uint8_t des[DES_CTX_SIZE]
DES cipher context.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
uint8_t md4[MD4_DIGEST_SIZE]
MD4 digest.
char wtf[42]
Authenticator response string.
MS-CHAPv2 authentication.
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.
static void digest_init(struct digest_algorithm *digest, void *ctx)
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.
size_t strlen(const char *src)
Get length of string.
An MS-CHAPv2 challenge response.
static struct dynamic_item password
struct mschapv2_nt_response nt
NT response.
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_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.
#define MD4_CTX_SIZE
MD4 context size.
An MS-CHAPv2 authenticator response.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define SHA1_CTX_SIZE
SHA-1 context size.
uint8_t sha1[SHA1_DIGEST_SIZE]
SHA-1 digest.
static const char mschapv2_magic2[41]
MS-CHAPv2 magic constant 2.
#define DES_BLOCKSIZE
DES blocksize.
#define cpu_to_le16(value)
A message digest algorithm.
static struct dynamic_item username
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
struct digest_algorithm md4_algorithm
MD4 algorithm.
struct mschapv2_challenge peer
Peer challenge.
uint8_t expand[3 *DES_BLOCKSIZE]
DES key expansion.
uint8_t block[3][8]
DES-encrypted blocks.
struct mschapv2_challenge peer
Peer challenge.
char wtf[42]
Authenticator response string.
static void mschapv2_password_hash(union mschapv2_context *ctx, const char *password, union mschapv2_password_hash *phash)
Calculate MS-CHAPv2 password hash.
struct mschapv2_nt_response nt
NT response.
An MS-CHAPv2 NT response.
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 int cipher_setkey(struct cipher_algorithm *cipher, void *ctx, const void *key, size_t keylen)
struct digest_algorithm sha1_algorithm
SHA-1 algorithm.
void * memset(void *dest, int character, size_t len) __nonnull