curl_ntlm_core.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef HEADER_CURL_NTLM_CORE_H
  2. #define HEADER_CURL_NTLM_CORE_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) Daniel Stenberg, <[email protected]>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at https://curl.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. * SPDX-License-Identifier: curl
  24. *
  25. ***************************************************************************/
  26. #include "curl_setup.h"
  27. #ifdef USE_CURL_NTLM_CORE
  28. #include "vauth/vauth.h"
  29. struct ntlmdata;
  30. /* Helpers to generate function byte arguments in little endian order */
  31. #define SHORTPAIR(x) ((int)((x) & 0xff)), ((int)(((x) >> 8) & 0xff))
  32. #define LONGQUARTET(x) ((int)((x) & 0xff)), ((int)(((x) >> 8) & 0xff)), \
  33. ((int)(((x) >> 16) & 0xff)), ((int)(((x) >> 24) & 0xff))
  34. void Curl_ntlm_core_lm_resp(const unsigned char *keys,
  35. const unsigned char *plaintext,
  36. unsigned char *results);
  37. CURLcode Curl_ntlm_core_mk_lm_hash(const char *password,
  38. unsigned char *lmbuffer /* 21 bytes */);
  39. CURLcode Curl_ntlm_core_mk_nt_hash(const char *password,
  40. unsigned char *ntbuffer /* 21 bytes */);
  41. #ifndef USE_WINDOWS_SSPI
  42. CURLcode Curl_hmac_md5(const unsigned char *key, unsigned int keylen,
  43. const unsigned char *data, unsigned int datalen,
  44. unsigned char *output);
  45. CURLcode Curl_ntlm_core_mk_ntlmv2_hash(const char *user, size_t userlen,
  46. const char *domain, size_t domlen,
  47. unsigned char *ntlmhash,
  48. unsigned char *ntlmv2hash);
  49. CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
  50. unsigned char *challenge_client,
  51. struct ntlmdata *ntlm,
  52. unsigned char **ntresp,
  53. unsigned int *ntresp_len);
  54. CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash,
  55. unsigned char *challenge_client,
  56. unsigned char *challenge_server,
  57. unsigned char *lmresp);
  58. #endif /* !USE_WINDOWS_SSPI */
  59. #endif /* USE_CURL_NTLM_CORE */
  60. #endif /* HEADER_CURL_NTLM_CORE_H */