Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
3.5 KiB

  1. /*
  2. * macssp.h
  3. * MSUAM
  4. *
  5. * Created by mconrad on Sun Sep 30 2001.
  6. * Copyright (c) 2001 Microsoft Corp. All rights reserved.
  7. *
  8. */
  9. #ifndef __MAC_SSP__
  10. #define __MAC_SSP__
  11. #include <macstrsafe.h>
  12. #include "descrypt.h"
  13. #include "ntstatus.h"
  14. #include "ntlmsspv2.h"
  15. #include "ntlmsspi.h"
  16. #include "ntlmssp.h"
  17. #include "crypt.h"
  18. #include "sspdebug.h"
  19. //
  20. // From ntsam.h
  21. //
  22. #define SAM_MAX_PASSWORD_LENGTH 256
  23. //
  24. // From sampass.h
  25. //
  26. typedef struct //_SAMPR_USER_PASSWORD
  27. {
  28. UInt16 Buffer[SAM_MAX_PASSWORD_LENGTH];
  29. DWORD Length;
  30. }SAMPR_USER_PASSWORD, *PSAMPR_USER_PASSWORD;
  31. //typedef struct _SAMPR_USER_PASSWORD __RPC_FAR *PSAMPR_USER_PASSWORD;
  32. typedef struct _SAMPR_ENCRYPTED_USER_PASSWORD
  33. {
  34. UCHAR Buffer[516];
  35. }SAMPR_ENCRYPTED_USER_PASSWORD, *PSAMPR_ENCRYPTED_USER_PASSWORD;
  36. typedef ENCRYPTED_LM_OWF_PASSWORD ENCRYPTED_NT_OWF_PASSWORD;
  37. typedef ENCRYPTED_NT_OWF_PASSWORD* PENCRYPTED_NT_OWF_PASSWORD;
  38. HRESULT
  39. MacSspHandleNtlmv2ChallengeMessage(
  40. IN PCSTR pszUserName,
  41. IN PCSTR pszDomainName,
  42. IN PCSTR pszWorkstation,
  43. IN PCSTR pszCleartextPassword,
  44. IN ULONG cbChallengeMessage,
  45. IN CHALLENGE_MESSAGE* pChallengeMessage,
  46. IN OUT ULONG* pNegotiateFlags,
  47. OUT ULONG* pcbAuthenticateMessage,
  48. OUT AUTHENTICATE_MESSAGE** ppAuthenticateMessage,
  49. OUT USER_SESSION_KEY* pUserSessionKey
  50. );
  51. HRESULT
  52. MacSspGenerateChallengeMessage(
  53. IN CHAR pChallengeToClient[MSV1_0_CHALLENGE_LENGTH],
  54. OUT ULONG* pcbChallengeMessage,
  55. OUT CHALLENGE_MESSAGE** ppChallengeMessage
  56. );
  57. BOOL
  58. MacSspCalculateLmResponse(
  59. IN PLM_CHALLENGE LmChallenge,
  60. IN PLM_OWF_PASSWORD LmOwfPassword,
  61. OUT PLM_RESPONSE LmResponse
  62. );
  63. BOOL
  64. MacSspCalculateLmOwfPassword(
  65. IN PLM_PASSWORD LmPassword,
  66. OUT PLM_OWF_PASSWORD LmOwfPassword
  67. );
  68. BOOL
  69. MacSspEncryptBlock(
  70. IN PCLEAR_BLOCK ClearBlock,
  71. IN PBLOCK_KEY BlockKey,
  72. OUT PCYPHER_BLOCK CypherBlock
  73. );
  74. BOOL
  75. MacSspEncryptLmOwfPwdWithLmOwfPwd(
  76. IN PLM_OWF_PASSWORD DataLmOwfPassword,
  77. IN PLM_OWF_PASSWORD KeyLmOwfPassword,
  78. OUT PENCRYPTED_LM_OWF_PASSWORD EncryptedLmOwfPassword
  79. );
  80. BOOL
  81. MacSspEncryptNtOwfPwdWithNtOwfPwd(
  82. IN PNT_OWF_PASSWORD DataNtOwfPassword,
  83. IN PNT_OWF_PASSWORD KeyNtOwfPassword,
  84. OUT PENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword
  85. );
  86. BOOL
  87. MacSspSampEncryptLmPasswords(
  88. LPSTR OldUpcasePassword,
  89. LPSTR NewUpcasePassword,
  90. LPSTR NewPassword,
  91. PSAMPR_ENCRYPTED_USER_PASSWORD NewEncryptedWithOldLm,
  92. PENCRYPTED_NT_OWF_PASSWORD OldLmOwfEncryptedWithNewLm
  93. );
  94. OSStatus
  95. MacSspSamiEncryptPasswords(
  96. IN PUNICODE_STRING oldPassword,
  97. IN PUNICODE_STRING newPassword,
  98. OUT PSAMPR_ENCRYPTED_USER_PASSWORD NewEncryptedWithOldNt,
  99. OUT PENCRYPTED_NT_OWF_PASSWORD OldNtOwfEncryptedWithNewNt
  100. );
  101. OSStatus
  102. MacSspSamiEncryptPasswordsANSI(
  103. IN PCSTR oldPassword,
  104. IN PCSTR newPassword,
  105. OUT PSAMPR_ENCRYPTED_USER_PASSWORD NewEncryptedWithOldNt,
  106. OUT PENCRYPTED_NT_OWF_PASSWORD OldNtOwfEncryptedWithNewNt
  107. );
  108. OSStatus
  109. MacSspSamiEncryptCStringPasswords(
  110. IN PCSTR oldPassword,
  111. IN PCSTR newPassword,
  112. OUT PSAMPR_ENCRYPTED_USER_PASSWORD NewEncryptedWithOldNt,
  113. OUT PENCRYPTED_NT_OWF_PASSWORD OldNtOwfEncryptedWithNewNt
  114. );
  115. OSStatus
  116. MacSspSamiEncryptPStringPasswords(
  117. IN Str255 oldPassword,
  118. IN Str255 newPassword,
  119. OUT PSAMPR_ENCRYPTED_USER_PASSWORD NewEncryptedWithOldNt,
  120. OUT PENCRYPTED_NT_OWF_PASSWORD OldNtOwfEncryptedWithNewNt
  121. );
  122. #endif //__MAC_SSP__