ReactOS 0.4.16-dev-106-g10b08aa
crypt32_private.h File Reference
#include "wine/list.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
 

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)
 

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
 

Enumerations

enum  _CertStoreType { StoreTypeMem , StoreTypeCollection , StoreTypeProvider , StoreTypeEmpty }
 

Functions

BOOL CRYPT_EncodeLen (DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN
 
BOOL WINAPI CRYPT_AsnEncodeSequence (DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN
 
BOOL WINAPI CRYPT_AsnEncodeConstructed (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN
 
BOOL WINAPI CRYPT_AsnEncodeOid (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN
 
BOOL WINAPI CRYPT_AsnEncodeOctets (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN
 
BOOL CRYPT_AsnEncodePKCSDigestedData (const CRYPT_DIGESTED_DATA *digestedData, void *pvData, DWORD *pcbData) DECLSPEC_HIDDEN
 
BOOL CRYPT_AsnEncodePKCSEnvelopedData (const CRYPT_ENVELOPED_DATA *envelopedData, void *pvData, DWORD *pcbData) DECLSPEC_HIDDEN
 
BOOL CRYPT_AsnDecodePKCSEnvelopedData (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, CRYPT_ENVELOPED_DATA *envelopedData, DWORD *pcbEnvelopedData) DECLSPEC_HIDDEN
 
BOOL CRYPT_AsnEncodeCMSSignedInfo (CRYPT_SIGNED_INFO *, void *pvData, DWORD *pcbData) DECLSPEC_HIDDEN
 
BOOL CRYPT_AsnDecodeCMSSignedInfo (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, CRYPT_SIGNED_INFO *signedInfo, DWORD *pcbSignedInfo) DECLSPEC_HIDDEN
 
BOOL CRYPT_EncodeEnsureSpace (DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded) DECLSPEC_HIDDEN
 
BOOL CRYPT_AsnDecodePKCSDigestedData (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, CRYPT_DIGESTED_DATA *digestedData, DWORD *pcbDigestedData) DECLSPEC_HIDDEN
 
BOOL WINAPI CRYPT_AsnEncodePubKeyInfoNoNull (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN
 
HCRYPTPROV WINAPI I_CryptGetDefaultCryptProv (ALG_ID)
 
void crypt_oid_init (void) DECLSPEC_HIDDEN
 
void crypt_oid_free (void) DECLSPEC_HIDDEN
 
void crypt_sip_free (void) DECLSPEC_HIDDEN
 
void root_store_free (void) DECLSPEC_HIDDEN
 
void default_chain_engine_free (void) DECLSPEC_HIDDEN
 
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 *) DECLSPEC_HIDDEN
 
void CRYPT_FreeStore (WINECRYPT_CERTSTORE *store) DECLSPEC_HIDDEN
 
BOOL WINAPI I_CertUpdateStore (HCERTSTORE store1, HCERTSTORE store2, DWORD unk0, DWORD unk1) DECLSPEC_HIDDEN
 
WINECRYPT_CERTSTORECRYPT_CollectionOpenStore (HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN
 
WINECRYPT_CERTSTORECRYPT_ProvCreateStore (DWORD dwFlags, WINECRYPT_CERTSTORE *memStore, const CERT_STORE_PROV_INFO *pProvInfo) DECLSPEC_HIDDEN
 
WINECRYPT_CERTSTORECRYPT_ProvOpenStore (LPCSTR lpszStoreProvider, DWORD dwEncodingType, HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN
 
WINECRYPT_CERTSTORECRYPT_RegOpenStore (HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN
 
WINECRYPT_CERTSTORECRYPT_FileOpenStore (HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN
 
WINECRYPT_CERTSTORECRYPT_FileNameOpenStoreA (HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN
 
WINECRYPT_CERTSTORECRYPT_FileNameOpenStoreW (HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN
 
void CRYPT_ImportSystemRootCertsToReg (void) DECLSPEC_HIDDEN
 
BOOL CRYPT_SerializeContextsToReg (HKEY key, DWORD flags, const WINE_CONTEXT_INTERFACE *contextInterface, HCERTSTORE memStore) DECLSPEC_HIDDEN
 
DWORD CRYPT_IsCertificateSelfSigned (const CERT_CONTEXT *cert) DECLSPEC_HIDDEN
 
HCERTCHAINENGINE CRYPT_CreateChainEngine (HCERTSTORE, DWORD, const CERT_CHAIN_ENGINE_CONFIG *) DECLSPEC_HIDDEN
 
const voidCRYPT_ReadSerializedElement (const BYTE *pbElement, DWORD cbElement, DWORD dwContextTypeFlags, DWORD *pdwContentType) DECLSPEC_HIDDEN
 
BOOL CRYPT_ReadSerializedStoreFromFile (HANDLE file, HCERTSTORE store) DECLSPEC_HIDDEN
 
BOOL CRYPT_ReadSerializedStoreFromBlob (const CRYPT_DATA_BLOB *blob, HCERTSTORE store) DECLSPEC_HIDDEN
 
void CRYPT_FixKeyProvInfoPointers (PCRYPT_KEY_PROV_INFO info) DECLSPEC_HIDDEN
 
DWORD cert_name_to_str_with_indent (DWORD dwCertEncodingType, DWORD indent, const CERT_NAME_BLOB *pName, DWORD dwStrType, LPWSTR psz, DWORD csz) DECLSPEC_HIDDEN
 
context_tContext_CreateDataContext (size_t contextSize, const context_vtbl_t *vtbl, struct WINE_CRYPTCERTSTORE *) DECLSPEC_HIDDEN
 
context_tContext_CreateLinkContext (unsigned contextSize, context_t *linked, struct WINE_CRYPTCERTSTORE *) DECLSPEC_HIDDEN
 
void Context_CopyProperties (const void *to, const void *from) DECLSPEC_HIDDEN
 
void Context_AddRef (context_t *) DECLSPEC_HIDDEN
 
void Context_Release (context_t *context) DECLSPEC_HIDDEN
 
void Context_Free (context_t *) DECLSPEC_HIDDEN
 
CONTEXT_PROPERTY_LISTContextPropertyList_Create (void) DECLSPEC_HIDDEN
 
BOOL ContextPropertyList_FindProperty (CONTEXT_PROPERTY_LIST *list, DWORD id, PCRYPT_DATA_BLOB blob) DECLSPEC_HIDDEN
 
BOOL ContextPropertyList_SetProperty (CONTEXT_PROPERTY_LIST *list, DWORD id, const BYTE *pbData, size_t cbData) DECLSPEC_HIDDEN
 
void ContextPropertyList_RemoveProperty (CONTEXT_PROPERTY_LIST *list, DWORD id) DECLSPEC_HIDDEN
 
DWORD ContextPropertyList_EnumPropIDs (CONTEXT_PROPERTY_LIST *list, DWORD id) DECLSPEC_HIDDEN
 
void ContextPropertyList_Copy (CONTEXT_PROPERTY_LIST *to, CONTEXT_PROPERTY_LIST *from) DECLSPEC_HIDDEN
 
void ContextPropertyList_Free (CONTEXT_PROPERTY_LIST *list) DECLSPEC_HIDDEN
 
void init_empty_store (void) DECLSPEC_HIDDEN
 

Variables

HINSTANCE hInstance DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ ALIGN_DWORD_PTR

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

Utilities.

Definition at line 447 of file crypt32_private.h.

◆ ASN_BITSTRING

#define ASN_BITSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03)

Definition at line 26 of file crypt32_private.h.

◆ ASN_BMPSTRING

#define ASN_BMPSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1e)

Definition at line 41 of file crypt32_private.h.

◆ ASN_BOOL

#define ASN_BOOL   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x01)

Definition at line 25 of file crypt32_private.h.

◆ ASN_ENUMERATED

#define ASN_ENUMERATED   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x0a)

Definition at line 27 of file crypt32_private.h.

◆ ASN_GENERALSTRING

#define ASN_GENERALSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1b)

Definition at line 39 of file crypt32_private.h.

◆ ASN_GENERALTIME

#define ASN_GENERALTIME   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x18)

Definition at line 36 of file crypt32_private.h.

◆ ASN_GRAPHICSTRING

#define ASN_GRAPHICSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x19)

Definition at line 37 of file crypt32_private.h.

◆ ASN_IA5STRING

#define ASN_IA5STRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x16)

Definition at line 34 of file crypt32_private.h.

◆ ASN_NUMERICSTRING

#define ASN_NUMERICSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x12)

Definition at line 30 of file crypt32_private.h.

◆ ASN_PRINTABLESTRING

#define ASN_PRINTABLESTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x13)

Definition at line 31 of file crypt32_private.h.

◆ ASN_SETOF

#define ASN_SETOF   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x11)

Definition at line 29 of file crypt32_private.h.

◆ ASN_T61STRING

#define ASN_T61STRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x14)

Definition at line 32 of file crypt32_private.h.

◆ ASN_UNIVERSALSTRING

#define ASN_UNIVERSALSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1c)

Definition at line 40 of file crypt32_private.h.

◆ ASN_UTCTIME

#define ASN_UTCTIME   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x17)

Definition at line 35 of file crypt32_private.h.

◆ ASN_UTF8STRING

#define ASN_UTF8STRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x0c)

Definition at line 28 of file crypt32_private.h.

◆ ASN_VIDEOTEXSTRING

#define ASN_VIDEOTEXSTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x15)

Definition at line 33 of file crypt32_private.h.

◆ ASN_VISIBLESTRING

#define ASN_VISIBLESTRING   (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1a)

Definition at line 38 of file crypt32_private.h.

◆ CERT_CERT_PROP_ID

#define CERT_CERT_PROP_ID   32

Definition at line 146 of file crypt32_private.h.

◆ CERT_CRL_PROP_ID

#define CERT_CRL_PROP_ID   33

Definition at line 147 of file crypt32_private.h.

◆ CERT_CTL_PROP_ID

#define CERT_CTL_PROP_ID   34

Definition at line 148 of file crypt32_private.h.

◆ IS_INTOID

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

Definition at line 452 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 448 of file crypt32_private.h.

◆ WINE_CRYPTCERTSTORE_MAGIC

#define WINE_CRYPTCERTSTORE_MAGIC   0x74726563

Definition at line 289 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 232 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 234 of file crypt32_private.h.

◆ CertStoreType

◆ CONTEXT_FUNCS

◆ CONTEXT_PROPERTY_LIST

◆ context_t

Definition at line 168 of file crypt32_private.h.

◆ CreateContextFunc

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

Definition at line 230 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 45 of file crypt32_private.h.

◆ DeleteContextFunc

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

Definition at line 246 of file crypt32_private.h.

◆ EnumContextsInStoreFunc

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

Definition at line 237 of file crypt32_private.h.

◆ EnumPropertiesFunc

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

Definition at line 239 of file crypt32_private.h.

◆ GetContextPropertyFunc

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

Definition at line 240 of file crypt32_private.h.

◆ SerializeElementFunc

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

Definition at line 244 of file crypt32_private.h.

◆ SetContextPropertyFunc

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

Definition at line 242 of file crypt32_private.h.

◆ StoreOpenFunc

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

Definition at line 264 of file crypt32_private.h.

◆ WINE_CONTEXT_INTERFACE

◆ WINECRYPT_CERTSTORE

Enumeration Type Documentation

◆ _CertStoreType

Enumerator
StoreTypeMem 
StoreTypeCollection 
StoreTypeProvider 
StoreTypeEmpty 

Definition at line 282 of file crypt32_private.h.

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

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 576 of file str.c.

578{
579 static const DWORD unsupportedFlags = CERT_NAME_STR_NO_QUOTING_FLAG |
581 static const WCHAR commaSep[] = { ',',' ',0 };
582 static const WCHAR semiSep[] = { ';',' ',0 };
583 static const WCHAR crlfSep[] = { '\r','\n',0 };
584 static const WCHAR plusSep[] = { ' ','+',' ',0 };
585 static const WCHAR spaceSep[] = { ' ',0 };
586 DWORD ret = 0, bytes = 0;
587 BOOL bRet;
589
590 if (dwStrType & unsupportedFlags)
591 FIXME("unsupported flags: %08x\n", dwStrType & unsupportedFlags);
592
595 if (bRet)
596 {
597 DWORD i, j, sepLen, rdnSepLen;
598 LPCWSTR sep, rdnSep;
600 const CERT_RDN *rdn = info->rgRDN;
601
602 if(reverse && info->cRDN > 1) rdn += (info->cRDN - 1);
603
605 sep = semiSep;
607 sep = crlfSep;
608 else
609 sep = commaSep;
610 sepLen = lstrlenW(sep);
612 rdnSep = spaceSep;
613 else
614 rdnSep = plusSep;
615 rdnSepLen = lstrlenW(rdnSep);
616 for (i = 0; (!psz || ret < csz) && i < info->cRDN; i++)
617 {
618 for (j = 0; (!psz || ret < csz) && j < rdn->cRDNAttr; j++)
619 {
620 DWORD chars;
621 LPCSTR prefixA = NULL;
622 LPCWSTR prefixW = NULL;
623
624 if ((dwStrType & 0x000000ff) == CERT_OID_NAME_STR)
625 prefixA = rdn->rgRDNAttr[j].pszObjId;
626 else if ((dwStrType & 0x000000ff) == CERT_X500_NAME_STR)
627 {
630 rdn->rgRDNAttr[j].pszObjId,
632
633 if (oidInfo)
634 prefixW = oidInfo->pwszName;
635 else
636 prefixA = rdn->rgRDNAttr[j].pszObjId;
637 }
639 {
640 DWORD k;
641
642 for (k = 0; k < indentLevel; k++)
643 {
644 if (psz)
645 {
646 chars = min(strlenW(indent), csz - ret - 1);
647 memcpy(psz + ret, indent, chars * sizeof(WCHAR));
648 }
649 else
650 chars = strlenW(indent);
651 ret += chars;
652 }
653 }
654 if (prefixW)
655 {
656 /* - 1 is needed to account for the NULL terminator. */
657 chars = CRYPT_AddPrefixW(prefixW,
658 psz ? psz + ret : NULL, psz ? csz - ret - 1 : 0);
659 ret += chars;
660 }
661 else if (prefixA)
662 {
663 /* - 1 is needed to account for the NULL terminator. */
664 chars = CRYPT_AddPrefixAToW(prefixA,
665 psz ? psz + ret : NULL, psz ? csz - ret - 1 : 0);
666 ret += chars;
667 }
669 rdn->rgRDNAttr[j].dwValueType,
670 &rdn->rgRDNAttr[j].Value, psz ? psz + ret : NULL,
671 psz ? csz - ret : 0);
672 if (chars)
673 ret += chars - 1;
674 if (j < rdn->cRDNAttr - 1)
675 {
676 if (psz && ret < csz - rdnSepLen - 1)
677 memcpy(psz + ret, rdnSep, rdnSepLen * sizeof(WCHAR));
678 ret += rdnSepLen;
679 }
680 }
681 if (i < info->cRDN - 1)
682 {
683 if (psz && ret < csz - sepLen - 1)
684 memcpy(psz + ret, sep, sepLen * sizeof(WCHAR));
685 ret += sepLen;
686 }
687 if(reverse) rdn--;
688 else rdn++;
689 }
691 }
692 if (psz && csz)
693 {
694 *(psz + ret) = '\0';
695 ret++;
696 }
697 else
698 ret++;
699 return ret;
700}
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:6286
#define NULL
Definition: types.h:112
static struct list oidInfo
Definition: oid.c:1206
PCCRYPT_OID_INFO WINAPI CryptFindOIDInfo(DWORD dwKeyType, void *pvKey, DWORD dwGroupId)
Definition: oid.c:1799
static DWORD CRYPT_AddPrefixAToW(LPCSTR prefix, LPWSTR psz, DWORD csz)
Definition: str.c:530
static const WCHAR indent[]
Definition: str.c:574
static DWORD quote_rdn_value_to_str_w(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, LPWSTR psz, DWORD csz)
Definition: str.c:288
static DWORD CRYPT_AddPrefixW(LPCWSTR prefix, LPWSTR psz, DWORD csz)
Definition: str.c:556
static const WCHAR commaSep[]
Definition: main.c:520
#define lstrlenW
Definition: compat.h:750
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
if(dx< 0)
Definition: linetemp.h:194
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static LPSTR pName
Definition: security.c:75
static LPCSTR DWORD dwStrType
Definition: str.c:196
#define min(a, b)
Definition: monoChain.cc:55
int k
Definition: mpi.c:3369
#define strlenW(s)
Definition: unicode.h:34
LPSTR pszObjId
Definition: wincrypt.h:256
DWORD dwValueType
Definition: wincrypt.h:257
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:258
PCERT_RDN_ATTR rgRDNAttr
Definition: wincrypt.h:263
static void reverse(int *pidx, int cch)
Definition: bidi.c:1153
int ret
#define CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG
Definition: wincrypt.h:3494
#define CERT_NAME_STR_NO_QUOTING_FLAG
Definition: wincrypt.h:3489
#define X509_NAME
Definition: wincrypt.h:3372
#define CERT_X500_NAME_STR
Definition: wincrypt.h:3486
#define CERT_NAME_STR_NO_PLUS_FLAG
Definition: wincrypt.h:3488
#define CERT_NAME_STR_SEMICOLON_FLAG
Definition: wincrypt.h:3487
#define CRYPT_RDN_ATTR_OID_GROUP_ID
Definition: wincrypt.h:1688
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5037
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define CERT_NAME_STR_CRLF_FLAG
Definition: wincrypt.h:3490
#define CRYPT_OID_INFO_OID_KEY
Definition: wincrypt.h:1702
#define CERT_NAME_STR_REVERSE_FLAG
Definition: wincrypt.h:3492
#define CERT_OID_NAME_STR
Definition: wincrypt.h:3485
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

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

◆ Context_AddRef()

void Context_AddRef ( context_t context)

Definition at line 78 of file context.c.

79{
81
82 TRACE("(%p) ref=%d\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) DECLSPEC_HIDDEN
Definition: proplist.c:207
#define assert(x)
Definition: debug.h:53
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) DECLSPEC_HIDDEN
Definition: proplist.c:43
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
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) DECLSPEC_HIDDEN
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=%d\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
#define list
Definition: rosglue.h:35
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define DWORD_PTR
Definition: treelist.c:76

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, %d, %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
#define FALSE
Definition: types.h:117
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 {
103 data = CryptMemAlloc(cbData);
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
unsigned char * LPBYTE
Definition: typedefs.h:53
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_updates_bytes_to_ pdwDataLen BYTE * pbData
Definition: wincrypt.h:4201

Referenced by CDecodeMsg_DecodeDataContent(), CDecodeMsg_DecodeHashedContent(), CDecodeMsg_SaveAlgorithmID(), 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 5822 of file decode.c.

5825{
5826 BOOL ret = FALSE;
5827 struct AsnDecodeSequenceItem items[] = {
5829 CRYPT_AsnDecodeIntInternal, sizeof(DWORD), FALSE, FALSE, 0, 0 },
5830 /* Placeholder for the hash algorithms - redundant with those in the
5831 * signers, so just ignore them.
5832 */
5833 { ASN_CONSTRUCTOR | ASN_SETOF, 0, NULL, 0, TRUE, FALSE, 0, 0 },
5836 FALSE, TRUE, offsetof(CRYPT_SIGNED_INFO, content.pszObjId), 0 },
5839 MEMBERSIZE(CRYPT_SIGNED_INFO, cCertEncoded, cCrlEncoded), TRUE, TRUE,
5840 offsetof(CRYPT_SIGNED_INFO, rgCertEncoded), 0 },
5843 MEMBERSIZE(CRYPT_SIGNED_INFO, cCrlEncoded, content), TRUE, TRUE,
5844 offsetof(CRYPT_SIGNED_INFO, rgCrlEncoded), 0 },
5848 offsetof(CRYPT_SIGNED_INFO, rgSignerInfo), 0 },
5849 };
5850
5851 TRACE("%p, %d, %08x, %p, %p, %p\n", pbEncoded, cbEncoded, dwFlags,
5852 pDecodePara, signedInfo, pcbSignedInfo);
5853
5855 pbEncoded, cbEncoded, dwFlags, pDecodePara, signedInfo, pcbSignedInfo,
5856 NULL, NULL);
5857 TRACE("returning %d\n", ret);
5858 return ret;
5859}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define MEMBERSIZE(s, member, nextmember)
Definition: decode.c:299
static BOOL CRYPT_AsnDecodeCMSCrlEncoded(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5654
#define FINALMEMBERSIZE(s, member)
Definition: decode.c:298
static BOOL CRYPT_AsnDecodePKCSContentInfoInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3304
static BOOL CRYPT_AsnDecodeIntInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4382
static BOOL CRYPT_DecodeSignerArray(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5803
static BOOL CRYPT_AsnDecodeCMSCertEncoded(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5634
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:451
#define ASN_SETOF
content
Definition: atl_ax.c:994
static const WCHAR version[]
Definition: asmname.c:66
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#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
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
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 3371 of file decode.c.

3374{
3375 BOOL ret;
3376 struct AsnDecodeSequenceItem items[] = {
3378 CRYPT_AsnDecodeIntInternal, sizeof(DWORD), FALSE, FALSE, 0, 0 },
3379 { ASN_SEQUENCEOF, offsetof(CRYPT_DIGESTED_DATA, DigestAlgorithm),
3381 FALSE, TRUE, offsetof(CRYPT_DIGESTED_DATA, DigestAlgorithm.pszObjId),
3382 0 },
3386 ContentInfo.pszObjId), 0 },
3389 offsetof(CRYPT_DIGESTED_DATA, hash.pbData), 0 },
3390 };
3391
3393 pbEncoded, cbEncoded, dwFlags, pDecodePara, digestedData, pcbDigestedData,
3394 NULL, NULL);
3395 return ret;
3396}
static BOOL CRYPT_AsnDecodeAlgorithmId(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2849
static BOOL CRYPT_AsnDecodeOctets(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4080
#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 5951 of file decode.c.

5954{
5955 BOOL ret;
5956 struct AsnDecodeSequenceItem items[] = {
5958 CRYPT_AsnDecodeIntInternal, sizeof(DWORD), FALSE, FALSE, 0, 0 },
5960 cRecipientInfo), CRYPT_DecodeRecipientInfoArray,
5961 MEMBERSIZE(CRYPT_ENVELOPED_DATA, cRecipientInfo, encryptedContentInfo),
5962 FALSE, TRUE, offsetof(CRYPT_ENVELOPED_DATA, rgRecipientInfo), 0 },
5963 { ASN_SEQUENCEOF, offsetof(CRYPT_ENVELOPED_DATA, encryptedContentInfo),
5966 offsetof(CRYPT_ENVELOPED_DATA, encryptedContentInfo.contentType), 0 },
5967 };
5968
5969 TRACE("%p, %d, %08x, %p, %p, %p\n", pbEncoded, cbEncoded, dwFlags,
5970 pDecodePara, envelopedData, pcbEnvelopedData);
5971
5973 pbEncoded, cbEncoded, dwFlags, pDecodePara, envelopedData,
5974 pcbEnvelopedData, NULL, NULL);
5975 TRACE("returning %d\n", ret);
5976 return ret;
5977}
static BOOL CRYPT_DecodeRecipientInfoArray(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5897
static BOOL CRYPT_AsnDecodeEncryptedContentInfo(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5919
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 4307 of file encode.c.

4309{
4310 struct AsnEncodeSequenceItem items[7] = {
4311 { &signedInfo->version, CRYPT_AsnEncodeInt, 0 },
4312 };
4313 struct DERSetDescriptor digestAlgorithmsSet = { 0 }, certSet = { 0 };
4314 struct DERSetDescriptor crlSet = { 0 }, signerSet = { 0 };
4315 struct AsnEncodeTagSwappedItem swapped[2] = { { 0 } };
4316 DWORD cItem = 1, cSwapped = 0;
4317 BOOL ret = TRUE;
4318
4319 if (signedInfo->cSignerInfo)
4320 {
4321 digestAlgorithmsSet.cItems = signedInfo->cSignerInfo;
4322 digestAlgorithmsSet.items = signedInfo->rgSignerInfo;
4323 digestAlgorithmsSet.itemSize = sizeof(CMSG_CMS_SIGNER_INFO);
4324 digestAlgorithmsSet.itemOffset =
4327 items[cItem].pvStructInfo = &digestAlgorithmsSet;
4328 items[cItem].encodeFunc = CRYPT_DEREncodeItemsAsSet;
4329 cItem++;
4330 }
4331 items[cItem].pvStructInfo = &signedInfo->content;
4333 cItem++;
4334 if (signedInfo->cCertEncoded)
4335 {
4336 certSet.cItems = signedInfo->cCertEncoded;
4337 certSet.items = signedInfo->rgCertEncoded;
4338 certSet.itemSize = sizeof(CERT_BLOB);
4339 certSet.itemOffset = 0;
4340 certSet.encode = CRYPT_CopyEncodedBlob;
4341 swapped[cSwapped].tag = ASN_CONSTRUCTOR | ASN_CONTEXT | 0;
4342 swapped[cSwapped].pvStructInfo = &certSet;
4343 swapped[cSwapped].encodeFunc = CRYPT_DEREncodeItemsAsSet;
4344 items[cItem].pvStructInfo = &swapped[cSwapped];
4345 items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
4346 cSwapped++;
4347 cItem++;
4348 }
4349 if (signedInfo->cCrlEncoded)
4350 {
4351 crlSet.cItems = signedInfo->cCrlEncoded;
4352 crlSet.items = signedInfo->rgCrlEncoded;
4353 crlSet.itemSize = sizeof(CRL_BLOB);
4354 crlSet.itemOffset = 0;
4356 swapped[cSwapped].tag = ASN_CONSTRUCTOR | ASN_CONTEXT | 1;
4357 swapped[cSwapped].pvStructInfo = &crlSet;
4358 swapped[cSwapped].encodeFunc = CRYPT_DEREncodeItemsAsSet;
4359 items[cItem].pvStructInfo = &swapped[cSwapped];
4360 items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
4361 cSwapped++;
4362 cItem++;
4363 }
4364 if (ret && signedInfo->cSignerInfo)
4365 {
4366 signerSet.cItems = signedInfo->cSignerInfo;
4367 signerSet.items = signedInfo->rgSignerInfo;
4368 signerSet.itemSize = sizeof(CMSG_CMS_SIGNER_INFO);
4369 signerSet.itemOffset = 0;
4370 signerSet.encode = CRYPT_AsnEncodeCMSSignerInfo;
4371 items[cItem].pvStructInfo = &signerSet;
4372 items[cItem].encodeFunc = CRYPT_DEREncodeItemsAsSet;
4373 cItem++;
4374 }
4375 if (ret)
4377 items, cItem, 0, NULL, pvData, pcbData);
4378
4379 return ret;
4380}
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:383
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
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:298
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:335
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:3333
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:4218
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:1926
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:1245
const void * pvStructInfo
Definition: encode.c:290
CryptEncodeObjectExFunc encodeFunc
Definition: encode.c:291
size_t itemOffset
Definition: encode.c:1241
CryptEncodeObjectExFunc encode
Definition: encode.c:1242
size_t itemSize
Definition: encode.c:1240
const void * items
Definition: encode.c:1239
PCERT_BLOB rgCertEncoded
CRYPT_CONTENT_INFO content
PCMSG_CMS_SIGNER_INFO rgSignerInfo
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
struct _CRYPTOAPI_BLOB CRL_BLOB
struct _CMSG_CMS_SIGNER_INFO CMSG_CMS_SIGNER_INFO
#define PKCS_7_ASN_ENCODING
Definition: wincrypt.h:2299
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4950
struct _CRYPTOAPI_BLOB CERT_BLOB
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3749
_In_ BOOLEAN _In_ ULONG HashAlgorithm
Definition: rtlfuncs.h:2052

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 239 of file encode.c.

242{
243 BOOL ret;
244 const struct AsnConstructedItem *item = pvStructInfo;
245 DWORD len;
246
247 if ((ret = item->encodeFunc(dwCertEncodingType, lpszStructType,
248 item->pvStructInfo, dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL, NULL, &len)))
249 {
250 DWORD dataLen, bytesNeeded;
251
252 CRYPT_EncodeLen(len, NULL, &dataLen);
253 bytesNeeded = 1 + dataLen + len;
254 if (!pbEncoded)
255 *pcbEncoded = bytesNeeded;
256 else if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara,
257 pbEncoded, pcbEncoded, bytesNeeded)))
258 {
259 BYTE *out;
260
262 pbEncoded = *(BYTE **)pbEncoded;
263 out = pbEncoded;
264 *out++ = ASN_CONTEXT | ASN_CONSTRUCTOR | item->tag;
265 CRYPT_EncodeLen(len, out, &dataLen);
266 out += dataLen;
267 ret = item->encodeFunc(dwCertEncodingType, lpszStructType,
268 item->pvStructInfo, dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL,
269 out, &len);
270 if (!ret)
271 {
272 /* Some functions propagate their errors through the size */
273 *pcbEncoded = len;
275 CRYPT_FreeSpace(pEncodePara, pbEncoded);
276 }
277 }
278 }
279 else
280 {
281 /* Some functions propagate their errors through the size */
282 *pcbEncoded = len;
283 }
284 return ret;
285}
static void CRYPT_FreeSpace(const CRYPT_ENCODE_PARA *pEncodePara, LPVOID pv)
Definition: encode.c:130
BOOL CRYPT_EncodeLen(DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:138
BOOL CRYPT_EncodeEnsureSpace(DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded)
Definition: encode.c:103
GLenum GLsizei len
Definition: glext.h:6722
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:197
static ATOM item
Definition: dde.c:856
static FILE * out
Definition: regtests2xml.c:44
const void * pvStructInfo
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3441
unsigned char BYTE
Definition: xxhash.c:193

Referenced by CRYPT_AsnEncodeAuthorityKeyId(), CRYPT_AsnEncodeCertInfo(), CRYPT_AsnEncodeCertVersion(), CRYPT_AsnEncodeCRLInfo(), CRYPT_AsnEncodeCTL(), CRYPT_AsnEncodeDistPoint(), CRYPT_AsnEncodeIssuingDistPoint(), 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 3178 of file encode.c.

3181{
3182 BOOL ret;
3183
3184 __TRY
3185 {
3186 const CRYPT_DATA_BLOB *blob = pvStructInfo;
3187 DWORD bytesNeeded, lenBytes;
3188
3189 TRACE("(%d, %p), %08x, %p, %p, %d\n", blob->cbData, blob->pbData,
3190 dwFlags, pEncodePara, pbEncoded, pbEncoded ? *pcbEncoded : 0);
3191
3192 CRYPT_EncodeLen(blob->cbData, NULL, &lenBytes);
3193 bytesNeeded = 1 + lenBytes + blob->cbData;
3194 if (!pbEncoded)
3195 {
3196 *pcbEncoded = bytesNeeded;
3197 ret = TRUE;
3198 }
3199 else
3200 {
3201 if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara, pbEncoded,
3202 pcbEncoded, bytesNeeded)))
3203 {
3205 pbEncoded = *(BYTE **)pbEncoded;
3207 CRYPT_EncodeLen(blob->cbData, pbEncoded, &lenBytes);
3208 pbEncoded += lenBytes;
3209 if (blob->cbData)
3210 memcpy(pbEncoded, blob->pbData, blob->cbData);
3211 }
3212 }
3213 }
3215 {
3217 ret = FALSE;
3218 }
3219 __ENDTRY
3220 TRACE("returning %d (%08x)\n", ret, GetLastError());
3221 return ret;
3222}
#define SetLastError(x)
Definition: compat.h:752
#define __TRY
Definition: compat.h:80
#define __ENDTRY
Definition: compat.h:82
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:81
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by CRYPT_AsnEncodeAuthorityKeyId(), CRYPT_AsnEncodeAuthorityKeyId2(), 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 820 of file encode.c.

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

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 1952 of file encode.c.

