2011-07-01 02:51:46 +04:00
|
|
|
/**
|
2012-02-21 01:17:57 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-07-01 02:51:46 +04:00
|
|
|
* Credential Security Support Provider (CredSSP)
|
|
|
|
*
|
2012-02-21 01:17:57 +04:00
|
|
|
* Copyright 2010-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
2011-07-01 02:51:46 +04:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2015-02-15 19:10:14 +03:00
|
|
|
#ifndef FREERDP_CORE_NLA_H
|
|
|
|
#define FREERDP_CORE_NLA_H
|
2011-07-01 02:51:46 +04:00
|
|
|
|
2015-02-15 19:10:14 +03:00
|
|
|
typedef struct rdp_nla rdpNla;
|
2011-07-07 21:37:48 +04:00
|
|
|
|
2012-02-21 09:56:55 +04:00
|
|
|
#include <freerdp/api.h>
|
2012-02-18 02:12:21 +04:00
|
|
|
#include <freerdp/freerdp.h>
|
2011-07-06 07:18:00 +04:00
|
|
|
|
2012-05-05 03:48:53 +04:00
|
|
|
#include <winpr/sspi.h>
|
2013-03-22 00:45:25 +04:00
|
|
|
#include <winpr/stream.h>
|
2012-02-29 19:46:09 +04:00
|
|
|
|
|
|
|
#include <freerdp/crypto/tls.h>
|
|
|
|
#include <freerdp/crypto/ber.h>
|
2012-06-18 23:56:40 +04:00
|
|
|
#include <freerdp/crypto/der.h>
|
2012-02-29 19:46:09 +04:00
|
|
|
#include <freerdp/crypto/crypto.h>
|
2011-07-01 02:51:46 +04:00
|
|
|
|
2012-11-15 06:30:21 +04:00
|
|
|
#include "transport.h"
|
|
|
|
|
2015-02-15 22:54:10 +03:00
|
|
|
enum _NLA_STATE
|
|
|
|
{
|
|
|
|
NLA_STATE_INITIAL,
|
|
|
|
NLA_STATE_NEGO_TOKEN,
|
|
|
|
NLA_STATE_PUB_KEY_AUTH,
|
|
|
|
NLA_STATE_AUTH_INFO,
|
|
|
|
NLA_STATE_FINAL
|
|
|
|
};
|
|
|
|
typedef enum _NLA_STATE NLA_STATE;
|
|
|
|
|
2015-02-15 19:10:14 +03:00
|
|
|
struct rdp_nla
|
2011-07-01 02:51:46 +04:00
|
|
|
{
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL server;
|
2015-02-15 22:54:10 +03:00
|
|
|
NLA_STATE state;
|
2015-02-15 19:10:14 +03:00
|
|
|
int sendSeqNum;
|
|
|
|
int recvSeqNum;
|
2012-02-29 20:36:11 +04:00
|
|
|
freerdp* instance;
|
2012-03-16 04:37:38 +04:00
|
|
|
CtxtHandle context;
|
2012-08-11 02:05:37 +04:00
|
|
|
LPTSTR SspiModule;
|
2012-02-29 20:57:43 +04:00
|
|
|
rdpSettings* settings;
|
2012-11-15 06:30:21 +04:00
|
|
|
rdpTransport* transport;
|
2015-02-15 19:10:14 +03:00
|
|
|
UINT32 cbMaxToken;
|
|
|
|
ULONG fContextReq;
|
|
|
|
ULONG pfContextAttr;
|
|
|
|
BOOL haveContext;
|
|
|
|
BOOL haveInputBuffer;
|
|
|
|
BOOL havePubKeyAuth;
|
|
|
|
SECURITY_STATUS status;
|
|
|
|
CredHandle credentials;
|
|
|
|
TimeStamp expiration;
|
|
|
|
PSecPkgInfo pPackageInfo;
|
|
|
|
SecBuffer inputBuffer;
|
|
|
|
SecBuffer outputBuffer;
|
|
|
|
SecBufferDesc inputBufferDesc;
|
|
|
|
SecBufferDesc outputBufferDesc;
|
2012-03-16 04:37:38 +04:00
|
|
|
SecBuffer negoToken;
|
|
|
|
SecBuffer pubKeyAuth;
|
|
|
|
SecBuffer authInfo;
|
|
|
|
SecBuffer PublicKey;
|
2015-02-15 19:10:14 +03:00
|
|
|
SecBuffer tsCredentials;
|
|
|
|
CryptoRc4 rc4SealState;
|
2012-06-07 05:16:47 +04:00
|
|
|
LPTSTR ServicePrincipalName;
|
2012-03-16 04:37:38 +04:00
|
|
|
SEC_WINNT_AUTH_IDENTITY identity;
|
2012-05-25 01:05:12 +04:00
|
|
|
PSecurityFunctionTable table;
|
2012-03-16 04:37:38 +04:00
|
|
|
SecPkgContext_Sizes ContextSizes;
|
2011-07-01 02:51:46 +04:00
|
|
|
};
|
|
|
|
|
2015-02-15 19:10:14 +03:00
|
|
|
int nla_authenticate(rdpNla* nla);
|
|
|
|
LPTSTR nla_make_spn(const char* ServiceClass, const char* hostname);
|
2011-07-01 02:51:46 +04:00
|
|
|
|
2015-02-16 00:04:59 +03:00
|
|
|
int nla_client_begin(rdpNla* nla);
|
|
|
|
int nla_recv_pdu(rdpNla* nla, wStream* s);
|
|
|
|
|
2015-02-15 19:10:14 +03:00
|
|
|
rdpNla* nla_new(freerdp* instance, rdpTransport* transport, rdpSettings* settings);
|
|
|
|
void nla_free(rdpNla* nla);
|
2011-07-01 02:51:46 +04:00
|
|
|
|
2015-02-15 19:10:14 +03:00
|
|
|
#endif /* FREERDP_CORE_NLA_H */
|