libwinpr-sspi: move NLA code out of CredSSP module

This commit is contained in:
Marc-André Moreau 2012-05-25 01:50:46 -04:00
parent 0bd91f3cb9
commit b70683af9e
11 changed files with 1359 additions and 1160 deletions

View File

@ -54,17 +54,6 @@ struct rdp_credssp
FREERDP_API int credssp_authenticate(rdpCredssp* credssp);
FREERDP_API void credssp_send(rdpCredssp* credssp);
FREERDP_API int credssp_recv(rdpCredssp* credssp);
FREERDP_API void credssp_buffer_print(rdpCredssp* credssp);
FREERDP_API void credssp_buffer_free(rdpCredssp* credssp);
SECURITY_STATUS credssp_verify_public_key_echo(rdpCredssp* credssp);
FREERDP_API void credssp_encode_ts_credentials(rdpCredssp* credssp);
SECURITY_STATUS credssp_encrypt_ts_credentials(rdpCredssp* credssp);
SECURITY_STATUS credssp_decrypt_ts_credentials(rdpCredssp* credssp);
FREERDP_API rdpCredssp* credssp_new(freerdp* instance, rdpTls* tls, rdpSettings* settings);
FREERDP_API void credssp_free(rdpCredssp* credssp);

View File

@ -963,4 +963,7 @@ WINPR_API void sspi_GlobalFinish();
WINPR_API void sspi_SecBufferAlloc(PSecBuffer SecBuffer, size_t size);
WINPR_API void sspi_SecBufferFree(PSecBuffer SecBuffer);
WINPR_API void sspi_SetAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, char* user, char* domain, char* password);
WINPR_API void sspi_CopyAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, SEC_WINNT_AUTH_IDENTITY* srcIdentity);
#endif /* WINPR_SSPI_H */

View File

@ -40,7 +40,7 @@
#include "fastpath.h"
#include "transport.h"
#include <winpr/credssp.h>
#include <freerdp/crypto/nla.h>
#define BUFFER_SIZE 16384

View File

@ -22,6 +22,7 @@ set(FREERDP_CRYPTO_SRCS
der.c
ber.c
per.c
nla.c
certificate.c
crypto.c
tls.c)

1167
libfreerdp-crypto/nla.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
/**
* WinPR: Windows Portable Runtime
* Credential Security Support Provider (CredSSP)
*
* Copyright 2010-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.
*/
#ifndef WINPR_SSPI_CREDSSP_PRIVATE_H
#define WINPR_SSPI_CREDSSP_PRIVATE_H
#include <winpr/sspi.h>
#include "../sspi.h"
struct _CREDSSP_CONTEXT
{
BOOL server;
};
typedef struct _CREDSSP_CONTEXT CREDSSP_CONTEXT;
CREDSSP_CONTEXT* credssp_ContextNew();
void credssp_ContextFree(CREDSSP_CONTEXT* context);
#endif /* WINPR_SSPI_CREDSSP_PRIVATE_H */

View File

@ -657,26 +657,6 @@ SECURITY_STATUS SEC_ENTRY ntlm_VerifySignature(PCtxtHandle phContext, PSecBuffer
return SEC_E_OK;
}
const SecPkgInfoA NTLM_SecPkgInfoA =
{
0x00082B37, /* fCapabilities */
1, /* wVersion */
0x000A, /* wRPCID */
0x00000B48, /* cbMaxToken */
"NTLM", /* Name */
"NTLM Security Package" /* Comment */
};
const SecPkgInfoW NTLM_SecPkgInfoW =
{
0x00082B37, /* fCapabilities */
1, /* wVersion */
0x000A, /* wRPCID */
0x00000B48, /* cbMaxToken */
L"NTLM", /* Name */
L"NTLM Security Package" /* Comment */
};
const SecurityFunctionTableA NTLM_SecurityFunctionTableA =
{
1, /* dwVersion */
@ -740,3 +720,23 @@ const SecurityFunctionTableW NTLM_SecurityFunctionTableW =
ntlm_DecryptMessage, /* DecryptMessage */
NULL, /* SetContextAttributes */
};
const SecPkgInfoA NTLM_SecPkgInfoA =
{
0x00082B37, /* fCapabilities */
1, /* wVersion */
0x000A, /* wRPCID */
0x00000B48, /* cbMaxToken */
"NTLM", /* Name */
"NTLM Security Package" /* Comment */
};
const SecPkgInfoW NTLM_SecPkgInfoW =
{
0x00082B37, /* fCapabilities */
1, /* wVersion */
0x000A, /* wRPCID */
0x00000B48, /* cbMaxToken */
L"NTLM", /* Name */
L"NTLM Security Package" /* Comment */
};

View File

@ -125,18 +125,6 @@ SECURITY_STATUS SEC_ENTRY negotiate_QueryContextAttributes(PCtxtHandle phContext
if (!pBuffer)
return SEC_E_INSUFFICIENT_MEMORY;
if (ulAttribute == SECPKG_ATTR_SIZES)
{
SecPkgContext_Sizes* ContextSizes = (SecPkgContext_Sizes*) pBuffer;
ContextSizes->cbMaxToken = 2010;
ContextSizes->cbMaxSignature = 16;
ContextSizes->cbBlockSize = 0;
ContextSizes->cbSecurityTrailer = 16;
return SEC_E_OK;
}
return SEC_E_UNSUPPORTED_FUNCTION;
}

View File

@ -26,26 +26,6 @@
char* SCHANNEL_PACKAGE_NAME = "Schannel";
const SecPkgInfoA SCHANNEL_SecPkgInfoA =
{
0x000107B3, /* fCapabilities */
1, /* wVersion */
0x000E, /* wRPCID */
0x00006000, /* cbMaxToken */
"Schannel", /* Name */
"Schannel Security Package" /* Comment */
};
const SecPkgInfoW SCHANNEL_SecPkgInfoW =
{
0x000107B3, /* fCapabilities */
1, /* wVersion */
0x000E, /* wRPCID */
0x00006000, /* cbMaxToken */
L"Schannel", /* Name */
L"Schannel Security Package" /* Comment */
};
SECURITY_STATUS SEC_ENTRY schannel_InitializeSecurityContextW(PCredHandle phCredential, PCtxtHandle phContext,
SEC_WCHAR* pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep,
PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext,
@ -260,3 +240,24 @@ const SecurityFunctionTableW SCHANNEL_SecurityFunctionTableW =
schannel_DecryptMessage, /* DecryptMessage */
NULL, /* SetContextAttributes */
};
const SecPkgInfoA SCHANNEL_SecPkgInfoA =
{
0x000107B3, /* fCapabilities */
1, /* wVersion */
0x000E, /* wRPCID */
0x00006000, /* cbMaxToken */
"Schannel", /* Name */
"Schannel Security Package" /* Comment */
};
const SecPkgInfoW SCHANNEL_SecPkgInfoW =
{
0x000107B3, /* fCapabilities */
1, /* wVersion */
0x000E, /* wRPCID */
0x00006000, /* cbMaxToken */
L"Schannel", /* Name */
L"Schannel Security Package" /* Comment */
};

View File

@ -42,9 +42,6 @@ void* sspi_SecureHandleGetUpperPointer(SecHandle* handle);
void sspi_SecureHandleSetUpperPointer(SecHandle* handle, void* pointer);
void sspi_SecureHandleFree(SecHandle* handle);
void sspi_SetAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, char* user, char* domain, char* password);
void sspi_CopyAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, SEC_WINNT_AUTH_IDENTITY* srcIdentity);
enum SecurityFunctionTableIndex
{
EnumerateSecurityPackagesIndex = 1,