FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
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(WinPrAsn1_OctetString* package);
83FREERDP_LOCAL wStream* rdpear_encodePayload(RdpEarPackageType packageType, wStream* payload);
84
85#define RDPEAR_COMMON_MESSAGE_DECL(V) \
86 FREERDP_LOCAL BOOL ndr_read_##V(NdrContext* context, wStream* s, const void* hints, V* obj); \
87 FREERDP_LOCAL BOOL ndr_write_##V(NdrContext* context, wStream* s, const void* hints, \
88 const V* obj); \
89 FREERDP_LOCAL void ndr_destroy_##V(NdrContext* context, const void* hints, V* obj); \
90 FREERDP_LOCAL void ndr_dump_##V(wLog* logger, UINT32 lvl, size_t indentLevel, const V* obj); \
91 FREERDP_LOCAL NdrMessageType ndr_##V##_descr(void)
92
94typedef struct
95{
96 UINT32 length;
97 BYTE* value;
99
100RDPEAR_COMMON_MESSAGE_DECL(KERB_RPC_OCTET_STRING);
101
103typedef struct
104{
105 UINT32 Pdu;
106 NdrArrayHints Asn1BufferHints;
107 BYTE* Asn1Buffer;
109
110RDPEAR_COMMON_MESSAGE_DECL(KERB_ASN1_DATA);
111
113typedef struct
114{
115 NdrVaryingArrayHints lenHints;
116 UINT32 strLength;
117 WCHAR* Buffer;
119
120RDPEAR_COMMON_MESSAGE_DECL(RPC_UNICODE_STRING);
121
123typedef struct
124{
125 UINT16 NameType;
126 NdrArrayHints nameHints;
127 RPC_UNICODE_STRING* Names;
129
130RDPEAR_COMMON_MESSAGE_DECL(KERB_RPC_INTERNAL_NAME);
131
133typedef struct
134{
135 UINT32 reserved1;
136 UINT32 reserved2;
137 KERB_RPC_OCTET_STRING reserved3;
139
140RDPEAR_COMMON_MESSAGE_DECL(KERB_RPC_ENCRYPTION_KEY);
141
143typedef struct
144{
145 UINT32 KeyUsage;
147 KERB_ASN1_DATA* PlainAuthData;
149
150RDPEAR_COMMON_MESSAGE_DECL(BuildEncryptedAuthDataReq);
151
153typedef struct
154{
155 KERB_ASN1_DATA* requestBody;
157 UINT32 ChecksumType;
159
160RDPEAR_COMMON_MESSAGE_DECL(ComputeTgsChecksumReq);
161
163typedef struct
164{
165 KERB_RPC_ENCRYPTION_KEY* EncryptionKey;
166 ULONG SequenceNumber;
167 KERB_RPC_INTERNAL_NAME* ClientName;
168 RPC_UNICODE_STRING* ClientRealm;
169 PLARGE_INTEGER SkewTime;
170 KERB_RPC_ENCRYPTION_KEY* SubKey; // optional
171 KERB_ASN1_DATA* AuthData; // optional
172 KERB_ASN1_DATA* GssChecksum; // optional
173 ULONG KeyUsage;
175
176RDPEAR_COMMON_MESSAGE_DECL(CreateApReqAuthenticatorReq);
177
179typedef struct
180{
181 LARGE_INTEGER AuthenticatorTime;
182 KERB_ASN1_DATA Authenticator;
183 LONG KerbProtocolError;
185
186RDPEAR_COMMON_MESSAGE_DECL(CreateApReqAuthenticatorResp);
187
189typedef struct
190{
191 KERB_ASN1_DATA* EncryptedData;
193 KERB_RPC_ENCRYPTION_KEY* StrengthenKey;
194 ULONG Pdu;
195 ULONG KeyUsage;
197
198RDPEAR_COMMON_MESSAGE_DECL(UnpackKdcReplyBodyReq);
199
201typedef struct
202{
203 LONG KerbProtocolError;
204 KERB_ASN1_DATA ReplyBody;
206
207RDPEAR_COMMON_MESSAGE_DECL(UnpackKdcReplyBodyResp);
208
209typedef struct
210{
211 KERB_ASN1_DATA* EncryptedReply;
214
215RDPEAR_COMMON_MESSAGE_DECL(DecryptApReplyReq);
216
217typedef struct
218{
219 KERB_ASN1_DATA* Reply;
220 KERB_ASN1_DATA* ReplyBody;
221 KERB_RPC_ENCRYPTION_KEY* SessionKey;
223
224RDPEAR_COMMON_MESSAGE_DECL(PackApReplyReq);
225
226typedef struct
227{
228 NdrArrayHints PackedReplyHints;
229 BYTE* PackedReply;
231
232RDPEAR_COMMON_MESSAGE_DECL(PackApReplyResp);
233
234#undef RDPEAR_COMMON_MESSAGE_DECL
235
236#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