ReactOS 0.4.17-dev-470-gf9e3448
crypt32_private.h File Reference
#include "wine/list.h"
#include "wine/unixlib.h"
Include dependency graph for crypt32_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  AsnEncodeSequenceItem
 
struct  AsnConstructedItem
 
struct  _CRYPT_DIGESTED_DATA
 
struct  _CRYPT_ENCRYPTED_CONTENT_INFO
 
struct  _CRYPT_ENVELOPED_DATA
 
struct  _CRYPT_SIGNED_INFO
 
struct  context_vtbl_t
 
struct  _context_t
 
struct  cert_t
 
struct  crl_t
 
struct  ctl_t
 
struct  _WINE_CONTEXT_INTERFACE
 
struct  _CONTEXT_FUNCS
 
struct  store_vtbl_t
 
struct  WINE_CRYPTCERTSTORE
 
struct  store_CERT_KEY_CONTEXT
 
struct  open_cert_store_params
 
struct  import_store_key_params
 
struct  import_store_cert_params
 
struct  close_cert_store_params
 
struct  enum_root_certs_params
 

Macros

#define ASN_BOOL   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x01)
 
#define ASN_BITSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03)
 
#define ASN_ENUMERATED   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x0a)
 
#define ASN_UTF8STRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x0c)
 
#define ASN_SETOF   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x11)
 
#define ASN_NUMERICSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x12)
 
#define ASN_PRINTABLESTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x13)
 
#define ASN_T61STRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x14)
 
#define ASN_VIDEOTEXSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x15)
 
#define ASN_IA5STRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x16)
 
#define ASN_UTCTIME   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x17)
 
#define ASN_GENERALTIME   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x18)
 
#define ASN_GRAPHICSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x19)
 
#define ASN_VISIBLESTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1a)
 
#define ASN_GENERALSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1b)
 
#define ASN_UNIVERSALSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1c)
 
#define ASN_BMPSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1e)
 
#define CERT_CERT_PROP_ID   32
 
#define CERT_CRL_PROP_ID   33
 
#define CERT_CTL_PROP_ID   34
 
#define WINE_CRYPTCERTSTORE_MAGIC   0x74726563
 
#define ALIGN_DWORD_PTR(x)   (((x) + sizeof(DWORD_PTR) - 1) & ~(sizeof(DWORD_PTR) - 1))
 
#define POINTER_ALIGN_DWORD_PTR(p)   ((LPVOID)ALIGN_DWORD_PTR((DWORD_PTR)(p)))
 
#define IS_INTOID(x)   (((ULONG_PTR)(x) >> 16) == 0)
 
#define CRYPT32_CALL(func, params)   WINE_UNIX_CALL( unix_ ## func, params )
 

Typedefs

typedef BOOL(WINAPICryptEncodeObjectExFunc) (DWORD, LPCSTR, const void *, DWORD, PCRYPT_ENCODE_PARA, BYTE *, DWORD *)
 
typedef struct _CRYPT_DIGESTED_DATA CRYPT_DIGESTED_DATA
 
typedef struct _CRYPT_ENCRYPTED_CONTENT_INFO CRYPT_ENCRYPTED_CONTENT_INFO
 
typedef struct _CRYPT_ENVELOPED_DATA CRYPT_ENVELOPED_DATA
 
typedef struct _CRYPT_SIGNED_INFO CRYPT_SIGNED_INFO
 
typedef struct _CONTEXT_PROPERTY_LIST CONTEXT_PROPERTY_LIST
 
typedef struct _context_t context_t
 
typedef const void *(WINAPICreateContextFunc) (DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded)
 
typedef BOOL(WINAPIAddContextToStoreFunc) (HCERTSTORE hCertStore, const void *context, DWORD dwAddDisposition, const void **ppStoreContext)
 
typedef BOOL(WINAPIAddEncodedContextToStoreFunc) (HCERTSTORE hCertStore, DWORD dwCertEncodingType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwAddDisposition, const void **ppContext)
 
typedef const void *(WINAPIEnumContextsInStoreFunc) (HCERTSTORE hCertStore, const void *pPrevContext)
 
typedef DWORD(WINAPIEnumPropertiesFunc) (const void *context, DWORD dwPropId)
 
typedef BOOL(WINAPIGetContextPropertyFunc) (const void *context, DWORD dwPropID, void *pvData, DWORD *pcbData)
 
typedef BOOL(WINAPISetContextPropertyFunc) (const void *context, DWORD dwPropID, DWORD dwFlags, const void *pvData)
 
typedef BOOL(WINAPISerializeElementFunc) (const void *context, DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement)
 
typedef BOOL(WINAPIDeleteContextFunc) (const void *contex)
 
typedef struct _WINE_CONTEXT_INTERFACE WINE_CONTEXT_INTERFACE
 
typedef struct WINE_CRYPTCERTSTORE *(* StoreOpenFunc) (HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara)
 
typedef struct _CONTEXT_FUNCS CONTEXT_FUNCS
 
typedef enum _CertStoreType CertStoreType
 
typedef struct WINE_CRYPTCERTSTORE WINECRYPT_CERTSTORE
 
typedef UINT64 cert_store_data_t
 

Enumerations

enum  _CertStoreType { StoreTypeMem , StoreTypeCollection , StoreTypeProvider , StoreTypeEmpty }
 
enum  unix_funcs {
  unix_process_attach , unix_process_detach , unix_open_cert_store , unix_import_store_key ,
  unix_import_store_cert , unix_close_cert_store , unix_enum_root_certs , unix_funcs_count
}
 

Functions

BOOL CNG_ImportPubKey (CERT_PUBLIC_KEY_INFO *pubKeyInfo, BCRYPT_KEY_HANDLE *key)
 
BOOL cng_prepare_signature (const char *alg_oid, BYTE *encoded_sig, DWORD encoded_sig_len, BYTE **sig_value, DWORD *sig_len)
 
void CRYPT_CopyReversed (BYTE *dst, const BYTE *src, size_t len)
 
BOOL CRYPT_EncodeLen (DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded)
 
