ms_funcs.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #ifndef MS_FUNCS_H
  9. #define MS_FUNCS_H
  10. int generate_nt_response(const u8 *auth_challenge, const u8 *peer_challenge,
  11. const u8 *username, size_t username_len,
  12. const u8 *password, size_t password_len,
  13. u8 *response);
  14. int generate_nt_response_pwhash(const u8 *auth_challenge,
  15. const u8 *peer_challenge,
  16. const u8 *username, size_t username_len,
  17. const u8 *password_hash,
  18. u8 *response);
  19. int generate_authenticator_response(const u8 *password, size_t password_len,
  20. const u8 *peer_challenge,
  21. const u8 *auth_challenge,
  22. const u8 *username, size_t username_len,
  23. const u8 *nt_response, u8 *response);
  24. int generate_authenticator_response_pwhash(
  25. const u8 *password_hash,
  26. const u8 *peer_challenge, const u8 *auth_challenge,
  27. const u8 *username, size_t username_len,
  28. const u8 *nt_response, u8 *response);
  29. int nt_challenge_response(const u8 *challenge, const u8 *password,
  30. size_t password_len, u8 *response);
  31. void challenge_response(const u8 *challenge, const u8 *password_hash,
  32. u8 *response);
  33. int nt_password_hash(const u8 *password, size_t password_len,
  34. u8 *password_hash);
  35. int hash_nt_password_hash(const u8 *password_hash, u8 *password_hash_hash);
  36. int get_master_key(const u8 *password_hash_hash, const u8 *nt_response,
  37. u8 *master_key);
  38. int get_asymetric_start_key(const u8 *master_key, u8 *session_key,
  39. size_t session_key_len, int is_send,
  40. int is_server);
  41. int __must_check encrypt_pw_block_with_password_hash(
  42. const u8 *password, size_t password_len,
  43. const u8 *password_hash, u8 *pw_block);
  44. int __must_check new_password_encrypted_with_old_nt_password_hash(
  45. const u8 *new_password, size_t new_password_len,
  46. const u8 *old_password, size_t old_password_len,
  47. u8 *encrypted_pw_block);
  48. void nt_password_hash_encrypted_with_block(const u8 *password_hash,
  49. const u8 *block, u8 *cypher);
  50. int old_nt_password_hash_encrypted_with_new_nt_password_hash(
  51. const u8 *new_password, size_t new_password_len,
  52. const u8 *old_password, size_t old_password_len,
  53. u8 *encrypted_password_hash);
  54. #endif /* MS_FUNCS_H */