1954{
1955 struct AsnEncodeSequenceItem items[] = {
1956 { &digestedData->version, CRYPT_AsnEncodeInt, 0 },
1958 0 },
1960 { &digestedData->hash, CRYPT_AsnEncodeOctets, 0 },
1961 };
1962
1964}
BOOL WINAPI CRYPT_AsnEncodeOctets(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3178
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 4418 of file encode.c.

4420{
4421 struct DERSetDescriptor recipientInfosSet = { envelopedData->cRecipientInfo,
4422 envelopedData->rgRecipientInfo, sizeof(CMSG_KEY_TRANS_RECIPIENT_INFO), 0,
4424 struct AsnEncodeSequenceItem items[] = {
4425 { &envelopedData->version, CRYPT_AsnEncodeInt, 0 },
4426 { &recipientInfosSet, CRYPT_DEREncodeItemsAsSet, 0 },
4427 { &envelopedData->encryptedContentInfo,
4429 };
4430
4433}
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:4382
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:4400
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 484 of file encode.c.

487{
488 BOOL ret;
489 const CERT_PUBLIC_KEY_INFO *info = pvStructInfo;
490 struct AsnEncodeSequenceItem items[] = {
491 { &info->Algorithm, CRYPT_AsnEncodeAlgorithmId, 0 },
492 { &info->PublicKey, CRYPT_AsnEncodeBits, 0 },
493 };
494
495 TRACE("Encoding public key with OID %s\n",
496 debugstr_a(info->Algorithm.pszObjId));
498 ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded,
499 pcbEncoded);
500 return ret;
501}
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:3224
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:408

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 180 of file encode.c.

183{
184 BOOL ret;
185 DWORD i, dataLen = 0;
186
187 TRACE("%p, %d, %08x, %p, %p, %d\n", items, cItem, dwFlags, pEncodePara,
189 for (i = 0, ret = TRUE; ret && i < cItem; i++)
190 {
191 ret = items[i].encodeFunc(dwCertEncodingType, NULL,
192 items[i].pvStructInfo, dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL,
193 NULL, &items[i].size);
194 /* Some functions propagate their errors through the size */
195 if (!ret)
196 *pcbEncoded = items[i].size;
197 dataLen += items[i].size;
198 }
199 if (ret)
200 {
201 DWORD lenBytes, bytesNeeded;
202
203 CRYPT_EncodeLen(dataLen, NULL, &lenBytes);
204 bytesNeeded = 1 + lenBytes + dataLen;
205 if (!pbEncoded)
206 *pcbEncoded = bytesNeeded;
207 else
208 {
209 if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara, pbEncoded,
210 pcbEncoded, bytesNeeded)))
211 {
212 BYTE *out;
213
215 pbEncoded = *(BYTE **)pbEncoded;
216 out = pbEncoded;
217 *out++ = ASN_SEQUENCE;
218 CRYPT_EncodeLen(dataLen, out, &lenBytes);
219 out += lenBytes;
220 for (i = 0; ret && i < cItem; i++)
221 {
222 ret = items[i].encodeFunc(dwCertEncodingType, NULL,
223 items[i].pvStructInfo, dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG,
224 NULL, out, &items[i].size);
225 /* Some functions propagate their errors through the size */
226 if (!ret)
227 *pcbEncoded = items[i].size;
228 out += items[i].size;
229 }
231 CRYPT_FreeSpace(pEncodePara, pbEncoded);
232 }
233 }
234 }
235 TRACE("returning %d (%08x)\n", ret, GetLastError());
236 return ret;
237}
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_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_AsnEncodePKCSAttribute(), CRYPT_AsnEncodePKCSContentInfoInternal(), CRYPT_AsnEncodePKCSDigestedData(), CRYPT_AsnEncodePKCSEnvelopedData(), CRYPT_AsnEncodePKCSSignerInfo(), CRYPT_AsnEncodePolicyQualifierUserNotice(), CRYPT_AsnEncodePubKeyInfo(), CRYPT_AsnEncodePubKeyInfoNoNull(), CRYPT_AsnEncodeRecipientInfo(), CRYPT_AsnEncodeRsaPubKey(), 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 *) DECLSPEC_HIDDEN
Definition: store.c:91
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define memset(x, y, z)
Definition: compat.h:39
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:887
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:894
WINECRYPT_CERTSTORE hdr
CRITICAL_SECTION cs
#define CERT_STORE_DELETE_FLAG
Definition: wincrypt.h:2455

