ms_funcs.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * Alternatively, this software may be distributed under the terms of BSD
  10. * license.
  11. *
  12. * See README and COPYING for more details.
  13. */
  14. #ifndef MS_FUNCS_H
  15. #define MS_FUNCS_H
  16. int generate_nt_response(const u8 *auth_challenge, const u8 *peer_challenge,
  17. const u8 *username, size_t username_len,
  18. const u8 *password, size_t password_len,
  19. u8 *response);
  20. int generate_nt_response_pwhash(const u8 *auth_challenge,
  21. const u8 *peer_challenge,
  22. const u8 *username, size_t username_len,
  23. const u8 *password_hash,
  24. u8 *response);
  25. int generate_authenticator_response(const u8 *password, size_t password_len,
  26. const u8 *peer_challenge,
  27. const u8 *auth_challenge,
  28. const u8 *username, size_t username_len,
  29. const u8 *nt_response, u8 *response);
  30. int generate_authenticator_response_pwhash(
  31. const u8 *password_hash,
  32. const u8 *peer_challenge, const u8 *auth_challenge,
  33. const u8 *username, size_t username_len,
  34. const u8 *nt_response, u8 *response);
  35. int nt_challenge_response(const u8 *challenge, const u8 *password,
  36. size_t password_len, u8 *response);
  37. void challenge_response(const u8 *challenge, const u8 *password_hash,
  38. u8 *response);
  39. int nt_password_hash(const u8 *password, size_t password_len,
  40. u8 *password_hash);
  41. int hash_nt_password_hash(const u8 *password_hash, u8 *password_hash_hash);
  42. int get_master_key(const u8 *password_hash_hash, const u8 *nt_response,
  43. u8 *master_key);
  44. int get_asymetric_start_key(const u8 *master_key, u8 *session_key,
  45. size_t session_key_len, int is_send,
  46. int is_server);
  47. int __must_check encrypt_pw_block_with_password_hash(
  48. const u8 *password, size_t password_len,
  49. const u8 *password_hash, u8 *pw_block);
  50. int __must_check new_password_encrypted_with_old_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_pw_block);
  54. void nt_password_hash_encrypted_with_block(const u8 *password_hash,
  55. const u8 *block, u8 *cypher);
  56. int old_nt_password_hash_encrypted_with_new_nt_password_hash(
  57. const u8 *new_password, size_t new_password_len,
  58. const u8 *old_password, size_t old_password_len,
  59. u8 *encrypted_password_hash);
  60. #endif /* MS_FUNCS_H */