139beb93cSSam Leffler /* 239beb93cSSam Leffler * WPA Supplicant / shared MSCHAPV2 helper functions / RFC 2433 / RFC 2759 3e28a4053SRui Paulo * Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi> 439beb93cSSam Leffler * 5f05cddf9SRui Paulo * This software may be distributed under the terms of the BSD license. 6f05cddf9SRui Paulo * See README for more details. 739beb93cSSam Leffler */ 839beb93cSSam Leffler 939beb93cSSam Leffler #ifndef MS_FUNCS_H 1039beb93cSSam Leffler #define MS_FUNCS_H 1139beb93cSSam Leffler 12e28a4053SRui Paulo int generate_nt_response(const u8 *auth_challenge, const u8 *peer_challenge, 1339beb93cSSam Leffler const u8 *username, size_t username_len, 1439beb93cSSam Leffler const u8 *password, size_t password_len, 1539beb93cSSam Leffler u8 *response); 16e28a4053SRui Paulo int generate_nt_response_pwhash(const u8 *auth_challenge, 1739beb93cSSam Leffler const u8 *peer_challenge, 1839beb93cSSam Leffler const u8 *username, size_t username_len, 1939beb93cSSam Leffler const u8 *password_hash, 2039beb93cSSam Leffler u8 *response); 21e28a4053SRui Paulo int generate_authenticator_response(const u8 *password, size_t password_len, 2239beb93cSSam Leffler const u8 *peer_challenge, 2339beb93cSSam Leffler const u8 *auth_challenge, 2439beb93cSSam Leffler const u8 *username, size_t username_len, 2539beb93cSSam Leffler const u8 *nt_response, u8 *response); 26e28a4053SRui Paulo int generate_authenticator_response_pwhash( 2739beb93cSSam Leffler const u8 *password_hash, 2839beb93cSSam Leffler const u8 *peer_challenge, const u8 *auth_challenge, 2939beb93cSSam Leffler const u8 *username, size_t username_len, 3039beb93cSSam Leffler const u8 *nt_response, u8 *response); 31e28a4053SRui Paulo int nt_challenge_response(const u8 *challenge, const u8 *password, 3239beb93cSSam Leffler size_t password_len, u8 *response); 3339beb93cSSam Leffler 34*85732ac8SCy Schubert int challenge_response(const u8 *challenge, const u8 *password_hash, 3539beb93cSSam Leffler u8 *response); 36325151a3SRui Paulo int challenge_hash(const u8 *peer_challenge, const u8 *auth_challenge, 37325151a3SRui Paulo const u8 *username, size_t username_len, u8 *challenge); 38e28a4053SRui Paulo int nt_password_hash(const u8 *password, size_t password_len, 3939beb93cSSam Leffler u8 *password_hash); 40e28a4053SRui Paulo int hash_nt_password_hash(const u8 *password_hash, u8 *password_hash_hash); 41e28a4053SRui Paulo int get_master_key(const u8 *password_hash_hash, const u8 *nt_response, 4239beb93cSSam Leffler u8 *master_key); 43e28a4053SRui Paulo int get_asymetric_start_key(const u8 *master_key, u8 *session_key, 4439beb93cSSam Leffler size_t session_key_len, int is_send, 4539beb93cSSam Leffler int is_server); 4639beb93cSSam Leffler int __must_check encrypt_pw_block_with_password_hash( 4739beb93cSSam Leffler const u8 *password, size_t password_len, 4839beb93cSSam Leffler const u8 *password_hash, u8 *pw_block); 4939beb93cSSam Leffler int __must_check new_password_encrypted_with_old_nt_password_hash( 5039beb93cSSam Leffler const u8 *new_password, size_t new_password_len, 5139beb93cSSam Leffler const u8 *old_password, size_t old_password_len, 5239beb93cSSam Leffler u8 *encrypted_pw_block); 53*85732ac8SCy Schubert int nt_password_hash_encrypted_with_block(const u8 *password_hash, 5439beb93cSSam Leffler const u8 *block, u8 *cypher); 55e28a4053SRui Paulo int old_nt_password_hash_encrypted_with_new_nt_password_hash( 5639beb93cSSam Leffler const u8 *new_password, size_t new_password_len, 5739beb93cSSam Leffler const u8 *old_password, size_t old_password_len, 5839beb93cSSam Leffler u8 *encrypted_password_hash); 5939beb93cSSam Leffler 6039beb93cSSam Leffler #endif /* MS_FUNCS_H */ 61