2012-02-24 00:56:50 +04:00
|
|
|
/**
|
2012-05-22 06:48:33 +04:00
|
|
|
* WinPR: Windows Portable Runtime
|
2012-02-24 00:56:50 +04:00
|
|
|
* NTLM Security Package
|
|
|
|
*
|
|
|
|
* Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2012-05-22 06:48:33 +04:00
|
|
|
#ifndef WINPR_SSPI_NTLM_PRIVATE_H
|
|
|
|
#define WINPR_SSPI_NTLM_PRIVATE_H
|
2012-02-24 06:26:00 +04:00
|
|
|
|
2012-05-05 03:48:53 +04:00
|
|
|
#include <winpr/sspi.h>
|
2012-02-25 19:20:12 +04:00
|
|
|
#include <freerdp/crypto/crypto.h>
|
2012-02-24 00:56:50 +04:00
|
|
|
|
2012-02-25 02:17:38 +04:00
|
|
|
#include <freerdp/utils/unicode.h>
|
|
|
|
|
2012-02-24 06:26:00 +04:00
|
|
|
#include "../sspi.h"
|
|
|
|
|
|
|
|
enum _NTLM_STATE
|
|
|
|
{
|
|
|
|
NTLM_STATE_INITIAL,
|
|
|
|
NTLM_STATE_NEGOTIATE,
|
|
|
|
NTLM_STATE_CHALLENGE,
|
|
|
|
NTLM_STATE_AUTHENTICATE,
|
|
|
|
NTLM_STATE_FINAL
|
|
|
|
};
|
|
|
|
typedef enum _NTLM_STATE NTLM_STATE;
|
2012-02-24 00:56:50 +04:00
|
|
|
|
2012-02-25 18:55:52 +04:00
|
|
|
struct _AV_PAIR
|
|
|
|
{
|
2012-05-23 11:08:24 +04:00
|
|
|
UINT16 length;
|
|
|
|
BYTE* value;
|
2012-02-25 18:55:52 +04:00
|
|
|
};
|
|
|
|
typedef struct _AV_PAIR AV_PAIR;
|
|
|
|
|
|
|
|
struct _AV_PAIRS
|
|
|
|
{
|
|
|
|
AV_PAIR NbComputerName;
|
|
|
|
AV_PAIR NbDomainName;
|
|
|
|
AV_PAIR DnsComputerName;
|
|
|
|
AV_PAIR DnsDomainName;
|
|
|
|
AV_PAIR DnsTreeName;
|
|
|
|
AV_PAIR Timestamp;
|
|
|
|
AV_PAIR Restrictions;
|
|
|
|
AV_PAIR TargetName;
|
|
|
|
AV_PAIR ChannelBindings;
|
2012-05-23 11:08:24 +04:00
|
|
|
UINT32 Flags;
|
2012-02-25 18:55:52 +04:00
|
|
|
};
|
|
|
|
typedef struct _AV_PAIRS AV_PAIRS;
|
|
|
|
|
|
|
|
enum _AV_ID
|
|
|
|
{
|
|
|
|
MsvAvEOL,
|
|
|
|
MsvAvNbComputerName,
|
|
|
|
MsvAvNbDomainName,
|
|
|
|
MsvAvDnsComputerName,
|
|
|
|
MsvAvDnsDomainName,
|
|
|
|
MsvAvDnsTreeName,
|
|
|
|
MsvAvFlags,
|
|
|
|
MsvAvTimestamp,
|
|
|
|
MsvAvRestrictions,
|
|
|
|
MsvAvTargetName,
|
|
|
|
MsvChannelBindings
|
|
|
|
};
|
|
|
|
typedef enum _AV_ID AV_ID;
|
|
|
|
|
2012-02-24 00:56:50 +04:00
|
|
|
struct _NTLM_CONTEXT
|
|
|
|
{
|
2012-03-19 06:24:49 +04:00
|
|
|
boolean server;
|
2012-02-24 06:26:00 +04:00
|
|
|
boolean ntlm_v2;
|
|
|
|
NTLM_STATE state;
|
2012-03-19 06:24:49 +04:00
|
|
|
int SendSeqNum;
|
|
|
|
int RecvSeqNum;
|
2012-04-21 01:00:00 +04:00
|
|
|
boolean confidentiality;
|
2012-03-19 06:24:49 +04:00
|
|
|
CryptoRc4 SendRc4Seal;
|
|
|
|
CryptoRc4 RecvRc4Seal;
|
2012-05-23 11:08:24 +04:00
|
|
|
BYTE* SendSigningKey;
|
|
|
|
BYTE* RecvSigningKey;
|
|
|
|
BYTE* SendSealingKey;
|
|
|
|
BYTE* RecvSealingKey;
|
2012-02-25 18:55:52 +04:00
|
|
|
AV_PAIRS* av_pairs;
|
2012-05-23 11:08:24 +04:00
|
|
|
UINT32 NegotiateFlags;
|
|
|
|
UINT16* Workstation;
|
|
|
|
UINT32 WorkstationLength;
|
2012-03-16 04:37:38 +04:00
|
|
|
SEC_WINNT_AUTH_IDENTITY identity;
|
|
|
|
SecBuffer NegotiateMessage;
|
|
|
|
SecBuffer ChallengeMessage;
|
|
|
|
SecBuffer AuthenticateMessage;
|
|
|
|
SecBuffer TargetInfo;
|
|
|
|
SecBuffer TargetName;
|
|
|
|
SecBuffer NtChallengeResponse;
|
|
|
|
SecBuffer LmChallengeResponse;
|
2012-05-23 11:08:24 +04:00
|
|
|
BYTE Timestamp[8];
|
|
|
|
BYTE ServerChallenge[8];
|
|
|
|
BYTE ClientChallenge[8];
|
|
|
|
BYTE SessionBaseKey[16];
|
|
|
|
BYTE KeyExchangeKey[16];
|
|
|
|
BYTE RandomSessionKey[16];
|
|
|
|
BYTE ExportedSessionKey[16];
|
|
|
|
BYTE EncryptedRandomSessionKey[16];
|
|
|
|
BYTE ClientSigningKey[16];
|
|
|
|
BYTE ClientSealingKey[16];
|
|
|
|
BYTE ServerSigningKey[16];
|
|
|
|
BYTE ServerSealingKey[16];
|
|
|
|
BYTE MessageIntegrityCheck[16];
|
2012-02-24 00:56:50 +04:00
|
|
|
};
|
|
|
|
typedef struct _NTLM_CONTEXT NTLM_CONTEXT;
|
|
|
|
|
2012-03-03 22:02:13 +04:00
|
|
|
NTLM_CONTEXT* ntlm_ContextNew();
|
|
|
|
void ntlm_ContextFree(NTLM_CONTEXT* context);
|
|
|
|
|
2012-03-19 02:14:20 +04:00
|
|
|
#ifdef WITH_DEBUG_NLA
|
|
|
|
#define WITH_DEBUG_NTLM
|
|
|
|
#endif
|
2012-02-25 18:55:52 +04:00
|
|
|
|
2012-03-06 02:23:22 +04:00
|
|
|
#endif /* FREERDP_SSPI_NTLM_PRIVATE_H */
|