BOOL WINAPI CRYPT_AsnEncodeSequence (DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
BOOL WINAPI CRYPT_AsnEncodeConstructed (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
BOOL WINAPI CRYPT_AsnEncodeOid (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
BOOL WINAPI CRYPT_AsnEncodeOctets (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
BOOL CRYPT_AsnEncodePKCSDigestedData (const CRYPT_DIGESTED_DATA *digestedData, void *pvData, DWORD *pcbData)
 
BOOL CRYPT_AsnEncodePKCSEnvelopedData (const CRYPT_ENVELOPED_DATA *envelopedData, void *pvData, DWORD *pcbData)
 
BOOL CRYPT_AsnDecodePKCSEnvelopedData (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, CRYPT_ENVELOPED_DATA *envelopedData, DWORD *pcbEnvelopedData)
 
BOOL CRYPT_AsnEncodeCMSSignedInfo (CRYPT_SIGNED_INFO *, void *pvData, DWORD *pcbData)
 
BOOL CRYPT_AsnDecodeCMSSignedInfo (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, CRYPT_SIGNED_INFO *signedInfo, DWORD *pcbSignedInfo)
 
BOOL CRYPT_EncodeEnsureSpace (DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded)
 
BOOL CRYPT_AsnDecodePKCSDigestedData (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, CRYPT_DIGESTED_DATA *digestedData, DWORD *pcbDigestedData)
 
BOOL WINAPI CRYPT_AsnEncodePubKeyInfoNoNull (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
HCRYPTPROV WINAPI I_CryptGetDefaultCryptProv (ALG_ID)
 
void crypt_oid_init (void)
 
void crypt_oid_free (void)
 
void crypt_sip_free (void)
 
void root_store_free (void)
 
void default_chain_engine_free (void)
 
static context_tcontext_from_ptr (const void *ptr)
 
static voidcontext_ptr (context_t *context)
 
static cert_tcert_from_ptr (const CERT_CONTEXT *ptr)
 
static crl_tcrl_from_ptr (const CRL_CONTEXT *ptr)
 
static ctl_tctl_from_ptr (const CTL_CONTEXT *ptr)
 
void CRYPT_InitStore (WINECRYPT_CERTSTORE *store, DWORD dwFlags, CertStoreType type, const store_vtbl_t *)
 
void CRYPT_FreeStore (WINECRYPT_CERTSTORE *store)
 
BOOL WINAPI I_CertUpdateStore (HCERTSTORE store1, HCERTSTORE store2, DWORD unk0, DWORD unk1)
 
WINECRYPT_CERTSTORECRYPT_CollectionOpenStore (HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara)
 
WINECRYPT_CERTSTORECRYPT_ProvCreateStore (DWORD dwFlags, WINECRYPT_CERTSTORE *memStore, const CERT_STORE_PROV_INFO *pProvInfo)
 
WINECRYPT_CERTSTORECRYPT_ProvOpenStore (LPCSTR lpszStoreProvider, DWORD dwEncodingType, HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara)
 
WINECRYPT_CERTSTORECRYPT_RegOpenStore (HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara)
 
WINECRYPT_CERTSTORECRYPT_FileOpenStore (HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara)
 
WINECRYPT_CERTSTORECRYPT_FileNameOpenStoreA (HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara)
 
WINECRYPT_CERTSTORECRYPT_FileNameOpenStoreW (HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara)
 
void CRYPT_ImportSystemRootCertsToReg (void)
 
BOOL CRYPT_SerializeContextsToReg (HKEY key, DWORD flags, const WINE_CONTEXT_INTERFACE *contextInterface, HCERTSTORE memStore)
 
void CRYPT_RegReadSerializedFromReg (HKEY key, DWORD contextType, HCERTSTORE store, DWORD disposition)
 
DWORD CRYPT_IsCertificateSelfSigned (const CERT_CONTEXT *cert)
 
HCERTCHAINENGINE CRYPT_CreateChainEngine (HCERTSTORE, DWORD, const CERT_CHAIN_ENGINE_CONFIG *)
 
const voidCRYPT_ReadSerializedElement (const BYTE *pbElement, DWORD cbElement, DWORD dwContextTypeFlags, DWORD *pdwContentType)
 
BOOL CRYPT_ReadSerializedStoreFromFile (HANDLE file, HCERTSTORE store)
 
BOOL CRYPT_ReadSerializedStoreFromBlob (const CRYPT_DATA_BLOB *blob, HCERTSTORE store)
 
void CRYPT_ConvertKeyContext (const struct store_CERT_KEY_CONTEXT *src, CERT_KEY_CONTEXT *dst)
 
DWORD cert_name_to_str_with_indent (DWORD dwCertEncodingType, DWORD indent, const CERT_NAME_BLOB *pName, DWORD dwStrType, LPWSTR psz, DWORD csz)
 
context_tContext_CreateDataContext (size_t contextSize, const context_vtbl_t *vtbl, struct WINE_CRYPTCERTSTORE *)
 
context_tContext_CreateLinkContext (unsigned contextSize, context_t *linked, struct WINE_CRYPTCERTSTORE *)
 
void Context_CopyProperties (const void *to, const void *from)
 
void Context_AddRef (context_t *)
 
void Context_Release (context_t *context)
 
void Context_Free (context_t *)
 
CONTEXT_PROPERTY_LISTContextPropertyList_Create (void)
 
BOOL ContextPropertyList_FindProperty (CONTEXT_PROPERTY_LIST *list, DWORD id, PCRYPT_DATA_BLOB blob)
 
BOOL ContextPropertyList_SetProperty (CONTEXT_PROPERTY_LIST *list, DWORD id, const BYTE *pbData, size_t cbData)
 
void ContextPropertyList_RemoveProperty (CONTEXT_PROPERTY_LIST *list, DWORD id)
 
DWORD ContextPropertyList_EnumPropIDs (CONTEXT_PROPERTY_LIST *list, DWORD id)
 
void ContextPropertyList_Copy (CONTEXT_PROPERTY_LIST *to, CONTEXT_PROPERTY_LIST *from)
 
void ContextPropertyList_Free (CONTEXT_PROPERTY_LIST *list)
 
void init_empty_store (void)
 

Variables

HINSTANCE hInstance
 
const WINE_CONTEXT_INTERFACEpCertInterface
 
const WINE_CONTEXT_INTERFACEpCRLInterface
 
const WINE_CONTEXT_INTERFACEpCTLInterface
 
WINECRYPT_CERTSTORE empty_store
 

Macro Definition Documentation

◆ ALIGN_DWORD_PTR

#define ALIGN_DWORD_PTR (   x)    (((x) + sizeof(DWORD_PTR) - 1) & ~(sizeof(DWORD_PTR) - 1))

Utilities.

Definition at line 459 of file crypt32_private.h.

◆ ASN_BITSTRING

#define ASN_BITSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03)

Definition at line 31 of file crypt32_private.h.

◆ ASN_BMPSTRING

#define ASN_BMPSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1e)

Definition at line 46 of file crypt32_private.h.

◆ ASN_BOOL

#define ASN_BOOL   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x01)

Definition at line 30 of file crypt32_private.h.

◆ ASN_ENUMERATED

#define ASN_ENUMERATED   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x0a)

Definition at line 32 of file crypt32_private.h.

◆ ASN_GENERALSTRING

#define ASN_GENERALSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1b)

Definition at line 44 of file crypt32_private.h.

◆ ASN_GENERALTIME

#define ASN_GENERALTIME   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x18)

Definition at line 41 of file crypt32_private.h.

◆ ASN_GRAPHICSTRING

#define ASN_GRAPHICSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x19)

Definition at line 42 of file crypt32_private.h.

◆ ASN_IA5STRING

#define ASN_IA5STRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x16)

Definition at line 39 of file crypt32_private.h.

◆ ASN_NUMERICSTRING

#define ASN_NUMERICSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x12)

Definition at line 35 of file crypt32_private.h.

◆ ASN_PRINTABLESTRING

#define ASN_PRINTABLESTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x13)

Definition at line 36 of file crypt32_private.h.

◆ ASN_SETOF

#define ASN_SETOF   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x11)

Definition at line 34 of file crypt32_private.h.

◆ ASN_T61STRING

#define ASN_T61STRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x14)

Definition at line 37 of file crypt32_private.h.

◆ ASN_UNIVERSALSTRING

#define ASN_UNIVERSALSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1c)

Definition at line 45 of file crypt32_private.h.

◆ ASN_UTCTIME

#define ASN_UTCTIME   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x17)

Definition at line 40 of file crypt32_private.h.

◆ ASN_UTF8STRING

#define ASN_UTF8STRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x0c)

Definition at line 33 of file crypt32_private.h.

◆ ASN_VIDEOTEXSTRING

#define ASN_VIDEOTEXSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x15)

Definition at line 38 of file crypt32_private.h.

◆ ASN_VISIBLESTRING

#define ASN_VISIBLESTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1a)

Definition at line 43 of file crypt32_private.h.

◆ CERT_CERT_PROP_ID

#define CERT_CERT_PROP_ID   32

Definition at line 156 of file crypt32_private.h.

◆ CERT_CRL_PROP_ID

#define CERT_CRL_PROP_ID   33

Definition at line 157 of file crypt32_private.h.

◆ CERT_CTL_PROP_ID

#define CERT_CTL_PROP_ID   34

Definition at line 158 of file crypt32_private.h.

◆ CRYPT32_CALL

#define CRYPT32_CALL (   func,
  params 
)    WINE_UNIX_CALL( unix_ ## func, params )

Definition at line 516 of file crypt32_private.h.

◆ IS_INTOID

#define IS_INTOID (   x)    (((ULONG_PTR)(x) >> 16) == 0)

Definition at line 464 of file crypt32_private.h.

◆ POINTER_ALIGN_DWORD_PTR

#define POINTER_ALIGN_DWORD_PTR (   p)    ((LPVOID)ALIGN_DWORD_PTR((DWORD_PTR)(p)))

Definition at line 460 of file crypt32_private.h.

◆ WINE_CRYPTCERTSTORE_MAGIC

#define WINE_CRYPTCERTSTORE_MAGIC   0x74726563

Definition at line 299 of file crypt32_private.h.

Typedef Documentation

◆ AddContextToStoreFunc

typedef BOOL(WINAPI * AddContextToStoreFunc) (HCERTSTORE hCertStore, const void *context, DWORD dwAddDisposition, const void **ppStoreContext)

Definition at line 242 of file crypt32_private.h.

◆ AddEncodedContextToStoreFunc

typedef BOOL(WINAPI * AddEncodedContextToStoreFunc) (HCERTSTORE hCertStore, DWORD dwCertEncodingType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwAddDisposition, const void **ppContext)

Definition at line 244 of file crypt32_private.h.

◆ cert_store_data_t

Definition at line 468 of file crypt32_private.h.

◆ CertStoreType

◆ CONTEXT_FUNCS

◆ CONTEXT_PROPERTY_LIST

◆ context_t

Definition at line 178 of file crypt32_private.h.

◆ CreateContextFunc

typedef const void *(WINAPI * CreateContextFunc) (DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded)

Definition at line 240 of file crypt32_private.h.

◆ CRYPT_DIGESTED_DATA

◆ CRYPT_ENCRYPTED_CONTENT_INFO

◆ CRYPT_ENVELOPED_DATA

◆ CRYPT_SIGNED_INFO

◆ CryptEncodeObjectExFunc

typedef BOOL(WINAPI * CryptEncodeObjectExFunc) (DWORD, LPCSTR, const void *, DWORD, PCRYPT_ENCODE_PARA, BYTE *, DWORD *)

Definition at line 55 of file crypt32_private.h.

◆ DeleteContextFunc

typedef BOOL(WINAPI * DeleteContextFunc) (const void *contex)

Definition at line 256 of file crypt32_private.h.

◆ EnumContextsInStoreFunc

typedef const void *(WINAPI * EnumContextsInStoreFunc) (HCERTSTORE hCertStore, const void *pPrevContext)

Definition at line 247 of file crypt32_private.h.

◆ EnumPropertiesFunc

typedef DWORD(WINAPI * EnumPropertiesFunc) (const void *context, DWORD dwPropId)

Definition at line 249 of file crypt32_private.h.

◆ GetContextPropertyFunc

typedef BOOL(WINAPI * GetContextPropertyFunc) (const void *context, DWORD dwPropID, void *pvData, DWORD *pcbData)

Definition at line 250 of file crypt32_private.h.

◆ SerializeElementFunc

typedef BOOL(WINAPI * SerializeElementFunc) (const void *context, DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement)

Definition at line 254 of file crypt32_private.h.

◆ SetContextPropertyFunc

typedef BOOL(WINAPI * SetContextPropertyFunc) (const void *context, DWORD dwPropID, DWORD dwFlags, const void *pvData)

Definition at line 252 of file crypt32_private.h.

◆ StoreOpenFunc

typedef struct WINE_CRYPTCERTSTORE *(* StoreOpenFunc) (HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara)

Definition at line 274 of file crypt32_private.h.

◆ WINE_CONTEXT_INTERFACE

◆ WINECRYPT_CERTSTORE

Enumeration Type Documentation

◆ _CertStoreType

Enumerator
StoreTypeMem 
StoreTypeCollection 
StoreTypeProvider 
StoreTypeEmpty 

Definition at line 292 of file crypt32_private.h.

292 {
enum _CertStoreType CertStoreType
@ StoreTypeCollection
@ StoreTypeEmpty
@ StoreTypeProvider
@ StoreTypeMem

◆ unix_funcs

Enumerator
unix_process_attach 
unix_process_detach 
unix_open_cert_store 
unix_import_store_key 
unix_import_store_cert 
unix_close_cert_store 
unix_enum_root_certs 
unix_funcs_count 

Definition at line 504 of file crypt32_private.h.

505{
514};
@ unix_process_detach
@ unix_open_cert_store
@ unix_process_attach
@ unix_enum_root_certs
@ unix_import_store_key
@ unix_import_store_cert
@ unix_close_cert_store
@ unix_funcs_count

Function Documentation

◆ cert_from_ptr()

◆ cert_name_to_str_with_indent()

DWORD cert_name_to_str_with_indent ( DWORD  dwCertEncodingType,
DWORD  indent,
const CERT_NAME_BLOB pName,
DWORD  dwStrType,
LPWSTR  psz,
DWORD  csz 
)

String functions

Definition at line 336 of file str.c.

338{
339 static const DWORD unsupportedFlags = CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG;
340 DWORD ret = 0, bytes = 0;
341 BOOL bRet;
343 DWORD chars;
344
345 if (dwStrType & unsupportedFlags)
346 FIXME("unsupported flags: %08lx\n", dwStrType & unsupportedFlags);
347
348 bRet = CryptDecodeObjectEx(dwCertEncodingType, X509_NAME, pName->pbData,
350 if (bRet)
351 {
352 DWORD i, j, sepLen, rdnSepLen;
353 LPCWSTR sep, rdnSep;
355 const CERT_RDN *rdn = info->rgRDN;
356
357 if(reverse && info->cRDN > 1) rdn += (info->cRDN - 1);
358
359 if (dwStrType & CERT_NAME_STR_SEMICOLON_FLAG)
360 sep = L"; ";
361 else if (dwStrType & CERT_NAME_STR_CRLF_FLAG)
362 sep = L"\r\n";
363 else
364 sep = L", ";
365 sepLen = lstrlenW(sep);
366 if (dwStrType & CERT_NAME_STR_NO_PLUS_FLAG)
367 rdnSep = L" ";
368 else
369 rdnSep = L" + ";
370 rdnSepLen = lstrlenW(rdnSep);
371 if (!csz) psz = NULL;
372 for (i = 0; i < info->cRDN; i++)
373 {
374 if (psz && ret + 1 == csz) break;
375 for (j = 0; j < rdn->cRDNAttr; j++)
376 {
377 LPCSTR prefixA = NULL;
378 LPCWSTR prefixW = NULL;
379
380 if (psz && ret + 1 == csz) break;
381
382 if ((dwStrType & 0x000000ff) == CERT_OID_NAME_STR)
383 prefixA = rdn->rgRDNAttr[j].pszObjId;
384 else if ((dwStrType & 0x000000ff) == CERT_X500_NAME_STR)
385 {
388 rdn->rgRDNAttr[j].pszObjId,
390
391 if (oidInfo)
392 prefixW = oidInfo->pwszName;
393 else
394 prefixA = rdn->rgRDNAttr[j].pszObjId;
395 }
396 if (dwStrType & CERT_NAME_STR_CRLF_FLAG)
397 {
398 DWORD k;
399
400 for (k = 0; k < indentLevel; k++)
401 {
402 if (psz)
403 {
404 chars = min(lstrlenW(indent), csz - ret - 1);
405 memcpy(psz + ret, indent, chars * sizeof(WCHAR));
406 }
407 else
408 chars = lstrlenW(indent);
409 ret += chars;
410 }
411 if (psz && ret + 1 == csz) break;
412 }
413 if (prefixW)
414 {
415 /* - 1 is needed to account for the NULL terminator. */
416 chars = CRYPT_AddPrefixW(prefixW,
417 psz ? psz + ret : NULL, psz ? csz - ret - 1 : 0);
418 ret += chars;
419 }
420 else if (prefixA)
421 {
422 /* - 1 is needed to account for the NULL terminator. */
423 chars = CRYPT_AddPrefixAToW(prefixA,
424 psz ? psz + ret : NULL, psz ? csz - ret - 1 : 0);
425 ret += chars;
426 }
427 if (psz && ret + 1 == csz) break;
428
429 chars = quote_rdn_value_to_str_w(rdn->rgRDNAttr[j].dwValueType, &rdn->rgRDNAttr[j].Value, dwStrType,
430 psz ? psz + ret : NULL, psz ? csz - ret - 1 : 0);
431 ret += chars;
432 if (j < rdn->cRDNAttr - 1)
433 {
434 if (psz)
435 {
436 chars = min(rdnSepLen, csz - ret - 1);
437 memcpy(psz + ret, rdnSep, chars * sizeof(WCHAR));
438 ret += chars;
439 }
440 else ret += rdnSepLen;
441 }
442 }
443 if (psz && ret + 1 == csz) break;
444 if (i < info->cRDN - 1)
445 {
446 if (psz)
447 {
448 chars = min(sepLen, csz - ret - 1);
449 memcpy(psz + ret, sep, chars * sizeof(WCHAR));
450 ret += chars;
451 }
452 else ret += sepLen;
453 }
454 if(reverse) rdn--;
455 else rdn++;
456 }
458 }
459 if (psz && csz) psz[ret] = 0;
460 return ret + 1;
461}
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define FIXME(fmt,...)
Definition: precomp.h:53
BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:6998
#define NULL
Definition: types.h:112
static struct list oidInfo
Definition: oid.c:1194
PCCRYPT_OID_INFO WINAPI CryptFindOIDInfo(DWORD dwKeyType, void *pvKey, DWORD dwGroupId)
Definition: oid.c:1714
static DWORD CRYPT_AddPrefixAToW(LPCSTR prefix, LPWSTR psz, DWORD csz)
Definition: str.c:290
static DWORD quote_rdn_value_to_str_w(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, DWORD dwStrType, LPWSTR psz, DWORD csz)
Definition: str.c:147
static const WCHAR indent[]
Definition: str.c:334
static DWORD CRYPT_AddPrefixW(LPCWSTR prefix, LPWSTR psz, DWORD csz)
Definition: str.c:316
#define lstrlenW
Definition: compat.h:750
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static LPSTR pName
Definition: security.c:86
#define min(a, b)
Definition: monoChain.cc:55
int k
Definition: mpi.c:3369
short WCHAR
Definition: pedump.c:58
LPSTR pszObjId
Definition: wincrypt.h:265
DWORD dwValueType
Definition: wincrypt.h:266
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:267
DWORD cRDNAttr
Definition: wincrypt.h:271
PCERT_RDN_ATTR rgRDNAttr
Definition: wincrypt.h:272
const char * LPCSTR
Definition: typedefs.h:52
const uint16_t * LPCWSTR
Definition: typedefs.h:57
static void reverse(int *pidx, int cch)
Definition: bidi.c:1153
#define CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG
Definition: wincrypt.h:3652
#define X509_NAME
Definition: wincrypt.h:3524
#define CERT_X500_NAME_STR
Definition: wincrypt.h:3644
#define CERT_NAME_STR_NO_PLUS_FLAG
Definition: wincrypt.h:3646
#define CERT_NAME_STR_SEMICOLON_FLAG
Definition: wincrypt.h:3645
#define CRYPT_RDN_ATTR_OID_GROUP_ID
Definition: wincrypt.h:1941
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3612
#define CERT_NAME_STR_CRLF_FLAG
Definition: wincrypt.h:3648
#define CRYPT_OID_INFO_OID_KEY
Definition: wincrypt.h:1955
#define CERT_NAME_STR_REVERSE_FLAG
Definition: wincrypt.h:3650
#define CERT_OID_NAME_STR
Definition: wincrypt.h:3643

Referenced by CertGetNameStringW(), CertNameToStrW(), CRYPT_FormatAltNameEntry(), and name_value_to_str().

◆ CNG_ImportPubKey()

BOOL CNG_ImportPubKey ( CERT_PUBLIC_KEY_INFO pubKeyInfo,
BCRYPT_KEY_HANDLE key 
)

Definition at line 2770 of file cert.c.

2771{
2772 if (!strcmp(pubKeyInfo->Algorithm.pszObjId, szOID_ECC_PUBLIC_KEY))
2773 return CNG_ImportECCPubKey(pubKeyInfo, key);
2774
2775 if (!strcmp(pubKeyInfo->Algorithm.pszObjId, szOID_RSA_RSA))
2776 return CNG_ImportRSAPubKey(pubKeyInfo, key);
2777
2778 FIXME("Unsupported public key type: %s\n", debugstr_a(pubKeyInfo->Algorithm.pszObjId));
2780 return FALSE;
2781}
#define FALSE
Definition: types.h:117
static BOOL CNG_ImportRSAPubKey(CERT_PUBLIC_KEY_INFO *info, BCRYPT_KEY_HANDLE *key)
Definition: cert.c:2701
static BOOL CNG_ImportECCPubKey(CERT_PUBLIC_KEY_INFO *pubKeyInfo, BCRYPT_KEY_HANDLE *key)
Definition: cert.c:2637
#define SetLastError(x)
Definition: compat.h:752
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
#define debugstr_a
Definition: kernel32.h:31
CRYPT_ALGORITHM_IDENTIFIER Algorithm
Definition: wincrypt.h:234
Definition: copy.c:22
#define szOID_ECC_PUBLIC_KEY
Definition: wincrypt.h:3216
#define szOID_RSA_RSA
Definition: wincrypt.h:3168
#define NTE_BAD_ALGID
Definition: winerror.h:4255

Referenced by CNG_VerifySignature(), and CryptImportPublicKeyInfoEx2().

◆ cng_prepare_signature()

BOOL cng_prepare_signature ( const char alg_oid,
BYTE encoded_sig,
DWORD  encoded_sig_len,
BYTE **  sig_value,
DWORD sig_len 
)

Definition at line 2822 of file cert.c.

2824{
2825 if (!strcmp(alg_oid, szOID_ECC_PUBLIC_KEY))
2826 return CNG_PrepareSignatureECC(encoded_sig, encoded_sig_len, sig_value, sig_len);
2827
2828 FIXME("Unsupported public key type: %s\n", debugstr_a(alg_oid));
2830 return FALSE;
2831}
static BOOL CNG_PrepareSignatureECC(BYTE *encoded_sig, DWORD encoded_size, BYTE **sig_value, DWORD *sig_len)
Definition: cert.c:2783

Referenced by CNG_PrepareCertSignature(), and cng_verify_msg_signature().

◆ Context_AddRef()

void Context_AddRef ( context_t context)

Definition at line 78 of file context.c.

79{
81
82 TRACE("(%p) ref=%ld\n", context, context->ref);
83
84 if(ref == 1) {
85 /* This is the first external (non-store) reference. Increase store ref cnt. */
86 context->store->vtbl->addref(context->store);
87 }
88}
#define InterlockedIncrement
Definition: armddk.h:53
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
Definition: http.c:7252
Definition: send.c:48

Referenced by CertDuplicateCertificateContext(), CertDuplicateCRLContext(), CertDuplicateCTLContext(), Context_CreateLinkContext(), CRYPT_CollectionAdvanceEnum(), CRYPT_QuerySerializedContextObject(), EmptyStore_add(), and MemStore_enumContext().

◆ Context_CopyProperties()

void Context_CopyProperties ( const void to,
const void from 
)

Definition at line 123 of file context.c.

124{
125 CONTEXT_PROPERTY_LIST *toProperties, *fromProperties;
126
127 toProperties = context_from_ptr(to)->properties;
128 fromProperties = context_from_ptr(from)->properties;
129 assert(toProperties && fromProperties);
130 ContextPropertyList_Copy(toProperties, fromProperties);
131}
static context_t * context_from_ptr(const void *ptr)
void ContextPropertyList_Copy(CONTEXT_PROPERTY_LIST *to, CONTEXT_PROPERTY_LIST *from)
Definition: proplist.c:207
#define assert(_expr)
Definition: assert.h:32
CardRegion * from
Definition: spigame.cpp:19
CONTEXT_PROPERTY_LIST * properties

Referenced by add_cert_to_store(), Cert_clone(), CertAddCRLContextToStore(), CertAddCTLContextToStore(), and CRL_clone().

◆ Context_CreateDataContext()

context_t * Context_CreateDataContext ( size_t  contextSize,
const context_vtbl_t vtbl,
struct WINE_CRYPTCERTSTORE store 
)

Context functions

Definition at line 28 of file context.c.

29{
31
32 context = CryptMemAlloc(sizeof(context_t) + contextSize);
33 if (!context)
34 return NULL;
35
36 context->properties = ContextPropertyList_Create();
37 if (!context->properties)
38 {
40 return NULL;
41 }
42
43 context->vtbl = vtbl;
44 context->ref = 1;
45 context->linked = NULL;
46
47 store->vtbl->addref(store);
48 context->store = store;
49
50 TRACE("returning %p\n", context);
51 return context;
52}
CONTEXT_PROPERTY_LIST * ContextPropertyList_Create(void)
Definition: proplist.c:43
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:136
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:146
const store_vtbl_t * vtbl
void(* addref)(struct WINE_CRYPTCERTSTORE *)

Referenced by Cert_clone(), CertCreateCertificateContext(), CertCreateCRLContext(), CertCreateCTLContext(), and CRL_clone().

◆ Context_CreateLinkContext()

context_t * Context_CreateLinkContext ( unsigned  contextSize,
context_t linked,
struct WINE_CRYPTCERTSTORE  
)

◆ Context_Free()

void Context_Free ( context_t context)

Definition at line 90 of file context.c.

91{
92 TRACE("(%p)\n", context);
93
94 assert(!context->ref);
95
96 if (!context->linked) {
98 context->vtbl->free(context);
99 }else {
100 Context_Release(context->linked);
101 }
102
104}
void ContextPropertyList_Free(CONTEXT_PROPERTY_LIST *list)
Definition: proplist.c:56
void Context_Release(context_t *context)
Definition: context.c:106

Referenced by Collection_releaseContext(), EmptyStore_releaseContext(), free_contexts(), MemStore_deleteContext(), and MemStore_releaseContext().

◆ context_from_ptr()

◆ context_ptr()

◆ Context_Release()

void Context_Release ( context_t context)

Definition at line 106 of file context.c.

107{
109
110 TRACE("(%p) ref=%ld\n", context, ref);
111 assert(ref >= 0);
112
113 if (!ref) {
114 WINECRYPT_CERTSTORE *store = context->store;
115
116 /* This is the last reference, but the context still may be in a store.
117 * We release our store reference, but leave it up to store to free or keep the context. */
118 store->vtbl->releaseContext(store, context);
119 store->vtbl->release(store, 0);
120 }
121}
#define InterlockedDecrement
Definition: armddk.h:52
DWORD(* release)(struct WINE_CRYPTCERTSTORE *, DWORD)
void(* releaseContext)(struct WINE_CRYPTCERTSTORE *, context_t *)

Referenced by add_cert_to_store(), CertAddSerializedElementToStore(), CertCreateCertificateContext(), CertCreateCRLContext(), CertCreateCTLContext(), CertFreeCertificateContext(), CertFreeCRLContext(), CertFreeCTLContext(), Collection_addCert(), Collection_addCRL(), Collection_addCTL(), Context_Free(), CRYPT_CollectionAdvanceEnum(), CRYPT_QuerySerializedContextObject(), CRYPT_ReadSerializedElement(), CRYPT_ReadSerializedStore(), CRYPT_RegReadSerializedFromReg(), CRYPT_SerializeContextsToReg(), CRYPT_SerializeContextsToStream(), MemStore_addContext(), and MemStore_enumContext().

◆ ContextPropertyList_Copy()

void ContextPropertyList_Copy ( CONTEXT_PROPERTY_LIST to,
CONTEXT_PROPERTY_LIST from 
)

Definition at line 207 of file proplist.c.

208{
209 CONTEXT_PROPERTY *prop;
210
212 LIST_FOR_EACH_ENTRY(prop, &from->properties, CONTEXT_PROPERTY, entry)
213 {
215 prop->cbData);
216 }
218}
uint32_t entry
Definition: isohybrid.c:63
BOOL ContextPropertyList_SetProperty(CONTEXT_PROPERTY_LIST *list, DWORD id, const BYTE *pbData, size_t cbData)
Definition: proplist.c:95
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by Context_CopyProperties().

◆ ContextPropertyList_Create()

CONTEXT_PROPERTY_LIST * ContextPropertyList_Create ( void  )

Context property list functions

Definition at line 43 of file proplist.c.

44{
46
47 if (list)
48 {
50 list->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": PCONTEXT_PROPERTY_LIST->cs");
51 list_init(&list->properties);
52 }
53 return list;
54}
static void list_init(struct list_entry *head)
Definition: list.h:51
Definition: list.h:37
BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount, IN DWORD flags)
Definition: sync.c:107
#define list
Definition: rosglue.h:35
#define DWORD_PTR
Definition: treelist.c:76
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO
Definition: winnt_old.h:1156

Referenced by CertSetStoreProperty(), Context_CreateDataContext(), and CryptMsgOpenToDecode().

◆ ContextPropertyList_EnumPropIDs()

DWORD ContextPropertyList_EnumPropIDs ( CONTEXT_PROPERTY_LIST list,
DWORD  id 
)

Definition at line 170 of file proplist.c.

171{
172 DWORD ret;
173
175 if (id)
176 {
177 CONTEXT_PROPERTY *cursor = NULL, *prop;
178
179 LIST_FOR_EACH_ENTRY(prop, &list->properties, CONTEXT_PROPERTY, entry)
180 {
181 if (prop->propID == id)
182 {
183 cursor = prop;
184 break;
185 }
186 }
187 if (cursor)
188 {
189 if (cursor->entry.next != &list->properties)
190 ret = LIST_ENTRY(cursor->entry.next, CONTEXT_PROPERTY,
191 entry)->propID;
192 else
193 ret = 0;
194 }
195 else
196 ret = 0;
197 }
198 else if (!list_empty(&list->properties))
199 ret = LIST_ENTRY(list->properties.next, CONTEXT_PROPERTY,
200 entry)->propID;
201 else
202 ret = 0;
204 return ret;
205}
static int list_empty(struct list_entry *head)
Definition: list.h:58
struct list * next
Definition: list.h:38
const char cursor[]
Definition: icontest.c:13
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by CertEnumCertificateContextProperties(), CertEnumCRLContextProperties(), and CertEnumCTLContextProperties().

◆ ContextPropertyList_FindProperty()

BOOL ContextPropertyList_FindProperty ( CONTEXT_PROPERTY_LIST list,
DWORD  id,
PCRYPT_DATA_BLOB  blob 
)

Definition at line 72 of file proplist.c.

74{
75 CONTEXT_PROPERTY *prop;
76 BOOL ret = FALSE;
77
78 TRACE("(%p, %ld, %p)\n", list, id, blob);
79
82 {
83 if (prop->propID == id)
84 {
85 blob->cbData = prop->cbData;
86 blob->pbData = prop->pbData;
87 ret = TRUE;
88 break;
89 }
90 }
92 return ret;
93}
#define TRUE
Definition: types.h:120
Definition: image.c:134

Referenced by CDecodeHashMsg_GetParam(), CDecodeHashMsg_VerifyHash(), CDecodeMsg_FinalizeHashedContent(), CDecodeMsg_GetParam(), CertContext_GetProperty(), CertGetStoreProperty(), CRLContext_GetProperty(), and CTLContext_GetProperty().

◆ ContextPropertyList_Free()

void ContextPropertyList_Free ( CONTEXT_PROPERTY_LIST list)

Definition at line 56 of file proplist.c.

57{
58 CONTEXT_PROPERTY *prop, *next;
59
61 entry)
62 {
63 list_remove(&prop->entry);
64 CryptMemFree(prop->pbData);
65 CryptMemFree(prop);
66 }
67 list->cs.DebugInfo->Spare[0] = 0;
70}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static unsigned __int64 next
Definition: rand_nt.c:6
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
struct list entry
Definition: proplist.c:40
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

Referenced by CDecodeMsg_Close(), Context_Free(), and CRYPT_FreeStore().

◆ ContextPropertyList_RemoveProperty()

void ContextPropertyList_RemoveProperty ( CONTEXT_PROPERTY_LIST list,
DWORD  id 
)

Definition at line 149 of file proplist.c.

150{
151 CONTEXT_PROPERTY *prop;
152
154 LIST_FOR_EACH_ENTRY(prop, &list->properties, CONTEXT_PROPERTY, entry)
155 {
156 if (prop->propID == id)
157 {
158 list_remove(&prop->entry);
159 CryptMemFree(prop->pbData);
160 CryptMemFree(prop);
161 break;
162 }
163 }
165}

Referenced by CertContext_SetProperty(), CertSetStoreProperty(), CRLContext_SetProperty(), and CTLContext_SetProperty().

◆ ContextPropertyList_SetProperty()

BOOL ContextPropertyList_SetProperty ( CONTEXT_PROPERTY_LIST list,
DWORD  id,
const BYTE pbData,
size_t  cbData 
)

Definition at line 95 of file proplist.c.

97{
99 BOOL ret = FALSE;
100
101 if (cbData)
102 {
104 if (data)
105 memcpy(data, pbData, cbData);
106 }
107 else
108 data = NULL;
109 if (!cbData || data)
110 {
111 CONTEXT_PROPERTY *prop;
112 BOOL found = FALSE;
113
115 LIST_FOR_EACH_ENTRY(prop, &list->properties, CONTEXT_PROPERTY, entry)
116 {
117 if (prop->propID == id)
118 {
119 found = TRUE;
120 break;
121 }
122 }
123 if (found)
124 {
125 CryptMemFree(prop->pbData);
126 prop->cbData = cbData;
127 prop->pbData = data;
128 ret = TRUE;
129 }
130 else
131 {
132 prop = CryptMemAlloc(sizeof(CONTEXT_PROPERTY));
133 if (prop)
134 {
135 prop->propID = id;
136 prop->cbData = cbData;
137 prop->pbData = data;
138 list_add_tail(&list->properties, &prop->entry);
139 ret = TRUE;
140 }
141 else
143 }
145 }
146 return ret;
147}
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint id
Definition: glext.h:5910
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
unsigned char * LPBYTE
Definition: typedefs.h:53

Referenced by CDecodeMsg_DecodeDataContent(), CDecodeMsg_DecodeHashedContent(), CDecodeMsg_SaveAlgorithmID(), CertContext_SetKeyContextProperty(), CertContext_SetKeyProvInfoProperty(), CertContext_SetProperty(), CertSetStoreProperty(), ContextPropertyList_Copy(), CRLContext_SetProperty(), and CTLContext_SetProperty().

◆ crl_from_ptr()

◆ CRYPT_AsnDecodeCMSSignedInfo()

BOOL CRYPT_AsnDecodeCMSSignedInfo ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
CRYPT_SIGNED_INFO signedInfo,
DWORD pcbSignedInfo 
)

Definition at line 5936 of file decode.c.

5939{
5940 BOOL ret = FALSE;
5941 struct AsnDecodeSequenceItem items[] = {
5943 CRYPT_AsnDecodeIntInternal, sizeof(DWORD), FALSE, FALSE, 0, 0 },
5944 /* Placeholder for the hash algorithms - redundant with those in the
5945 * signers, so just ignore them.
5946 */
5947 { ASN_CONSTRUCTOR | ASN_SETOF, 0, NULL, 0, TRUE, FALSE, 0, 0 },
5950 FALSE, TRUE, offsetof(CRYPT_SIGNED_INFO, content.pszObjId), 0 },
5953 MEMBERSIZE(CRYPT_SIGNED_INFO, cCertEncoded, cCrlEncoded), TRUE, TRUE,
5954 offsetof(CRYPT_SIGNED_INFO, rgCertEncoded), 0 },
5957 MEMBERSIZE(CRYPT_SIGNED_INFO, cCrlEncoded, content), TRUE, TRUE,
5958 offsetof(CRYPT_SIGNED_INFO, rgCrlEncoded), 0 },
5962 offsetof(CRYPT_SIGNED_INFO, rgSignerInfo), 0 },
5963 };
5964
5965 TRACE("%p, %ld, %08lx, %p, %p, %p\n", pbEncoded, cbEncoded, dwFlags,
5966 pDecodePara, signedInfo, pcbSignedInfo);
5967
5969 pbEncoded, cbEncoded, dwFlags, pDecodePara, signedInfo, pcbSignedInfo,
5970 NULL, NULL);
5971 TRACE("returning %d\n", ret);
5972 return ret;
5973}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define MEMBERSIZE(s, member, nextmember)
Definition: decode.c:302
static BOOL CRYPT_AsnDecodeCMSCrlEncoded(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5771
#define FINALMEMBERSIZE(s, member)
Definition: decode.c:301
static BOOL CRYPT_AsnDecodePKCSContentInfoInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3311
static BOOL CRYPT_AsnDecodeIntInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4480
static BOOL CRYPT_DecodeSignerArray(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5917
static BOOL CRYPT_AsnDecodeCMSCertEncoded(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5751
static BOOL CRYPT_AsnDecodeSequence(struct AsnDecodeSequenceItem items[], DWORD cItem, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded, void *startingPointer)
Definition: decode.c:454
#define ASN_SETOF
content
Definition: atl_ax.c:994
static const WCHAR version[]
Definition: asmname.c:66
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define DWORD
Definition: nt_native.h:44
static TCHAR * items[]
Definition: page1.c:45
#define offsetof(TYPE, MEMBER)
#define ASN_CONSTRUCTOR
Definition: snmp.h:92
#define ASN_SEQUENCE
Definition: snmp.h:110
#define ASN_INTEGER
Definition: snmp.h:103
#define ASN_CONTEXT
Definition: snmp.h:89
struct _CRYPT_CONTENT_INFO CRYPT_CONTENT_INFO

Referenced by CDecodeMsg_DecodeSignedContent().

◆ CRYPT_AsnDecodePKCSDigestedData()

BOOL CRYPT_AsnDecodePKCSDigestedData ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
CRYPT_DIGESTED_DATA digestedData,
DWORD pcbDigestedData 
)

Definition at line 3378 of file decode.c.

3381{
3382 BOOL ret;
3383 struct AsnDecodeSequenceItem items[] = {
3385 CRYPT_AsnDecodeIntInternal, sizeof(DWORD), FALSE, FALSE, 0, 0 },
3386 { ASN_SEQUENCEOF, offsetof(CRYPT_DIGESTED_DATA, DigestAlgorithm),
3388 FALSE, TRUE, offsetof(CRYPT_DIGESTED_DATA, DigestAlgorithm.pszObjId),
3389 0 },
3393 ContentInfo.pszObjId), 0 },
3396 offsetof(CRYPT_DIGESTED_DATA, hash.pbData), 0 },
3397 };
3398
3400 pbEncoded, cbEncoded, dwFlags, pDecodePara, digestedData, pcbDigestedData,
3401 NULL, NULL);
3402 return ret;
3403}
static BOOL CRYPT_AsnDecodeAlgorithmId(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2857
static BOOL CRYPT_AsnDecodeOctets(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4178
#define ASN_OCTETSTRING
Definition: snmp.h:105
#define ASN_SEQUENCEOF
Definition: snmp.h:111
Definition: _hash_fun.h:40
struct _CRYPT_ALGORITHM_IDENTIFIER CRYPT_ALGORITHM_IDENTIFIER
struct _CRYPTOAPI_BLOB CRYPT_HASH_BLOB

Referenced by CDecodeMsg_DecodeHashedContent().

◆ CRYPT_AsnDecodePKCSEnvelopedData()

BOOL CRYPT_AsnDecodePKCSEnvelopedData ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
CRYPT_ENVELOPED_DATA envelopedData,
DWORD pcbEnvelopedData 
)

Definition at line 6065 of file decode.c.

6068{
6069 BOOL ret;
6070 struct AsnDecodeSequenceItem items[] = {
6072 CRYPT_AsnDecodeIntInternal, sizeof(DWORD), FALSE, FALSE, 0, 0 },
6074 cRecipientInfo), CRYPT_DecodeRecipientInfoArray,
6075 MEMBERSIZE(CRYPT_ENVELOPED_DATA, cRecipientInfo, encryptedContentInfo),
6076 FALSE, TRUE, offsetof(CRYPT_ENVELOPED_DATA, rgRecipientInfo), 0 },
6077 { ASN_SEQUENCEOF, offsetof(CRYPT_ENVELOPED_DATA, encryptedContentInfo),
6080 offsetof(CRYPT_ENVELOPED_DATA, encryptedContentInfo.contentType), 0 },
6081 };
6082
6083 TRACE("%p, %ld, %08lx, %p, %p, %p\n", pbEncoded, cbEncoded, dwFlags,
6084 pDecodePara, envelopedData, pcbEnvelopedData);
6085
6087 pbEncoded, cbEncoded, dwFlags, pDecodePara, envelopedData,
6088 pcbEnvelopedData, NULL, NULL);
6089 TRACE("returning %d\n", ret);
6090 return ret;
6091}
static BOOL CRYPT_DecodeRecipientInfoArray(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:6011
static BOOL CRYPT_AsnDecodeEncryptedContentInfo(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:6033
struct _CRYPT_ENCRYPTED_CONTENT_INFO CRYPT_ENCRYPTED_CONTENT_INFO

Referenced by CDecodeMsg_DecodeEnvelopedContent().

◆ CRYPT_AsnEncodeCMSSignedInfo()

BOOL CRYPT_AsnEncodeCMSSignedInfo ( CRYPT_SIGNED_INFO signedInfo,
void pvData,
DWORD pcbData 
)

Definition at line 4345 of file encode.c.

4347{
4348 struct DERSetDescriptor digestAlgorithmsSet = { signedInfo->cSignerInfo,
4349 signedInfo->rgSignerInfo, sizeof(CMSG_CMS_SIGNER_INFO),
4352 struct AsnEncodeSequenceItem items[7] = {
4353 { &signedInfo->version, CRYPT_AsnEncodeInt, 0 },
4354 { &digestAlgorithmsSet, CRYPT_DEREncodeItemsAsSet, 0 },
4356 };
4357 struct DERSetDescriptor certSet = { 0 }, crlSet = { 0 }, signerSet = { 0 };
4358 struct AsnEncodeTagSwappedItem swapped[2] = { { 0 } };
4359 DWORD cItem = 3, cSwapped = 0;
4360
4361 if (signedInfo->cCertEncoded)
4362 {
4363 certSet.cItems = signedInfo->cCertEncoded;
4364 certSet.items = signedInfo->rgCertEncoded;
4365 certSet.itemSize = sizeof(CERT_BLOB);
4366 certSet.itemOffset = 0;
4367 certSet.encode = CRYPT_CopyEncodedBlob;
4368 swapped[cSwapped].tag = ASN_CONSTRUCTOR | ASN_CONTEXT | 0;
4369 swapped[cSwapped].pvStructInfo = &certSet;
4370 swapped[cSwapped].encodeFunc = CRYPT_DEREncodeItemsAsSet;
4371 items[cItem].pvStructInfo = &swapped[cSwapped];
4372 items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
4373 cSwapped++;
4374 cItem++;
4375 }
4376 if (signedInfo->cCrlEncoded)
4377 {
4378 crlSet.cItems = signedInfo->cCrlEncoded;
4379 crlSet.items = signedInfo->rgCrlEncoded;
4380 crlSet.itemSize = sizeof(CRL_BLOB);
4381 crlSet.itemOffset = 0;
4382 crlSet.encode = CRYPT_CopyEncodedBlob;
4383 swapped[cSwapped].tag = ASN_CONSTRUCTOR | ASN_CONTEXT | 1;
4384 swapped[cSwapped].pvStructInfo = &crlSet;
4385 swapped[cSwapped].encodeFunc = CRYPT_DEREncodeItemsAsSet;
4386 items[cItem].pvStructInfo = &swapped[cSwapped];
4387 items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
4388 cSwapped++;
4389 cItem++;
4390 }
4391 signerSet.cItems = signedInfo->cSignerInfo;
4392 signerSet.items = signedInfo->rgSignerInfo;
4393 signerSet.itemSize = sizeof(CMSG_CMS_SIGNER_INFO);
4394 signerSet.itemOffset = 0;
4395 signerSet.encode = CRYPT_AsnEncodeCMSSignerInfo;
4396 items[cItem].pvStructInfo = &signerSet;
4397 items[cItem].encodeFunc = CRYPT_DEREncodeItemsAsSet;
4398 cItem++;
4399
4401 items, cItem, 0, NULL, pvData, pcbData);
4402}
static BOOL WINAPI CRYPT_AsnEncodeAlgorithmIdWithNullParams(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:377
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:174
static BOOL WINAPI CRYPT_AsnEncodeSwapTag(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:292
static BOOL WINAPI CRYPT_CopyEncodedBlob(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:329
static BOOL WINAPI CRYPT_AsnEncodeInt(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3371
static BOOL WINAPI CRYPT_AsnEncodeCMSSignerInfo(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:4256
static BOOL WINAPI CRYPT_AsnEncodePKCSContentInfoInternal(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:1920
static BOOL WINAPI CRYPT_DEREncodeItemsAsSet(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:1239
_In_ LPWSTR _In_ DWORD _In_ LPCVOID pvData
Definition: netsh.h:116
_In_ _Out_writes_opt_ pcchValueName _Inout_opt_ LPDWORD _Out_opt_ _Out_writes_bytes_to_opt_ pcbData _Inout_opt_ LPDWORD pcbData
Definition: shlwapi.h:757
const void * pvStructInfo
Definition: encode.c:284
CryptEncodeObjectExFunc encodeFunc
Definition: encode.c:285
size_t itemOffset
Definition: encode.c:1235
CryptEncodeObjectExFunc encode
Definition: encode.c:1236
size_t itemSize
Definition: encode.c:1234
const void * items
Definition: encode.c:1233
PCERT_BLOB rgCertEncoded
CRYPT_CONTENT_INFO content
PCMSG_CMS_SIGNER_INFO rgSignerInfo
#define X509_ASN_ENCODING
Definition: wincrypt.h:2501
struct _CRYPTOAPI_BLOB CRL_BLOB
struct _CMSG_CMS_SIGNER_INFO CMSG_CMS_SIGNER_INFO
#define PKCS_7_ASN_ENCODING
Definition: wincrypt.h:2503
struct _CRYPTOAPI_BLOB CERT_BLOB
_In_ BOOLEAN _In_ ULONG HashAlgorithm
Definition: rtlfuncs.h:2055

Referenced by CRYPT_SavePKCSToMem(), and CSignedEncodeMsg_GetParam().

◆ CRYPT_AsnEncodeConstructed()

BOOL WINAPI CRYPT_AsnEncodeConstructed ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const void pvStructInfo,
DWORD  dwFlags,
PCRYPT_ENCODE_PARA  pEncodePara,
BYTE pbEncoded,
DWORD pcbEncoded 
)

Definition at line 233 of file encode.c.

236{
237 BOOL ret;
238 const struct AsnConstructedItem *item = pvStructInfo;
239 DWORD len;
240
241 if ((ret = item->encodeFunc(dwCertEncodingType, lpszStructType,
242 item->pvStructInfo, dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL, NULL, &len)))
243 {
244 DWORD dataLen, bytesNeeded;
245
246 CRYPT_EncodeLen(len, NULL, &dataLen);
247 bytesNeeded = 1 + dataLen + len;
248 if (!pbEncoded)
249 *pcbEncoded = bytesNeeded;
250 else if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara,
251 pbEncoded, pcbEncoded, bytesNeeded)))
252 {
253 BYTE *out;
254
256 pbEncoded = *(BYTE **)pbEncoded;
257 out = pbEncoded;
258 *out++ = ASN_CONTEXT | ASN_CONSTRUCTOR | item->tag;
259 CRYPT_EncodeLen(len, out, &dataLen);
260 out += dataLen;
261 ret = item->encodeFunc(dwCertEncodingType, lpszStructType,
262 item->pvStructInfo, dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL,
263 out, &len);
264 if (!ret)
265 {
266 /* Some functions propagate their errors through the size */
267 *pcbEncoded = len;
269 CRYPT_FreeSpace(pEncodePara, pbEncoded);
270 }
271 }
272 }
273 else
274 {
275 /* Some functions propagate their errors through the size */
276 *pcbEncoded = len;
277 }
278 return ret;
279}
static void CRYPT_FreeSpace(const CRYPT_ENCODE_PARA *pEncodePara, LPVOID pv)
Definition: encode.c:124
BOOL CRYPT_EncodeLen(DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:132
BOOL CRYPT_EncodeEnsureSpace(DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded)
Definition: encode.c:97
GLenum GLsizei len
Definition: glext.h:6722
const void * pvStructInfo
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3599
unsigned char BYTE
Definition: xxhash.c:193

Referenced by CRYPT_AsnEncodeAuthorityKeyId(), CRYPT_AsnEncodeCertInfo(), CRYPT_AsnEncodeCertVersion(), CRYPT_AsnEncodeCRLInfo(), CRYPT_AsnEncodeCTL(), CRYPT_AsnEncodeDistPoint(), CRYPT_AsnEncodeIssuingDistPoint(), CRYPT_AsnEncodeOCSPRequest(), CRYPT_AsnEncodePKCSContentInfoInternal(), and CRYPT_EncodeDataContentInfoHeader().

◆ CRYPT_AsnEncodeOctets()

BOOL WINAPI CRYPT_AsnEncodeOctets ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const void pvStructInfo,
DWORD  dwFlags,
PCRYPT_ENCODE_PARA  pEncodePara,
BYTE pbEncoded,
DWORD pcbEncoded 
)

Definition at line 3216 of file encode.c.

3219{
3220 BOOL ret;
3221
3222 __TRY
3223 {
3224 const CRYPT_DATA_BLOB *blob = pvStructInfo;
3225 DWORD bytesNeeded, lenBytes;
3226
3227 TRACE("(%ld, %p), %08lx, %p, %p, %ld\n", blob->cbData, blob->pbData,
3228 dwFlags, pEncodePara, pbEncoded, pbEncoded ? *pcbEncoded : 0);
3229
3230 CRYPT_EncodeLen(blob->cbData, NULL, &lenBytes);
3231 bytesNeeded = 1 + lenBytes + blob->cbData;
3232 if (!pbEncoded)
3233 {
3234 *pcbEncoded = bytesNeeded;
3235 ret = TRUE;
3236 }
3237 else
3238 {
3239 if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara, pbEncoded,
3240 pcbEncoded, bytesNeeded)))
3241 {
3243 pbEncoded = *(BYTE **)pbEncoded;
3244 *pbEncoded++ = ASN_OCTETSTRING;
3245 CRYPT_EncodeLen(blob->cbData, pbEncoded, &lenBytes);
3246 pbEncoded += lenBytes;
3247 if (blob->cbData)
3248 memcpy(pbEncoded, blob->pbData, blob->cbData);
3249 }
3250 }
3251 }
3253 {
3255 ret = FALSE;
3256 }
3257 __ENDTRY
3258 TRACE("returning %d (%08lx)\n", ret, GetLastError());
3259 return ret;
3260}
#define __TRY
Definition: compat.h:80
#define __ENDTRY
Definition: compat.h:82
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:81
#define STATUS_ACCESS_VIOLATION
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by CRYPT_AsnEncodeAuthorityKeyId(), CRYPT_AsnEncodeAuthorityKeyId2(), CRYPT_AsnEncodeCertId(), CRYPT_AsnEncodeCMSSignerInfo(), CRYPT_AsnEncodeCTL(), CRYPT_AsnEncodeCTLEntry(), CRYPT_AsnEncodeEncryptedContentInfo(), CRYPT_AsnEncodeExtension(), CRYPT_AsnEncodePKCSDigestedData(), CRYPT_AsnEncodePKCSSignerInfo(), CRYPT_AsnEncodeRecipientInfo(), CRYPT_EncodePKCSDigestedData(), CRYPT_GetBuiltinEncoder(), and CSignedMsgData_AppendMessageDigestAttribute().

◆ CRYPT_AsnEncodeOid()

BOOL WINAPI CRYPT_AsnEncodeOid ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const void pvStructInfo,
DWORD  dwFlags,
PCRYPT_ENCODE_PARA  pEncodePara,
BYTE pbEncoded,
DWORD pcbEncoded 
)

Definition at line 814 of file encode.c.

817{
818 LPCSTR pszObjId = pvStructInfo;
819 DWORD bytesNeeded = 0, lenBytes;
820 BOOL ret = TRUE;
821 int firstPos = 0;
822 BYTE firstByte = 0;
823
824 TRACE("%s\n", debugstr_a(pszObjId));
825
826 if (pszObjId)
827 {
828 const char *ptr;
829 int val1, val2;
830
831 if (sscanf(pszObjId, "%d.%d%n", &val1, &val2, &firstPos) != 2)
832 {
834 return FALSE;
835 }
836 bytesNeeded++;
837 firstByte = val1 * 40 + val2;
838 ptr = pszObjId + firstPos;
839 if (*ptr == '.')
840 {
841 ptr++;
842 firstPos++;
843 }
844 while (ret && *ptr)
845 {
846 int pos;
847
848 /* note I assume each component is at most 32-bits long in base 2 */
849 if (sscanf(ptr, "%d%n", &val1, &pos) == 1)
850 {
851 if (val1 >= 0x10000000)
852 bytesNeeded += 5;
853 else if (val1 >= 0x200000)
854 bytesNeeded += 4;
855 else if (val1 >= 0x4000)
856 bytesNeeded += 3;
857 else if (val1 >= 0x80)
858 bytesNeeded += 2;
859 else
860 bytesNeeded += 1;
861 ptr += pos;
862 if (*ptr == '.')
863 ptr++;
864 }
865 else
866 {
868 return FALSE;
869 }
870 }
871 CRYPT_EncodeLen(bytesNeeded, NULL, &lenBytes);
872 }
873 else
874 lenBytes = 1;
875 bytesNeeded += 1 + lenBytes;
876 if (pbEncoded)
877 {
878 if (*pcbEncoded < bytesNeeded)
879 {
881 ret = FALSE;
882 }
883 else
884 {
885 *pbEncoded++ = ASN_OBJECTIDENTIFIER;
886 CRYPT_EncodeLen(bytesNeeded - 1 - lenBytes, pbEncoded, &lenBytes);
887 pbEncoded += lenBytes;
888 if (pszObjId)
889 {
890 const char *ptr;
891 int val, pos;
892
893 *pbEncoded++ = firstByte;
894 ptr = pszObjId + firstPos;
895 while (ret && *ptr)
896 {
897 sscanf(ptr, "%d%n", &val, &pos);
898 {
899 unsigned char outBytes[5];
900 int numBytes, i;
901
902 if (val >= 0x10000000)
903 numBytes = 5;
904 else if (val >= 0x200000)
905 numBytes = 4;
906 else if (val >= 0x4000)
907 numBytes = 3;
908 else if (val >= 0x80)
909 numBytes = 2;
910 else
911 numBytes = 1;
912 for (i = numBytes; i > 0; i--)
913 {
914 outBytes[i - 1] = val & 0x7f;
915 val >>= 7;
916 }
917 for (i = 0; i < numBytes - 1; i++)
918 *pbEncoded++ = outBytes[i] | 0x80;
919 *pbEncoded++ = outBytes[i];
920 ptr += pos;
921 if (*ptr == '.')
922 ptr++;
923 }
924 }
925 }
926 }
927 }
928 *pcbEncoded = bytesNeeded;
929 return ret;
930}
#define ERROR_MORE_DATA
Definition: dderror.h:13
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl sscanf(const char *, const char *,...) __WINE_CRT_SCANF_ATTR(2
GLuint GLfloat * val
Definition: glext.h:7180
#define ASN_OBJECTIDENTIFIER
Definition: snmp.h:107
#define CRYPT_E_ASN1_ERROR
Definition: winerror.h:4499

Referenced by CRYPT_AsnEncodeAccessDescription(), CRYPT_AsnEncodeAlgorithmId(), CRYPT_AsnEncodeAlgorithmIdWithNullParams(), CRYPT_AsnEncodeAltNameEntry(), CRYPT_AsnEncodeCertPolicy(), CRYPT_AsnEncodeCertPolicyMapping(), CRYPT_AsnEncodeCertPolicyQualifiers(), CRYPT_AsnEncodeCTLSubjectAlgorithm(), CRYPT_AsnEncodeEncryptedContentInfo(), CRYPT_AsnEncodeEnhancedKeyUsage(), CRYPT_AsnEncodeExtension(), CRYPT_AsnEncodePKCSAttribute(), CRYPT_AsnEncodePKCSContentInfoInternal(), CRYPT_AsnEncodeRdnAttr(), CRYPT_AsnEncodeSMIMECapability(), and CRYPT_EncodeDataContentInfoHeader().

◆ CRYPT_AsnEncodePKCSDigestedData()

BOOL CRYPT_AsnEncodePKCSDigestedData ( const CRYPT_DIGESTED_DATA digestedData,
void pvData,
DWORD pcbData 
)

Definition at line 1946 of file encode.c.

1948{
1949 struct AsnEncodeSequenceItem items[] = {
1950 { &digestedData->version, CRYPT_AsnEncodeInt, 0 },
1952 0 },
1954 { &digestedData->hash, CRYPT_AsnEncodeOctets, 0 },
1955 };
1956
1958}
BOOL WINAPI CRYPT_AsnEncodeOctets(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3216
CRYPT_CONTENT_INFO ContentInfo
CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm
CRYPT_HASH_BLOB hash

Referenced by CRYPT_EncodePKCSDigestedData().

◆ CRYPT_AsnEncodePKCSEnvelopedData()

BOOL CRYPT_AsnEncodePKCSEnvelopedData ( const CRYPT_ENVELOPED_DATA envelopedData,
void pvData,
DWORD pcbData 
)

Definition at line 4440 of file encode.c.

4442{
4443 struct DERSetDescriptor recipientInfosSet = { envelopedData->cRecipientInfo,
4444 envelopedData->rgRecipientInfo, sizeof(CMSG_KEY_TRANS_RECIPIENT_INFO), 0,
4446 struct AsnEncodeSequenceItem items[] = {
4447 { &envelopedData->version, CRYPT_AsnEncodeInt, 0 },
4448 { &recipientInfosSet, CRYPT_DEREncodeItemsAsSet, 0 },
4449 { &envelopedData->encryptedContentInfo,
4451 };
4452
4455}
static BOOL WINAPI CRYPT_AsnEncodeRecipientInfo(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:4404
static BOOL WINAPI CRYPT_AsnEncodeEncryptedContentInfo(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:4422
CRYPT_ENCRYPTED_CONTENT_INFO encryptedContentInfo
PCMSG_KEY_TRANS_RECIPIENT_INFO rgRecipientInfo
struct _CMSG_KEY_TRANS_RECIPIENT_INFO CMSG_KEY_TRANS_RECIPIENT_INFO

Referenced by CEnvelopedEncodeMsg_GetParam().

◆ CRYPT_AsnEncodePubKeyInfoNoNull()

BOOL WINAPI CRYPT_AsnEncodePubKeyInfoNoNull ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const void pvStructInfo,
DWORD  dwFlags,
PCRYPT_ENCODE_PARA  pEncodePara,
BYTE pbEncoded,
DWORD pcbEncoded 
)

Definition at line 478 of file encode.c.

481{
482 BOOL ret;
483 const CERT_PUBLIC_KEY_INFO *info = pvStructInfo;
484 struct AsnEncodeSequenceItem items[] = {
485 { &info->Algorithm, CRYPT_AsnEncodeAlgorithmId, 0 },
486 { &info->PublicKey, CRYPT_AsnEncodeBits, 0 },
487 };
488
489 TRACE("Encoding public key with OID %s\n",
490 debugstr_a(info->Algorithm.pszObjId));
491 ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
492 ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded,
493 pcbEncoded);
494 return ret;
495}
static BOOL WINAPI CRYPT_AsnEncodeBits(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3262
static BOOL WINAPI CRYPT_AsnEncodeAlgorithmId(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:402

Referenced by CRYPT_AsnEncodeCertInfo(), and CryptHashPublicKeyInfo().

◆ CRYPT_AsnEncodeSequence()

BOOL WINAPI CRYPT_AsnEncodeSequence ( DWORD  dwCertEncodingType,
struct AsnEncodeSequenceItem  items[],
DWORD  cItem,
DWORD  dwFlags,
PCRYPT_ENCODE_PARA  pEncodePara,
BYTE pbEncoded,
DWORD pcbEncoded 
)

Definition at line 174 of file encode.c.

177{
178 BOOL ret;
179 DWORD i, dataLen = 0;
180
181 TRACE("%p, %ld, %08lx, %p, %p, %ld\n", items, cItem, dwFlags, pEncodePara,
182 pbEncoded, pbEncoded ? *pcbEncoded : 0);
183 for (i = 0, ret = TRUE; ret && i < cItem; i++)
184 {
185 ret = items[i].encodeFunc(dwCertEncodingType, NULL,
186 items[i].pvStructInfo, dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL,
187 NULL, &items[i].size);
188 /* Some functions propagate their errors through the size */
189 if (!ret)
190 *pcbEncoded = items[i].size;
191 dataLen += items[i].size;
192 }
193 if (ret)
194 {
195 DWORD lenBytes, bytesNeeded;
196
197 CRYPT_EncodeLen(dataLen, NULL, &lenBytes);
198 bytesNeeded = 1 + lenBytes + dataLen;
199 if (!pbEncoded)
200 *pcbEncoded = bytesNeeded;
201 else
202 {
203 if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara, pbEncoded,
204 pcbEncoded, bytesNeeded)))
205 {
206 BYTE *out;
207
209 pbEncoded = *(BYTE **)pbEncoded;
210 out = pbEncoded;
211 *out++ = ASN_SEQUENCE;
212 CRYPT_EncodeLen(dataLen, out, &lenBytes);
213 out += lenBytes;
214 for (i = 0; ret && i < cItem; i++)
215 {
216 ret = items[i].encodeFunc(dwCertEncodingType, NULL,
217 items[i].pvStructInfo, dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG,
218 NULL, out, &items[i].size);
219 /* Some functions propagate their errors through the size */
220 if (!ret)
221 *pcbEncoded = items[i].size;
222 out += items[i].size;
223 }
225 CRYPT_FreeSpace(pEncodePara, pbEncoded);
226 }
227 }
228 }
229 TRACE("returning %d (%08lx)\n", ret, GetLastError());
230 return ret;
231}
GLsizeiptr size
Definition: glext.h:5919

Referenced by CRYPT_AsnEncodeAccessDescription(), CRYPT_AsnEncodeAlgorithmId(), CRYPT_AsnEncodeAlgorithmIdWithNullParams(), CRYPT_AsnEncodeAuthorityKeyId(), CRYPT_AsnEncodeAuthorityKeyId2(), CRYPT_AsnEncodeBasicConstraints(), CRYPT_AsnEncodeBasicConstraints2(), CRYPT_AsnEncodeCert(), CRYPT_AsnEncodeCertId(), CRYPT_AsnEncodeCertInfo(), CRYPT_AsnEncodeCertPolicy(), CRYPT_AsnEncodeCertPolicyConstraints(), CRYPT_AsnEncodeCertPolicyMapping(), CRYPT_AsnEncodeCertPolicyQualifiers(), CRYPT_AsnEncodeCMSSignedInfo(), CRYPT_AsnEncodeCMSSignerInfo(), CRYPT_AsnEncodeCRLEntry(), CRYPT_AsnEncodeCRLInfo(), CRYPT_AsnEncodeCTL(), CRYPT_AsnEncodeCTLEntry(), CRYPT_AsnEncodeCTLSubjectAlgorithm(), CRYPT_AsnEncodeDistPoint(), CRYPT_AsnEncodeEncryptedContentInfo(), CRYPT_AsnEncodeExtension(), CRYPT_AsnEncodeGeneralSubtree(), CRYPT_AsnEncodeIssuerSerialNumber(), CRYPT_AsnEncodeIssuingDistPoint(), CRYPT_AsnEncodeNameConstraints(), CRYPT_AsnEncodeNoticeReference(), CRYPT_AsnEncodeOCSPRequest(), CRYPT_AsnEncodeOCSPRequestEntry(), CRYPT_AsnEncodeOCSPSignedRequest(), CRYPT_AsnEncodePKCSAttribute(), CRYPT_AsnEncodePKCSContentInfoInternal(), CRYPT_AsnEncodePKCSDigestedData(), CRYPT_AsnEncodePKCSEnvelopedData(), CRYPT_AsnEncodePKCSSignerInfo(), CRYPT_AsnEncodePolicyQualifierUserNotice(), CRYPT_AsnEncodePubKeyInfo(), CRYPT_AsnEncodePubKeyInfoNoNull(), CRYPT_AsnEncodeRecipientInfo(), CRYPT_AsnEncodeRsaPubKey(), CRYPT_AsnEncodeRsaPubKey_Bcrypt(), CRYPT_AsnEncodeSMIMECapability(), CRYPT_AsnEncodeValidity(), and CRYPT_EncodeDataContentInfoHeader().

◆ CRYPT_CollectionOpenStore()

WINECRYPT_CERTSTORE * CRYPT_CollectionOpenStore ( HCRYPTPROV  hCryptProv,
DWORD  dwFlags,
const void pvPara 
)

Definition at line 464 of file collectionstore.c.

466{
468
470 {
472 store = NULL;
473 }
474 else
475 {
476 store = CryptMemAlloc(sizeof(WINE_COLLECTIONSTORE));
477 if (store)
478 {
479 memset(store, 0, sizeof(WINE_COLLECTIONSTORE));
482 store->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": PWINE_COLLECTIONSTORE->cs");
483 list_init(&store->stores);
484 }
485 }
486 return (WINECRYPT_CERTSTORE*)store;
487}
static const store_vtbl_t CollectionStoreVtbl
void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, DWORD dwFlags, CertStoreType type, const store_vtbl_t *)
Definition: store.c:88
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define memset(x, y, z)
Definition: compat.h:39
PRTL_CRITICAL_SECTION_DEBUG DebugInfo
Definition: rtltypes.h:1450
WINECRYPT_CERTSTORE hdr
CRITICAL_SECTION cs
#define CERT_STORE_DELETE_FLAG
Definition: wincrypt.h:2624

Referenced by CertOpenStore().

◆ CRYPT_ConvertKeyContext()

void CRYPT_ConvertKeyContext ( const struct store_CERT_KEY_CONTEXT src,
CERT_KEY_CONTEXT dst 
)

Definition at line 429 of file cert.c.

430{
431 dst->cbSize = sizeof(*dst);
432 dst->hCryptProv = src->hCryptProv;
433 dst->dwKeySpec = src->dwKeySpec;
434}
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

Referenced by CertContext_GetProperty(), and CRYPT_ReadContextProp().

◆ CRYPT_CopyReversed()

void CRYPT_CopyReversed ( BYTE dst,
const BYTE src,
size_t  len 
)

Definition at line 56 of file decode.c.

57{
58 DWORD i;
59 for (i = 0; i < len; i++) {
60 dst[len - i - 1] = src[i];
61 }
62}

Referenced by CRYPT_AsnDecodeRsaPubKey_Bcrypt(), CRYPT_AsnEncodeRsaPubKey_Bcrypt(), test_decodeRsaPublicKey_Bcrypt(), and test_encodeRsaPublicKey_Bcrypt().

◆ CRYPT_CreateChainEngine()

HCERTCHAINENGINE CRYPT_CreateChainEngine ( HCERTSTORE  root,
DWORD  system_store,
const CERT_CHAIN_ENGINE_CONFIG config 
)

Definition at line 115 of file chain.c.

116{
118 HCERTSTORE worldStores[4];
119
120 if(!root) {
121 if(config->cbSize >= sizeof(CERT_CHAIN_ENGINE_CONFIG) && config->hExclusiveRoot)
122 root = CertDuplicateStore(config->hExclusiveRoot);
123 else if (config->hRestrictedRoot)
124 root = CertDuplicateStore(config->hRestrictedRoot);
125 else
126 root = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, L"Root");
127 if(!root)
128 return NULL;
129 }
130
131 engine = CryptMemAlloc(sizeof(CertificateChainEngine));
132 if(!engine) {
134 return NULL;
135 }
136
137 engine->ref = 1;
138 engine->hRoot = root;
140 worldStores[0] = CertDuplicateStore(engine->hRoot);
141 worldStores[1] = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, L"CA");
142 worldStores[2] = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, L"My");
143 worldStores[3] = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, L"Trust");
144
145 CRYPT_AddStoresToCollection(engine->hWorld, ARRAY_SIZE(worldStores), worldStores);
146 CRYPT_AddStoresToCollection(engine->hWorld, config->cAdditionalStore, config->rghAdditionalStore);
147 CRYPT_CloseStores(ARRAY_SIZE(worldStores), worldStores);
148
149 engine->dwFlags = config->dwFlags;
150 engine->dwUrlRetrievalTimeout = config->dwUrlRetrievalTimeout;
151 engine->MaximumCachedCertificates = config->MaximumCachedCertificates;
152 if(config->CycleDetectionModulus)
153 engine->CycleDetectionModulus = config->CycleDetectionModulus;
154 else
156
157 return engine;
158}
struct _root root
static void CRYPT_CloseStores(DWORD cStores, HCERTSTORE *stores)
Definition: chain.c:63
#define DEFAULT_CYCLE_MODULUS
Definition: chain.c:36
static void CRYPT_AddStoresToCollection(HCERTSTORE collection, DWORD cStores, HCERTSTORE *stores)
Definition: chain.c:54
HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwMsgAndCertEncodingType, HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const void *pvPara)
Definition: store.c:809
HCERTSTORE WINAPI CertDuplicateStore(HCERTSTORE hCertStore)
Definition: store.c:1110
BOOL WINAPI CertCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
Definition: store.c:1121
DWORD MaximumCachedCertificates
Definition: chain.c:50
DWORD dwUrlRetrievalTimeout
Definition: chain.c:49
HCERTSTORE hRoot
Definition: chain.c:46
DWORD CycleDetectionModulus
Definition: chain.c:51
HCERTSTORE hWorld
Definition: chain.c:47
#define CERT_STORE_PROV_COLLECTION
Definition: wincrypt.h:2465
#define CERT_STORE_CREATE_NEW_FLAG
Definition: wincrypt.h:2633
#define CERT_STORE_PROV_SYSTEM_W
Definition: wincrypt.h:2463