Referenced by CertOpenStore().

◆ 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 static const WCHAR caW[] = { 'C','A',0 };
121 static const WCHAR myW[] = { 'M','y',0 };
122 static const WCHAR trustW[] = { 'T','r','u','s','t',0 };
123
124 if(!root) {
125 if(config->cbSize >= sizeof(CERT_CHAIN_ENGINE_CONFIG) && config->hExclusiveRoot)
126 root = CertDuplicateStore(config->hExclusiveRoot);
127 else if (config->hRestrictedRoot)
128 root = CertDuplicateStore(config->hRestrictedRoot);
129 else
130 root = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, rootW);
131 if(!root)
132 return NULL;
133 }
134
135 engine = CryptMemAlloc(sizeof(CertificateChainEngine));
136 if(!engine) {
138 return NULL;
139 }
140
141 engine->ref = 1;
142 engine->hRoot = root;
144 worldStores[0] = CertDuplicateStore(engine->hRoot);
145 worldStores[1] = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, caW);
146 worldStores[2] = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, myW);
147 worldStores[3] = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, trustW);
148
149 CRYPT_AddStoresToCollection(engine->hWorld, ARRAY_SIZE(worldStores), worldStores);
150 CRYPT_AddStoresToCollection(engine->hWorld, config->cAdditionalStore, config->rghAdditionalStore);
151 CRYPT_CloseStores(ARRAY_SIZE(worldStores), worldStores);
152
153 engine->dwFlags = config->dwFlags;
154 engine->dwUrlRetrievalTimeout = config->dwUrlRetrievalTimeout;
155 engine->MaximumCachedCertificates = config->MaximumCachedCertificates;
156 if(config->CycleDetectionModulus)
157 engine->CycleDetectionModulus = config->CycleDetectionModulus;
158 else
160
161 return engine;
162}
struct _root root
static void CRYPT_CloseStores(DWORD cStores, HCERTSTORE *stores)
Definition: chain.c:61
#define DEFAULT_CYCLE_MODULUS
Definition: chain.c:34
static const WCHAR rootW[]
Definition: chain.c:69
static void CRYPT_AddStoresToCollection(HCERTSTORE collection, DWORD cStores, HCERTSTORE *stores)
Definition: chain.c:52
HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwMsgAndCertEncodingType, HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const void *pvPara)
Definition: store.c:815
HCERTSTORE WINAPI CertDuplicateStore(HCERTSTORE hCertStore)
Definition: store.c:1116
BOOL WINAPI CertCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
Definition: store.c:1127
DWORD MaximumCachedCertificates
Definition: chain.c:48
DWORD dwUrlRetrievalTimeout
Definition: chain.c:47
HCERTSTORE hRoot
Definition: chain.c:44
DWORD CycleDetectionModulus
Definition: chain.c:49
HCERTSTORE hWorld
Definition: chain.c:45
#define CERT_STORE_PROV_COLLECTION
Definition: wincrypt.h:2261
#define CERT_STORE_CREATE_NEW_FLAG
Definition: wincrypt.h:2464
#define CERT_STORE_PROV_SYSTEM_W
Definition: wincrypt.h:2259

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 103 of file encode.c.

