xref: /reactos/dll/win32/secur32/wine/ntlm.h (revision 98aabbcf)
1c2c66affSColin Finck 
2c2c66affSColin Finck #ifndef __WINE_NTLM_H__
3c2c66affSColin Finck #define __WINE_NTLM_H__
4c2c66affSColin Finck 
5c2c66affSColin Finck #include <sys/types.h>
6c2c66affSColin Finck #define CP_UNIXCP CP_ACP
7c2c66affSColin Finck 
8c2c66affSColin Finck void SECUR32_initNTLMSP(void) DECLSPEC_HIDDEN;
9c2c66affSColin Finck 
10c2c66affSColin Finck typedef enum _helper_mode {
11c2c66affSColin Finck     NTLM_SERVER,
12c2c66affSColin Finck     NTLM_CLIENT,
13c2c66affSColin Finck     NUM_HELPER_MODES
14c2c66affSColin Finck } HelperMode;
15c2c66affSColin Finck 
16c2c66affSColin Finck typedef struct tag_arc4_info {
17c2c66affSColin Finck     unsigned char x, y;
18c2c66affSColin Finck     unsigned char state[256];
19c2c66affSColin Finck } arc4_info;
20c2c66affSColin Finck 
21c2c66affSColin Finck typedef struct _NegoHelper {
22c2c66affSColin Finck #ifndef __REACTOS__
23c2c66affSColin Finck     pid_t helper_pid;
24c2c66affSColin Finck #else
25c2c66affSColin Finck     HANDLE helper_pid;
26c2c66affSColin Finck #endif
27c2c66affSColin Finck     HelperMode mode;
28c2c66affSColin Finck     int pipe_in;
29c2c66affSColin Finck     int pipe_out;
30c2c66affSColin Finck     int major;
31c2c66affSColin Finck     int minor;
32c2c66affSColin Finck     int micro;
33c2c66affSColin Finck     char *com_buf;
34c2c66affSColin Finck     int com_buf_size;
35c2c66affSColin Finck     int com_buf_offset;
36c2c66affSColin Finck     BYTE *session_key;
37c2c66affSColin Finck     ULONG neg_flags;
38c2c66affSColin Finck     struct {
39c2c66affSColin Finck         struct {
40c2c66affSColin Finck             ULONG seq_num;
41c2c66affSColin Finck             arc4_info *a4i;
42c2c66affSColin Finck         } ntlm;
43c2c66affSColin Finck         struct {
44c2c66affSColin Finck             BYTE *send_sign_key;
45c2c66affSColin Finck             BYTE *send_seal_key;
46c2c66affSColin Finck             BYTE *recv_sign_key;
47c2c66affSColin Finck             BYTE *recv_seal_key;
48c2c66affSColin Finck             ULONG send_seq_no;
49c2c66affSColin Finck             ULONG recv_seq_no;
50c2c66affSColin Finck             arc4_info *send_a4i;
51c2c66affSColin Finck             arc4_info *recv_a4i;
52c2c66affSColin Finck         } ntlm2;
53c2c66affSColin Finck     } crypt;
54c2c66affSColin Finck } NegoHelper, *PNegoHelper;
55c2c66affSColin Finck 
56c2c66affSColin Finck typedef struct _NtlmCredentials
57c2c66affSColin Finck {
58c2c66affSColin Finck     HelperMode mode;
59c2c66affSColin Finck 
60c2c66affSColin Finck     /* these are all in the Unix codepage */
61c2c66affSColin Finck     char *username_arg;
62c2c66affSColin Finck     char *domain_arg;
63c2c66affSColin Finck     char *password; /* not nul-terminated */
64c2c66affSColin Finck     int pwlen;
65c2c66affSColin Finck     int no_cached_credentials; /* don't try to use cached Samba credentials */
66c2c66affSColin Finck } NtlmCredentials, *PNtlmCredentials;
67c2c66affSColin Finck 
68c2c66affSColin Finck typedef enum _sign_direction {
69c2c66affSColin Finck     NTLM_SEND,
70c2c66affSColin Finck     NTLM_RECV
71c2c66affSColin Finck } SignDirection;
72c2c66affSColin Finck 
73c2c66affSColin Finck SECURITY_STATUS SECUR32_CreateNTLM1SessionKey(PBYTE password, int len, PBYTE session_key) DECLSPEC_HIDDEN;
74c2c66affSColin Finck SECURITY_STATUS SECUR32_CreateNTLM2SubKeys(PNegoHelper helper) DECLSPEC_HIDDEN;
75c2c66affSColin Finck 
76c2c66affSColin Finck /* NTLMSSP flags indicating the negotiated features */
77c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_UNICODE                   0x00000001
78c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_OEM                       0x00000002
79c2c66affSColin Finck #define NTLMSSP_REQUEST_TARGET                      0x00000004
80c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_SIGN                      0x00000010
81c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_SEAL                      0x00000020
82c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_DATAGRAM_STYLE            0x00000040
83c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_LM_SESSION_KEY            0x00000080
84c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_NTLM                      0x00000200
85c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED           0x00001000
86c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED      0x00002000
87c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_LOCAL_CALL                0x00004000
88c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_ALWAYS_SIGN               0x00008000
89c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_TARGET_TYPE_DOMAIN        0x00010000
90c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_TARGET_TYPE_SERVER        0x00020000
91c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_NTLM2                     0x00080000
92c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_TARGET_INFO               0x00800000
93c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_128                       0x20000000
94c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_KEY_EXCHANGE              0x40000000
95c2c66affSColin Finck #define NTLMSSP_NEGOTIATE_56                        0x80000000
96c2c66affSColin Finck 
97c2c66affSColin Finck SECURITY_STATUS SEC_ENTRY ntlm_AcquireCredentialsHandleW(SEC_WCHAR *, SEC_WCHAR *,
98c2c66affSColin Finck     ULONG, PLUID, PVOID, SEC_GET_KEY_FN, PVOID, PCredHandle, PTimeStamp) DECLSPEC_HIDDEN;
99c2c66affSColin Finck SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextW(PCredHandle, PCtxtHandle,
100c2c66affSColin Finck     SEC_WCHAR *, ULONG fContextReq, ULONG, ULONG, PSecBufferDesc, ULONG, PCtxtHandle,
101c2c66affSColin Finck     PSecBufferDesc, ULONG *, PTimeStamp) DECLSPEC_HIDDEN;
102c2c66affSColin Finck SECURITY_STATUS SEC_ENTRY ntlm_AcceptSecurityContext(PCredHandle, PCtxtHandle, PSecBufferDesc,
103c2c66affSColin Finck     ULONG, ULONG, PCtxtHandle, PSecBufferDesc, ULONG *, PTimeStamp) DECLSPEC_HIDDEN;
104c2c66affSColin Finck SECURITY_STATUS SEC_ENTRY ntlm_QueryContextAttributesA(PCtxtHandle, ULONG, void *) DECLSPEC_HIDDEN;
105c2c66affSColin Finck SECURITY_STATUS SEC_ENTRY ntlm_QueryContextAttributesW(PCtxtHandle, ULONG, void *) DECLSPEC_HIDDEN;
106c2c66affSColin Finck SECURITY_STATUS SEC_ENTRY ntlm_EncryptMessage(PCtxtHandle, ULONG, PSecBufferDesc, ULONG) DECLSPEC_HIDDEN;
107c2c66affSColin Finck SECURITY_STATUS SEC_ENTRY ntlm_DecryptMessage(PCtxtHandle, PSecBufferDesc, ULONG, PULONG) DECLSPEC_HIDDEN;
108c2c66affSColin Finck SECURITY_STATUS SEC_ENTRY ntlm_FreeCredentialsHandle(PCredHandle) DECLSPEC_HIDDEN;
109c2c66affSColin Finck SECURITY_STATUS SEC_ENTRY ntlm_DeleteSecurityContext(PCtxtHandle) DECLSPEC_HIDDEN;
110c2c66affSColin Finck SECURITY_STATUS SEC_ENTRY ntlm_MakeSignature(PCtxtHandle, ULONG, PSecBufferDesc, ULONG) DECLSPEC_HIDDEN;
111c2c66affSColin Finck SECURITY_STATUS SEC_ENTRY ntlm_VerifySignature(PCtxtHandle, PSecBufferDesc, ULONG, PULONG) DECLSPEC_HIDDEN;
112c2c66affSColin Finck 
113*98aabbcfSVictor Perevertkin extern SecPkgInfoW *ntlm_package_infoW DECLSPEC_HIDDEN;
114*98aabbcfSVictor Perevertkin extern SecPkgInfoA *ntlm_package_infoA DECLSPEC_HIDDEN;
115c2c66affSColin Finck 
116c2c66affSColin Finck #endif /* __WINE_NTLM_H__ */
117