Referenced by CertCreateCertificateChainEngine(), check_and_store_certs(), and get_chain_engine().

◆ CRYPT_EncodeEnsureSpace()

BOOL CRYPT_EncodeEnsureSpace ( DWORD  dwFlags,
const CRYPT_ENCODE_PARA pEncodePara,
BYTE pbEncoded,
DWORD pcbEncoded,
DWORD  bytesNeeded 
)

Definition at line 97 of file encode.c.

99{
100 BOOL ret = TRUE;
101
103 {
104 if (pEncodePara && pEncodePara->pfnAlloc)
105 *(BYTE **)pbEncoded = pEncodePara->pfnAlloc(bytesNeeded);
106 else
107 *(BYTE **)pbEncoded = LocalAlloc(0, bytesNeeded);
108 if (!*(BYTE **)pbEncoded)
109 ret = FALSE;
110 else
111 *pcbEncoded = bytesNeeded;
112 }
113 else if (bytesNeeded > *pcbEncoded)
114 {
115 *pcbEncoded = bytesNeeded;
117 ret = FALSE;
118 }
119 else
120 *pcbEncoded = bytesNeeded;
121 return ret;
122}
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
PFN_CRYPT_ALLOC pfnAlloc
Definition: wincrypt.h:1262

Referenced by CRYPT_AsnEncodeAltName(), CRYPT_AsnEncodeAuthorityInfoAccess(), CRYPT_AsnEncodeBits(), CRYPT_AsnEncodeBMPString(), CRYPT_AsnEncodeCertPolicies(), CRYPT_AsnEncodeCertPolicyMappings(), CRYPT_AsnEncodeCertPolicyQualifiers(), CRYPT_AsnEncodeConstructed(), CRYPT_AsnEncodeCRLDistPoints(), CRYPT_AsnEncodeCRLEntries(), CRYPT_AsnEncodeCTLEntries(), CRYPT_AsnEncodeEnhancedKeyUsage(), CRYPT_AsnEncodeExtensions(), CRYPT_AsnEncodeGeneralizedTime(), CRYPT_AsnEncodeIA5String(), CRYPT_AsnEncodeInteger(), CRYPT_AsnEncodeName(), CRYPT_AsnEncodeNoticeNumbers(), CRYPT_AsnEncodeNumericString(), CRYPT_AsnEncodeOCSPRequestEntries(), CRYPT_AsnEncodeOctets(), CRYPT_AsnEncodePrintableString(), CRYPT_AsnEncodeSequence(), CRYPT_AsnEncodeSequenceOfAny(), CRYPT_AsnEncodeSMIMECapabilities(), CRYPT_AsnEncodeStringCoerce(), CRYPT_AsnEncodeUnicodeName(), CRYPT_AsnEncodeUnicodeStringCoerce(), CRYPT_AsnEncodeUniversalString(), CRYPT_AsnEncodeUnsignedInteger(), CRYPT_AsnEncodeUtcTime(), CRYPT_AsnEncodeUTF8String(), CRYPT_CopyEncodedBlob(), CRYPT_DEREncodeItemsAsSet(), CRYPT_DEREncodeSet(), CRYPT_EncodeContentLength(), and CryptEncodeObjectEx().