105{
106 BOOL ret = TRUE;
107
109 {
110 if (pEncodePara && pEncodePara->pfnAlloc)
111 *(BYTE **)pbEncoded = pEncodePara->pfnAlloc(bytesNeeded);
112 else
113 *(BYTE **)pbEncoded = LocalAlloc(0, bytesNeeded);
114 if (!*(BYTE **)pbEncoded)
115 ret = FALSE;
116 else
117 *pcbEncoded = bytesNeeded;
118 }
119 else if (bytesNeeded > *pcbEncoded)
120 {
121 *pcbEncoded = bytesNeeded;
123 ret = FALSE;
124 }
125 else
126 *pcbEncoded = bytesNeeded;
127 return ret;
128}
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
PFN_CRYPT_ALLOC pfnAlloc
Definition: wincrypt.h:1136

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_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 138 of file encode.c.

139{
140 DWORD bytesNeeded, significantBytes = 0;
141
142 if (len <= 0x7f)
143 bytesNeeded = 1;
144 else
145 {
146 DWORD temp;
147
148 for (temp = len, significantBytes = sizeof(temp); !(temp & 0xff000000);
149 temp <<= 8, significantBytes--)
150 ;
151 bytesNeeded = significantBytes + 1;
152 }
153 if (!pbEncoded)
154 {
155 *pcbEncoded = bytesNeeded;
156 return TRUE;
157 }
158 if (*pcbEncoded < bytesNeeded)
159 {
161 return FALSE;
162 }
163 if (len <= 0x7f)
164 *pbEncoded = (BYTE)len;
165 else
166 {
167 DWORD i;
168
169 *pbEncoded++ = significantBytes | 0x80;
170 for (i = 0; i < significantBytes; i++)
171 {
172 *(pbEncoded + significantBytes - i - 1) = (BYTE)(len & 0xff);
173 len >>= 8;
174 }
175 }
176 *pcbEncoded = bytesNeeded;
177 return TRUE;
178}
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_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 383 of file filestore.c.

