2 * secur32 private definitions.
4 * Copyright (C) 2004 Juan Lang
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __SECUR32_PRIV_H__
22 #define __SECUR32_PRIV_H__
24 #include "wine/list.h"
26 /* Memory allocation functions for memory accessible by callers of secur32.
27 * There is no REALLOC, because LocalReAlloc can only work if used in
28 * conjunction with LMEM_MOVEABLE and LocalLock, but callers aren't using
29 * LocalLock. I don't use the Heap functions because there seems to be an
30 * implicit assumption that LocalAlloc and Free will be used--MS' secur32
31 * imports them (but not the heap functions), the sample SSP uses them, and
32 * there isn't an exported secur32 function to allocate memory.
34 #define SECUR32_ALLOC(bytes) LocalAlloc(0, (bytes))
35 #define SECUR32_FREE(p) LocalFree(p)
37 typedef struct _SecureProvider
43 SecurityFunctionTableA fnTableA;
44 SecurityFunctionTableW fnTableW;
47 typedef struct _SecurePackage
51 SecureProvider *provider;
54 /* Allocates space for and initializes a new provider. If fnTableA or fnTableW
55 * is non-NULL, assumes the provider is built-in (and is thus already loaded.)
56 * Otherwise moduleName must not be NULL.
57 * Returns a pointer to the stored provider entry, for use adding packages.
59 SecureProvider *SECUR32_addProvider(PSecurityFunctionTableA fnTableA,
60 PSecurityFunctionTableW fnTableW, PWSTR moduleName);
62 /* Allocates space for and adds toAdd packages with the given provider.
63 * provider must not be NULL, and either infoA or infoW may be NULL, but not
66 void SECUR32_addPackages(SecureProvider *provider, ULONG toAdd,
67 const SecPkgInfoA *infoA, const SecPkgInfoW *infoW);
69 /* Tries to find the package named packageName. If it finds it, implicitly
70 * loads the package if it isn't already loaded.
72 SecurePackage *SECUR32_findPackageW(PWSTR packageName);
74 /* Tries to find the package named packageName. (Thunks to _findPackageW)
76 SecurePackage *SECUR32_findPackageA(PSTR packageName);
78 /* A few string helpers; will return NULL if str is NULL. Free return with
80 PWSTR SECUR32_strdupW(PCWSTR str);
81 PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str);
82 PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str);
84 /* Initialization functions for built-in providers */
85 void SECUR32_initSchannelSP(void);
86 void SECUR32_initNegotiateSP(void);
87 void SECUR32_initNTLMSP(void);
89 /* Functions from base64_codec.c used elsewhere */
90 SECURITY_STATUS encodeBase64(PBYTE in_buf, int in_len, char* out_buf,
91 int max_len, int *out_len);
93 SECURITY_STATUS decodeBase64(char *in_buf, int in_len, BYTE *out_buf,
94 int max_len, int *out_len);
96 #endif /* ndef __SECUR32_PRIV_H__ */