◆ CRYPT_EncodeLen()

BOOL CRYPT_EncodeLen ( DWORD  len,
BYTE pbEncoded,
DWORD pcbEncoded 
)

Definition at line 132 of file encode.c.

133{
134 DWORD bytesNeeded, significantBytes = 0;
135
136 if (len <= 0x7f)
137 bytesNeeded = 1;
138 else
139 {
140 DWORD temp;
141
142 for (temp = len, significantBytes = sizeof(temp); !(temp & 0xff000000);
143 temp <<= 8, significantBytes--)
144 ;
145 bytesNeeded = significantBytes + 1;
146 }
147 if (!pbEncoded)
148 {
149 *pcbEncoded = bytesNeeded;
150 return TRUE;
151 }
152 if (*pcbEncoded < bytesNeeded)
153 {
155 return FALSE;
156 }
157 if (len <= 0x7f)
158 *pbEncoded = (BYTE)len;
159 else
160 {
161 DWORD i;
162
163 *pbEncoded++ = significantBytes | 0x80;
164 for (i = 0; i < significantBytes; i++)
165 {
166 *(pbEncoded + significantBytes - i - 1) = (BYTE)(len & 0xff);
167 len >>= 8;
168 }
169 }
170 *pcbEncoded = bytesNeeded;
171 return TRUE;
172}
static calc_node_t temp
Definition: rpn_ieee.c:38