385{
386 int len;
388
389 TRACE("(%ld, %08x, %s)\n", hCryptProv, dwFlags,
391
392 if (!pvPara)
393 {
395 return NULL;
396 }
398 if (len)
399 {
400 LPWSTR storeName = CryptMemAlloc(len * sizeof(WCHAR));
401
402 if (storeName)
403 {
404 MultiByteToWideChar(CP_ACP, 0, pvPara, -1, storeName, len);
405 ret = CRYPT_FileNameOpenStoreW(hCryptProv, dwFlags, storeName);
406 CryptMemFree(storeName);
407 }
408 }
409 return ret;
410}
#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:292
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
_In_ void * pvPara
Definition: wincrypt.h:6077
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CertOpenStore().

◆ CRYPT_FileNameOpenStoreW()

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

Definition at line 292 of file filestore.c.

294{
295 HCERTSTORE store = 0;
296 LPCWSTR fileName = pvPara;
298 HANDLE file;
299
300 TRACE("(%ld, %08x, %s)\n", hCryptProv, dwFlags, debugstr_w(fileName));
301
302 if (!fileName)
303 {
305 return NULL;
306 }
309 {
311 return NULL;
312 }
313
321 else
326 {
327 HCERTSTORE memStore = NULL;
329
330 /* If the file isn't empty, try to get the type from the file itself */
331 if (size)
332 {
333 DWORD contentType;
334 BOOL ret;
335
336 /* Close the file so CryptQueryObject can succeed.. */
342 CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, &contentType, NULL,
343 &memStore, NULL, NULL);
344 if (ret)
345 {
346 if (contentType == CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED)
348 else
350 /* and reopen the file. */
353 }
354 }
355 else
356 {
357 static const WCHAR spc[] = { 's','p','c',0 };
358 static const WCHAR p7c[] = { 'p','7','c',0 };
359 LPCWSTR ext = strrchrW(fileName, '.');
360
361 if (ext)
362 {
363 ext++;
364 if (!lstrcmpiW(ext, spc) || !lstrcmpiW(ext, p7c))
366 }
367 if (!type)
369 memStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
371 }
372 if (memStore)
373 {
374 store = CRYPT_CreateFileStore(dwFlags, memStore, file, type);
375 /* File store doesn't need crypto provider, so close it */
376 if (hCryptProv && !(dwFlags & CERT_STORE_NO_CRYPT_RELEASE_FLAG))
377 CryptReleaseContext(hCryptProv, 0);
378 }
379 }
380 return store;
381}
#define E_INVALIDARG
Definition: ddrawi.h:101
BOOL WINAPI CryptReleaseContext(HCRYPTPROV hProv, DWORD dwFlags)
Definition: crypt.c:648
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:699
#define CloseHandle
Definition: compat.h:739
#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:4261
static WINECRYPT_CERTSTORE * CRYPT_CreateFileStore(DWORD dwFlags, HCERTSTORE memStore, HANDLE file, DWORD type)
Definition: filestore.c:218
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
#define strrchrW(s, c)
Definition: unicode.h:41
Definition: fci.c:127
#define CERT_STORE_SAVE_AS_STORE
Definition: wincrypt.h:2646
#define CERT_QUERY_OBJECT_FILE
Definition: wincrypt.h:3526
#define CERT_STORE_SAVE_AS_PKCS7
Definition: wincrypt.h:2647
#define CERT_QUERY_CONTENT_FLAG_CERT
Definition: wincrypt.h:3543
#define CERT_STORE_OPEN_EXISTING_FLAG
Definition: wincrypt.h:2465
#define CERT_FILE_STORE_COMMIT_ENABLE_FLAG
Definition: wincrypt.h:2475
#define CERT_STORE_PROV_MEMORY
Definition: wincrypt.h:2251
#define CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED
Definition: wincrypt.h:3554
#define CERT_QUERY_FORMAT_FLAG_ALL
Definition: wincrypt.h:3589
#define CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE
Definition: wincrypt.h:3546
#define CERT_STORE_NO_CRYPT_RELEASE_FLAG
Definition: wincrypt.h:2452
#define CERT_STORE_READONLY_FLAG
Definition: wincrypt.h:2466
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106

