ms_funcs.c File Reference

WPA Supplicant / shared MSCHAPV2 helper functions / RFC 2433 / RFC 2759. More...

#include "includes.h"
#include "common.h"
#include "sha1.h"
#include "ms_funcs.h"
#include "crypto.h"
Include dependency graph for ms_funcs.c:

Go to the source code of this file.

Defines

#define PWBLOCK_LEN   516

Functions

int nt_password_hash (const u8 *password, size_t password_len, u8 *password_hash)
 NtPasswordHash() - RFC 2759, Sect. 8.3.
int hash_nt_password_hash (const u8 *password_hash, u8 *password_hash_hash)
 HashNtPasswordHash() - RFC 2759, Sect. 8.4.
void challenge_response (const u8 *challenge, const u8 *password_hash, u8 *response)
 ChallengeResponse() - RFC 2759, Sect. 8.5.
int generate_nt_response (const u8 *auth_challenge, const u8 *peer_challenge, const u8 *username, size_t username_len, const u8 *password, size_t password_len, u8 *response)
 GenerateNTResponse() - RFC 2759, Sect. 8.1.
int generate_nt_response_pwhash (const u8 *auth_challenge, const u8 *peer_challenge, const u8 *username, size_t username_len, const u8 *password_hash, u8 *response)
 GenerateNTResponse() - RFC 2759, Sect. 8.1.
int generate_authenticator_response_pwhash (const u8 *password_hash, const u8 *peer_challenge, const u8 *auth_challenge, const u8 *username, size_t username_len, const u8 *nt_response, u8 *response)
 GenerateAuthenticatorResponse() - RFC 2759, Sect. 8.7.
int generate_authenticator_response (const u8 *password, size_t password_len, const u8 *peer_challenge, const u8 *auth_challenge, const u8 *username, size_t username_len, const u8 *nt_response, u8 *response)
 GenerateAuthenticatorResponse() - RFC 2759, Sect. 8.7.
int nt_challenge_response (const u8 *challenge, const u8 *password, size_t password_len, u8 *response)
 NtChallengeResponse() - RFC 2433, Sect. A.5.
int get_master_key (const u8 *password_hash_hash, const u8 *nt_response, u8 *master_key)
 GetMasterKey() - RFC 3079, Sect. 3.4.
int get_asymetric_start_key (const u8 *master_key, u8 *session_key, size_t session_key_len, int is_send, int is_server)
 GetAsymetricStartKey() - RFC 3079, Sect. 3.4.
int encrypt_pw_block_with_password_hash (const u8 *password, size_t password_len, const u8 *password_hash, u8 *pw_block)
 EncryptPwBlockWithPasswordHash() - RFC 2759, Sect. 8.10.
int new_password_encrypted_with_old_nt_password_hash (const u8 *new_password, size_t new_password_len, const u8 *old_password, size_t old_password_len, u8 *encrypted_pw_block)
 NewPasswordEncryptedWithOldNtPasswordHash() - RFC 2759, Sect. 8.9.
void nt_password_hash_encrypted_with_block (const u8 *password_hash, const u8 *block, u8 *cypher)
 NtPasswordHashEncryptedWithBlock() - RFC 2759, Sect 8.13.
int old_nt_password_hash_encrypted_with_new_nt_password_hash (const u8 *new_password, size_t new_password_len, const u8 *old_password, size_t old_password_len, u8 *encrypted_password_hash)
 OldNtPasswordHashEncryptedWithNewNtPasswordHash() - RFC 2759, Sect. 8.12.

Detailed Description

WPA Supplicant / shared MSCHAPV2 helper functions / RFC 2433 / RFC 2759.

Copyright
Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

Alternatively, this software may be distributed under the terms of BSD license.

See README and COPYING for more details.

Definition in file ms_funcs.c.


Function Documentation

void challenge_response ( const u8 *  challenge,
const u8 *  password_hash,
u8 *  response 
)

ChallengeResponse() - RFC 2759, Sect. 8.5.

Parameters:
challenge 8-octet Challenge (IN)
password_hash 16-octet PasswordHash (IN)
response 24-octet Response (OUT)

Definition at line 106 of file ms_funcs.c.