Referenced by CRYPT_AsnEncodeAltName(), CRYPT_AsnEncodeAltNameEntry(), CRYPT_AsnEncodeAuthorityInfoAccess(), CRYPT_AsnEncodeBits(), CRYPT_AsnEncodeBMPString(), CRYPT_AsnEncodeCertPolicies(), CRYPT_AsnEncodeCertPolicyMappings(), CRYPT_AsnEncodeCertPolicyQualifiers(), CRYPT_AsnEncodeConstructed(), CRYPT_AsnEncodeCRLDistPoints(), CRYPT_AsnEncodeCRLEntries(), CRYPT_AsnEncodeCTLEntries(), CRYPT_AsnEncodeEnhancedKeyUsage(), CRYPT_AsnEncodeExtensions(), CRYPT_AsnEncodeIA5String(), CRYPT_AsnEncodeInteger(), CRYPT_AsnEncodeName(), CRYPT_AsnEncodeNoticeNumbers(), CRYPT_AsnEncodeNumericString(), CRYPT_AsnEncodeOCSPRequestEntries(), CRYPT_AsnEncodeOctets(), CRYPT_AsnEncodeOid(), CRYPT_AsnEncodePrintableString(), CRYPT_AsnEncodeRdnAttr(), CRYPT_AsnEncodeSequence(), CRYPT_AsnEncodeSequenceOfAny(), CRYPT_AsnEncodeSMIMECapabilities(), CRYPT_AsnEncodeStringCoerce(), CRYPT_AsnEncodeUnicodeName(), CRYPT_AsnEncodeUnicodeStringCoerce(), CRYPT_AsnEncodeUniversalString(), CRYPT_AsnEncodeUnsignedInteger(), CRYPT_AsnEncodeUTF8String(), CRYPT_DEREncodeItemsAsSet(), CRYPT_DEREncodeSet(), and CRYPT_EncodeContentLength().