Referenced by CertOpenStore(), and CRYPT_FileNameOpenStoreA().

◆ CRYPT_FileOpenStore()

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

Definition at line 242 of file filestore.c.

244{
245 WINECRYPT_CERTSTORE *store = NULL;
247
248 TRACE("(%ld, %08x, %p)\n", hCryptProv, dwFlags, pvPara);
249
250 if (!pvPara)
251 {
253 return NULL;
254 }
256 {
258 return NULL;
259 }
262 {
264 return NULL;
265 }
266
270 {
271 HCERTSTORE memStore;
272
273 memStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
275 if (memStore)
276 {
278 {
279 store = CRYPT_CreateFileStore(dwFlags, memStore, file,
281 /* File store doesn't need crypto provider, so close it */
282 if (hCryptProv &&
284 CryptReleaseContext(hCryptProv, 0);
285 }
286 }
287 }
288 TRACE("returning %p\n", store);
289 return store;
290}
BOOL CRYPT_ReadSerializedStoreFromFile(HANDLE file, HCERTSTORE store) DECLSPEC_HIDDEN
Definition: serialize.c:544
#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_FixKeyProvInfoPointers()

void CRYPT_FixKeyProvInfoPointers ( PCRYPT_KEY_PROV_INFO  info)

Definition at line 523 of file cert.c.

524{
525 DWORD i, containerLen, provNameLen;
527
528 info->pwszContainerName = (LPWSTR)data;
529 containerLen = (lstrlenW(info->pwszContainerName) + 1) * sizeof(WCHAR);
530 data += containerLen;
531
532 info->pwszProvName = (LPWSTR)data;
533 provNameLen = (lstrlenW(info->pwszProvName) + 1) * sizeof(WCHAR);
534 data += provNameLen;
535
536 if (info->cProvParam)
537 {
538 info->rgProvParam = (PCRYPT_KEY_PROV_PARAM)data;
539 data += info->cProvParam * sizeof(CRYPT_KEY_PROV_PARAM);
540
541 for (i = 0; i < info->cProvParam; i++)
542 {
543 info->rgProvParam[i].pbData = data;
544 data += info->rgProvParam[i].cbData;
545 }
546 }
547 else
548 info->rgProvParam = NULL;
549}
struct _CRYPT_KEY_PROV_PARAM * PCRYPT_KEY_PROV_PARAM
struct _CRYPT_KEY_PROV_PARAM CRYPT_KEY_PROV_PARAM

Referenced by CertGetCertificateContextProperty(), and CRYPT_ReadContextProp().

◆ CRYPT_FreeStore()

void CRYPT_FreeStore ( WINECRYPT_CERTSTORE store)

Definition at line 101 of file store.c.

102{
103 if (store->properties)
105 store->dwMagic = 0;
106 CryptMemFree(store);
107}
CONTEXT_PROPERTY_LIST * properties

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

◆ CRYPT_ImportSystemRootCertsToReg()

void CRYPT_ImportSystemRootCertsToReg ( void  )

Definition at line 1044 of file rootstore.c.

1045{
1046 HCERTSTORE store = NULL;
1047 HKEY key;
1048 LONG rc;
1049 HANDLE hsem;
1050
1051 static BOOL root_certs_imported = FALSE;
1052
1053 if (root_certs_imported)
1054 return;
1055
1056 hsem = CreateSemaphoreW( NULL, 0, 1, semaphoreW);
1057 if (!hsem)
1058 {
1059 ERR("Failed to create semaphore\n");
1060 return;
1061 }
1062
1065 else
1066 {
1067 if ((store = create_root_store()))
1068 {
1070 KEY_ALL_ACCESS, NULL, &key, 0);
1071 if (!rc)
1072 {
1074 ERR("Failed to import system certs into registry, %08x\n", GetLastError());
1076 }
1077 CertCloseStore(store, 0);
1078 } else
1079 ERR("Failed to create root store\n");
1080 }
1081
1082 root_certs_imported = TRUE;
1083 ReleaseSemaphore(hsem, 1, NULL);
1084 CloseHandle(hsem);
1085}
#define ERR(fmt,...)
Definition: precomp.h:57
#define RegCloseKey(hKey)
Definition: registry.h:49
BOOL CRYPT_SerializeContextsToReg(HKEY key, DWORD flags, const WINE_CONTEXT_INTERFACE *contextInterface, HCERTSTORE memStore) DECLSPEC_HIDDEN
Definition: regstore.c:208
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
const WINE_CONTEXT_INTERFACE * pCertInterface
Definition: store.c:54
#define INFINITE
Definition: serial.h:102
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
static HCERTSTORE create_root_store(void)
Definition: rootstore.c:991
static const WCHAR certs_root_pathW[]
Definition: rootstore.c:1037
static const WCHAR semaphoreW[]
Definition: rootstore.c:1041
Definition: copy.c:22
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:444
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:542
#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 91 of file store.c.

92{
93 store->ref = 1;
95 store->type = type;
96 store->dwOpenFlags = dwFlags;
97 store->vtbl = vtbl;
98 store->properties = NULL;
99}
#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 268 of file chain.c.

269{
270 DWORD size, status = 0;
272 BOOL ret;
273
275 cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension)))
276 {
278
279 ret = CryptDecodeObjectEx(cert->dwCertEncodingType,
280 X509_AUTHORITY_KEY_ID2, ext->Value.pbData, ext->Value.cbData,
282 &info, &size);
283 if (ret)
284 {
285 if (info->AuthorityCertIssuer.cAltEntry &&
286 info->AuthorityCertSerialNumber.cbData)
287 {
288 PCERT_ALT_NAME_ENTRY directoryName = NULL;
289 DWORD i;
290
291 for (i = 0; !directoryName &&
292 i < info->AuthorityCertIssuer.cAltEntry; i++)
293 if (info->AuthorityCertIssuer.rgAltEntry[i].dwAltNameChoice
295 directoryName =
296 &info->AuthorityCertIssuer.rgAltEntry[i];
297 if (directoryName)
298 {
299 if (CertCompareCertificateName(cert->dwCertEncodingType, &directoryName->u.DirectoryName, &cert->pCertInfo->Issuer)
300 && CertCompareIntegerBlob(&info->AuthorityCertSerialNumber, &cert->pCertInfo->SerialNumber))
302 }
303 else
304 {
305 FIXME("no supported name type in authority key id2\n");
306 ret = FALSE;
307 }
308 }
309 else if (info->KeyId.cbData)
310 {
313 if (ret && size == info->KeyId.cbData)
314 {
316
317 if (buf)
318 {
320 if (!memcmp(buf, info->KeyId.pbData, size))
323 }
324 }
325 }
327 }
328 }
330 cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension)))
331 {
333
334 ret = CryptDecodeObjectEx(cert->dwCertEncodingType,
335 X509_AUTHORITY_KEY_ID, ext->Value.pbData, ext->Value.cbData,
337 &info, &size);
338 if (ret)
339 {
340 if (info->CertIssuer.cbData && info->CertSerialNumber.cbData)
341 {
342 if (CertCompareCertificateName(cert->dwCertEncodingType, &info->CertIssuer, &cert->pCertInfo->Issuer)
343 && CertCompareIntegerBlob(&info->CertSerialNumber, &cert->pCertInfo->SerialNumber))
345 }
346 else if (info->KeyId.cbData)
347 {
350 if (ret && size == info->KeyId.cbData)
351 {
353
354 if (buf)
355 {
358 if (!memcmp(buf, info->KeyId.pbData, size))
361 }
362 }
363 }
365 }
366 }
367 else
368 if (CertCompareCertificateName(cert->dwCertEncodingType, &cert->pCertInfo->Subject, &cert->pCertInfo->Issuer))
370
371 if (status)
373
374 return status;
375}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
BOOL WINAPI CertCompareCertificateName(DWORD dwCertEncodingType, PCERT_NAME_BLOB pCertName1, PCERT_NAME_BLOB pCertName2)
Definition: cert.c:1180
PCERT_EXTENSION WINAPI CertFindExtension(LPCSTR pszObjId, DWORD cExtensions, CERT_EXTENSION rgExtensions[])
Definition: cert.c:2028
BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, void *pvData, DWORD *pcbData)
Definition: cert.c:551
BOOL WINAPI CertCompareIntegerBlob(PCRYPT_INTEGER_BLOB pInt1, PCRYPT_INTEGER_BLOB pInt2)
Definition: cert.c:1221
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static BYTE cert[]
Definition: msg.c:1437
Definition: wincrypt.h:332
CERT_NAME_BLOB DirectoryName
Definition: wincrypt.h:338
Definition: ps.c:97
#define X509_AUTHORITY_KEY_ID2
Definition: wincrypt.h:3398
#define szOID_AUTHORITY_KEY_IDENTIFIER
Definition: wincrypt.h:3175
#define CRYPT_DECODE_NOCOPY_FLAG
Definition: wincrypt.h:3450
#define CERT_KEY_IDENTIFIER_PROP_ID
Definition: wincrypt.h:2706
#define CERT_ALT_NAME_DIRECTORY_NAME
Definition: wincrypt.h:349
#define CERT_TRUST_IS_SELF_SIGNED
Definition: wincrypt.h:899
#define CERT_TRUST_HAS_KEY_MATCH_ISSUER
Definition: wincrypt.h:897
#define X509_AUTHORITY_KEY_ID
Definition: wincrypt.h:3374
#define CERT_TRUST_HAS_NAME_MATCH_ISSUER
Definition: wincrypt.h:898
#define szOID_AUTHORITY_KEY_IDENTIFIER2
Definition: wincrypt.h:3200

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

