1 /* 2 * WPA Supplicant / shared MSCHAPV2 helper functions / RFC 2433 / RFC 2759 3 * Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi> 4 * 5 * This software may be distributed under the terms of the BSD license. 6 * See README for more details. 7 */ 8 9 #ifndef MS_FUNCS_H 10 #define MS_FUNCS_H 11 12 int generate_nt_response(const u8 *auth_challenge, const u8 *peer_challenge, 13 const u8 *username, size_t username_len, 14 const u8 *password, size_t password_len, 15 u8 *response); 16 int generate_nt_response_pwhash(const u8 *auth_challenge, 17 const u8 *peer_challenge, 18 const u8 *username, size_t username_len, 19 const u8 *password_hash, 20 u8 *response); 21 int generate_authenticator_response(const u8 *password, size_t password_len, 22 const u8 *peer_challenge, 23 const u8 *auth_challenge, 24 const u8 *username, size_t username_len, 25 const u8 *nt_response, u8 *response); 26 int generate_authenticator_response_pwhash( 27 const u8 *password_hash, 28 const u8 *peer_challenge, const u8 *auth_challenge, 29 const u8 *username, size_t username_len, 30 const u8 *nt_response, u8 *response); 31 int nt_challenge_response(const u8 *challenge, const u8 *password, 32 size_t password_len, u8 *response); 33 34 void challenge_response(const u8 *challenge, const u8 *password_hash, 35 u8 *response); 36 int nt_password_hash(const u8 *password, size_t password_len, 37 u8 *password_hash); 38 int hash_nt_password_hash(const u8 *password_hash, u8 *password_hash_hash); 39 int get_master_key(const u8 *password_hash_hash, const u8 *nt_response, 40 u8 *master_key); 41 int get_asymetric_start_key(const u8 *master_key, u8 *session_key, 42 size_t session_key_len, int is_send, 43 int is_server); 44 int __must_check encrypt_pw_block_with_password_hash( 45 const u8 *password, size_t password_len, 46 const u8 *password_hash, u8 *pw_block); 47 int __must_check new_password_encrypted_with_old_nt_password_hash( 48 const u8 *new_password, size_t new_password_len, 49 const u8 *old_password, size_t old_password_len, 50 u8 *encrypted_pw_block); 51 void nt_password_hash_encrypted_with_block(const u8 *password_hash, 52 const u8 *block, u8 *cypher); 53 int old_nt_password_hash_encrypted_with_new_nt_password_hash( 54 const u8 *new_password, size_t new_password_len, 55 const u8 *old_password, size_t old_password_len, 56 u8 *encrypted_password_hash); 57 58 #endif /* MS_FUNCS_H */ 59