◆ CRYPT_FileNameOpenStoreA()

WINECRYPT_CERTSTORE * CRYPT_FileNameOpenStoreA ( HCRYPTPROV  hCryptProv,
DWORD  dwFlags,
const void pvPara 
)

Definition at line 380 of file filestore.c.

382{
383 int len;
385
386 TRACE("(%Id, %08lx, %s)\n", hCryptProv, dwFlags,
387 debugstr_a(pvPara));
388
389 if (!pvPara)
390 {
392 return NULL;
393 }
394 len = MultiByteToWideChar(CP_ACP, 0, pvPara, -1, NULL, 0);
395 if (len)
396 {
397 LPWSTR storeName = CryptMemAlloc(len * sizeof(WCHAR));
398
399 if (storeName)
400 {
401 MultiByteToWideChar(CP_ACP, 0, pvPara, -1, storeName, len);
402 ret = CRYPT_FileNameOpenStoreW(hCryptProv, dwFlags, storeName);
403 CryptMemFree(storeName);
404 }
405 }
406 return ret;
407}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
WINECRYPT_CERTSTORE * CRYPT_FileNameOpenStoreW(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara)
Definition: filestore.c:291
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
uint16_t * LPWSTR
Definition: typedefs.h:56

Referenced by CertOpenStore().

◆ CRYPT_FileNameOpenStoreW()

WINECRYPT_CERTSTORE * CRYPT_FileNameOpenStoreW ( HCRYPTPROV  hCryptProv,
DWORD  dwFlags,
const void pvPara 
)

Definition at line 291 of file filestore.c.

293{
294 HCERTSTORE store = 0;
295 LPCWSTR fileName = pvPara;
297 HANDLE file;
298
299 TRACE("(%Id, %08lx, %s)\n", hCryptProv, dwFlags, debugstr_w(fileName));
300
301 if (!fileName)
302 {
304 return NULL;
305 }
308 {
310 return NULL;
311 }
312
320 else
325 {
326 HCERTSTORE memStore = NULL;
328
329 /* If the file isn't empty, try to get the type from the file itself */
330 if (size)
331 {
332 DWORD contentType;
333 BOOL ret;
334
335 /* Close the file so CryptQueryObject can succeed.. */
341 CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, &contentType, NULL,
342 &memStore, NULL, NULL);
343 if (ret)
344 {
345 if (contentType == CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED)
347 else
349 /* and reopen the file. */
352 }
353 }
354 else
355 {
356 LPCWSTR ext = wcsrchr(fileName, '.');
357
358 if (ext)
359 {
360 ext++;
361 if (!lstrcmpiW(ext, L"spc") || !lstrcmpiW(ext, L"p7c"))
363 }
364 if (!type)
366 memStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
368 }
369 if (memStore)
370 {
371 store = CRYPT_CreateFileStore(dwFlags, memStore, file, type);
372 /* File store doesn't need crypto provider, so close it */
373 if (hCryptProv && !(dwFlags & CERT_STORE_NO_CRYPT_RELEASE_FLAG))
374 CryptReleaseContext(hCryptProv, 0);
375 }
376 }
377 return store;
378}
#define E_INVALIDARG
Definition: ddrawi.h:101
BOOL WINAPI CryptReleaseContext(HCRYPTPROV hProv, DWORD dwFlags)
Definition: crypt.c:641
BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void *pvObject, DWORD dwExpectedContentTypeFlags, DWORD dwExpectedFormatTypeFlags, DWORD dwFlags, DWORD *pdwMsgAndCertEncodingType, DWORD *pdwContentType, DWORD *pdwFormatType, HCERTSTORE *phCertStore, HCRYPTMSG *phMsg, const void **ppvContext)
Definition: object.c:770
#define CloseHandle
Definition: compat.h:739
#define wcsrchr
Definition: compat.h:16
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_SHARE_READ
Definition: compat.h:136
static const WCHAR *const ext[]
Definition: module.c:53
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4171
static WINECRYPT_CERTSTORE * CRYPT_CreateFileStore(DWORD dwFlags, HCERTSTORE memStore, HANDLE file, DWORD type)
Definition: filestore.c:217
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define debugstr_w
Definition: kernel32.h:32
#define CREATE_NEW
Definition: disk.h:69
#define OPEN_ALWAYS
Definition: disk.h:70
static const struct access_res create[16]
Definition: package.c:7505
#define GENERIC_WRITE
Definition: nt_native.h:90
Definition: fci.c:127
#define CERT_STORE_SAVE_AS_STORE
Definition: wincrypt.h:2793
#define CERT_QUERY_OBJECT_FILE
Definition: wincrypt.h:3686
#define CERT_STORE_SAVE_AS_PKCS7
Definition: wincrypt.h:2794
#define CERT_QUERY_CONTENT_FLAG_CERT
Definition: wincrypt.h:3703
#define CERT_STORE_OPEN_EXISTING_FLAG
Definition: wincrypt.h:2634
#define CERT_FILE_STORE_COMMIT_ENABLE_FLAG
Definition: wincrypt.h:2644
#define CERT_STORE_PROV_MEMORY
Definition: wincrypt.h:2455
#define CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED
Definition: wincrypt.h:3714
#define CERT_QUERY_FORMAT_FLAG_ALL
Definition: wincrypt.h:3749
#define CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE
Definition: wincrypt.h:3706
#define CERT_STORE_NO_CRYPT_RELEASE_FLAG
Definition: wincrypt.h:2621
#define CERT_STORE_READONLY_FLAG
Definition: wincrypt.h:2635
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:228

Referenced by CertOpenStore(), and CRYPT_FileNameOpenStoreA().

◆ CRYPT_FileOpenStore()

WINECRYPT_CERTSTORE * CRYPT_FileOpenStore ( HCRYPTPROV  hCryptProv,
DWORD  dwFlags,
const void pvPara 
)

Definition at line 241 of file filestore.c.

243{
244 WINECRYPT_CERTSTORE *store = NULL;
245 HANDLE file = (HANDLE)pvPara;
246
247 TRACE("(%Id, %08lx, %p)\n", hCryptProv, dwFlags, pvPara);
248
249 if (!pvPara)
250 {
252 return NULL;
253 }
255 {
257 return NULL;
258 }
261 {
263 return NULL;
264 }
265
269 {
270 HCERTSTORE memStore;
271
272 memStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
274 if (memStore)
275 {
277 {
278 store = CRYPT_CreateFileStore(dwFlags, memStore, file,
280 /* File store doesn't need crypto provider, so close it */
281 if (hCryptProv &&
283 CryptReleaseContext(hCryptProv, 0);
284 }
285 }
286 }
287 TRACE("returning %p\n", store);
288 return store;
289}
BOOL CRYPT_ReadSerializedStoreFromFile(HANDLE file, HCERTSTORE store)
Definition: serialize.c:731
#define GetCurrentProcess()
Definition: compat.h:759
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
Definition: handle.c:149
PVOID HANDLE
Definition: typedefs.h:73

Referenced by CertOpenStore().

◆ CRYPT_FreeStore()

void CRYPT_FreeStore ( WINECRYPT_CERTSTORE store)

Definition at line 98 of file store.c.

99{
100 if (store->properties)
102 store->dwMagic = 0;
103 CryptMemFree(store);
104}
CONTEXT_PROPERTY_LIST * properties

Referenced by Collection_release(), MemStore_release(), and ProvStore_release().

◆ CRYPT_ImportSystemRootCertsToReg()

void CRYPT_ImportSystemRootCertsToReg ( void  )

Definition at line 738 of file rootstore.c.

739{
740 HCERTSTORE store = NULL, reg = NULL;
741 HKEY key = NULL;
742 LONG rc;
743 HANDLE hsem;
744 BOOL delete;
745
746 static BOOL root_certs_imported = FALSE;
747
748 if (root_certs_imported)
749 return;
750
751 hsem = CreateSemaphoreW( NULL, 0, 1, L"crypt32_root_semaphore");
752 if (!hsem)
753 {
754 ERR("Failed to create semaphore\n");
755 return;
756 }
757
759 {
761 goto done;
762 }
763
764 rc = RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\SystemCertificates\\Root\\Certificates", 0, NULL, 0,
765 KEY_ALL_ACCESS, NULL, &key, 0);
766 if (rc)
767 goto done;
768
770 {
771 ERR("Failed to create memory store.\n");
772 goto done;
773 }
775
776 if (!(store = create_root_store(reg, &delete)))
777 {
778 ERR("Failed to create root store\n");
779 goto done;
780 }
781 if (delete && RegDeleteTreeW(key, NULL))
782 ERR("Error deleting key.\n");
784 ERR("Failed to import system certs into registry, %08lx\n", GetLastError());
785
786done:
788 CertCloseStore(store, 0);
790 root_certs_imported = TRUE;
791 ReleaseSemaphore(hsem, 1, NULL);
792 CloseHandle(hsem);
793}
#define ERR(fmt,...)
Definition: precomp.h:57
#define RegCloseKey(hKey)
Definition: registry.h:49
LSTATUS WINAPI RegDeleteTreeW(_In_ HKEY, _In_opt_ LPCWSTR)
void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType, HCERTSTORE store, DWORD disposition)
Definition: regstore.c:59
const WINE_CONTEXT_INTERFACE * pCertInterface
Definition: store.c:51
BOOL CRYPT_SerializeContextsToReg(HKEY key, DWORD flags, const WINE_CONTEXT_INTERFACE *contextInterface, HCERTSTORE memStore)
Definition: regstore.c:200
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
#define INFINITE
Definition: serial.h:102
static int reg
Definition: i386-dis.c:1290
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
static HCERTSTORE create_root_store(HCERTSTORE cached, BOOL *delete)
Definition: rootstore.c:721
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreW(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:406
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:491
#define CERT_STORE_ADD_ALWAYS
Definition: wincrypt.h:2654
#define CERT_STORE_CERTIFICATE_CONTEXT_FLAG
Definition: wincrypt.h:3125
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by CRYPT_SysRegOpenStoreW().

◆ CRYPT_InitStore()

void CRYPT_InitStore ( WINECRYPT_CERTSTORE store,
DWORD  dwFlags,
CertStoreType  type,
const store_vtbl_t vtbl 
)

Definition at line 88 of file store.c.

89{
90 store->ref = 1;
92 store->type = type;
93 store->dwOpenFlags = dwFlags;
94 store->vtbl = vtbl;
95 store->properties = NULL;
96}
#define WINE_CRYPTCERTSTORE_MAGIC

Referenced by CRYPT_CollectionOpenStore(), CRYPT_MemOpenStore(), CRYPT_ProvCreateStore(), and init_empty_store().

◆ CRYPT_IsCertificateSelfSigned()

DWORD CRYPT_IsCertificateSelfSigned ( const CERT_CONTEXT cert)

Definition at line 264 of file chain.c.

265{
266 DWORD size, status = 0;
268 BOOL ret;
269
271 cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension)))
272 {
274
275 ret = CryptDecodeObjectEx(cert->dwCertEncodingType,
276 X509_AUTHORITY_KEY_ID2, ext->Value.pbData, ext->Value.cbData,
278 &info, &size);
279 if (ret)
280 {
281 if (info->AuthorityCertIssuer.cAltEntry &&
282 info->AuthorityCertSerialNumber.cbData)
283 {
284 PCERT_ALT_NAME_ENTRY directoryName = NULL;
285 DWORD i;
286
287 for (i = 0; !directoryName &&
288 i < info->AuthorityCertIssuer.cAltEntry; i++)
289 if (info->AuthorityCertIssuer.rgAltEntry[i].dwAltNameChoice
291 directoryName =
292 &info->AuthorityCertIssuer.rgAltEntry[i];
293 if (directoryName)
294 {
295 if (CertCompareCertificateName(cert->dwCertEncodingType, &directoryName->DirectoryName, &cert->pCertInfo->Issuer)
296 && CertCompareIntegerBlob(&info->AuthorityCertSerialNumber, &cert->pCertInfo->SerialNumber))
298 }
299 else
300 {
301 FIXME("no supported name type in authority key id2\n");
302 ret = FALSE;
303 }
304 }
305 else if (info->KeyId.cbData)
306 {
309 if (ret && size == info->KeyId.cbData)
310 {
312
313 if (buf)
314 {
316 if (!memcmp(buf, info->KeyId.pbData, size))
319 }
320 }
321 }
323 }
324 }
326 cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension)))
327 {
329
330 ret = CryptDecodeObjectEx(cert->dwCertEncodingType,
331 X509_AUTHORITY_KEY_ID, ext->Value.pbData, ext->Value.cbData,
333 &info, &size);
334 if (ret)
335 {
336 if (info->CertIssuer.cbData && info->CertSerialNumber.cbData)
337 {
338 if (CertCompareCertificateName(cert->dwCertEncodingType, &info->CertIssuer, &cert->pCertInfo->Issuer)
339 && CertCompareIntegerBlob(&info->CertSerialNumber, &cert->pCertInfo->SerialNumber))
341 }
342 else if (info->KeyId.cbData)
343 {
346 if (ret && size == info->KeyId.cbData)
347 {
349
350 if (buf)
351 {
354 if (!memcmp(buf, info->KeyId.pbData, size))
357 }
358 }
359 }
361 }
362 }
363 else
364 if (CertCompareCertificateName(cert->dwCertEncodingType, &cert->pCertInfo->Subject, &cert->pCertInfo->Issuer))
366
367 if (status)
369
370 return status;
371}
BOOL WINAPI CertCompareCertificateName(DWORD dwCertEncodingType, PCERT_NAME_BLOB pCertName1, PCERT_NAME_BLOB pCertName2)
Definition: cert.c:1250
PCERT_EXTENSION WINAPI CertFindExtension(LPCSTR pszObjId, DWORD cExtensions, CERT_EXTENSION rgExtensions[])
Definition: cert.c:2099
BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, void *pvData, DWORD *pcbData)
Definition: cert.c:615
BOOL WINAPI CertCompareIntegerBlob(PCRYPT_INTEGER_BLOB pInt1, PCRYPT_INTEGER_BLOB pInt2)
Definition: cert.c:1291
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static BYTE cert[]
Definition: msg.c:1374
Definition: wincrypt.h:341
CERT_NAME_BLOB DirectoryName
Definition: wincrypt.h:347
Definition: ps.c:97
#define X509_AUTHORITY_KEY_ID2
Definition: wincrypt.h:3550
#define szOID_AUTHORITY_KEY_IDENTIFIER
Definition: wincrypt.h:3331
#define CRYPT_DECODE_NOCOPY_FLAG
Definition: wincrypt.h:3608
#define CERT_KEY_IDENTIFIER_PROP_ID
Definition: wincrypt.h:2853
#define CERT_ALT_NAME_DIRECTORY_NAME
Definition: wincrypt.h:358
#define CERT_TRUST_IS_SELF_SIGNED
Definition: wincrypt.h:1011
#define CERT_TRUST_HAS_KEY_MATCH_ISSUER
Definition: wincrypt.h:1009
#define X509_AUTHORITY_KEY_ID
Definition: wincrypt.h:3526
#define CERT_TRUST_HAS_NAME_MATCH_ISSUER
Definition: wincrypt.h:1010
#define szOID_AUTHORITY_KEY_IDENTIFIER2
Definition: wincrypt.h:3356

