[SHELL32] CDrivesFolder: Implement the eject and disconnect menu items. CORE-13841
[reactos.git] / dll / win32 / crypt32 / crypt32_private.h
1 /*
2 * Copyright 2005 Juan Lang
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19 #ifndef __CRYPT32_PRIVATE_H__
20 #define __CRYPT32_PRIVATE_H__
21
22 #include <wine/config.h>
23 #include <wine/port.h>
24
25 #include <assert.h>
26 #include <stdarg.h>
27 #include <stdio.h>
28
29 #define _INC_WINDOWS
30 #define COM_NO_WINDOWS_H
31
32 #define NONAMELESSUNION
33
34 #include <windef.h>
35 #include <winbase.h>
36 #include <winuser.h>
37 #include <winreg.h>
38 #include <snmp.h>
39
40 #define CERT_CHAIN_PARA_HAS_EXTRA_FIELDS
41 #define CERT_REVOCATION_PARA_HAS_EXTRA_FIELDS
42 #include <wincrypt.h>
43
44 #include <mssip.h>
45
46 #include <wine/unicode.h>
47 #include <wine/list.h>
48 #include <wine/exception.h>
49 #include <wine/debug.h>
50
51 #include "cryptres.h"
52
53 /* a few asn.1 tags we need */
54 #define ASN_BOOL (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x01)
55 #define ASN_BITSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03)
56 #define ASN_ENUMERATED (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x0a)
57 #define ASN_UTF8STRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x0c)
58 #define ASN_SETOF (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x11)
59 #define ASN_NUMERICSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x12)
60 #define ASN_PRINTABLESTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x13)
61 #define ASN_T61STRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x14)
62 #define ASN_VIDEOTEXSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x15)
63 #define ASN_IA5STRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x16)
64 #define ASN_UTCTIME (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x17)
65 #define ASN_GENERALTIME (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x18)
66 #define ASN_GRAPHICSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x19)
67 #define ASN_VISIBLESTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1a)
68 #define ASN_GENERALSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1b)
69 #define ASN_UNIVERSALSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1c)
70 #define ASN_BMPSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1e)
71
72 BOOL CRYPT_EncodeLen(DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN;
73
74 typedef BOOL (WINAPI *CryptEncodeObjectExFunc)(DWORD, LPCSTR, const void *,
75 DWORD, PCRYPT_ENCODE_PARA, BYTE *, DWORD *);
76
77 struct AsnEncodeSequenceItem
78 {
79 const void *pvStructInfo;
80 CryptEncodeObjectExFunc encodeFunc;
81 DWORD size; /* used during encoding, not for your use */
82 };
83
84 BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType,
85 struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags,
86 PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN;
87
88 struct AsnConstructedItem
89 {
90 BYTE tag;
91 const void *pvStructInfo;
92 CryptEncodeObjectExFunc encodeFunc;
93 };
94
95 BOOL WINAPI CRYPT_AsnEncodeConstructed(DWORD dwCertEncodingType,
96 LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags,
97 PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN;
98 BOOL WINAPI CRYPT_AsnEncodeOid(DWORD dwCertEncodingType,
99 LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags,
100 PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN;
101 BOOL WINAPI CRYPT_AsnEncodeOctets(DWORD dwCertEncodingType,
102 LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags,
103 PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN;
104
105 typedef struct _CRYPT_DIGESTED_DATA
106 {
107 DWORD version;
108 CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm;
109 CRYPT_CONTENT_INFO ContentInfo;
110 CRYPT_HASH_BLOB hash;
111 } CRYPT_DIGESTED_DATA;
112
113 BOOL CRYPT_AsnEncodePKCSDigestedData(const CRYPT_DIGESTED_DATA *digestedData,
114 void *pvData, DWORD *pcbData) DECLSPEC_HIDDEN;
115
116 typedef struct _CRYPT_ENCRYPTED_CONTENT_INFO
117 {
118 LPSTR contentType;
119 CRYPT_ALGORITHM_IDENTIFIER contentEncryptionAlgorithm;
120 CRYPT_DATA_BLOB encryptedContent;
121 } CRYPT_ENCRYPTED_CONTENT_INFO;
122
123 typedef struct _CRYPT_ENVELOPED_DATA
124 {
125 DWORD version;
126 DWORD cRecipientInfo;
127 PCMSG_KEY_TRANS_RECIPIENT_INFO rgRecipientInfo;
128 CRYPT_ENCRYPTED_CONTENT_INFO encryptedContentInfo;
129 } CRYPT_ENVELOPED_DATA;
130
131 BOOL CRYPT_AsnEncodePKCSEnvelopedData(const CRYPT_ENVELOPED_DATA *envelopedData,
132 void *pvData, DWORD *pcbData) DECLSPEC_HIDDEN;
133
134 BOOL CRYPT_AsnDecodePKCSEnvelopedData(const BYTE *pbEncoded, DWORD cbEncoded,
135 DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara,
136 CRYPT_ENVELOPED_DATA *envelopedData, DWORD *pcbEnvelopedData) DECLSPEC_HIDDEN;
137
138 typedef struct _CRYPT_SIGNED_INFO
139 {
140 DWORD version;
141 DWORD cCertEncoded;
142 PCERT_BLOB rgCertEncoded;
143 DWORD cCrlEncoded;
144 PCRL_BLOB rgCrlEncoded;
145 CRYPT_CONTENT_INFO content;
146 DWORD cSignerInfo;
147 PCMSG_CMS_SIGNER_INFO rgSignerInfo;
148 } CRYPT_SIGNED_INFO;
149
150 BOOL CRYPT_AsnEncodeCMSSignedInfo(CRYPT_SIGNED_INFO *, void *pvData,
151 DWORD *pcbData) DECLSPEC_HIDDEN;
152
153 BOOL CRYPT_AsnDecodeCMSSignedInfo(const BYTE *pbEncoded, DWORD cbEncoded,
154 DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara,
155 CRYPT_SIGNED_INFO *signedInfo, DWORD *pcbSignedInfo) DECLSPEC_HIDDEN;
156
157 /* Helper function to check *pcbEncoded, set it to the required size, and
158 * optionally to allocate memory. Assumes pbEncoded is not NULL.
159 * If CRYPT_ENCODE_ALLOC_FLAG is set in dwFlags, *pbEncoded will be set to a
160 * pointer to the newly allocated memory.
161 */
162 BOOL CRYPT_EncodeEnsureSpace(DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara,
163 BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded) DECLSPEC_HIDDEN;
164
165 BOOL CRYPT_AsnDecodePKCSDigestedData(const BYTE *pbEncoded, DWORD cbEncoded,
166 DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara,
167 CRYPT_DIGESTED_DATA *digestedData, DWORD *pcbDigestedData) DECLSPEC_HIDDEN;
168
169 BOOL WINAPI CRYPT_AsnEncodePubKeyInfoNoNull(DWORD dwCertEncodingType,
170 LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags,
171 PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN;
172
173 /* The following aren't defined in wincrypt.h, as they're "reserved" */
174 #define CERT_CERT_PROP_ID 32
175 #define CERT_CRL_PROP_ID 33
176 #define CERT_CTL_PROP_ID 34
177
178 /* Returns a handle to the default crypto provider; loads it if necessary.
179 * Returns NULL on failure.
180 */
181 HCRYPTPROV CRYPT_GetDefaultProvider(void) DECLSPEC_HIDDEN;
182
183 HINSTANCE hInstance DECLSPEC_HIDDEN;
184
185 void crypt_oid_init(void) DECLSPEC_HIDDEN;
186 void crypt_oid_free(void) DECLSPEC_HIDDEN;
187 void crypt_sip_free(void) DECLSPEC_HIDDEN;
188 void root_store_free(void) DECLSPEC_HIDDEN;
189 void default_chain_engine_free(void) DECLSPEC_HIDDEN;
190
191 /* (Internal) certificate store types and functions */
192 struct WINE_CRYPTCERTSTORE;
193
194 typedef struct _CONTEXT_PROPERTY_LIST CONTEXT_PROPERTY_LIST;
195
196 typedef struct _context_t context_t;
197
198 typedef struct {
199 void (*free)(context_t*);
200 struct _context_t *(*clone)(context_t*,struct WINE_CRYPTCERTSTORE*,BOOL);
201 } context_vtbl_t;
202
203 struct _context_t {
204 const context_vtbl_t *vtbl;
205 LONG ref;
206 struct WINE_CRYPTCERTSTORE *store;
207 struct _context_t *linked;
208 CONTEXT_PROPERTY_LIST *properties;
209 union {
210 struct list entry;
211 void *ptr;
212 } u;
213 };
214
215 static inline context_t *context_from_ptr(const void *ptr)
216 {
217 return (context_t*)ptr-1;
218 }
219
220 static inline void *context_ptr(context_t *context)
221 {
222 return context+1;
223 }
224
225 typedef struct {
226 context_t base;
227 CERT_CONTEXT ctx;
228 } cert_t;
229
230 static inline cert_t *cert_from_ptr(const CERT_CONTEXT *ptr)
231 {
232 return CONTAINING_RECORD(ptr, cert_t, ctx);
233 }
234
235 typedef struct {
236 context_t base;
237 CRL_CONTEXT ctx;
238 } crl_t;
239
240 static inline crl_t *crl_from_ptr(const CRL_CONTEXT *ptr)
241 {
242 return CONTAINING_RECORD(ptr, crl_t, ctx);
243 }
244
245 typedef struct {
246 context_t base;
247 CTL_CONTEXT ctx;
248 } ctl_t;
249
250 static inline ctl_t *ctl_from_ptr(const CTL_CONTEXT *ptr)
251 {
252 return CONTAINING_RECORD(ptr, ctl_t, ctx);
253 }
254
255 /* Some typedefs that make it easier to abstract which type of context we're
256 * working with.
257 */
258 typedef const void *(WINAPI *CreateContextFunc)(DWORD dwCertEncodingType,
259 const BYTE *pbCertEncoded, DWORD cbCertEncoded);
260 typedef BOOL (WINAPI *AddContextToStoreFunc)(HCERTSTORE hCertStore,
261 const void *context, DWORD dwAddDisposition, const void **ppStoreContext);
262 typedef BOOL (WINAPI *AddEncodedContextToStoreFunc)(HCERTSTORE hCertStore,
263 DWORD dwCertEncodingType, const BYTE *pbEncoded, DWORD cbEncoded,
264 DWORD dwAddDisposition, const void **ppContext);
265 typedef const void *(WINAPI *EnumContextsInStoreFunc)(HCERTSTORE hCertStore,
266 const void *pPrevContext);
267 typedef DWORD (WINAPI *EnumPropertiesFunc)(const void *context, DWORD dwPropId);
268 typedef BOOL (WINAPI *GetContextPropertyFunc)(const void *context,
269 DWORD dwPropID, void *pvData, DWORD *pcbData);
270 typedef BOOL (WINAPI *SetContextPropertyFunc)(const void *context,
271 DWORD dwPropID, DWORD dwFlags, const void *pvData);
272 typedef BOOL (WINAPI *SerializeElementFunc)(const void *context, DWORD dwFlags,
273 BYTE *pbElement, DWORD *pcbElement);
274 typedef BOOL (WINAPI *DeleteContextFunc)(const void *contex);
275
276 /* An abstract context (certificate, CRL, or CTL) interface */
277 typedef struct _WINE_CONTEXT_INTERFACE
278 {
279 CreateContextFunc create;
280 AddContextToStoreFunc addContextToStore;
281 AddEncodedContextToStoreFunc addEncodedToStore;
282 EnumContextsInStoreFunc enumContextsInStore;
283 EnumPropertiesFunc enumProps;
284 GetContextPropertyFunc getProp;
285 SetContextPropertyFunc setProp;
286 SerializeElementFunc serialize;
287 DeleteContextFunc deleteFromStore;
288 } WINE_CONTEXT_INTERFACE;
289
290 extern const WINE_CONTEXT_INTERFACE *pCertInterface DECLSPEC_HIDDEN;
291 extern const WINE_CONTEXT_INTERFACE *pCRLInterface DECLSPEC_HIDDEN;
292 extern const WINE_CONTEXT_INTERFACE *pCTLInterface DECLSPEC_HIDDEN;
293
294 typedef struct WINE_CRYPTCERTSTORE * (*StoreOpenFunc)(HCRYPTPROV hCryptProv,
295 DWORD dwFlags, const void *pvPara);
296
297 typedef struct _CONTEXT_FUNCS
298 {
299 /* Called to add a context to a store. If toReplace is not NULL,
300 * context replaces toReplace in the store, and access checks should not be
301 * performed. Otherwise context is a new context, and it should only be
302 * added if the store allows it. If ppStoreContext is not NULL, the added
303 * context should be returned in *ppStoreContext.
304 */
305 BOOL (*addContext)(struct WINE_CRYPTCERTSTORE*,context_t*,context_t*,context_t**,BOOL);
306 context_t *(*enumContext)(struct WINE_CRYPTCERTSTORE *store, context_t *prev);
307 BOOL (*delete)(struct WINE_CRYPTCERTSTORE*,context_t*);
308 } CONTEXT_FUNCS;
309
310 typedef enum _CertStoreType {
311 StoreTypeMem,
312 StoreTypeCollection,
313 StoreTypeProvider,
314 StoreTypeEmpty
315 } CertStoreType;
316
317 #define WINE_CRYPTCERTSTORE_MAGIC 0x74726563
318
319 /* A cert store is polymorphic through the use of function pointers. A type
320 * is still needed to distinguish collection stores from other types.
321 * On the function pointers:
322 * - closeStore is called when the store's ref count becomes 0
323 * - control is optional, but should be implemented by any store that supports
324 * persistence
325 */
326
327 typedef struct {
328 void (*addref)(struct WINE_CRYPTCERTSTORE*);
329 DWORD (*release)(struct WINE_CRYPTCERTSTORE*,DWORD);
330 void (*releaseContext)(struct WINE_CRYPTCERTSTORE*,context_t*);
331 BOOL (*control)(struct WINE_CRYPTCERTSTORE*,DWORD,DWORD,void const*);
332 CONTEXT_FUNCS certs;
333 CONTEXT_FUNCS crls;
334 CONTEXT_FUNCS ctls;
335 } store_vtbl_t;
336
337 typedef struct WINE_CRYPTCERTSTORE
338 {
339 DWORD dwMagic;
340 LONG ref;
341 DWORD dwOpenFlags;
342 CertStoreType type;
343 const store_vtbl_t *vtbl;
344 CONTEXT_PROPERTY_LIST *properties;
345 } WINECRYPT_CERTSTORE;
346
347 void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, DWORD dwFlags,
348 CertStoreType type, const store_vtbl_t*) DECLSPEC_HIDDEN;
349 void CRYPT_FreeStore(WINECRYPT_CERTSTORE *store) DECLSPEC_HIDDEN;
350 BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0,
351 DWORD unk1) DECLSPEC_HIDDEN;
352
353 WINECRYPT_CERTSTORE *CRYPT_CollectionOpenStore(HCRYPTPROV hCryptProv,
354 DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN;
355 WINECRYPT_CERTSTORE *CRYPT_ProvCreateStore(DWORD dwFlags,
356 WINECRYPT_CERTSTORE *memStore, const CERT_STORE_PROV_INFO *pProvInfo) DECLSPEC_HIDDEN;
357 WINECRYPT_CERTSTORE *CRYPT_ProvOpenStore(LPCSTR lpszStoreProvider,
358 DWORD dwEncodingType, HCRYPTPROV hCryptProv, DWORD dwFlags,
359 const void *pvPara) DECLSPEC_HIDDEN;
360 WINECRYPT_CERTSTORE *CRYPT_RegOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags,
361 const void *pvPara) DECLSPEC_HIDDEN;
362 WINECRYPT_CERTSTORE *CRYPT_FileOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags,
363 const void *pvPara) DECLSPEC_HIDDEN;
364 WINECRYPT_CERTSTORE *CRYPT_FileNameOpenStoreA(HCRYPTPROV hCryptProv,
365 DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN;
366 WINECRYPT_CERTSTORE *CRYPT_FileNameOpenStoreW(HCRYPTPROV hCryptProv,
367 DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN;
368
369 void CRYPT_ImportSystemRootCertsToReg(void) DECLSPEC_HIDDEN;
370 BOOL CRYPT_SerializeContextsToReg(HKEY key, DWORD flags, const WINE_CONTEXT_INTERFACE *contextInterface,
371 HCERTSTORE memStore) DECLSPEC_HIDDEN;
372
373 BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert) DECLSPEC_HIDDEN;
374
375 /* Allocates and initializes a certificate chain engine, but without creating
376 * the root store. Instead, it uses root, and assumes the caller has done any
377 * checking necessary.
378 */
379 HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE, DWORD, const CERT_CHAIN_ENGINE_CONFIG*) DECLSPEC_HIDDEN;
380
381 /* Helper function for store reading functions and
382 * CertAddSerializedElementToStore. Returns a context of the appropriate type
383 * if it can, or NULL otherwise. Doesn't validate any of the properties in
384 * the serialized context (for example, bad hashes are retained.)
385 * *pdwContentType is set to the type of the returned context.
386 */
387 const void *CRYPT_ReadSerializedElement(const BYTE *pbElement,
388 DWORD cbElement, DWORD dwContextTypeFlags, DWORD *pdwContentType) DECLSPEC_HIDDEN;
389
390 /* Reads contexts serialized in the file into the memory store. Returns FALSE
391 * if the file is not of the expected format.
392 */
393 BOOL CRYPT_ReadSerializedStoreFromFile(HANDLE file, HCERTSTORE store) DECLSPEC_HIDDEN;
394
395 /* Reads contexts serialized in the blob into the memory store. Returns FALSE
396 * if the file is not of the expected format.
397 */
398 BOOL CRYPT_ReadSerializedStoreFromBlob(const CRYPT_DATA_BLOB *blob,
399 HCERTSTORE store) DECLSPEC_HIDDEN;
400
401 /* Fixes up the pointers in info, where info is assumed to be a
402 * CRYPT_KEY_PROV_INFO, followed by its container name, provider name, and any
403 * provider parameters, in a contiguous buffer, but where info's pointers are
404 * assumed to be invalid. Upon return, info's pointers point to the
405 * appropriate memory locations.
406 */
407 void CRYPT_FixKeyProvInfoPointers(PCRYPT_KEY_PROV_INFO info) DECLSPEC_HIDDEN;
408
409 /**
410 * String functions
411 */
412
413 DWORD cert_name_to_str_with_indent(DWORD dwCertEncodingType, DWORD indent,
414 const CERT_NAME_BLOB *pName, DWORD dwStrType, LPWSTR psz, DWORD csz) DECLSPEC_HIDDEN;
415
416 /**
417 * Context functions
418 */
419
420 /* Allocates a new data context, a context which owns properties directly.
421 * contextSize is the size of the public data type associated with context,
422 * which should be one of CERT_CONTEXT, CRL_CONTEXT, or CTL_CONTEXT.
423 * Free with Context_Release.
424 */
425 context_t *Context_CreateDataContext(size_t contextSize, const context_vtbl_t *vtbl, struct WINE_CRYPTCERTSTORE*) DECLSPEC_HIDDEN;
426
427 /* Creates a new link context. The context refers to linked
428 * rather than owning its own properties. If addRef is TRUE (which ordinarily
429 * it should be) linked is addref'd.
430 * Free with Context_Release.
431 */
432 context_t *Context_CreateLinkContext(unsigned contextSize, context_t *linked, struct WINE_CRYPTCERTSTORE*) DECLSPEC_HIDDEN;
433
434 /* Copies properties from fromContext to toContext. */
435 void Context_CopyProperties(const void *to, const void *from) DECLSPEC_HIDDEN;
436
437 void Context_AddRef(context_t*) DECLSPEC_HIDDEN;
438 void Context_Release(context_t *context) DECLSPEC_HIDDEN;
439 void Context_Free(context_t*) DECLSPEC_HIDDEN;
440
441 /**
442 * Context property list functions
443 */
444
445 CONTEXT_PROPERTY_LIST *ContextPropertyList_Create(void) DECLSPEC_HIDDEN;
446
447 /* Searches for the property with ID id in the context. Returns TRUE if found,
448 * and copies the property's length and a pointer to its data to blob.
449 * Otherwise returns FALSE.
450 */
451 BOOL ContextPropertyList_FindProperty(CONTEXT_PROPERTY_LIST *list, DWORD id,
452 PCRYPT_DATA_BLOB blob) DECLSPEC_HIDDEN;
453
454 BOOL ContextPropertyList_SetProperty(CONTEXT_PROPERTY_LIST *list, DWORD id,
455 const BYTE *pbData, size_t cbData) DECLSPEC_HIDDEN;
456
457 void ContextPropertyList_RemoveProperty(CONTEXT_PROPERTY_LIST *list, DWORD id) DECLSPEC_HIDDEN;
458
459 DWORD ContextPropertyList_EnumPropIDs(CONTEXT_PROPERTY_LIST *list, DWORD id) DECLSPEC_HIDDEN;
460
461 void ContextPropertyList_Copy(CONTEXT_PROPERTY_LIST *to,
462 CONTEXT_PROPERTY_LIST *from) DECLSPEC_HIDDEN;
463
464 void ContextPropertyList_Free(CONTEXT_PROPERTY_LIST *list) DECLSPEC_HIDDEN;
465
466 extern WINECRYPT_CERTSTORE empty_store DECLSPEC_HIDDEN;
467 void init_empty_store(void) DECLSPEC_HIDDEN;
468
469 /**
470 * Utilities.
471 */
472
473 /* Align up to a DWORD_PTR boundary
474 */
475 #define ALIGN_DWORD_PTR(x) (((x) + sizeof(DWORD_PTR) - 1) & ~(sizeof(DWORD_PTR) - 1))
476 #define POINTER_ALIGN_DWORD_PTR(p) ((LPVOID)ALIGN_DWORD_PTR((DWORD_PTR)(p)))
477
478 /* Check if the OID is a small int
479 */
480 #define IS_INTOID(x) (((ULONG_PTR)(x) >> 16) == 0)
481
482 #endif /* __CRYPT32_PRIVATE_H__ */