◆ crypt_oid_free()

void crypt_oid_free ( void  )

Definition at line 1920 of file oid.c.

1921{
1923 free_oid_info();
1924}
static void free_oid_info(void)
Definition: oid.c:1761
static void free_function_sets(void)
Definition: oid.c:87

Referenced by DllMain().

◆ crypt_oid_init()

void crypt_oid_init ( void  )

Definition at line 1914 of file oid.c.

1915{
1916 init_oid_info();
1918}
static void init_oid_info(void)
Definition: oid.c:1690
static void init_registered_oid_info(void)
Definition: oid.c:1650

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:1149
HCERTSTOREPROV hStoreProv
Definition: wincrypt.h:1150
#define CERT_STORE_PROV_WRITE_CTL_FUNC
Definition: wincrypt.h:2563
#define CERT_STORE_PROV_CONTROL_FUNC
Definition: wincrypt.h:2566
#define CERT_STORE_PROV_EXTERNAL_FLAG
Definition: wincrypt.h:2546
#define CERT_STORE_PROV_CLOSE_FUNC
Definition: wincrypt.h:2553
#define CERT_STORE_PROV_DELETE_CTL_FUNC
Definition: wincrypt.h:2564
#define CERT_STORE_PROV_DELETE_CRL_FUNC
Definition: wincrypt.h:2560
#define CERT_STORE_PROV_DELETE_CERT_FUNC
Definition: wincrypt.h:2556
#define CERT_STORE_PROV_WRITE_CERT_FUNC
Definition: wincrypt.h:2555
#define CERT_STORE_PROV_WRITE_CRL_FUNC
Definition: wincrypt.h:2559

Referenced by create_root_store(), 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:114
BOOL WINAPI CryptGetOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet, DWORD dwEncodingType, LPCSTR pszOID, DWORD dwFlags, void **ppvFuncAddr, HCRYPTOIDFUNCADDR *phFuncAddr)
Definition: oid.c:387
BOOL WINAPI CryptFreeOIDFunctionAddress(HCRYPTOIDFUNCADDR hFuncAddr, DWORD dwFlags)
Definition: oid.c:468
WINECRYPT_CERTSTORE * CRYPT_ProvCreateStore(DWORD dwFlags, WINECRYPT_CERTSTORE *memStore, const CERT_STORE_PROV_INFO *pProvInfo)
Definition: provstore.c:307
_In_ DWORD dwEncodingType
Definition: wincrypt.h:4625
BOOL(WINAPI * PFN_CERT_DLL_OPEN_STORE_PROV_FUNC)(_In_ LPCSTR lpszStoreProvider, _In_ DWORD dwEncodingType, _In_opt_ HCRYPTPROV_LEGACY hCryptProv, _In_ DWORD dwFlags, _In_opt_ const void *pvPara, _In_ HCERTSTORE hCertStore, _Inout_ PCERT_STORE_PROV_INFO pStoreProvInfo)
Definition: wincrypt.h:1156
#define CRYPT_OID_OPEN_STORE_PROV_FUNC
Definition: wincrypt.h:2491

Referenced by CertOpenStore().

◆ CRYPT_ReadSerializedElement()

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

Definition at line 295 of file serialize.c.

297{
298 const void *context;
299
300 TRACE("(%p, %d, %08x, %p)\n", pbElement, cbElement, dwContextTypeFlags,
301 pdwContentType);
302
303 if (!cbElement)
304 {
306 return NULL;
307 }
308
309 __TRY
310 {
311 const WINE_CONTEXT_INTERFACE *contextInterface = NULL;
313 DWORD type = 0;
314 BOOL ret;
315
316 ret = TRUE;
317 context = NULL;
319 {
321 if (hdr)
323 else
324 {
326 if (hdr)
328 else
329 {
330 hdr = CRYPT_findPropID(pbElement, cbElement,
332 if (hdr)
334 }
335 }
336 }
338 {
341 }
343 {
346 }
348 {
351 }
352
353 switch (type)
354 {
356 contextInterface = pCertInterface;
357 break;
359 contextInterface = pCRLInterface;
360 break;
362 contextInterface = pCTLInterface;
363 break;
364 default:
366 ret = FALSE;
367 }
368 if (!hdr)
369 ret = FALSE;
370
371 if (ret)
372 context = contextInterface->create(X509_ASN_ENCODING,
373 (BYTE *)hdr + sizeof(WINE_CERT_PROP_HEADER), hdr->cb);
374 if (ret && context)
375 {
376 BOOL noMoreProps = FALSE;
377
378 while (!noMoreProps && ret)
379 {
380 if (cbElement < sizeof(WINE_CERT_PROP_HEADER))
381 ret = FALSE;
382 else
383 {
385 (const WINE_CERT_PROP_HEADER *)pbElement;
386
387 TRACE("prop is %d\n", hdr->propID);
389 pbElement += sizeof(WINE_CERT_PROP_HEADER);
390 if (!hdr->propID)
391 {
392 /* Like in CRYPT_findPropID, stop if the propID is zero
393 */
394 noMoreProps = TRUE;
395 }
396 else
397 ret = CRYPT_ReadContextProp(contextInterface, context,
398 hdr, pbElement, cbElement);
399 pbElement += hdr->cb;
400 cbElement -= hdr->cb;
401 if (!cbElement)
402 noMoreProps = TRUE;
403 }
404 }
405 if (ret)
406 {
407 if (pdwContentType)
408 *pdwContentType = type;
409 }
410 else
411 {
413 context = NULL;
414 }
415 }
416 }
418 {
420 context = NULL;
421 }
423 return context;
424}
#define CERT_CTL_PROP_ID
#define CERT_CRL_PROP_ID
#define CERT_CERT_PROP_ID
const WINE_CONTEXT_INTERFACE * pCTLInterface
Definition: store.c:80
const WINE_CONTEXT_INTERFACE * pCRLInterface
Definition: store.c:67
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:172
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:221
struct _WINE_CERT_PROP_HEADER WINE_CERT_PROP_HEADER
CreateContextFunc create
_In_ DWORD cbElement
Definition: wincrypt.h:5088
#define CERT_STORE_CTL_CONTEXT_FLAG
Definition: wincrypt.h:2981
#define CERT_STORE_CRL_CONTEXT_FLAG
Definition: wincrypt.h:2980
#define CERT_STORE_ALL_CONTEXT_FLAG
Definition: wincrypt.h:2977
_In_ DWORD _In_ DWORD _In_ DWORD _In_ DWORD dwContextTypeFlags
Definition: wincrypt.h:5091
#define CERT_STORE_CERTIFICATE_CONTEXT
Definition: wincrypt.h:2974
#define CERT_STORE_CTL_CONTEXT
Definition: wincrypt.h:2976
#define CERT_STORE_CERTIFICATE_CONTEXT_FLAG
Definition: wincrypt.h:2978
#define CERT_STORE_CRL_CONTEXT
Definition: wincrypt.h:2975
#define ERROR_END_OF_MEDIA
Definition: winerror.h:636

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

◆ CRYPT_ReadSerializedStoreFromBlob()

BOOL CRYPT_ReadSerializedStoreFromBlob ( const CRYPT_DATA_BLOB blob,
HCERTSTORE  store 
)

Definition at line 578 of file serialize.c.

580{
581 struct BlobReader reader = { blob, 0 };
582
584}
static BOOL read_blob_wrapper(void *handle, void *buffer, DWORD bytesToRead, DWORD *bytesRead)
Definition: serialize.c:555
static BOOL CRYPT_ReadSerializedStore(void *handle, read_serialized_func read_func, HCERTSTORE store)
Definition: serialize.c:431
const CRYPT_DATA_BLOB * blob
Definition: serialize.c:551
Definition: reader.h:84

Referenced by CRYPT_QuerySerializedStoreFromBlob(), and CRYPT_SerializedOpenStore().

◆ CRYPT_ReadSerializedStoreFromFile()

BOOL CRYPT_ReadSerializedStoreFromFile ( HANDLE  file,
HCERTSTORE  store 
)

Definition at line 544 of file serialize.c.

545{
547}
static BOOL read_file_wrapper(void *handle, void *buffer, DWORD bytesToRead, DWORD *bytesRead)
Definition: serialize.c:538

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 512 of file regstore.c.

514{
515 WINECRYPT_CERTSTORE *store = NULL;
516
517 TRACE("(%ld, %08x, %p)\n", hCryptProv, dwFlags, pvPara);
518
520 {
522
523 if (rc == ERROR_SUCCESS || rc == ERROR_NO_MORE_ITEMS)
525 if (rc == ERROR_SUCCESS || rc == ERROR_NO_MORE_ITEMS)
527 if (rc == ERROR_NO_MORE_ITEMS)
528 rc = ERROR_SUCCESS;
529 SetLastError(rc);
530 }
531 else
532 {
533 HKEY key;
534
538 TRUE, 0))
539 {
540 WINECRYPT_CERTSTORE *memStore;
541
542 memStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, hCryptProv,
544 if (memStore)
545 {
547 sizeof(WINE_REGSTOREINFO));
548
549 if (regInfo)
550 {
551 CERT_STORE_PROV_INFO provInfo = { 0 };
552
553 regInfo->dwOpenFlags = dwFlags;
554 regInfo->memStore = memStore;
555 regInfo->key = key;
556 InitializeCriticalSection(&regInfo->cs);
557 regInfo->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": PWINE_REGSTOREINFO->cs");
558 list_init(&regInfo->certsToDelete);
559 list_init(&regInfo->crlsToDelete);
560 list_init(&regInfo->ctlsToDelete);
561 CRYPT_RegReadFromReg(regInfo->key, regInfo->memStore);
562 regInfo->dirty = FALSE;
563 provInfo.cbSize = sizeof(provInfo);
566 provInfo.hStoreProv = regInfo;
567 store = CRYPT_ProvCreateStore(dwFlags, memStore, &provInfo);
568 /* Reg store doesn't need crypto provider, so close it */
569 if (hCryptProv &&
571 CryptReleaseContext(hCryptProv, 0);
572 }
573 }
574 }
575 }
576 TRACE("returning %p\n", store);
577 return store;
578}
LSTATUS WINAPI RegDeleteTreeW(_In_ HKEY, _In_opt_ LPCWSTR)
WINECRYPT_CERTSTORE * CRYPT_ProvCreateStore(DWORD dwFlags, WINECRYPT_CERTSTORE *memStore, const CERT_STORE_PROV_INFO *pProvInfo) DECLSPEC_HIDDEN
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:1023
static void * regProvFuncs[]
Definition: regstore.c:495
static const WCHAR CertsW[]
Definition: regstore.c:60
static void CRYPT_RegReadFromReg(HKEY key, HCERTSTORE store)
Definition: regstore.c:159
static const WCHAR CTLsW[]
Definition: regstore.c:63
static const WCHAR CRLsW[]
Definition: regstore.c:62
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_SerializeContextsToReg()

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