Referenced by CertGetIssuerCertificateFromStore(), CRYPT_BuildSimpleChain(), CRYPT_CheckChainNameConstraints(), and CRYPT_CheckSimpleChain().

◆ crypt_oid_free()

void crypt_oid_free ( void  )

Definition at line 1835 of file oid.c.

1836{
1838 free_oid_info();
1839}
static void free_oid_info(void)
Definition: oid.c:1676
static void free_function_sets(void)
Definition: oid.c:76

Referenced by DllMain().

◆ crypt_oid_init()

void crypt_oid_init ( void  )

Definition at line 1829 of file oid.c.

1830{
1831 init_oid_info();
1833}
static void init_oid_info(void)
Definition: oid.c:1605
static void init_registered_oid_info(void)
Definition: oid.c:1565

Referenced by DllMain().

◆ CRYPT_ProvCreateStore()

WINECRYPT_CERTSTORE * CRYPT_ProvCreateStore ( DWORD  dwFlags,
WINECRYPT_CERTSTORE memStore,
const CERT_STORE_PROV_INFO pProvInfo 
)

Definition at line 307 of file provstore.c.

309{
311
312 if (ret)
313 {
315 ret->dwStoreProvFlags = pProvInfo->dwStoreProvFlags;
316 if (ret->dwStoreProvFlags & CERT_STORE_PROV_EXTERNAL_FLAG)
317 {
318 CertCloseStore(memStore, 0);
319 ret->memStore = NULL;
320 }
321 else
322 ret->memStore = memStore;
323 ret->hStoreProv = pProvInfo->hStoreProv;
325 ret->provCloseStore =
327 else
328 ret->provCloseStore = NULL;
329 if (pProvInfo->cStoreProvFunc >
331 ret->provWriteCert = pProvInfo->rgpvStoreProvFunc[
333 else
334 ret->provWriteCert = NULL;
335 if (pProvInfo->cStoreProvFunc >
337 ret->provDeleteCert = pProvInfo->rgpvStoreProvFunc[
339 else
340 ret->provDeleteCert = NULL;
341 if (pProvInfo->cStoreProvFunc >
343 ret->provWriteCrl = pProvInfo->rgpvStoreProvFunc[
345 else
346 ret->provWriteCrl = NULL;
347 if (pProvInfo->cStoreProvFunc >
349 ret->provDeleteCrl = pProvInfo->rgpvStoreProvFunc[
351 else
352 ret->provDeleteCrl = NULL;
353 if (pProvInfo->cStoreProvFunc >
355 ret->provWriteCtl = pProvInfo->rgpvStoreProvFunc[
357 else
358 ret->provWriteCtl = NULL;
359 if (pProvInfo->cStoreProvFunc >
361 ret->provDeleteCtl = pProvInfo->rgpvStoreProvFunc[
363 else
364 ret->provDeleteCtl = NULL;
365 if (pProvInfo->cStoreProvFunc >
367 ret->provControl = pProvInfo->rgpvStoreProvFunc[
369 else
370 ret->provControl = NULL;
371 }
372 return (WINECRYPT_CERTSTORE*)ret;
373}
static const store_vtbl_t ProvStoreVtbl
Definition: provstore.c:287
void ** rgpvStoreProvFunc
Definition: wincrypt.h:1275
HCERTSTOREPROV hStoreProv
Definition: wincrypt.h:1276
#define CERT_STORE_PROV_WRITE_CTL_FUNC
Definition: wincrypt.h:2726
#define CERT_STORE_PROV_CONTROL_FUNC
Definition: wincrypt.h:2729
#define CERT_STORE_PROV_EXTERNAL_FLAG
Definition: wincrypt.h:2709
#define CERT_STORE_PROV_CLOSE_FUNC
Definition: wincrypt.h:2716
#define CERT_STORE_PROV_DELETE_CTL_FUNC
Definition: wincrypt.h:2727
#define CERT_STORE_PROV_DELETE_CRL_FUNC
Definition: wincrypt.h:2723
#define CERT_STORE_PROV_DELETE_CERT_FUNC
Definition: wincrypt.h:2719
#define CERT_STORE_PROV_WRITE_CERT_FUNC
Definition: wincrypt.h:2718
#define CERT_STORE_PROV_WRITE_CRL_FUNC
Definition: wincrypt.h:2722

Referenced by CRYPT_CreateFileStore(), CRYPT_MsgOpenStore(), CRYPT_ProvOpenStore(), and CRYPT_RegOpenStore().

◆ CRYPT_ProvOpenStore()

WINECRYPT_CERTSTORE * CRYPT_ProvOpenStore ( LPCSTR  lpszStoreProvider,
DWORD  dwEncodingType,
HCRYPTPROV  hCryptProv,
DWORD  dwFlags,
const void pvPara 
)

Definition at line 375 of file provstore.c.

377{
378 static HCRYPTOIDFUNCSET set = NULL;
380 HCRYPTOIDFUNCADDR hFunc;
382
383 if (!set)
385 CryptGetOIDFunctionAddress(set, dwEncodingType, lpszStoreProvider, 0,
386 (void **)&provOpenFunc, &hFunc);
387 if (provOpenFunc)
388 {
389 CERT_STORE_PROV_INFO provInfo = { 0 };
390
391 provInfo.cbSize = sizeof(provInfo);
393 provOpenFunc(lpszStoreProvider, dwEncodingType, hCryptProv,
394 dwFlags, pvPara, NULL, &provInfo);
395 else
396 {
397 HCERTSTORE memStore;
398
399 memStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
401 if (memStore)
402 {
403 if (provOpenFunc(lpszStoreProvider, dwEncodingType, hCryptProv,
404 dwFlags, pvPara, memStore, &provInfo))
405 ret = CRYPT_ProvCreateStore(dwFlags, memStore, &provInfo);
406 else
407 CertCloseStore(memStore, 0);
408 }
409 }
411 }
412 else
414 return ret;
415}
Definition: _set.h:50
HCRYPTOIDFUNCSET WINAPI CryptInitOIDFunctionSet(LPCSTR pszFuncName, DWORD dwFlags)
Definition: oid.c:103
BOOL WINAPI CryptGetOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet, DWORD dwEncodingType, LPCSTR pszOID, DWORD dwFlags, void **ppvFuncAddr, HCRYPTOIDFUNCADDR *phFuncAddr)
Definition: oid.c:375
BOOL WINAPI CryptFreeOIDFunctionAddress(HCRYPTOIDFUNCADDR hFuncAddr, DWORD dwFlags)
Definition: oid.c:456
WINECRYPT_CERTSTORE * CRYPT_ProvCreateStore(DWORD dwFlags, WINECRYPT_CERTSTORE *memStore, const CERT_STORE_PROV_INFO *pProvInfo)
Definition: provstore.c:307
BOOL(WINAPI * PFN_CERT_DLL_OPEN_STORE_PROV_FUNC)(LPCSTR lpszStoreProvider, DWORD dwEncodingType, HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const void *pvPara, HCERTSTORE hCertStore, PCERT_STORE_PROV_INFO pStoreProvInfo)
Definition: wincrypt.h:1391
#define CRYPT_OID_OPEN_STORE_PROV_FUNC
Definition: wincrypt.h:2660

Referenced by CertOpenStore().

◆ CRYPT_ReadSerializedElement()

const void * CRYPT_ReadSerializedElement ( const BYTE pbElement,
DWORD  cbElement,
DWORD  dwContextTypeFlags,
DWORD pdwContentType 
)

Definition at line 482 of file serialize.c.

484{
485 const void *context;
486
487 TRACE("(%p, %ld, %08lx, %p)\n", pbElement, cbElement, dwContextTypeFlags,
488 pdwContentType);
489
490 if (!cbElement)
491 {
493 return NULL;
494 }
495
496 __TRY
497 {
498 const WINE_CONTEXT_INTERFACE *contextInterface = NULL;
500 DWORD type = 0;
501 BOOL ret;
502
503 ret = TRUE;
504 context = NULL;
505 if (dwContextTypeFlags == CERT_STORE_ALL_CONTEXT_FLAG)
506 {
507 hdr = CRYPT_findPropID(pbElement, cbElement, CERT_CERT_PROP_ID);
508 if (hdr)
510 else
511 {
512 hdr = CRYPT_findPropID(pbElement, cbElement, CERT_CRL_PROP_ID);
513 if (hdr)
515 else
516 {
517 hdr = CRYPT_findPropID(pbElement, cbElement,
519 if (hdr)
521 }
522 }
523 }
524 else if (dwContextTypeFlags & CERT_STORE_CERTIFICATE_CONTEXT_FLAG)
525 {
526 hdr = CRYPT_findPropID(pbElement, cbElement, CERT_CERT_PROP_ID);
528 }
529 else if (dwContextTypeFlags & CERT_STORE_CRL_CONTEXT_FLAG)
530 {
531 hdr = CRYPT_findPropID(pbElement, cbElement, CERT_CRL_PROP_ID);
533 }
534 else if (dwContextTypeFlags & CERT_STORE_CTL_CONTEXT_FLAG)
535 {
536 hdr = CRYPT_findPropID(pbElement, cbElement, CERT_CTL_PROP_ID);
538 }
539
540 switch (type)
541 {
543 contextInterface = pCertInterface;
544 break;
546 contextInterface = pCRLInterface;
547 break;
549 contextInterface = pCTLInterface;
550 break;
551 default:
553 ret = FALSE;
554 }
555 if (!hdr)
556 ret = FALSE;
557
558 if (ret)
559 context = contextInterface->create(X509_ASN_ENCODING,
560 (BYTE *)hdr + sizeof(WINE_CERT_PROP_HEADER), hdr->cb);
561 if (ret && context)
562 {
563 BOOL noMoreProps = FALSE;
564
565 while (!noMoreProps && ret)
566 {
567 if (cbElement < sizeof(WINE_CERT_PROP_HEADER))
568 ret = FALSE;
569 else
570 {
572 (const WINE_CERT_PROP_HEADER *)pbElement;
573
574 TRACE("prop is %ld\n", hdr->propID);
575 cbElement -= sizeof(WINE_CERT_PROP_HEADER);
576 pbElement += sizeof(WINE_CERT_PROP_HEADER);
577 if (!hdr->propID)
578 {
579 /* Like in CRYPT_findPropID, stop if the propID is zero
580 */
581 noMoreProps = TRUE;
582 }
583 else
584 ret = CRYPT_ReadContextProp(contextInterface, context,
585 hdr, pbElement, cbElement);
586 pbElement += hdr->cb;
587 cbElement -= hdr->cb;
588 if (!cbElement)
589 noMoreProps = TRUE;
590 }
591 }
592 if (ret)
593 {
594 if (pdwContentType)
595 *pdwContentType = type;
596 }
597 else
598 {
600 context = NULL;
601 }
602 }
603 }
605 {
607 context = NULL;
608 }
610 return context;
611}
#define CERT_CTL_PROP_ID
#define CERT_CRL_PROP_ID
const WINE_CONTEXT_INTERFACE * pCTLInterface
Definition: store.c:77
#define CERT_CERT_PROP_ID
const WINE_CONTEXT_INTERFACE * pCRLInterface
Definition: store.c:64
char hdr[14]
Definition: iptest.cpp:33
static const WINE_CERT_PROP_HEADER * CRYPT_findPropID(const BYTE *buf, DWORD size, DWORD propID)
Definition: serialize.c:266
static BOOL CRYPT_ReadContextProp(const WINE_CONTEXT_INTERFACE *contextInterface, const void *context, const WINE_CERT_PROP_HEADER *hdr, const BYTE *pbElement, DWORD cbElement)
Definition: serialize.c:392
struct _WINE_CERT_PROP_HEADER WINE_CERT_PROP_HEADER
CreateContextFunc create
#define CERT_STORE_CTL_CONTEXT_FLAG
Definition: wincrypt.h:3128
#define CERT_STORE_CRL_CONTEXT_FLAG
Definition: wincrypt.h:3127
#define CERT_STORE_ALL_CONTEXT_FLAG
Definition: wincrypt.h:3124
#define CERT_STORE_CERTIFICATE_CONTEXT
Definition: wincrypt.h:3121
#define CERT_STORE_CTL_CONTEXT
Definition: wincrypt.h:3123
#define CERT_STORE_CRL_CONTEXT
Definition: wincrypt.h:3122
#define ERROR_END_OF_MEDIA
Definition: winerror.h:960

Referenced by CertAddSerializedElementToStore(), CRYPT_QuerySerializedContextObject(), and CRYPT_RegReadSerializedFromReg().

◆ CRYPT_ReadSerializedStoreFromBlob()

BOOL CRYPT_ReadSerializedStoreFromBlob ( const CRYPT_DATA_BLOB blob,
HCERTSTORE  store 
)

Definition at line 765 of file serialize.c.

767{
768 struct BlobReader reader = { blob, 0 };
769
771}
static BOOL read_blob_wrapper(void *handle, void *buffer, DWORD bytesToRead, DWORD *bytesRead)
Definition: serialize.c:742
static BOOL CRYPT_ReadSerializedStore(void *handle, read_serialized_func read_func, HCERTSTORE store)
Definition: serialize.c:618
const CRYPT_DATA_BLOB * blob
Definition: serialize.c:738
Definition: reader.h:84

Referenced by CRYPT_QuerySerializedStoreFromBlob(), and CRYPT_SerializedOpenStore().

◆ CRYPT_ReadSerializedStoreFromFile()

BOOL CRYPT_ReadSerializedStoreFromFile ( HANDLE  file,
HCERTSTORE  store 
)

Definition at line 731 of file serialize.c.

732{
734}
static BOOL read_file_wrapper(void *handle, void *buffer, DWORD bytesToRead, DWORD *bytesRead)
Definition: serialize.c:725

Referenced by CRYPT_FileControl(), CRYPT_FileOpenStore(), and CRYPT_QuerySerializedStoreFromFile().

◆ CRYPT_RegOpenStore()

WINECRYPT_CERTSTORE * CRYPT_RegOpenStore ( HCRYPTPROV  hCryptProv,
DWORD  dwFlags,
const void pvPara 
)

Definition at line 504 of file regstore.c.

506{
507 WINECRYPT_CERTSTORE *store = NULL;
508
509 TRACE("(%Id, %08lx, %p)\n", hCryptProv, dwFlags, pvPara);
510
512 {
513 DWORD rc = RegDeleteTreeW((HKEY)pvPara, L"Certificates");
514
515 if (rc == ERROR_SUCCESS || rc == ERROR_NO_MORE_ITEMS)
516 rc = RegDeleteTreeW((HKEY)pvPara, L"CRLs");
517 if (rc == ERROR_SUCCESS || rc == ERROR_NO_MORE_ITEMS)
518 rc = RegDeleteTreeW((HKEY)pvPara, L"CTLs");
519 if (rc == ERROR_NO_MORE_ITEMS)
520 rc = ERROR_SUCCESS;
521 SetLastError(rc);
522 }
523 else
524 {
525 HKEY key;
526
530 TRUE, 0))
531 {
532 WINECRYPT_CERTSTORE *memStore;
533
534 memStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, hCryptProv,
536 if (memStore)
537 {
539 sizeof(WINE_REGSTOREINFO));
540
541 if (regInfo)
542 {
543 CERT_STORE_PROV_INFO provInfo = { 0 };
544
545 regInfo->dwOpenFlags = dwFlags;
546 regInfo->memStore = memStore;
547 regInfo->key = key;
549 regInfo->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": PWINE_REGSTOREINFO->cs");
550 list_init(&regInfo->certsToDelete);
551 list_init(&regInfo->crlsToDelete);
552 list_init(&regInfo->ctlsToDelete);
554 regInfo->dirty = FALSE;
555 provInfo.cbSize = sizeof(provInfo);
558 provInfo.hStoreProv = regInfo;
559 store = CRYPT_ProvCreateStore(dwFlags, memStore, &provInfo);
560 /* Reg store doesn't need crypto provider, so close it */
561 if (hCryptProv &&
563 CryptReleaseContext(hCryptProv, 0);
564 }
565 }
566 }
567 }
568 TRACE("returning %p\n", store);
569 return store;
570}
WINECRYPT_CERTSTORE * CRYPT_ProvCreateStore(DWORD dwFlags, WINECRYPT_CERTSTORE *memStore, const CERT_STORE_PROV_INFO *pProvInfo)
Definition: provstore.c:307
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define KEY_READ
Definition: nt_native.h:1026
static void * regProvFuncs[]
Definition: regstore.c:487
static void CRYPT_RegReadFromReg(HKEY key, HCERTSTORE store, DWORD disposition)
Definition: regstore.c:151
struct list crlsToDelete
Definition: regstore.c:44
struct list certsToDelete
Definition: regstore.c:43
HCERTSTORE memStore
Definition: regstore.c:39
struct list ctlsToDelete
Definition: regstore.c:45
CRITICAL_SECTION cs
Definition: regstore.c:42

Referenced by CertOpenStore(), and CRYPT_SysRegOpenStoreW().

◆ CRYPT_RegReadSerializedFromReg()

void CRYPT_RegReadSerializedFromReg ( HKEY  key,
DWORD  contextType,
HCERTSTORE  store,
DWORD  disposition 
)

Definition at line 59 of file regstore.c.

60{
61 LONG rc;
62 DWORD index = 0;
63 WCHAR subKeyName[MAX_PATH];
64
65 do {
66 DWORD size = ARRAY_SIZE(subKeyName);
67
68 rc = RegEnumKeyExW(key, index++, subKeyName, &size, NULL, NULL, NULL,
69 NULL);
70 if (!rc)
71 {
72 HKEY subKey;
73
74 rc = RegOpenKeyExW(key, subKeyName, 0, KEY_READ, &subKey);
75 if (!rc)
76 {
77 LPBYTE buf = NULL;
78
79 size = 0;
80 rc = RegQueryValueExW(subKey, L"Blob", NULL, NULL, NULL, &size);
81 if (!rc)
83 if (buf)
84 {
85 rc = RegQueryValueExW(subKey, L"Blob", NULL, NULL, buf,
86 &size);
87 if (!rc)
88 {
89 const void *context;
90 DWORD addedType;
91
92 TRACE("Adding cert with hash %s\n",
93 debugstr_w(subKeyName));
95 contextType, &addedType);
96 if (context)
97 {
98 const WINE_CONTEXT_INTERFACE *contextInterface;
99 BYTE hash[20];
100
101 switch (addedType)
102 {
104 contextInterface = pCertInterface;
105 break;
107 contextInterface = pCRLInterface;
108 break;
110 contextInterface = pCTLInterface;
111 break;
112 default:
113 contextInterface = NULL;
114 }
115 if (contextInterface)
116 {
117 size = sizeof(hash);
118 if (contextInterface->getProp(context,
120 {
121 WCHAR asciiHash[20 * 2 + 1];
122
123 CRYPT_HashToStr(hash, asciiHash);
124 TRACE("comparing %s\n",
125 debugstr_w(asciiHash));
126 TRACE("with %s\n", debugstr_w(subKeyName));
127 if (!wcscmp(asciiHash, subKeyName))
128 {
129 TRACE("hash matches, adding\n");
130 contextInterface->addContextToStore(
131 store, context,
132 disposition, NULL);
133 }
134 else
135 TRACE("hash doesn't match, ignoring\n");
136 }
138 }
139 }
140 }
142 }
143 RegCloseKey(subKey);
144 }
145 /* Ignore intermediate errors, continue enumerating */
146 rc = ERROR_SUCCESS;
147 }
148 } while (!rc);
149}
const void * CRYPT_ReadSerializedElement(const BYTE *pbElement, DWORD cbElement, DWORD dwContextTypeFlags, DWORD *pdwContentType)
Definition: serialize.c:482
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
#define MAX_PATH
Definition: compat.h:34
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
GLuint index
Definition: glext.h:6031
static void CRYPT_HashToStr(const BYTE *hash, LPWSTR asciiHash)
Definition: regstore.c:48
GetContextPropertyFunc getProp
AddContextToStoreFunc addContextToStore
#define CERT_HASH_PROP_ID
Definition: wincrypt.h:2835

Referenced by CRYPT_ImportSystemRootCertsToReg(), and CRYPT_RegReadFromReg().

◆ CRYPT_SerializeContextsToReg()

BOOL CRYPT_SerializeContextsToReg ( HKEY  key,
DWORD  flags,
const WINE_CONTEXT_INTERFACE contextInterface,
HCERTSTORE  memStore 
)

Definition at line 200 of file regstore.c.

202{
203 const void *context = NULL;
204 BOOL ret;
205
206 do {
207 context = contextInterface->enumContextsInStore(memStore, context);
208 if (context)
209 {
210 BYTE hash[20];
211 DWORD hashSize = sizeof(hash);
212
213 ret = contextInterface->getProp(context, CERT_HASH_PROP_ID, hash,
214 &hashSize);
215 if (ret)
216 {
217 DWORD size = 0;
218 LPBYTE buf = NULL;
219
220 ret = contextInterface->serialize(context, 0, NULL, &size);
221 if (size)
223 if (buf)
224 {
225 ret = contextInterface->serialize(context, 0, buf, &size);
226 if (ret)
228 }
230 }
231 }
232 else
233 ret = TRUE;
234 } while (ret && context != NULL);
235 if (context)
237 return ret;
238}
GLbitfield flags
Definition: glext.h:7161
static BOOL CRYPT_WriteSerializedToReg(HKEY key, DWORD flags, const BYTE *hash, const BYTE *buf, DWORD len)
Definition: regstore.c:174
SerializeElementFunc serialize
EnumContextsInStoreFunc enumContextsInStore

Referenced by CRYPT_ImportSystemRootCertsToReg(), and CRYPT_RegWriteToReg().

◆ crypt_sip_free()

void crypt_sip_free ( void  )

Definition at line 578 of file sip.c.

579{
580 WINE_SIP_PROVIDER *prov, *next;
581
583 {
584 list_remove(&prov->entry);
585 FreeLibrary(prov->info.hSIP);
586 CryptMemFree(prov);
587 }
589}
static struct list providers
Definition: sip.c:532
static CRITICAL_SECTION providers_cs
Definition: sip.c:533
#define FreeLibrary(x)
Definition: compat.h:748
struct list entry
Definition: sip.c:529
SIP_DISPATCH_INFO info
Definition: sip.c:528

Referenced by DllMain().

◆ ctl_from_ptr()

◆ default_chain_engine_free()

void default_chain_engine_free ( void  )

Definition at line 251 of file chain.c.

252{
255}
static CertificateChainEngine * default_lm_engine
Definition: chain.c:160
static void free_chain_engine(CertificateChainEngine *engine)
Definition: chain.c:197
static CertificateChainEngine * default_cu_engine
Definition: chain.c:160

Referenced by DllMain().

◆ I_CertUpdateStore()

BOOL WINAPI I_CertUpdateStore ( HCERTSTORE  store1,
HCERTSTORE  store2,
DWORD  unk0,
DWORD  unk1 
)

Definition at line 106 of file store.c.

108{
109 static BOOL warned = FALSE;
110 const WINE_CONTEXT_INTERFACE * const interfaces[] = { pCertInterface,
112 DWORD i;
113
114 TRACE("(%p, %p, %08lx, %08lx)\n", store1, store2, unk0, unk1);
115 if (!warned)
116 {
117 FIXME("semi-stub\n");
118 warned = TRUE;
119 }
120
121 /* Poor-man's resync: empty first store, then add everything from second
122 * store to it.
123 */
124 for (i = 0; i < ARRAY_SIZE(interfaces); i++)
125 {
126 const void *context;
127
128 do {
129 context = interfaces[i]->enumContextsInStore(store1, NULL);
130 if (context)
131 interfaces[i]->deleteFromStore(context);
132 } while (context);
133 do {
134 context = interfaces[i]->enumContextsInStore(store2, context);
135 if (context)
136 interfaces[i]->addContextToStore(store1, context,
138 } while (context);
139 }
140 return TRUE;
141}
const WINE_CONTEXT_INTERFACE * pCTLInterface
Definition: store.c:77
const WINE_CONTEXT_INTERFACE * pCertInterface
Definition: store.c:51
const WINE_CONTEXT_INTERFACE * pCRLInterface
Definition: store.c:64
static DWORD unk1
Definition: cursoricon.c:1804
DeleteContextFunc deleteFromStore

Referenced by CRYPT_FileControl(), and CRYPT_RegControl().

◆ I_CryptGetDefaultCryptProv()

HCRYPTPROV WINAPI I_CryptGetDefaultCryptProv ( ALG_ID  algid)

Definition at line 215 of file main.c.

216{
217 HCRYPTPROV prov, defprov;
218
219 TRACE("(%08x)\n", algid);
220
221 defprov = CRYPT_GetDefaultProvider();
222
223 if (algid && !is_supported_algid(defprov, algid))
224 {
225 DWORD i = 0, type, size;
226
227 while (CryptEnumProvidersW(i, NULL, 0, &type, NULL, &size))
228 {
230 if (name)
231 {
232 if (CryptEnumProvidersW(i, NULL, 0, &type, name, &size))
233 {
235 {
236 if (is_supported_algid(prov, algid))
237 {
239 return prov;
240 }
241 CryptReleaseContext(prov, 0);
242 }
243 }
245 }
246 i++;
247 }
248
250 return 0;
251 }
252
253 CryptContextAddRef(defprov, NULL, 0);
254 return defprov;
255}
BOOL WINAPI CryptContextAddRef(HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFlags)
Definition: crypt.c:615
BOOL WINAPI CryptEnumProvidersW(DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPWSTR pszProvName, DWORD *pcbProvName)
Definition: crypt.c:1119
BOOL WINAPI CryptAcquireContextW(HCRYPTPROV *phProv, LPCWSTR pszContainer, LPCWSTR pszProvider, DWORD dwProvType, DWORD dwFlags)
Definition: crypt.c:362
static BOOL is_supported_algid(HCRYPTPROV prov, ALG_ID algid)
Definition: main.c:192
static HCRYPTPROV CRYPT_GetDefaultProvider(void)
Definition: main.c:74
Definition: name.c:39
#define CRYPT_VERIFYCONTEXT
Definition: wincrypt.h:2273
ULONG_PTR HCRYPTPROV
Definition: wincrypt.h:55

Referenced by CDecodeMsg_FinalizeHashedContent(), CEnvelopedEncodeMsg_Open(), CertGetPublicKeyLength(), CHashEncodeMsg_Open(), CRYPT_VerifySignature(), CryptHashCertificate(), CryptHashPublicKeyInfo(), CryptHashToBeSigned(), CryptSignCertificate(), and CSignedMsgData_ConstructSignerHandles().

◆ init_empty_store()

void init_empty_store ( void  )

Definition at line 1505 of file store.c.

1506{
1508}
void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, DWORD dwFlags, CertStoreType type, const store_vtbl_t *vtbl)
Definition: store.c:88
static const store_vtbl_t EmptyStoreVtbl
Definition: store.c:1483
WINECRYPT_CERTSTORE empty_store
Definition: store.c:1503

Referenced by DllMain().

◆ root_store_free()

void root_store_free ( void  )

Variable Documentation

◆ empty_store

◆ hInstance

HINSTANCE hInstance
extern

Definition at line 19 of file charmap.c.

◆ pCertInterface

◆ pCRLInterface

◆ pCTLInterface