FreeRDP
Loading...
Searching...
No Matches
rdpear_common.h
1
19#ifndef FREERDP_CHANNEL_RDPEAR_COMMON_H
20#define FREERDP_CHANNEL_RDPEAR_COMMON_H
21
22#include <winpr/stream.h>
23#include <winpr/asn1.h>
24#include <winpr/wlog.h>
25#include <winpr/sspi.h>
26
27#include <freerdp/api.h>
28
29#include <rdpear-common/ndr.h>
30
31typedef enum
32{
33 RDPEAR_PACKAGE_KERBEROS,
34 RDPEAR_PACKAGE_NTLM,
35 RDPEAR_PACKAGE_UNKNOWN
36} RdpEarPackageType;
37
38/* RDPEAR 2.2.1.1 */
39typedef enum
40{
41 // Start Kerberos remote calls
42 RemoteCallKerbMinimum = 0x100,
43 RemoteCallKerbNegotiateVersion = 0x100,
44 RemoteCallKerbBuildAsReqAuthenticator,
45 RemoteCallKerbVerifyServiceTicket,
46 RemoteCallKerbCreateApReqAuthenticator,
47 RemoteCallKerbDecryptApReply,
48 RemoteCallKerbUnpackKdcReplyBody,
49 RemoteCallKerbComputeTgsChecksum,
50 RemoteCallKerbBuildEncryptedAuthData,
51 RemoteCallKerbPackApReply,
52 RemoteCallKerbHashS4UPreauth,
53 RemoteCallKerbSignS4UPreauthData,
54 RemoteCallKerbVerifyChecksum,
55 RemoteCallKerbReserved1,
56 RemoteCallKerbReserved2,
57 RemoteCallKerbReserved3,
58 RemoteCallKerbReserved4,
59 RemoteCallKerbReserved5,
60 RemoteCallKerbReserved6,
61 RemoteCallKerbReserved7,
62 RemoteCallKerbDecryptPacCredentials,
63 RemoteCallKerbCreateECDHKeyAgreement,
64 RemoteCallKerbCreateDHKeyAgreement,
65 RemoteCallKerbDestroyKeyAgreement,
66 RemoteCallKerbKeyAgreementGenerateNonce,
67 RemoteCallKerbFinalizeKeyAgreement,
68 RemoteCallKerbMaximum = 0x1ff,
69 // End Kerberos remote calls
70
71 // Start NTLM remote calls
72 RemoteCallNtlmMinimum = 0x200,
73 RemoteCallNtlmNegotiateVersion = 0x200,
74 RemoteCallNtlmLm20GetNtlm3ChallengeResponse,
75 RemoteCallNtlmCalculateNtResponse,
76 RemoteCallNtlmCalculateUserSessionKeyNt,
77 RemoteCallNtlmCompareCredentials,
78 RemoteCallNtlmMaximum = 0x2ff,
79 // End NTLM remote calls
80} RemoteGuardCallId;
81
82FREERDP_LOCAL RdpEarPackageType rdpear_packageType_from_name(const WinPrAsn1_OctetString* package);
83WINPR_ATTR_MALLOC(Stream_Free, 1)
84FREERDP_LOCAL wStream* rdpear_encodePayload(BOOL isKerb, wStream* payload);
85
86#define RDPEAR_COMMON_MESSAGE_DECL(V) \
87 FREERDP_LOCAL BOOL ndr_read_##V(NdrContext* context, wStream* s, const void* hints, V* obj); \
88 FREERDP_LOCAL BOOL ndr_write_##V(NdrContext* context, wStream* s, const void* hints, \
89 const V* obj); \
90 FREERDP_LOCAL void ndr_destroy_##V(NdrContext* context, const void* hints, V* obj); \
91 FREERDP_LOCAL void ndr_dump_##V(wLog* logger, UINT32 lvl, size_t indentLevel, const V* obj); \
92 FREERDP_LOCAL NdrMessageType ndr_##V##_descr(void)
93
95typedef struct
96{
97 UINT32 length;
98 BYTE* value;
100
101RDPEAR_COMMON_MESSAGE_DECL(KERB_RPC_OCTET_STRING);
102
104typedef struct
105{
106 UINT32 Pdu;
107 NdrArrayHints Asn1BufferHints;
108 BYTE* Asn1Buffer;
110
111RDPEAR_COMMON_MESSAGE_DECL(KERB_ASN1_DATA);
112
114typedef struct
115{
116 NdrVaryingArrayHints lenHints;
117 UINT32 strLength;
118 WCHAR* Buffer;
120
121RDPEAR_COMMON_MESSAGE_DECL(RPC_UNICODE_STRING);
122
124typedef struct
125{
126 UINT16 NameType;
127 NdrArrayHints nameHints;
128 RPC_UNICODE_STRING* Names;
130
131RDPEAR_COMMON_MESSAGE_DECL(KERB_RPC_INTERNAL_NAME);
132
134typedef struct
135{
136 UINT32 reserved1;
137 UINT32 reserved2;
138 KERB_RPC_OCTET_STRING reserved3;
140
141RDPEAR_COMMON_MESSAGE_DECL(KERB_RPC_ENCRYPTION_KEY);
142
144typedef struct
145{
146 UINT32 KeyUsage;
148 KERB_ASN1_DATA* PlainAuthData;
150
151RDPEAR_COMMON_MESSAGE_DECL(BuildEncryptedAuthDataReq);
152
154typedef struct
155{
156 KERB_ASN1_DATA* requestBody;
158 UINT32 ChecksumType;
160
161RDPEAR_COMMON_MESSAGE_DECL(ComputeTgsChecksumReq);
162
164typedef struct
165{
166 KERB_RPC_ENCRYPTION_KEY* EncryptionKey;
167 ULONG SequenceNumber;
168 KERB_RPC_INTERNAL_NAME* ClientName;
169 RPC_UNICODE_STRING* ClientRealm;
170 PLARGE_INTEGER SkewTime;
171 KERB_RPC_ENCRYPTION_KEY* SubKey; // optional
172 KERB_ASN1_DATA* AuthData; // optional
173 KERB_ASN1_DATA* GssChecksum; // optional
174 ULONG KeyUsage;
176
177RDPEAR_COMMON_MESSAGE_DECL(CreateApReqAuthenticatorReq);
178
180typedef struct
181{
182 LARGE_INTEGER AuthenticatorTime;
183 KERB_ASN1_DATA Authenticator;
184 LONG KerbProtocolError;
186
187RDPEAR_COMMON_MESSAGE_DECL(CreateApReqAuthenticatorResp);
188
190typedef struct
191{
192 KERB_ASN1_DATA* EncryptedData;
194 KERB_RPC_ENCRYPTION_KEY* StrengthenKey;
195 ULONG Pdu;
196 ULONG KeyUsage;
198
199RDPEAR_COMMON_MESSAGE_DECL(UnpackKdcReplyBodyReq);
200
202typedef struct
203{
204 LONG KerbProtocolError;
205 KERB_ASN1_DATA ReplyBody;
207
208RDPEAR_COMMON_MESSAGE_DECL(UnpackKdcReplyBodyResp);
209
210typedef struct
211{
212 KERB_ASN1_DATA* EncryptedReply;
215
216RDPEAR_COMMON_MESSAGE_DECL(DecryptApReplyReq);
217
218typedef struct
219{
220 KERB_ASN1_DATA* Reply;
221 KERB_ASN1_DATA* ReplyBody;
222 KERB_RPC_ENCRYPTION_KEY* SessionKey;
224
225RDPEAR_COMMON_MESSAGE_DECL(PackApReplyReq);
226
227typedef struct
228{
229 NdrArrayHints PackedReplyHints;
230 BYTE* PackedReply;
232
233RDPEAR_COMMON_MESSAGE_DECL(PackApReplyResp);
234
235#undef RDPEAR_COMMON_MESSAGE_DECL
236
237#endif /* FREERDP_CHANNEL_RDPEAR_COMMON_H */
2.2.2.1.8 BuildEncryptedAuthData
2.2.2.1.7 ComputeTgsChecksum
2.2.2.1.4 CreateApReqAuthenticator
2.2.2.1.4 CreateApReqAuthenticator
2.2.1.2.1 KERB_ASN1_DATA
2.2.1.2.8 KERB_RPC_ENCRYPTION_KEY
2.2.1.2.3 KERB_RPC_INTERNAL_NAME
2.2.1.2.2 KERB_RPC_OCTET_STRING
hints for a conformant array
Definition ndr.h:185
hints for a varying conformant array
Definition ndr.h:171
2.3.10 RPC_UNICODE_STRING (MS-DTYP)
2.2.2.1.6 UnpackKdcReplyBody
2.2.2.1.6 UnpackKdcReplyBody