Here is the call graph for this function:

int encrypt_pw_block_with_password_hash ( const u8 *  password,
size_t  password_len,
const u8 *  password_hash,
u8 *  pw_block 
)

EncryptPwBlockWithPasswordHash() - RFC 2759, Sect. 8.10.

Parameters:
password 0-to-256-unicode-char Password (IN; ASCII)
password_len Length of password
password_hash 16-octet PasswordHash (IN)
pw_block 516-byte PwBlock (OUT)
Returns:
0 on success, -1 on failure

Definition at line 397 of file ms_funcs.c.

Here is the call graph for this function:

int generate_authenticator_response ( const u8 *  password,
size_t  password_len,
const u8 *  peer_challenge,
const u8 *  auth_challenge,
const u8 *  username,
size_t  username_len,
const u8 *  nt_response,
u8 *  response 
)

GenerateAuthenticatorResponse() - RFC 2759, Sect. 8.7.

Parameters:
password 0-to-256-unicode-char Password (IN; ASCII)
password_len Length of password
nt_response 24-octet NT-Response (IN)
peer_challenge 16-octet PeerChallenge (IN)
auth_challenge 16-octet AuthenticatorChallenge (IN)
username 0-to-256-char UserName (IN)
username_len Length of username
response 20-octet AuthenticatorResponse (OUT) (note: this value is usually encoded as a 42-octet ASCII string (S=hexdump_of_response)
Returns:
0 on success, -1 on failure

Definition at line 248 of file ms_funcs.c.

Here is the call graph for this function:

int generate_authenticator_response_pwhash ( const u8 *  password_hash,
const u8 *  peer_challenge,
const u8 *  auth_challenge,
const u8 *  username,
size_t  username_len,
const u8 *  nt_response,
u8 *  response 
)

GenerateAuthenticatorResponse() - RFC 2759, Sect. 8.7.

Parameters:
password_hash 16-octet PasswordHash (IN)
nt_response 24-octet NT-Response (IN)
peer_challenge 16-octet PeerChallenge (IN)
auth_challenge 16-octet AuthenticatorChallenge (IN)
username 0-to-256-char UserName (IN)
username_len Length of username
response 20-octet AuthenticatorResponse (OUT) (note: this value is usually encoded as a 42-octet ASCII string (S=hexdump_of_response)
Returns:
0 on success, -1 on failure

Definition at line 189 of file ms_funcs.c.

Here is the call graph for this function:

int generate_nt_response ( const u8 *  auth_challenge,
const u8 *  peer_challenge,
const u8 *  username,
size_t  username_len,
const u8 *  password,
size_t  password_len,
u8 *  response 
)

GenerateNTResponse() - RFC 2759, Sect. 8.1.

Parameters:
auth_challenge 16-octet AuthenticatorChallenge (IN)
peer_challenge 16-octet PeerChallenge (IN)
username 0-to-256-char UserName (IN)
username_len Length of username
password 0-to-256-unicode-char Password (IN; ASCII)
password_len Length of password
response 24-octet Response (OUT)
Returns:
0 on success, -1 on failure

Definition at line 131 of file ms_funcs.c.

Here is the call graph for this function:

int generate_nt_response_pwhash ( const u8 *  auth_challenge,
const u8 *  peer_challenge,
const u8 *  username,
size_t  username_len,
const u8 *  password_hash,
u8 *  response 
)

GenerateNTResponse() - RFC 2759, Sect. 8.1.

Parameters:
auth_challenge 16-octet AuthenticatorChallenge (IN)
peer_challenge 16-octet PeerChallenge (IN)
username 0-to-256-char UserName (IN)
username_len Length of username
password_hash 16-octet PasswordHash (IN)
response 24-octet Response (OUT)
Returns:
0 on success, -1 on failure

Definition at line 159 of file ms_funcs.c.

Here is the call graph for this function:

int get_asymetric_start_key ( const u8 *  master_key,
u8 *  session_key,
size_t  session_key_len,
int  is_send,
int  is_server 
)

GetAsymetricStartKey() - RFC 3079, Sect. 3.4.

Parameters:
master_key 16-octet MasterKey (IN)
session_key 8-to-16 octet SessionKey (OUT)
session_key_len SessionKeyLength (Length of session_key) (IN)
is_send IsSend (IN, BOOLEAN)
is_server IsServer (IN, BOOLEAN)
Returns:
0 on success, -1 on failure

Definition at line 324 of file ms_funcs.c.

Here is the call graph for this function:

int get_master_key ( const u8 *  password_hash_hash,
const u8 *  nt_response,
u8 *  master_key 
)

GetMasterKey() - RFC 3079, Sect. 3.4.

Parameters:
password_hash_hash 16-octet PasswordHashHash (IN)
nt_response 24-octet NTResponse (IN)
master_key 16-octet MasterKey (OUT)
Returns:
0 on success, -1 on failure

Definition at line 291 of file ms_funcs.c.

Here is the call graph for this function:

int hash_nt_password_hash ( const u8 *  password_hash,
u8 *  password_hash_hash 
)

HashNtPasswordHash() - RFC 2759, Sect. 8.4.

Parameters:
password_hash 16-octet PasswordHash (IN)
password_hash_hash 16-octet PasswordHashHash (OUT)
Returns:
0 on success, -1 on failure

Definition at line 92 of file ms_funcs.c.

Here is the call graph for this function:

int new_password_encrypted_with_old_nt_password_hash ( const u8 *  new_password,
size_t  new_password_len,
const u8 *  old_password,
size_t  old_password_len,
u8 *  encrypted_pw_block 
)

NewPasswordEncryptedWithOldNtPasswordHash() - RFC 2759, Sect. 8.9.

Parameters:
new_password 0-to-256-unicode-char NewPassword (IN; ASCII)
new_password_len Length of new_password
old_password 0-to-256-unicode-char OldPassword (IN; ASCII)
old_password_len Length of old_password
encrypted_pw_block 516-octet EncryptedPwBlock (OUT)
Returns:
0 on success, -1 on failure

Definition at line 434 of file ms_funcs.c.

Here is the call graph for this function:

int nt_challenge_response ( const u8 *  challenge,
const u8 *  password,
size_t  password_len,
u8 *  response 
)

NtChallengeResponse() - RFC 2433, Sect. A.5.

Parameters:
challenge 8-octet Challenge (IN)
password 0-to-256-unicode-char Password (IN; ASCII)
password_len Length of password
response 24-octet Response (OUT)
Returns:
0 on success, -1 on failure

Definition at line 272 of file ms_funcs.c.

Here is the call graph for this function:

int nt_password_hash ( const u8 *  password,
size_t  password_len,
u8 *  password_hash 
)

NtPasswordHash() - RFC 2759, Sect. 8.3.

Parameters:
password 0-to-256-unicode-char Password (IN; ASCII)
password_len Length of password
password_hash 16-octet PasswordHash (OUT)
Returns:
0 on success, -1 on failure

Definition at line 64 of file ms_funcs.c.

Here is the call graph for this function:

void nt_password_hash_encrypted_with_block ( const u8 *  password_hash,
const u8 *  block,
u8 *  cypher 
)

NtPasswordHashEncryptedWithBlock() - RFC 2759, Sect 8.13.

Parameters:
password_hash 16-octer PasswordHash (IN)
block 16-octet Block (IN)
cypher 16-octer Cypher (OUT)

Definition at line 458 of file ms_funcs.c.

Here is the call graph for this function:

int old_nt_password_hash_encrypted_with_new_nt_password_hash ( const u8 *  new_password,
size_t  new_password_len,
const u8 *  old_password,
size_t  old_password_len,
u8 *  encrypted_password_hash 
)

OldNtPasswordHashEncryptedWithNewNtPasswordHash() - RFC 2759, Sect. 8.12.

Parameters:
new_password 0-to-256-unicode-char NewPassword (IN; ASCII)
new_password_len Length of new_password
old_password 0-to-256-unicode-char OldPassword (IN; ASCII)
old_password_len Length of old_password
encrypted_password_hash 16-octet EncryptedPasswordHash (OUT)
Returns:
0 on success, -1 on failure

Definition at line 476 of file ms_funcs.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Sat Nov 21 23:19:32 2009 for hostapd by  doxygen 1.6.1