Definition at line 208 of file regstore.c.

210{
211 const void *context = NULL;
212 BOOL ret;
213
214 do {
215 context = contextInterface->enumContextsInStore(memStore, context);
216 if (context)
217 {
218 BYTE hash[20];
219 DWORD hashSize = sizeof(hash);
220
221 ret = contextInterface->getProp(context, CERT_HASH_PROP_ID, hash,
222 &hashSize);
223 if (ret)
224 {
225 DWORD size = 0;
226 LPBYTE buf = NULL;
227
228 ret = contextInterface->serialize(context, 0, NULL, &size);
229 if (size)
231 if (buf)
232 {
233 ret = contextInterface->serialize(context, 0, buf, &size);
234 if (ret)
236 }
238 }
239 }
240 else
241 ret = TRUE;
242 } while (ret && context != NULL);
243 if (context)
245 return ret;
246}
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:182
GetContextPropertyFunc getProp
SerializeElementFunc serialize
EnumContextsInStoreFunc enumContextsInStore
#define CERT_HASH_PROP_ID
Definition: wincrypt.h:2688

Referenced by CRYPT_ImportSystemRootCertsToReg(), and CRYPT_RegWriteToReg().

◆ crypt_sip_free()

void crypt_sip_free ( void  )

Definition at line 610 of file sip.c.

611{
612 WINE_SIP_PROVIDER *prov, *next;
613
615 {
616 list_remove(&prov->entry);
617 FreeLibrary(prov->info.hSIP);
618 CryptMemFree(prov);
619 }
621}
static struct list providers
Definition: sip.c:564
static CRITICAL_SECTION providers_cs
Definition: sip.c:565
#define FreeLibrary(x)
Definition: compat.h:748
struct list entry
Definition: sip.c:561
SIP_DISPATCH_INFO info
Definition: sip.c:560

Referenced by DllMain().

◆ ctl_from_ptr()

◆ default_chain_engine_free()

void default_chain_engine_free ( void  )

Definition at line 255 of file chain.c.

256{
259}
static CertificateChainEngine * default_lm_engine
Definition: chain.c:164
static void free_chain_engine(CertificateChainEngine *engine)
Definition: chain.c:201
static CertificateChainEngine * default_cu_engine
Definition: chain.c:164

Referenced by DllMain().

◆ I_CertUpdateStore()

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

Definition at line 109 of file store.c.

111{
112 static BOOL warned = FALSE;
113 const WINE_CONTEXT_INTERFACE * const interfaces[] = { pCertInterface,
115 DWORD i;
116
117 TRACE("(%p, %p, %08x, %08x)\n", store1, store2, unk0, unk1);
118 if (!warned)
119 {
120 FIXME("semi-stub\n");
121 warned = TRUE;
122 }
123
124 /* Poor-man's resync: empty first store, then add everything from second
125 * store to it.
126 */
127 for (i = 0; i < ARRAY_SIZE(interfaces); i++)
128 {
129 const void *context;
130
131 do {
132 context = interfaces[i]->enumContextsInStore(store1, NULL);
133 if (context)
134 interfaces[i]->deleteFromStore(context);
135 } while (context);
136 do {
137 context = interfaces[i]->enumContextsInStore(store2, context);
138 if (context)
139 interfaces[i]->addContextToStore(store1, context,
141 } while (context);
142 }
143 return TRUE;
144}
static DWORD unk1
Definition: cursoricon.c:1638
DeleteContextFunc deleteFromStore
AddContextToStoreFunc addContextToStore
#define CERT_STORE_ADD_ALWAYS
Definition: wincrypt.h:2485

Referenced by CRYPT_FileControl(), and CRYPT_RegControl().

◆ I_CryptGetDefaultCryptProv()

HCRYPTPROV WINAPI I_CryptGetDefaultCryptProv ( ALG_ID  algid)

Definition at line 210 of file main.c.

211{
212 HCRYPTPROV prov, defprov;
213
214 TRACE("(%08x)\n", algid);
215
216 defprov = CRYPT_GetDefaultProvider();
217
218 if (algid && !is_supported_algid(defprov, algid))
219 {
220 DWORD i = 0, type, size;
221
222 while (CryptEnumProvidersW(i, NULL, 0, &type, NULL, &size))
223 {
225 if (name)
226 {
227 if (CryptEnumProvidersW(i, NULL, 0, &type, name, &size))
228 {
230 {
231 if (is_supported_algid(prov, algid))
232 {
234 return prov;
235 }
236 CryptReleaseContext(prov, 0);
237 }
238 }
240 }
241 i++;
242 }
243
245 return 0;
246 }
247
248 CryptContextAddRef(defprov, NULL, 0);
249 return defprov;
250}
BOOL WINAPI CryptContextAddRef(HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFlags)
Definition: crypt.c:613
BOOL WINAPI CryptEnumProvidersW(DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPWSTR pszProvName, DWORD *pcbProvName)
Definition: crypt.c:1136
BOOL WINAPI CryptAcquireContextW(HCRYPTPROV *phProv, LPCWSTR pszContainer, LPCWSTR pszProvider, DWORD dwProvType, DWORD dwFlags)
Definition: crypt.c:358
static BOOL is_supported_algid(HCRYPTPROV prov, ALG_ID algid)
Definition: main.c:187
static HCRYPTPROV CRYPT_GetDefaultProvider(void)
Definition: main.c:69
Definition: name.c:39
#define CRYPT_VERIFYCONTEXT
Definition: wincrypt.h:2069
ULONG_PTR HCRYPTPROV
Definition: wincrypt.h:46

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 1511 of file store.c.

1512{
1514}
void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, DWORD dwFlags, CertStoreType type, const store_vtbl_t *vtbl)
Definition: store.c:91
static const store_vtbl_t EmptyStoreVtbl
Definition: store.c:1489
WINECRYPT_CERTSTORE empty_store
Definition: store.c:1509

Referenced by DllMain().

◆ root_store_free()

void root_store_free ( void  )

Variable Documentation

◆ DECLSPEC_HIDDEN

WINECRYPT_CERTSTORE empty_store DECLSPEC_HIDDEN
extern

Definition at line 262 of file crypt32_private.h.