ReactOS 0.4.16-dev-336-gb667d82
decode.c File Reference
#include "config.h"
#include "wine/port.h"
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wincrypt.h"
#include "winnls.h"
#include "snmp.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "crypt32_private.h"
Include dependency graph for decode.c:

Go to the source code of this file.

Classes

struct  AsnDecodeSequenceItem
 
struct  AsnArrayDescriptor
 
struct  AsnArrayItemSize
 
struct  PATH_LEN_CONSTRAINT
 
struct  DECODED_RSA_PUB_KEY
 
struct  DECODED_RSA_PRIV_KEY
 

Macros

#define NONAMELESSUNION
 
#define MAX_ENCODED_LEN   0x02000000
 
#define ASN_FLAGS_MASK   0xe0
 
#define ASN_TYPE_MASK   0x1f
 
#define GET_LEN_BYTES(b)   ((b) <= 0x80 ? 1 : 1 + ((b) & 0x7f))
 
#define FINALMEMBERSIZE(s, member)   (sizeof(s) - offsetof(s, member))
 
#define MEMBERSIZE(s, member, nextmember)    (offsetof(s, nextmember) - offsetof(s, member))
 
#define RSA1_MAGIC   0x31415352
 
#define RSA2_MAGIC   0x32415352
 
#define CRYPT_TIME_GET_DIGITS(pbEncoded, len, numDigits, word)
 
#define MIN_ENCODED_TIME_LENGTH   10
 

Typedefs

typedef BOOL(WINAPICryptDecodeObjectFunc) (DWORD, LPCSTR, const BYTE *, DWORD, DWORD, void *, DWORD *)
 
typedef BOOL(WINAPICryptDecodeObjectExFunc) (DWORD, LPCSTR, const BYTE *, DWORD, DWORD, PCRYPT_DECODE_PARA, void *, DWORD *)
 
typedef BOOL(* InternalDecodeFunc) (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (cryptasn)
 
 WINE_DECLARE_DEBUG_CHANNEL (crypt)
 
static BOOL CRYPT_AsnDecodeChoiceOfTimeInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodePubKeyInfoInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeExtension (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeAlgorithmId (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeBool (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeOctets (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeBitsInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeIntInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeIntegerInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeUnsignedIntegerInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodePKCSAttributeInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_GetLengthIndefinite (const BYTE *pbEncoded, DWORD cbEncoded, DWORD *len)
 
static BOOL CRYPT_GetLen (const BYTE *pbEncoded, DWORD cbEncoded, DWORD *len)
 
static BOOL CRYPT_DecodeEnsureSpace (DWORD dwFlags, const CRYPT_DECODE_PARA *pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo, DWORD bytesNeeded)
 
static void CRYPT_FreeSpace (const CRYPT_DECODE_PARA *pDecodePara, LPVOID pv)
 
static BOOL CRYPT_DecodeCheckSpace (DWORD *pcbStructInfo, DWORD bytesNeeded)
 
static BOOL CRYPT_AsnDecodeSequenceItems (struct AsnDecodeSequenceItem items[], DWORD cItem, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, BYTE *nextData, DWORD *cbDecoded)
 
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)
 
static BOOL CRYPT_AsnDecodeArray (const struct AsnArrayDescriptor *arrayDesc, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, const CRYPT_DECODE_PARA *pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeDerBlob (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeBitsSwapBytes (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeCertSignedContent (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeCertVersion (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeValidity (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCertExtensionsInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCertExtensions (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCertInfo (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodeCert (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeCRLEntryExtensions (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCRLEntry (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCRLEntries (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCRLExtensionsInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCRLExtensions (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCRLInfo (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodeCRL (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeOidIgnoreTag (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeOidInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeExtensions (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeNameValueInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeNameValue (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeUnicodeNameValueInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeUnicodeNameValue (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeRdnAttr (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeRdn (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeName (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeUnicodeRdnAttr (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeUnicodeRdn (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeUnicodeName (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_FindEncodedLen (const BYTE *pbEncoded, DWORD cbEncoded, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCopyBytes (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCTLUsage (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCTLEntryAttributes (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCTLEntry (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCTLEntries (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCTLExtensionsInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCTLExtensions (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeCTL (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeSMIMECapability (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeSMIMECapabilities (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeIA5String (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeNoticeNumbers (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeNoticeReference (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeUnicodeString (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodePolicyQualifierUserNoticeInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodePolicyQualifierUserNotice (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodePKCSAttributeValue (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodePKCSAttribute (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodePKCSAttributesInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodePKCSAttributes (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodePubKeyInfo (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeAltNameEntry (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeAltNameInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeAuthorityKeyId (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodeAuthorityKeyId2 (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeAccessDescription (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeAuthorityInfoAccess (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodePKCSContent (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodePKCSContentInfoInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodePKCSContentInfo (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
BOOL CRYPT_AsnDecodePKCSDigestedData (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, CRYPT_DIGESTED_DATA *digestedData, DWORD *pcbDigestedData)
 
static BOOL WINAPI CRYPT_AsnDecodeAltName (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodePathLenConstraint (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeSubtreeConstraints (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeBasicConstraints (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodeBasicConstraints2 (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodePolicyQualifier (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodePolicyQualifiers (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCertPolicy (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeCertPolicies (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeCertPolicyMapping (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeCertPolicyMappings (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeRequireExplicit (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeInhibitMapping (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeCertPolicyConstraints (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodeRsaPubKey (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodeRsaPrivKey (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeOctetStringInternal (const BYTE *encoded, DWORD encoded_size, DWORD flags, void *buf, DWORD *buf_size, DWORD *ret_decoded)
 
static BOOL WINAPI CRYPT_AsnDecodeOctetString (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodeBits (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodeInt (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodeInteger (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodeUnsignedInteger (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodeEnumerated (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeTimeZone (const BYTE *pbEncoded, DWORD len, SYSTEMTIME *sysTime)
 
static BOOL CRYPT_AsnDecodeUtcTimeInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeUtcTime (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeGeneralizedTime (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeChoiceOfTime (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodeSequenceOfAny (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeDistPointName (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeDistPoint (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeCRLDistPoints (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodeEnhancedKeyUsage (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodeIssuingDistPoint (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeMaximum (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeSubtree (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodePermittedSubtree (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeExcludedSubtree (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeNameConstraints (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeIssuerSerialNumber (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodePKCSSignerInfoInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodePKCSSignerInfo (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_AsnDecodeCMSCertEncoded (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCMSCrlEncoded (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCMSSignerId (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeCMSSignerInfoInternal (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL WINAPI CRYPT_AsnDecodeCMSSignerInfo (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL CRYPT_DecodeSignerArray (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
BOOL CRYPT_AsnDecodeCMSSignedInfo (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, CRYPT_SIGNED_INFO *signedInfo, DWORD *pcbSignedInfo)
 
static BOOL CRYPT_AsnDecodeRecipientInfo (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_DecodeRecipientInfoArray (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
static BOOL CRYPT_AsnDecodeEncryptedContentInfo (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
 
BOOL CRYPT_AsnDecodePKCSEnvelopedData (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, CRYPT_ENVELOPED_DATA *envelopedData, DWORD *pcbEnvelopedData)
 
static BOOL WINAPI CRYPT_AsnDecodeObjectIdentifier (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, CRYPT_DECODE_PARA *pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static BOOL WINAPI CRYPT_AsnDecodeEccSignature (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, CRYPT_DECODE_PARA *pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
static CryptDecodeObjectExFunc CRYPT_GetBuiltinDecoder (DWORD dwCertEncodingType, LPCSTR lpszStructType)
 
static CryptDecodeObjectFunc CRYPT_LoadDecoderFunc (DWORD dwCertEncodingType, LPCSTR lpszStructType, HCRYPTOIDFUNCADDR *hFunc)
 
static CryptDecodeObjectExFunc CRYPT_LoadDecoderExFunc (DWORD dwCertEncodingType, LPCSTR lpszStructType, HCRYPTOIDFUNCADDR *hFunc)
 
BOOL WINAPI CryptDecodeObject (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo)
 
BOOL WINAPI CryptDecodeObjectEx (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
 
BOOL WINAPI PFXIsPFXBlob (CRYPT_DATA_BLOB *pPFX)
 
HCERTSTORE WINAPI PFXImportCertStore (CRYPT_DATA_BLOB *pPFX, LPCWSTR szPassword, DWORD dwFlags)
 
BOOL WINAPI PFXVerifyPassword (CRYPT_DATA_BLOB *pPFX, LPCWSTR szPassword, DWORD dwFlags)
 

Macro Definition Documentation

◆ ASN_FLAGS_MASK

#define ASN_FLAGS_MASK   0xe0

Definition at line 55 of file decode.c.

◆ ASN_TYPE_MASK

#define ASN_TYPE_MASK   0x1f

Definition at line 56 of file decode.c.

◆ CRYPT_TIME_GET_DIGITS

#define CRYPT_TIME_GET_DIGITS (   pbEncoded,
  len,
  numDigits,
  word 
)
Value:
do { \
BYTE i; \
\
(word) = 0; \
for (i = 0; (len) > 0 && i < (numDigits); i++, (len)--) \
{ \
if (!isdigit(*(pbEncoded))) \
{ \
SetLastError(CRYPT_E_ASN1_CORRUPT); \
ret = FALSE; \
} \
else \
{ \
(word) *= 10; \
(word) += *(pbEncoded)++ - '0'; \
} \
} \
} while (0)
#define isdigit(c)
Definition: acclib.h:68
#define FALSE
Definition: types.h:117
GLenum GLsizei len
Definition: glext.h:6722
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
const WCHAR * word
Definition: lex.c:36
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
int ret
#define CRYPT_E_ASN1_CORRUPT
Definition: winerror.h:3087
unsigned char BYTE
Definition: xxhash.c:193

Definition at line 4737 of file decode.c.

◆ FINALMEMBERSIZE

#define FINALMEMBERSIZE (   s,
  member 
)    (sizeof(s) - offsetof(s, member))

Definition at line 298 of file decode.c.

◆ GET_LEN_BYTES

#define GET_LEN_BYTES (   b)    ((b) <= 0x80 ? 1 : 1 + ((b) & 0x7f))

Definition at line 113 of file decode.c.

◆ MAX_ENCODED_LEN

#define MAX_ENCODED_LEN   0x02000000

Definition at line 53 of file decode.c.

◆ MEMBERSIZE

#define MEMBERSIZE (   s,
  member,
  nextmember 
)     (offsetof(s, nextmember) - offsetof(s, member))

Definition at line 299 of file decode.c.

◆ MIN_ENCODED_TIME_LENGTH

#define MIN_ENCODED_TIME_LENGTH   10

Definition at line 4812 of file decode.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 41 of file decode.c.

◆ RSA1_MAGIC

#define RSA1_MAGIC   0x31415352

Definition at line 3863 of file decode.c.

◆ RSA2_MAGIC

#define RSA2_MAGIC   0x32415352

Definition at line 3937 of file decode.c.

Typedef Documentation

◆ CryptDecodeObjectExFunc

typedef BOOL(WINAPI * CryptDecodeObjectExFunc) (DWORD, LPCSTR, const BYTE *, DWORD, DWORD, PCRYPT_DECODE_PARA, void *, DWORD *)

Definition at line 63 of file decode.c.

◆ CryptDecodeObjectFunc

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

Definition at line 61 of file decode.c.

◆ InternalDecodeFunc

typedef BOOL(* InternalDecodeFunc) (const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)

Definition at line 69 of file decode.c.

Function Documentation

◆ CRYPT_AsnDecodeAccessDescription()

static BOOL CRYPT_AsnDecodeAccessDescription ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 3200 of file decode.c.

3203{
3204 struct AsnDecodeSequenceItem items[] = {
3205 { 0, offsetof(CERT_ACCESS_DESCRIPTION, pszAccessMethod),
3207 offsetof(CERT_ACCESS_DESCRIPTION, pszAccessMethod), 0 },
3208 { 0, offsetof(CERT_ACCESS_DESCRIPTION, AccessLocation),
3210 TRUE, offsetof(CERT_ACCESS_DESCRIPTION, AccessLocation.u.pwszURL), 0 },
3211 };
3212 CERT_ACCESS_DESCRIPTION *descr = pvStructInfo;
3213
3215 pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
3216 pcbDecoded, descr ? descr->pszAccessMethod : NULL);
3217}
#define ARRAY_SIZE(A)
Definition: main.h:20
static BOOL CRYPT_AsnDecodeOidInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:1395
static BOOL CRYPT_AsnDecodeAltNameEntry(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2984
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 NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
static TCHAR * items[]
Definition: page1.c:45
#define offsetof(TYPE, MEMBER)
const char * descr
Definition: boot.c:45
struct _CERT_ALT_NAME_ENTRY CERT_ALT_NAME_ENTRY
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
char * LPSTR
Definition: xmlstorage.h:182

Referenced by CRYPT_AsnDecodeAuthorityInfoAccess().

◆ CRYPT_AsnDecodeAlgorithmId()

static BOOL CRYPT_AsnDecodeAlgorithmId ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 2849 of file decode.c.

2851{
2852 CRYPT_ALGORITHM_IDENTIFIER *algo = pvStructInfo;
2853 BOOL ret = TRUE;
2854 struct AsnDecodeSequenceItem items[] = {
2857 offsetof(CRYPT_ALGORITHM_IDENTIFIER, pszObjId), 0 },
2861 };
2862
2863 TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
2864 pvStructInfo, *pcbStructInfo, pcbDecoded);
2865
2867 pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
2868 pcbDecoded, algo ? algo->pszObjId : NULL);
2869 if (ret && pvStructInfo)
2870 {
2871 TRACE("pszObjId is %p (%s)\n", algo->pszObjId,
2872 debugstr_a(algo->pszObjId));
2873 }
2874 return ret;
2875}
static BOOL CRYPT_AsnDecodeOidIgnoreTag(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:1296
static BOOL CRYPT_AsnDecodeCopyBytes(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2103
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_a
Definition: kernel32.h:31
#define ASN_OBJECTIDENTIFIER
Definition: snmp.h:107
#define TRACE(s)
Definition: solgame.cpp:4
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:869
struct _CRYPTOAPI_BLOB CRYPT_OBJID_BLOB

Referenced by CRYPT_AsnDecodeCertInfo(), CRYPT_AsnDecodeCertSignedContent(), CRYPT_AsnDecodeCMSSignerInfoInternal(), CRYPT_AsnDecodeCRLInfo(), CRYPT_AsnDecodeCTL(), CRYPT_AsnDecodeEncryptedContentInfo(), CRYPT_AsnDecodePKCSDigestedData(), CRYPT_AsnDecodePKCSSignerInfoInternal(), CRYPT_AsnDecodePubKeyInfoInternal(), and CRYPT_AsnDecodeRecipientInfo().

◆ CRYPT_AsnDecodeAltName()

static BOOL WINAPI CRYPT_AsnDecodeAltName ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 3398 of file decode.c.

3401{
3402 BOOL ret = TRUE;
3403
3404 TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
3405 pDecodePara, pvStructInfo, *pcbStructInfo);
3406
3407 __TRY
3408 {
3409 DWORD bytesNeeded = 0;
3410
3412 dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, &bytesNeeded, NULL)))
3413 {
3414 if (!pvStructInfo)
3415 *pcbStructInfo = bytesNeeded;
3416 else if ((ret = CRYPT_DecodeEnsureSpace(dwFlags, pDecodePara,
3417 pvStructInfo, pcbStructInfo, bytesNeeded)))
3418 {
3420
3422 pvStructInfo = *(BYTE **)pvStructInfo;
3423 name = pvStructInfo;
3424 name->rgAltEntry = (PCERT_ALT_NAME_ENTRY)
3425 ((BYTE *)pvStructInfo + sizeof(CERT_ALT_NAME_INFO));
3427 dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, pvStructInfo,
3428 &bytesNeeded, NULL);
3430 CRYPT_FreeSpace(pDecodePara, name);
3431 }
3432 }
3433 }
3435 {
3437 ret = FALSE;
3438 }
3439 __ENDTRY
3440 return ret;
3441}
static void CRYPT_FreeSpace(const CRYPT_DECODE_PARA *pDecodePara, LPVOID pv)
Definition: decode.c:235
static BOOL CRYPT_DecodeEnsureSpace(DWORD dwFlags, const CRYPT_DECODE_PARA *pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo, DWORD bytesNeeded)
Definition: decode.c:207
static BOOL CRYPT_AsnDecodeAltNameInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3108
#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
unsigned long DWORD
Definition: ntddk_ex.h:95
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
Definition: name.c:39
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
struct _CERT_ALT_NAME_INFO CERT_ALT_NAME_INFO
struct _CERT_ALT_NAME_ENTRY * PCERT_ALT_NAME_ENTRY

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeAltNameEntry()

static BOOL CRYPT_AsnDecodeAltNameEntry ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 2984 of file decode.c.

2986{
2987 PCERT_ALT_NAME_ENTRY entry = pvStructInfo;
2988 DWORD dataLen, lenBytes, bytesNeeded = sizeof(CERT_ALT_NAME_ENTRY);
2989 BOOL ret;
2990
2991 TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
2992 pvStructInfo, *pcbStructInfo);
2993
2994 if (cbEncoded < 2)
2995 {
2997 return FALSE;
2998 }
2999 lenBytes = GET_LEN_BYTES(pbEncoded[1]);
3000 if (1 + lenBytes > cbEncoded)
3001 {
3003 return FALSE;
3004 }
3005 if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
3006 {
3007 switch (pbEncoded[0] & ASN_TYPE_MASK)
3008 {
3009 case 1: /* rfc822Name */
3010 case 2: /* dNSName */
3011 case 6: /* uniformResourceIdentifier */
3012 if (memchr(pbEncoded + 1 + lenBytes, 0, dataLen))
3013 {
3015 ret = FALSE;
3016 }
3017 else
3018 bytesNeeded += (dataLen + 1) * sizeof(WCHAR);
3019 break;
3020 case 4: /* directoryName */
3021 case 7: /* iPAddress */
3022 bytesNeeded += dataLen;
3023 break;
3024 case 8: /* registeredID */
3026 &dataLen, NULL);
3027 if (ret)
3028 {
3029 /* FIXME: ugly, shouldn't need to know internals of OID decode
3030 * function to use it.
3031 */
3032 bytesNeeded += dataLen - sizeof(LPSTR);
3033 }
3034 break;
3035 case 0: /* otherName */
3036 FIXME("%d: stub\n", pbEncoded[0] & ASN_TYPE_MASK);
3038 ret = FALSE;
3039 break;
3040 case 3: /* x400Address, unimplemented */
3041 case 5: /* ediPartyName, unimplemented */
3042 TRACE("type %d unimplemented\n", pbEncoded[0] & ASN_TYPE_MASK);
3044 ret = FALSE;
3045 break;
3046 default:
3047 TRACE("type %d bad\n", pbEncoded[0] & ASN_TYPE_MASK);
3049 ret = FALSE;
3050 }
3051 if (ret)
3052 {
3053 if (pcbDecoded)
3054 *pcbDecoded = 1 + lenBytes + dataLen;
3055 if (!entry)
3056 *pcbStructInfo = bytesNeeded;
3057 else if (*pcbStructInfo < bytesNeeded)
3058 {
3059 *pcbStructInfo = bytesNeeded;
3061 ret = FALSE;
3062 }
3063 else
3064 {
3065 *pcbStructInfo = bytesNeeded;
3066 /* MS used values one greater than the asn1 ones.. sigh */
3067 entry->dwAltNameChoice = (pbEncoded[0] & ASN_TYPE_MASK) + 1;
3068 switch (pbEncoded[0] & ASN_TYPE_MASK)
3069 {
3070 case 1: /* rfc822Name */
3071 case 2: /* dNSName */
3072 case 6: /* uniformResourceIdentifier */
3073 {
3074 DWORD i;
3075
3076 for (i = 0; i < dataLen; i++)
3077 entry->u.pwszURL[i] =
3078 (WCHAR)pbEncoded[1 + lenBytes + i];
3079 entry->u.pwszURL[i] = 0;
3080 TRACE("URL is %p (%s)\n", entry->u.pwszURL,
3081 debugstr_w(entry->u.pwszURL));
3082 break;
3083 }
3084 case 4: /* directoryName */
3085 /* The data are memory-equivalent with the IPAddress case,
3086 * fall-through
3087 */
3088 case 7: /* iPAddress */
3089 /* The next data pointer is in the pwszURL spot, that is,
3090 * the first 4 bytes. Need to move it to the next spot.
3091 */
3092 entry->u.IPAddress.pbData = (LPBYTE)entry->u.pwszURL;
3093 entry->u.IPAddress.cbData = dataLen;
3094 memcpy(entry->u.IPAddress.pbData, pbEncoded + 1 + lenBytes,
3095 dataLen);
3096 break;
3097 case 8: /* registeredID */
3099 &entry->u.pszRegisteredID, &dataLen, NULL);
3100 break;
3101 }
3102 }
3103 }
3104 }
3105 return ret;
3106}
#define FIXME(fmt,...)
Definition: precomp.h:53
static BOOL CRYPT_GetLen(const BYTE *pbEncoded, DWORD cbEncoded, DWORD *len)
Definition: decode.c:189
#define ASN_TYPE_MASK
Definition: decode.c:56
#define GET_LEN_BYTES(b)
Definition: decode.c:113
#define ERROR_MORE_DATA
Definition: dderror.h:13
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_w
Definition: kernel32.h:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memchr(s, c, n)
Definition: mkisofs.h:875
Definition: wincrypt.h:332
unsigned char * LPBYTE
Definition: typedefs.h:53
#define CRYPT_E_ASN1_RULE
Definition: winerror.h:3097
#define CRYPT_E_ASN1_BADTAG
Definition: winerror.h:3095
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CRYPT_AsnDecodeAccessDescription(), CRYPT_AsnDecodeAltNameInternal(), CRYPT_AsnDecodeDistPointName(), and CRYPT_AsnDecodeSubtree().

◆ CRYPT_AsnDecodeAltNameInternal()

static BOOL CRYPT_AsnDecodeAltNameInternal ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 3108 of file decode.c.

3111{
3112 BOOL ret;
3113 struct AsnArrayDescriptor arrayDesc = { 0,
3114 offsetof(CERT_ALT_NAME_INFO, cAltEntry),
3115 offsetof(CERT_ALT_NAME_INFO, rgAltEntry),
3116 sizeof(CERT_ALT_NAME_INFO),
3118 offsetof(CERT_ALT_NAME_ENTRY, u.pwszURL) };
3119
3120 TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
3121 pvStructInfo, *pcbStructInfo, pcbDecoded);
3122
3123 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded, dwFlags,
3124 NULL, pvStructInfo, pcbStructInfo, pcbDecoded);
3125 return ret;
3126}
static BOOL CRYPT_AsnDecodeArray(const struct AsnArrayDescriptor *arrayDesc, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, const CRYPT_DECODE_PARA *pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:613
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 * u
Definition: glfuncs.h:240

Referenced by CRYPT_AsnDecodeAltName(), CRYPT_AsnDecodeAuthorityKeyId2(), and CRYPT_AsnDecodeDistPoint().

◆ CRYPT_AsnDecodeArray()

static BOOL CRYPT_AsnDecodeArray ( const struct AsnArrayDescriptor arrayDesc,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
const CRYPT_DECODE_PARA pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 613 of file decode.c.

617{
618 BOOL ret = TRUE;
619
620 TRACE("%p, %p, %d, %p, %d\n", arrayDesc, pbEncoded,
621 cbEncoded, pvStructInfo, pvStructInfo ? *pcbStructInfo : 0);
622
623 if (!cbEncoded)
624 {
626 ret = FALSE;
627 }
628 else if (!arrayDesc->tag || pbEncoded[0] == arrayDesc->tag)
629 {
630 DWORD dataLen;
631
632 if ((ret = CRYPT_GetLengthIndefinite(pbEncoded, cbEncoded, &dataLen)))
633 {
634 DWORD bytesNeeded = arrayDesc->minArraySize, cItems = 0, decoded;
635 BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]);
636 /* There can be arbitrarily many items, but there is often only one.
637 */
638 struct AsnArrayItemSize itemSize = { 0 }, *itemSizes = &itemSize;
639
640 decoded = 1 + lenBytes;
641 if (dataLen)
642 {
643 const BYTE *ptr;
644 BOOL doneDecoding = FALSE;
645
646 for (ptr = pbEncoded + 1 + lenBytes; ret && !doneDecoding; )
647 {
648 if (dataLen == CMSG_INDEFINITE_LENGTH)
649 {
650 if (ptr[0] == 0)
651 {
652 doneDecoding = TRUE;
653 if (ptr[1] != 0)
654 {
656 ret = FALSE;
657 }
658 else
659 decoded += 2;
660 }
661 }
662 else if (ptr - pbEncoded - 1 - lenBytes >= dataLen)
663 doneDecoding = TRUE;
664 if (!doneDecoding)
665 {
666 DWORD itemEncoded, itemDataLen, itemDecoded, size = 0;
667
668 /* Each item decoded may not tolerate extraneous bytes,
669 * so get the length of the next element if known.
670 */
672 cbEncoded - (ptr - pbEncoded), &itemDataLen)))
673 {
674 if (itemDataLen == CMSG_INDEFINITE_LENGTH)
675 itemEncoded = cbEncoded - (ptr - pbEncoded);
676 else
677 itemEncoded = 1 + GET_LEN_BYTES(ptr[1]) +
678 itemDataLen;
679 }
680 if (ret)
681 ret = arrayDesc->decodeFunc(ptr, itemEncoded,
683 &itemDecoded);
684 if (ret)
685 {
686 cItems++;
687 if (itemSizes != &itemSize)
688 itemSizes = CryptMemRealloc(itemSizes,
689 cItems * sizeof(struct AsnArrayItemSize));
690 else if (cItems > 1)
691 {
692 itemSizes =
694 cItems * sizeof(struct AsnArrayItemSize));
695 if (itemSizes)
696 *itemSizes = itemSize;
697 }
698 if (itemSizes)
699 {
700 decoded += itemDecoded;
701 itemSizes[cItems - 1].encodedLen = itemEncoded;
702 itemSizes[cItems - 1].size = size;
703 bytesNeeded += size;
704 ptr += itemEncoded;
705 }
706 else
707 ret = FALSE;
708 }
709 }
710 }
711 }
712 if (ret)
713 {
714 if (pcbDecoded)
715 *pcbDecoded = decoded;
716 if (!pvStructInfo)
717 *pcbStructInfo = bytesNeeded;
718 else if ((ret = CRYPT_DecodeEnsureSpace(dwFlags, pDecodePara,
719 pvStructInfo, pcbStructInfo, bytesNeeded)))
720 {
721 DWORD i, *pcItems;
722 BYTE *nextData;
723 const BYTE *ptr;
724 void *rgItems;
725
727 pvStructInfo = *(void **)pvStructInfo;
728 pcItems = pvStructInfo;
729 *pcItems = cItems;
731 {
732 rgItems = (BYTE *)pvStructInfo +
733 arrayDesc->minArraySize;
734 *(void **)((BYTE *)pcItems -
735 arrayDesc->countOffset + arrayDesc->arrayOffset) =
736 rgItems;
737 }
738 else
739 rgItems = *(void **)((BYTE *)pcItems -
740 arrayDesc->countOffset + arrayDesc->arrayOffset);
741 nextData = (BYTE *)rgItems + cItems * arrayDesc->itemSize;
742 for (i = 0, ptr = pbEncoded + 1 + lenBytes; ret &&
743 i < cItems && ptr - pbEncoded - 1 - lenBytes <
744 dataLen; i++)
745 {
746 DWORD itemDecoded;
747
748 if (arrayDesc->hasPointer)
749 *(BYTE **)((BYTE *)rgItems + i * arrayDesc->itemSize
750 + arrayDesc->pointerOffset) = nextData;
751 ret = arrayDesc->decodeFunc(ptr,
752 itemSizes[i].encodedLen,
754 (BYTE *)rgItems + i * arrayDesc->itemSize,
755 &itemSizes[i].size, &itemDecoded);
756 if (ret)
757 {
758 nextData += itemSizes[i].size - arrayDesc->itemSize;
759 ptr += itemDecoded;
760 }
761 }
763 CRYPT_FreeSpace(pDecodePara, pvStructInfo);
764 }
765 }
766 if (itemSizes != &itemSize)
767 CryptMemFree(itemSizes);
768 }
769 }
770 else
771 {
773 ret = FALSE;
774 }
775 return ret;
776}
static BOOL CRYPT_GetLengthIndefinite(const BYTE *pbEncoded, DWORD cbEncoded, DWORD *len)
Definition: decode.c:121
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize)
Definition: main.c:136
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
GLsizeiptr size
Definition: glext.h:5919
#define for
Definition: utility.h:88
static PVOID ptr
Definition: dispmode.c:27
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM ULONG int * pcItems
Definition: usp10.c:62
DWORD pointerOffset
Definition: decode.c:601
DWORD arrayOffset
Definition: decode.c:596
DWORD minArraySize
Definition: decode.c:597
DWORD countOffset
Definition: decode.c:595
InternalDecodeFunc decodeFunc
Definition: decode.c:598
DWORD encodedLen
Definition: decode.c:606
#define CMSG_INDEFINITE_LENGTH
Definition: wincrypt.h:3648
#define CRYPT_E_ASN1_EOD
Definition: winerror.h:3086

Referenced by CRYPT_AsnDecodeAltNameInternal(), CRYPT_AsnDecodeAuthorityInfoAccess(), CRYPT_AsnDecodeCertExtensionsInternal(), CRYPT_AsnDecodeCertPolicies(), CRYPT_AsnDecodeCertPolicyMappings(), CRYPT_AsnDecodeCMSCertEncoded(), CRYPT_AsnDecodeCMSCrlEncoded(), CRYPT_AsnDecodeCRLDistPoints(), CRYPT_AsnDecodeCRLEntries(), CRYPT_AsnDecodeCRLEntryExtensions(), CRYPT_AsnDecodeCRLExtensionsInternal(), CRYPT_AsnDecodeCTLEntries(), CRYPT_AsnDecodeCTLEntryAttributes(), CRYPT_AsnDecodeCTLExtensionsInternal(), CRYPT_AsnDecodeCTLUsage(), CRYPT_AsnDecodeDistPointName(), CRYPT_AsnDecodeEnhancedKeyUsage(), CRYPT_AsnDecodeExcludedSubtree(), CRYPT_AsnDecodeExtensions(), CRYPT_AsnDecodeName(), CRYPT_AsnDecodeNoticeNumbers(), CRYPT_AsnDecodePermittedSubtree(), CRYPT_AsnDecodePKCSAttributes(), CRYPT_AsnDecodePKCSAttributesInternal(), CRYPT_AsnDecodePKCSAttributeValue(), CRYPT_AsnDecodePolicyQualifiers(), CRYPT_AsnDecodeRdn(), CRYPT_AsnDecodeSMIMECapabilities(), CRYPT_AsnDecodeSubtreeConstraints(), CRYPT_AsnDecodeUnicodeName(), CRYPT_AsnDecodeUnicodeRdn(), CRYPT_DecodeRecipientInfoArray(), and CRYPT_DecodeSignerArray().

◆ CRYPT_AsnDecodeAuthorityInfoAccess()

static BOOL WINAPI CRYPT_AsnDecodeAuthorityInfoAccess ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 3219 of file decode.c.

3222{
3223 BOOL ret;
3224
3225 TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
3226 pDecodePara, pvStructInfo, *pcbStructInfo);
3227
3228 __TRY
3229 {
3230 struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
3235 TRUE, offsetof(CERT_ACCESS_DESCRIPTION, pszAccessMethod) };
3236 CERT_AUTHORITY_INFO_ACCESS *info = pvStructInfo;
3237
3238 if (pvStructInfo && !(dwFlags & CRYPT_DECODE_ALLOC_FLAG))
3239 info->rgAccDescr = (CERT_ACCESS_DESCRIPTION *)(info + 1);
3240 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
3241 dwFlags, pDecodePara, pvStructInfo, pcbStructInfo, NULL);
3242 }
3244 {
3246 ret = FALSE;
3247 }
3248 __ENDTRY
3249 return ret;
3250}
static BOOL CRYPT_AsnDecodeAccessDescription(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3200
#define ASN_SEQUENCEOF
Definition: snmp.h:111
struct _CERT_AUTHORITY_INFO_ACCESS CERT_AUTHORITY_INFO_ACCESS

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeAuthorityKeyId()

static BOOL WINAPI CRYPT_AsnDecodeAuthorityKeyId ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 3128 of file decode.c.

3131{
3132 BOOL ret;
3133
3134 __TRY
3135 {
3136 struct AsnDecodeSequenceItem items[] = {
3139 TRUE, TRUE, offsetof(CERT_AUTHORITY_KEY_ID_INFO, KeyId.pbData), 0 },
3143 offsetof(CERT_AUTHORITY_KEY_ID_INFO, CertIssuer.pbData), 0 },
3145 CertSerialNumber), CRYPT_AsnDecodeIntegerInternal,
3146 sizeof(CRYPT_INTEGER_BLOB), TRUE, TRUE,
3147 offsetof(CERT_AUTHORITY_KEY_ID_INFO, CertSerialNumber.pbData), 0 },
3148 };
3149
3151 pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
3152 pcbStructInfo, NULL, NULL);
3153 }
3155 {
3157 ret = FALSE;
3158 }
3159 __ENDTRY
3160 return ret;
3161}
static BOOL CRYPT_AsnDecodeOctets(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4080
static BOOL CRYPT_AsnDecodeIntegerInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4472
#define ASN_CONSTRUCTOR
Definition: snmp.h:92
#define ASN_CONTEXT
Definition: snmp.h:89
struct _CRYPTOAPI_BLOB CRYPT_INTEGER_BLOB
struct _CRYPTOAPI_BLOB CRYPT_DATA_BLOB
struct _CRYPTOAPI_BLOB CERT_NAME_BLOB

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeAuthorityKeyId2()

static BOOL WINAPI CRYPT_AsnDecodeAuthorityKeyId2 ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 3163 of file decode.c.

3166{
3167 BOOL ret;
3168
3169 __TRY
3170 {
3171 struct AsnDecodeSequenceItem items[] = {
3174 TRUE, TRUE, offsetof(CERT_AUTHORITY_KEY_ID2_INFO, KeyId.pbData), 0 },
3176 offsetof(CERT_AUTHORITY_KEY_ID2_INFO, AuthorityCertIssuer),
3179 AuthorityCertIssuer.rgAltEntry), 0 },
3181 AuthorityCertSerialNumber), CRYPT_AsnDecodeIntegerInternal,
3182 sizeof(CRYPT_INTEGER_BLOB), TRUE, TRUE,
3184 AuthorityCertSerialNumber.pbData), 0 },
3185 };
3186
3188 pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
3189 pcbStructInfo, NULL, NULL);
3190 }
3192 {
3194 ret = FALSE;
3195 }
3196 __ENDTRY
3197 return ret;
3198}

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeBasicConstraints()

static BOOL WINAPI CRYPT_AsnDecodeBasicConstraints ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 3509 of file decode.c.

3512{
3513 BOOL ret;
3514
3515 __TRY
3516 {
3517 struct AsnDecodeSequenceItem items[] = {
3520 offsetof(CERT_BASIC_CONSTRAINTS_INFO, SubjectType.pbData), 0 },
3522 fPathLenConstraint), CRYPT_AsnDecodePathLenConstraint,
3523 sizeof(struct PATH_LEN_CONSTRAINT), TRUE, FALSE, 0, 0 },
3525 cSubtreesConstraint), CRYPT_AsnDecodeSubtreeConstraints,
3526 FINALMEMBERSIZE(CERT_BASIC_CONSTRAINTS_INFO, cSubtreesConstraint),
3527 TRUE, TRUE,
3528 offsetof(CERT_BASIC_CONSTRAINTS_INFO, rgSubtreesConstraint), 0 },
3529 };
3530
3532 pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
3533 pcbStructInfo, NULL, NULL);
3534 }
3536 {
3538 ret = FALSE;
3539 }
3540 __ENDTRY
3541 return ret;
3542}
static BOOL CRYPT_AsnDecodeBitsInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4271
#define FINALMEMBERSIZE(s, member)
Definition: decode.c:298
static BOOL CRYPT_AsnDecodePathLenConstraint(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3449
static BOOL CRYPT_AsnDecodeSubtreeConstraints(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3488
#define ASN_BITSTRING
#define ASN_INTEGER
Definition: snmp.h:103
struct _CRYPT_BIT_BLOB CRYPT_BIT_BLOB

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeBasicConstraints2()

static BOOL WINAPI CRYPT_AsnDecodeBasicConstraints2 ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 3544 of file decode.c.

3547{
3548 BOOL ret;
3549
3550 __TRY
3551 {
3552 struct AsnDecodeSequenceItem items[] = {
3554 CRYPT_AsnDecodeBool, sizeof(BOOL), TRUE, FALSE, 0, 0 },
3556 fPathLenConstraint), CRYPT_AsnDecodePathLenConstraint,
3557 sizeof(struct PATH_LEN_CONSTRAINT), TRUE, FALSE, 0, 0 },
3558 };
3559
3561 pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
3562 pcbStructInfo, NULL, NULL);
3563 }
3565 {
3567 ret = FALSE;
3568 }
3569 __ENDTRY
3570 return ret;
3571}
static BOOL CRYPT_AsnDecodeBool(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2941
#define ASN_BOOL
#define BOOL
Definition: nt_native.h:43

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeBits()

static BOOL WINAPI CRYPT_AsnDecodeBits ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 4326 of file decode.c.

4329{
4330 BOOL ret;
4331
4332 TRACE("(%p, %d, 0x%08x, %p, %p, %p)\n", pbEncoded, cbEncoded, dwFlags,
4333 pDecodePara, pvStructInfo, pcbStructInfo);
4334
4335 __TRY
4336 {
4337 DWORD bytesNeeded = 0;
4338
4339 if (!cbEncoded)
4340 {
4342 ret = FALSE;
4343 }
4344 else if (pbEncoded[0] != ASN_BITSTRING)
4345 {
4347 ret = FALSE;
4348 }
4349 else if ((ret = CRYPT_AsnDecodeBitsInternal(pbEncoded, cbEncoded,
4350 dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, &bytesNeeded, NULL)))
4351 {
4352 if (!pvStructInfo)
4353 *pcbStructInfo = bytesNeeded;
4354 else if ((ret = CRYPT_DecodeEnsureSpace(dwFlags, pDecodePara,
4355 pvStructInfo, pcbStructInfo, bytesNeeded)))
4356 {
4358
4360 pvStructInfo = *(BYTE **)pvStructInfo;
4361 blob = pvStructInfo;
4362 blob->pbData = (BYTE *)pvStructInfo + sizeof(CRYPT_BIT_BLOB);
4364 dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, pvStructInfo,
4365 &bytesNeeded, NULL);
4367 CRYPT_FreeSpace(pDecodePara, blob);
4368 }
4369 }
4370 }
4372 {
4374 ret = FALSE;
4375 }
4376 __ENDTRY
4377 TRACE("returning %d (%08x)\n", ret, GetLastError());
4378 return ret;
4379}
Definition: image.c:134
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeBitsInternal()

static BOOL CRYPT_AsnDecodeBitsInternal ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 4271 of file decode.c.

4273{
4274 BOOL ret;
4275 DWORD bytesNeeded, dataLen;
4276 BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]);
4277
4278 TRACE("(%p, %d, 0x%08x, %p, %d, %p)\n", pbEncoded, cbEncoded, dwFlags,
4279 pvStructInfo, *pcbStructInfo, pcbDecoded);
4280
4281 if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
4282 {
4284 bytesNeeded = sizeof(CRYPT_BIT_BLOB);
4285 else
4286 bytesNeeded = dataLen - 1 + sizeof(CRYPT_BIT_BLOB);
4287 if (pcbDecoded)
4288 *pcbDecoded = 1 + lenBytes + dataLen;
4289 if (!pvStructInfo)
4290 *pcbStructInfo = bytesNeeded;
4291 else if (*pcbStructInfo < bytesNeeded)
4292 {
4293 *pcbStructInfo = bytesNeeded;
4295 ret = FALSE;
4296 }
4297 else
4298 {
4300
4301 *pcbStructInfo = bytesNeeded;
4302 blob = pvStructInfo;
4303 blob->cbData = dataLen - 1;
4304 blob->cUnusedBits = *(pbEncoded + 1 + lenBytes);
4306 {
4307 blob->pbData = (BYTE *)pbEncoded + 2 + lenBytes;
4308 }
4309 else
4310 {
4311 assert(blob->pbData);
4312 if (blob->cbData)
4313 {
4314 BYTE mask = 0xff << blob->cUnusedBits;
4315
4316 memcpy(blob->pbData, pbEncoded + 2 + lenBytes,
4317 blob->cbData);
4318 blob->pbData[blob->cbData - 1] &= mask;
4319 }
4320 }
4321 }
4322 }
4323 return ret;
4324}
#define assert(x)
Definition: debug.h:53
GLenum GLint GLuint mask
Definition: glext.h:6028
#define CRYPT_DECODE_NOCOPY_FLAG
Definition: wincrypt.h:3450

Referenced by CRYPT_AsnDecodeBasicConstraints(), CRYPT_AsnDecodeBits(), CRYPT_AsnDecodeBitsSwapBytes(), CRYPT_AsnDecodeCertInfo(), CRYPT_AsnDecodeCertSignedContent(), CRYPT_AsnDecodeDistPoint(), CRYPT_AsnDecodeIssuingDistPoint(), and CRYPT_AsnDecodePubKeyInfoInternal().

◆ CRYPT_AsnDecodeBitsSwapBytes()

static BOOL CRYPT_AsnDecodeBitsSwapBytes ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 831 of file decode.c.

834{
835 BOOL ret;
836
837 TRACE("(%p, %d, 0x%08x, %p, %d, %p)\n", pbEncoded, cbEncoded, dwFlags,
838 pvStructInfo, *pcbStructInfo, pcbDecoded);
839
840 /* Can't use the CRYPT_DECODE_NOCOPY_FLAG, because we modify the bytes in-
841 * place.
842 */
844 dwFlags & ~CRYPT_DECODE_NOCOPY_FLAG, pvStructInfo, pcbStructInfo,
845 pcbDecoded);
846 if (ret && pvStructInfo)
847 {
848 CRYPT_BIT_BLOB *blob = pvStructInfo;
849
850 if (blob->cbData)
851 {
852 DWORD i;
853 BYTE temp;
854
855 for (i = 0; i < blob->cbData / 2; i++)
856 {
857 temp = blob->pbData[i];
858 blob->pbData[i] = blob->pbData[blob->cbData - i - 1];
859 blob->pbData[blob->cbData - i - 1] = temp;
860 }
861 }
862 }
863 TRACE("returning %d (%08x)\n", ret, GetLastError());
864 return ret;
865}
static calc_node_t temp
Definition: rpn_ieee.c:38

Referenced by CRYPT_AsnDecodeCertSignedContent().

◆ CRYPT_AsnDecodeBool()

static BOOL CRYPT_AsnDecodeBool ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 2941 of file decode.c.

2943{
2944 BOOL ret;
2945
2946 if (cbEncoded < 3)
2947 {
2949 return FALSE;
2950 }
2951 if (GET_LEN_BYTES(pbEncoded[1]) > 1)
2952 {
2954 return FALSE;
2955 }
2956 if (pbEncoded[1] > 1)
2957 {
2959 return FALSE;
2960 }
2961 if (pcbDecoded)
2962 *pcbDecoded = 3;
2963 if (!pvStructInfo)
2964 {
2965 *pcbStructInfo = sizeof(BOOL);
2966 ret = TRUE;
2967 }
2968 else if (*pcbStructInfo < sizeof(BOOL))
2969 {
2970 *pcbStructInfo = sizeof(BOOL);
2972 ret = FALSE;
2973 }
2974 else
2975 {
2976 *pcbStructInfo = sizeof(BOOL);
2977 *(BOOL *)pvStructInfo = pbEncoded[2] != 0;
2978 ret = TRUE;
2979 }
2980 TRACE("returning %d (%08x)\n", ret, GetLastError());
2981 return ret;
2982}

Referenced by CRYPT_AsnDecodeBasicConstraints2(), CRYPT_AsnDecodeExtension(), and CRYPT_AsnDecodeIssuingDistPoint().

◆ CRYPT_AsnDecodeCert()

static BOOL WINAPI CRYPT_AsnDecodeCert ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 1049 of file decode.c.

1052{
1053 BOOL ret = FALSE;
1054
1055 TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
1056 pDecodePara, pvStructInfo, *pcbStructInfo);
1057
1058 __TRY
1059 {
1060 DWORD size = 0;
1061
1062 /* Unless told not to, first try to decode it as a signed cert. */
1064 {
1065 PCERT_SIGNED_CONTENT_INFO signedCert = NULL;
1066
1069 &signedCert, &size);
1070 if (ret)
1071 {
1072 size = 0;
1075 signedCert->ToBeSigned.cbData, dwFlags, pDecodePara,
1076 pvStructInfo, pcbStructInfo);
1077 LocalFree(signedCert);
1078 }
1079 }
1080 /* Failing that, try it as an unsigned cert */
1081 if (!ret)
1082 {
1083 size = 0;
1086 pDecodePara, pvStructInfo, pcbStructInfo);
1087 }
1088 }
1090 {
1092 }
1093 __ENDTRY
1094
1095 TRACE("Returning %d (%08x)\n", ret, GetLastError());
1096 return ret;
1097}
static BOOL CRYPT_AsnDecodeCertInfo(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:982
static BOOL WINAPI CRYPT_AsnDecodeCertSignedContent(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:867
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
CRYPT_DER_BLOB ToBeSigned
Definition: wincrypt.h:613
BYTE * pbData
Definition: wincrypt.h:103
#define X509_CERT_TO_BE_SIGNED
Definition: wincrypt.h:3366
#define X509_CERT
Definition: wincrypt.h:3365
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5037
#define CRYPT_DECODE_TO_BE_SIGNED_FLAG
Definition: wincrypt.h:3451

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeCertExtensions()

static BOOL CRYPT_AsnDecodeCertExtensions ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 963 of file decode.c.

966{
967 BOOL ret;
968 DWORD dataLen;
969
970 if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
971 {
972 BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]);
973
975 dataLen, dwFlags, pvStructInfo, pcbStructInfo, NULL);
976 if (ret && pcbDecoded)
977 *pcbDecoded = 1 + lenBytes + dataLen;
978 }
979 return ret;
980}
static BOOL CRYPT_AsnDecodeCertExtensionsInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:944

Referenced by CRYPT_AsnDecodeCertInfo().

◆ CRYPT_AsnDecodeCertExtensionsInternal()

static BOOL CRYPT_AsnDecodeCertExtensionsInternal ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 944 of file decode.c.

947{
948 BOOL ret = TRUE;
949 struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
950 offsetof(CERT_INFO, cExtension), offsetof(CERT_INFO, rgExtension),
951 FINALMEMBERSIZE(CERT_INFO, cExtension),
953 offsetof(CERT_EXTENSION, pszObjId) };
954
955 TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
956 pvStructInfo, *pcbStructInfo, pcbDecoded);
957
958 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
959 dwFlags, NULL, pvStructInfo, pcbStructInfo, pcbDecoded);
960 return ret;
961}
static BOOL CRYPT_AsnDecodeExtension(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:1414
struct _CERT_EXTENSION CERT_EXTENSION

Referenced by CRYPT_AsnDecodeCertExtensions().

◆ CRYPT_AsnDecodeCertInfo()

static BOOL CRYPT_AsnDecodeCertInfo ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 982 of file decode.c.

985{
986 BOOL ret = TRUE;
987 struct AsnDecodeSequenceItem items[] = {
989 CRYPT_AsnDecodeCertVersion, sizeof(DWORD), TRUE, FALSE, 0, 0 },
992 TRUE, offsetof(CERT_INFO, SerialNumber.pbData), 0 },
993 { ASN_SEQUENCEOF, offsetof(CERT_INFO, SignatureAlgorithm),
995 FALSE, TRUE, offsetof(CERT_INFO, SignatureAlgorithm.pszObjId), 0 },
998 Issuer.pbData) },
999 { ASN_SEQUENCEOF, offsetof(CERT_INFO, NotBefore),
1001 FALSE, 0 },
1004 Subject.pbData) },
1005 { ASN_SEQUENCEOF, offsetof(CERT_INFO, SubjectPublicKeyInfo),
1008 SubjectPublicKeyInfo.Algorithm.Parameters.pbData), 0 },
1009 { ASN_CONTEXT | 1, offsetof(CERT_INFO, IssuerUniqueId),
1011 offsetof(CERT_INFO, IssuerUniqueId.pbData), 0 },
1012 { ASN_CONTEXT | 2, offsetof(CERT_INFO, SubjectUniqueId),
1014 offsetof(CERT_INFO, SubjectUniqueId.pbData), 0 },
1015 { ASN_CONTEXT | ASN_CONSTRUCTOR | 3, offsetof(CERT_INFO, cExtension),
1017 TRUE, TRUE, offsetof(CERT_INFO, rgExtension), 0 },
1018 };
1019
1020 TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
1021 pDecodePara, pvStructInfo, *pcbStructInfo);
1022
1024 pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo, pcbStructInfo,
1025 NULL, NULL);
1026 if (ret && pvStructInfo)
1027 {
1028 CERT_INFO *info;
1029
1031 info = *(CERT_INFO **)pvStructInfo;
1032 else
1033 info = pvStructInfo;
1034 if (!info->SerialNumber.cbData || !info->Issuer.cbData ||
1035 !info->Subject.cbData)
1036 {
1038 /* Don't need to deallocate, because it should have failed on the
1039 * first pass (and no memory was allocated.)
1040 */
1041 ret = FALSE;
1042 }
1043 }
1044
1045 TRACE("Returning %d (%08x)\n", ret, GetLastError());
1046 return ret;
1047}
DWORD dwVersion
Definition: LocaleTests.cpp:63
static BOOL CRYPT_AsnDecodePubKeyInfoInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2877
static BOOL CRYPT_AsnDecodeValidity(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:926
static BOOL CRYPT_AsnDecodeAlgorithmId(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2849
static BOOL CRYPT_AsnDecodeDerBlob(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:784
static BOOL CRYPT_AsnDecodeCertExtensions(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:963
static BOOL CRYPT_AsnDecodeCertVersion(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:908
#define DWORD
Definition: nt_native.h:44
ULONG SerialNumber
Definition: rxce.c:117
struct _CRYPTOAPI_BLOB CRYPT_DER_BLOB
struct _CERT_PRIVATE_KEY_VALIDITY CERT_PRIVATE_KEY_VALIDITY
struct _CERT_PUBLIC_KEY_INFO CERT_PUBLIC_KEY_INFO
struct _CRYPT_ALGORITHM_IDENTIFIER CRYPT_ALGORITHM_IDENTIFIER

Referenced by CRYPT_AsnDecodeCert().

◆ CRYPT_AsnDecodeCertPolicies()

static BOOL WINAPI CRYPT_AsnDecodeCertPolicies ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 3643 of file decode.c.

3646{
3647 BOOL ret = FALSE;
3648
3649 TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
3650 pDecodePara, pvStructInfo, pvStructInfo ? *pcbStructInfo : 0);
3651
3652 __TRY
3653 {
3654 struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
3655 offsetof(CERT_POLICIES_INFO, cPolicyInfo),
3656 offsetof(CERT_POLICIES_INFO, rgPolicyInfo),
3657 sizeof(CERT_POLICIES_INFO),
3659 offsetof(CERT_POLICY_INFO, pszPolicyIdentifier) };
3660 CERT_POLICIES_INFO *info = pvStructInfo;
3661
3662 if (pvStructInfo && !(dwFlags & CRYPT_DECODE_ALLOC_FLAG))
3663 info->rgPolicyInfo = (CERT_POLICY_INFO *)(info + 1);
3664
3665 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
3666 dwFlags, pDecodePara, pvStructInfo, pcbStructInfo, NULL);
3667 }
3669 {
3671 }
3672 __ENDTRY
3673 return ret;
3674}
static BOOL CRYPT_AsnDecodeCertPolicy(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3619
struct _CERT_POLICIES_INFO CERT_POLICIES_INFO

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeCertPolicy()

static BOOL CRYPT_AsnDecodeCertPolicy ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 3619 of file decode.c.

3621{
3622 struct AsnDecodeSequenceItem items[] = {
3623 { ASN_OBJECTIDENTIFIER, offsetof(CERT_POLICY_INFO, pszPolicyIdentifier),
3625 offsetof(CERT_POLICY_INFO, pszPolicyIdentifier), 0 },
3626 { ASN_SEQUENCEOF, offsetof(CERT_POLICY_INFO, cPolicyQualifier),
3628 FINALMEMBERSIZE(CERT_POLICY_INFO, cPolicyQualifier), TRUE,
3629 TRUE, offsetof(CERT_POLICY_INFO, rgPolicyQualifier), 0 },
3630 };
3631 CERT_POLICY_INFO *info = pvStructInfo;
3632 BOOL ret;
3633
3634 TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
3635 pvStructInfo, pvStructInfo ? *pcbStructInfo : 0);
3636
3638 pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
3639 pcbDecoded, info ? info->pszPolicyIdentifier : NULL);
3640 return ret;
3641}
static BOOL CRYPT_AsnDecodePolicyQualifiers(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3598

Referenced by CRYPT_AsnDecodeCertPolicies().

◆ CRYPT_AsnDecodeCertPolicyConstraints()

static BOOL WINAPI CRYPT_AsnDecodeCertPolicyConstraints ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 3826 of file decode.c.

3830{
3831 BOOL ret = FALSE;
3832
3833 TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
3834 pDecodePara, pvStructInfo, pvStructInfo ? *pcbStructInfo : 0);
3835
3836 __TRY
3837 {
3838 struct AsnDecodeSequenceItem items[] = {
3839 { ASN_CONTEXT | 0,
3840 offsetof(CERT_POLICY_CONSTRAINTS_INFO, fRequireExplicitPolicy),
3842 MEMBERSIZE(CERT_POLICY_CONSTRAINTS_INFO, fRequireExplicitPolicy,
3843 fInhibitPolicyMapping), TRUE, FALSE, 0, 0 },
3844 { ASN_CONTEXT | 1,
3845 offsetof(CERT_POLICY_CONSTRAINTS_INFO, fInhibitPolicyMapping),
3847 FINALMEMBERSIZE(CERT_POLICY_CONSTRAINTS_INFO, fInhibitPolicyMapping),
3848 TRUE, FALSE, 0, 0 },
3849 };
3850
3852 pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
3853 pcbStructInfo, NULL, NULL);
3854 }
3856 {
3858 }
3859 __ENDTRY
3860 return ret;
3861}
#define MEMBERSIZE(s, member, nextmember)
Definition: decode.c:299
static BOOL CRYPT_AsnDecodeRequireExplicit(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3732
static BOOL CRYPT_AsnDecodeInhibitMapping(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3779

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeCertPolicyMapping()

static BOOL CRYPT_AsnDecodeCertPolicyMapping ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 3676 of file decode.c.

3679{
3680 struct AsnDecodeSequenceItem items[] = {
3682 pszIssuerDomainPolicy), CRYPT_AsnDecodeOidInternal, sizeof(LPSTR),
3683 FALSE, TRUE, offsetof(CERT_POLICY_MAPPING, pszIssuerDomainPolicy), 0 },
3685 pszSubjectDomainPolicy), CRYPT_AsnDecodeOidInternal, sizeof(LPSTR),
3686 FALSE, TRUE, offsetof(CERT_POLICY_MAPPING, pszSubjectDomainPolicy), 0 },
3687 };
3688 CERT_POLICY_MAPPING *mapping = pvStructInfo;
3689 BOOL ret;
3690
3691 TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
3692 pvStructInfo, pvStructInfo ? *pcbStructInfo : 0);
3693
3695 pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
3696 pcbDecoded, mapping ? mapping->pszIssuerDomainPolicy : NULL);
3697 return ret;
3698}
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031

Referenced by CRYPT_AsnDecodeCertPolicyMappings().

◆ CRYPT_AsnDecodeCertPolicyMappings()

static BOOL WINAPI CRYPT_AsnDecodeCertPolicyMappings ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 3700 of file decode.c.

3703{
3704 BOOL ret = FALSE;
3705
3706 TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
3707 pDecodePara, pvStructInfo, pvStructInfo ? *pcbStructInfo : 0);
3708
3709 __TRY
3710 {
3711 struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
3712 offsetof(CERT_POLICY_MAPPINGS_INFO, cPolicyMapping),
3713 offsetof(CERT_POLICY_MAPPINGS_INFO, rgPolicyMapping),
3714 sizeof(CERT_POLICY_MAPPING),
3716 offsetof(CERT_POLICY_MAPPING, pszIssuerDomainPolicy) };
3717 CERT_POLICY_MAPPINGS_INFO *info = pvStructInfo;
3718
3719 if (pvStructInfo && !(dwFlags & CRYPT_DECODE_ALLOC_FLAG))
3720 info->rgPolicyMapping = (CERT_POLICY_MAPPING *)(info + 1);
3721 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
3722 dwFlags, pDecodePara, pvStructInfo, pcbStructInfo, NULL);
3723 }
3725 {
3727 }
3728 __ENDTRY
3729 return ret;
3730}
static BOOL CRYPT_AsnDecodeCertPolicyMapping(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3676
struct _CERT_POLICY_MAPPING CERT_POLICY_MAPPING

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeCertSignedContent()

static BOOL WINAPI CRYPT_AsnDecodeCertSignedContent ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 867 of file decode.c.

870{
871 BOOL ret = TRUE;
872
873 TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
874 pDecodePara, pvStructInfo, *pcbStructInfo);
875
876 __TRY
877 {
878 struct AsnDecodeSequenceItem items[] = {
879 { 0, offsetof(CERT_SIGNED_CONTENT_INFO, ToBeSigned),
881 offsetof(CERT_SIGNED_CONTENT_INFO, ToBeSigned.pbData), 0 },
883 SignatureAlgorithm), CRYPT_AsnDecodeAlgorithmId,
885 offsetof(CERT_SIGNED_CONTENT_INFO, SignatureAlgorithm.pszObjId), 0 },
889 };
890
892 items[2].decodeFunc = CRYPT_AsnDecodeBitsInternal;
894 pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
895 pcbStructInfo, NULL, NULL);
896 }
898 {
900 ret = FALSE;
901 }
903
904 TRACE("Returning %d (%08x)\n", ret, GetLastError());
905 return ret;
906}
static BOOL CRYPT_AsnDecodeBitsSwapBytes(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:831
static const WCHAR Signature[]
Definition: parser.c:141
#define CRYPT_DECODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG
Definition: wincrypt.h:3453

Referenced by CRYPT_AsnDecodeCert(), CRYPT_AsnDecodeCRL(), and CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeCertVersion()

static BOOL CRYPT_AsnDecodeCertVersion ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 908 of file decode.c.

910{
911 BOOL ret;
912 DWORD dataLen;
913
914 if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
915 {
916 BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]);
917
918 ret = CRYPT_AsnDecodeIntInternal(pbEncoded + 1 + lenBytes, dataLen,
919 dwFlags, pvStructInfo, pcbStructInfo, NULL);
920 if (pcbDecoded)
921 *pcbDecoded = 1 + lenBytes + dataLen;
922 }
923 return ret;
924}
static BOOL CRYPT_AsnDecodeIntInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4382

Referenced by CRYPT_AsnDecodeCertInfo().

◆ CRYPT_AsnDecodeChoiceOfTime()

static BOOL WINAPI CRYPT_AsnDecodeChoiceOfTime ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 5011 of file decode.c.

5014{
5015 BOOL ret;
5016
5017 __TRY
5018 {
5019 DWORD bytesNeeded = 0;
5020
5022 dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, &bytesNeeded, NULL);
5023 if (ret)
5024 {
5025 if (!pvStructInfo)
5026 *pcbStructInfo = bytesNeeded;
5027 else if ((ret = CRYPT_DecodeEnsureSpace(dwFlags, pDecodePara,
5028 pvStructInfo, pcbStructInfo, bytesNeeded)))
5029 {
5031 pvStructInfo = *(BYTE **)pvStructInfo;
5033 dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, pvStructInfo,
5034 &bytesNeeded, NULL);
5036 CRYPT_FreeSpace(pDecodePara, pvStructInfo);
5037 }
5038 }
5039 }
5041 {
5043 ret = FALSE;
5044 }
5045 __ENDTRY
5046 return ret;
5047}
static BOOL CRYPT_AsnDecodeChoiceOfTimeInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4989

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeChoiceOfTimeInternal()

static BOOL CRYPT_AsnDecodeChoiceOfTimeInternal ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 4989 of file decode.c.

4992{
4993 BOOL ret;
4995
4996 if (pbEncoded[0] == ASN_UTCTIME)
4998 else if (pbEncoded[0] == ASN_GENERALTIME)
5000 if (decode)
5001 ret = decode(pbEncoded, cbEncoded, dwFlags, pvStructInfo,
5002 pcbStructInfo, pcbDecoded);
5003 else
5004 {
5006 ret = FALSE;
5007 }
5008 return ret;
5009}
static BYTE decode(char c)
Definition: base64_codec.c:97
static BOOL CRYPT_AsnDecodeUtcTimeInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4814
BOOL(* InternalDecodeFunc)(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:69
static BOOL CRYPT_AsnDecodeGeneralizedTime(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4917
#define ASN_UTCTIME
#define ASN_GENERALTIME

Referenced by CRYPT_AsnDecodeChoiceOfTime(), CRYPT_AsnDecodeCRLEntry(), CRYPT_AsnDecodeCRLInfo(), CRYPT_AsnDecodeCTL(), and CRYPT_AsnDecodeValidity().

◆ CRYPT_AsnDecodeCMSCertEncoded()

static BOOL CRYPT_AsnDecodeCMSCertEncoded ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 5634 of file decode.c.

5637{
5638 BOOL ret;
5639 struct AsnArrayDescriptor arrayDesc = { 0,
5640 offsetof(CRYPT_SIGNED_INFO, cCertEncoded),
5641 offsetof(CRYPT_SIGNED_INFO, rgCertEncoded),
5642 MEMBERSIZE(CRYPT_SIGNED_INFO, cCertEncoded, cCrlEncoded),
5645
5646 TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
5647 pvStructInfo, pvStructInfo ? *pcbStructInfo : 0, pcbDecoded);
5648
5649 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
5650 dwFlags, NULL, pvStructInfo, pcbStructInfo, pcbDecoded);
5651 return ret;
5652}
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_updates_bytes_to_ pdwDataLen BYTE * pbData
Definition: wincrypt.h:4201

Referenced by CRYPT_AsnDecodeCMSSignedInfo().

◆ CRYPT_AsnDecodeCMSCrlEncoded()

static BOOL CRYPT_AsnDecodeCMSCrlEncoded ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 5654 of file decode.c.

5657{
5658 BOOL ret;
5659 struct AsnArrayDescriptor arrayDesc = { 0,
5660 offsetof(CRYPT_SIGNED_INFO, cCrlEncoded),
5661 offsetof(CRYPT_SIGNED_INFO, rgCrlEncoded),
5662 MEMBERSIZE(CRYPT_SIGNED_INFO, cCrlEncoded, content),
5665
5666 TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
5667 pvStructInfo, pvStructInfo ? *pcbStructInfo : 0, pcbDecoded);
5668
5669 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
5670 dwFlags, NULL, pvStructInfo, pcbStructInfo, pcbDecoded);
5671 return ret;
5672}
content
Definition: atl_ax.c:994

Referenced by CRYPT_AsnDecodeCMSSignedInfo().

◆ 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}
static BOOL CRYPT_AsnDecodeCMSCrlEncoded(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5654
static BOOL CRYPT_AsnDecodePKCSContentInfoInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3304
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
#define ASN_SETOF
static const WCHAR version[]
Definition: asmname.c:66
#define ASN_SEQUENCE
Definition: snmp.h:110
struct _CRYPT_CONTENT_INFO CRYPT_CONTENT_INFO

Referenced by CDecodeMsg_DecodeSignedContent().

◆ CRYPT_AsnDecodeCMSSignerId()

static BOOL CRYPT_AsnDecodeCMSSignerId ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 5674 of file decode.c.

5677{
5678 CERT_ID *id = pvStructInfo;
5679 BOOL ret = FALSE;
5680
5681 if (*pbEncoded == ASN_SEQUENCEOF)
5682 {
5684 id ? &id->u.IssuerSerialNumber : NULL, pcbStructInfo, pcbDecoded);
5685 if (ret)
5686 {
5687 if (id)
5688 id->dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
5689 if (*pcbStructInfo > sizeof(CERT_ISSUER_SERIAL_NUMBER))
5690 *pcbStructInfo = sizeof(CERT_ID) + *pcbStructInfo -
5692 else
5693 *pcbStructInfo = sizeof(CERT_ID);
5694 }
5695 }
5696 else if (*pbEncoded == (ASN_CONTEXT | 0))
5697 {
5699 id ? &id->u.KeyId : NULL, pcbStructInfo, pcbDecoded);
5700 if (ret)
5701 {
5702 if (id)
5703 id->dwIdChoice = CERT_ID_KEY_IDENTIFIER;
5704 if (*pcbStructInfo > sizeof(CRYPT_DATA_BLOB))
5705 *pcbStructInfo = sizeof(CERT_ID) + *pcbStructInfo -
5706 sizeof(CRYPT_DATA_BLOB);
5707 else
5708 *pcbStructInfo = sizeof(CERT_ID);
5709 }
5710 }
5711 else
5713 return ret;
5714}
static BOOL CRYPT_AsnDecodeIssuerSerialNumber(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5520
GLuint id
Definition: glext.h:5910
#define CERT_ID_ISSUER_SERIAL_NUMBER
Definition: wincrypt.h:3673
#define CERT_ID_KEY_IDENTIFIER
Definition: wincrypt.h:3674
struct _CERT_ID CERT_ID

Referenced by CRYPT_AsnDecodeCMSSignerInfoInternal().

◆ CRYPT_AsnDecodeCMSSignerInfo()

static BOOL WINAPI CRYPT_AsnDecodeCMSSignerInfo ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 5760 of file decode.c.

5763{
5764 BOOL ret = FALSE;
5765
5766 TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
5767 pDecodePara, pvStructInfo, *pcbStructInfo);
5768
5769 __TRY
5770 {
5772 dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, pcbStructInfo, NULL);
5773 if (ret && pvStructInfo)
5774 {
5775 ret = CRYPT_DecodeEnsureSpace(dwFlags, pDecodePara, pvStructInfo,
5776 pcbStructInfo, *pcbStructInfo);
5777 if (ret)
5778 {
5780
5782 pvStructInfo = *(BYTE **)pvStructInfo;
5783 info = pvStructInfo;
5784 info->SignerId.u.KeyId.pbData = ((BYTE *)info +
5785 sizeof(CMSG_CMS_SIGNER_INFO));
5787 cbEncoded, dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, pvStructInfo,
5788 pcbStructInfo, NULL);
5790 CRYPT_FreeSpace(pDecodePara, info);
5791 }
5792 }
5793 }
5795 {
5797 }
5798 __ENDTRY
5799 TRACE("returning %d\n", ret);
5800 return ret;
5801}
static BOOL CRYPT_AsnDecodeCMSSignerInfoInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5716

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeCMSSignerInfoInternal()

static BOOL CRYPT_AsnDecodeCMSSignerInfoInternal ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 5716 of file decode.c.

5719{
5720 CMSG_CMS_SIGNER_INFO *info = pvStructInfo;
5721 struct AsnDecodeSequenceItem items[] = {
5723 CRYPT_AsnDecodeIntInternal, sizeof(DWORD), FALSE, FALSE, 0, 0 },
5724 { 0, offsetof(CMSG_CMS_SIGNER_INFO, SignerId),
5726 offsetof(CMSG_CMS_SIGNER_INFO, SignerId.u.KeyId.pbData), 0 },
5731 offsetof(CMSG_CMS_SIGNER_INFO, AuthAttrs),
5733 TRUE, TRUE, offsetof(CMSG_CMS_SIGNER_INFO, AuthAttrs.rgAttr), 0 },
5734 /* FIXME: Tests show that CertOpenStore accepts such certificates, but
5735 * how exactly should they be interpreted? */
5736 { ASN_CONSTRUCTOR | ASN_UNIVERSAL | 0x11, 0, NULL, 0, TRUE, FALSE, 0, 0 },
5737 { ASN_SEQUENCEOF, offsetof(CMSG_CMS_SIGNER_INFO, HashEncryptionAlgorithm),
5740 HashEncryptionAlgorithm.pszObjId), 0 },
5743 FALSE, TRUE, offsetof(CMSG_CMS_SIGNER_INFO, EncryptedHash.pbData), 0 },
5745 offsetof(CMSG_CMS_SIGNER_INFO, UnauthAttrs),
5747 TRUE, TRUE, offsetof(CMSG_CMS_SIGNER_INFO, UnauthAttrs.rgAttr), 0 },
5748 };
5749 BOOL ret;
5750
5751 TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
5752 pvStructInfo, *pcbStructInfo);
5753
5755 pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
5756 pcbDecoded, info ? info->SignerId.u.KeyId.pbData : NULL);
5757 return ret;
5758}
static BOOL CRYPT_AsnDecodePKCSAttributesInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2801
static BOOL CRYPT_AsnDecodeCMSSignerId(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5674
#define ASN_OCTETSTRING
Definition: snmp.h:105
#define ASN_UNIVERSAL
Definition: snmp.h:87
struct _CRYPT_ATTRIBUTES CRYPT_ATTRIBUTES
_In_ BOOLEAN _In_ ULONG HashAlgorithm
Definition: rtlfuncs.h:2055

Referenced by CRYPT_AsnDecodeCMSSignerInfo(), and CRYPT_DecodeSignerArray().

◆ CRYPT_AsnDecodeCopyBytes()

static BOOL CRYPT_AsnDecodeCopyBytes ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 2103 of file decode.c.

2106{
2107 BOOL ret = TRUE;
2108 DWORD bytesNeeded = sizeof(CRYPT_OBJID_BLOB), encodedLen = 0;
2109
2110 TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
2111 pvStructInfo, *pcbStructInfo);
2112
2113 if ((ret = CRYPT_FindEncodedLen(pbEncoded, cbEncoded, &encodedLen)))
2114 {
2116 bytesNeeded += encodedLen;
2117 if (!pvStructInfo)
2118 *pcbStructInfo = bytesNeeded;
2119 else if (*pcbStructInfo < bytesNeeded)
2120 {
2122 *pcbStructInfo = bytesNeeded;
2123 ret = FALSE;
2124 }
2125 else
2126 {
2127 PCRYPT_OBJID_BLOB blob = pvStructInfo;
2128
2129 *pcbStructInfo = bytesNeeded;
2130 blob->cbData = encodedLen;
2131 if (encodedLen)
2132 {
2134 blob->pbData = (LPBYTE)pbEncoded;
2135 else
2136 {
2137 assert(blob->pbData);
2138 memcpy(blob->pbData, pbEncoded, blob->cbData);
2139 }
2140 }
2141 else
2142 blob->pbData = NULL;
2143 }
2144 if (pcbDecoded)
2145 *pcbDecoded = encodedLen;
2146 }
2147 return ret;
2148}
static BOOL CRYPT_FindEncodedLen(const BYTE *pbEncoded, DWORD cbEncoded, DWORD *pcbDecoded)
Definition: decode.c:2047

Referenced by CRYPT_AsnDecodeAlgorithmId(), CRYPT_AsnDecodeCMSCertEncoded(), CRYPT_AsnDecodeCMSCrlEncoded(), CRYPT_AsnDecodePKCSAttributeValue(), CRYPT_AsnDecodePKCSContent(), CRYPT_AsnDecodeSMIMECapability(), and CRYPT_AsnDecodeSubtreeConstraints().

◆ CRYPT_AsnDecodeCRL()

static BOOL WINAPI CRYPT_AsnDecodeCRL ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 1246 of file decode.c.

1249{
1250 BOOL ret = FALSE;
1251
1252 TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
1253 pDecodePara, pvStructInfo, *pcbStructInfo);
1254
1255 __TRY
1256 {
1257 DWORD size = 0;
1258
1259 /* Unless told not to, first try to decode it as a signed crl. */
1261 {
1262 PCERT_SIGNED_CONTENT_INFO signedCrl = NULL;
1263
1266 &signedCrl, &size);
1267 if (ret)
1268 {
1269 size = 0;
1272 signedCrl->ToBeSigned.cbData, dwFlags, pDecodePara,
1273 pvStructInfo, pcbStructInfo);
1274 LocalFree(signedCrl);
1275 }
1276 }
1277 /* Failing that, try it as an unsigned crl */
1278 if (!ret)
1279 {
1280 size = 0;
1283 dwFlags, pDecodePara, pvStructInfo, pcbStructInfo);
1284 }
1285 }
1287 {
1289 }
1290 __ENDTRY
1291
1292 TRACE("Returning %d (%08x)\n", ret, GetLastError());
1293 return ret;
1294}
static BOOL CRYPT_AsnDecodeCRLInfo(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:1210
#define X509_CERT_CRL_TO_BE_SIGNED
Definition: wincrypt.h:3367

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeCRLDistPoints()

static BOOL WINAPI CRYPT_AsnDecodeCRLDistPoints ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 5248 of file decode.c.

5251{
5252 BOOL ret;
5253
5254 TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
5255 pDecodePara, pvStructInfo, *pcbStructInfo);
5256
5257 __TRY
5258 {
5259 struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
5260 offsetof(CRL_DIST_POINTS_INFO, cDistPoint),
5261 offsetof(CRL_DIST_POINTS_INFO, rgDistPoint),
5262 sizeof(CRL_DIST_POINTS_INFO),
5264 offsetof(CRL_DIST_POINT, DistPointName.u.FullName.rgAltEntry) };
5265 CRL_DIST_POINTS_INFO *info = pvStructInfo;
5266
5267 if (pvStructInfo && !(dwFlags & CRYPT_DECODE_ALLOC_FLAG))
5268 info->rgDistPoint = (CRL_DIST_POINT *)(info + 1);
5269 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
5270 dwFlags, pDecodePara, pvStructInfo, pcbStructInfo, NULL);
5271 }
5273 {
5275 ret = FALSE;
5276 }
5277 __ENDTRY
5278 return ret;
5279}
static BOOL CRYPT_AsnDecodeDistPoint(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5224
struct _CRL_DIST_POINTS_INFO CRL_DIST_POINTS_INFO

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeCRLEntries()

static BOOL CRYPT_AsnDecodeCRLEntries ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 1153 of file decode.c.

1155{
1156 BOOL ret;
1157 struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
1158 offsetof(CRL_INFO, cCRLEntry), offsetof(CRL_INFO, rgCRLEntry),
1159 MEMBERSIZE(CRL_INFO, cCRLEntry, cExtension),
1161 offsetof(CRL_ENTRY, SerialNumber.pbData) };
1162
1163 TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
1164 pvStructInfo, *pcbStructInfo, pcbDecoded);
1165
1166 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
1167 dwFlags, NULL, pvStructInfo, pcbStructInfo, pcbDecoded);
1168 TRACE("Returning %d (%08x)\n", ret, GetLastError());
1169 return ret;
1170}
static BOOL CRYPT_AsnDecodeCRLEntry(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:1118
Definition: wincrypt.h:487
struct _CRL_ENTRY CRL_ENTRY

Referenced by CRYPT_AsnDecodeCRLInfo().

◆ CRYPT_AsnDecodeCRLEntry()

static BOOL CRYPT_AsnDecodeCRLEntry ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 1118 of file decode.c.

1120{
1121 BOOL ret;
1122 struct AsnDecodeSequenceItem items[] = {
1125 offsetof(CRL_ENTRY, SerialNumber.pbData), 0 },
1126 { 0, offsetof(CRL_ENTRY, RevocationDate),
1128 { ASN_SEQUENCEOF, offsetof(CRL_ENTRY, cExtension),
1130 FINALMEMBERSIZE(CRL_ENTRY, cExtension), TRUE, TRUE,
1131 offsetof(CRL_ENTRY, rgExtension), 0 },
1132 };
1133 PCRL_ENTRY entry = pvStructInfo;
1134
1135 TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags, entry,
1136 *pcbStructInfo);
1137
1139 pbEncoded, cbEncoded, dwFlags, NULL, entry, pcbStructInfo, pcbDecoded,
1140 entry ? entry->SerialNumber.pbData : NULL);
1141 if (ret && entry && !entry->SerialNumber.cbData)
1142 {
1143 WARN("empty CRL entry serial number\n");
1145 ret = FALSE;
1146 }
1147 return ret;
1148}
#define WARN(fmt,...)
Definition: precomp.h:61
static BOOL CRYPT_AsnDecodeCRLEntryExtensions(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:1099
struct _FILETIME FILETIME

Referenced by CRYPT_AsnDecodeCRLEntries().

◆ CRYPT_AsnDecodeCRLEntryExtensions()

static BOOL CRYPT_AsnDecodeCRLEntryExtensions ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 1099 of file decode.c.

1102{
1103 BOOL ret = TRUE;
1104 struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
1105 offsetof(CRL_ENTRY, cExtension), offsetof(CRL_ENTRY, rgExtension),
1106 FINALMEMBERSIZE(CRL_ENTRY, cExtension),
1108 offsetof(CERT_EXTENSION, pszObjId) };
1109
1110 TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
1111 pvStructInfo, *pcbStructInfo, pcbDecoded);
1112
1113 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
1114 dwFlags, NULL, pvStructInfo, pcbStructInfo, pcbDecoded);
1115 return ret;
1116}

Referenced by CRYPT_AsnDecodeCRLEntry().

◆ CRYPT_AsnDecodeCRLExtensions()

static BOOL CRYPT_AsnDecodeCRLExtensions ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 1191 of file decode.c.

1194{
1195 BOOL ret;
1196 DWORD dataLen;
1197
1198 if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
1199 {
1200 BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]);
1201
1203 dataLen, dwFlags, pvStructInfo, pcbStructInfo, NULL);
1204 if (ret && pcbDecoded)
1205 *pcbDecoded = 1 + lenBytes + dataLen;
1206 }
1207 return ret;
1208}
static BOOL CRYPT_AsnDecodeCRLExtensionsInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:1172

Referenced by CRYPT_AsnDecodeCRLInfo().

◆ CRYPT_AsnDecodeCRLExtensionsInternal()

static BOOL CRYPT_AsnDecodeCRLExtensionsInternal ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 1172 of file decode.c.

1175{
1176 BOOL ret = TRUE;
1177 struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
1178 offsetof(CRL_INFO, cExtension), offsetof(CRL_INFO, rgExtension),
1179 FINALMEMBERSIZE(CRL_INFO, cExtension),
1181 offsetof(CERT_EXTENSION, pszObjId) };
1182
1183 TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
1184 pvStructInfo, *pcbStructInfo, pcbDecoded);
1185
1186 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
1187 dwFlags, NULL, pvStructInfo, pcbStructInfo, pcbDecoded);
1188 return ret;
1189}

Referenced by CRYPT_AsnDecodeCRLExtensions().

◆ CRYPT_AsnDecodeCRLInfo()

static BOOL CRYPT_AsnDecodeCRLInfo ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 1210 of file decode.c.

1213{
1214 struct AsnDecodeSequenceItem items[] = {
1216 CRYPT_AsnDecodeIntInternal, sizeof(DWORD), TRUE, FALSE, 0, 0 },
1217 { ASN_SEQUENCEOF, offsetof(CRL_INFO, SignatureAlgorithm),
1219 FALSE, TRUE, offsetof(CRL_INFO, SignatureAlgorithm.pszObjId), 0 },
1222 Issuer.pbData) },
1224 sizeof(FILETIME), FALSE, FALSE, 0 },
1226 sizeof(FILETIME), TRUE, FALSE, 0 },
1227 { ASN_SEQUENCEOF, offsetof(CRL_INFO, cCRLEntry),
1228 CRYPT_AsnDecodeCRLEntries, MEMBERSIZE(CRL_INFO, cCRLEntry, cExtension),
1229 TRUE, TRUE, offsetof(CRL_INFO, rgCRLEntry), 0 },
1230 { ASN_CONTEXT | ASN_CONSTRUCTOR | 0, offsetof(CRL_INFO, cExtension),
1232 TRUE, TRUE, offsetof(CRL_INFO, rgExtension), 0 },
1233 };
1234 BOOL ret = TRUE;
1235
1236 TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
1237 pDecodePara, pvStructInfo, *pcbStructInfo);
1238
1240 pDecodePara, pvStructInfo, pcbStructInfo, NULL, NULL);
1241
1242 TRACE("Returning %d (%08x)\n", ret, GetLastError());
1243 return ret;
1244}
static BOOL CRYPT_AsnDecodeCRLEntries(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:1153
static BOOL CRYPT_AsnDecodeCRLExtensions(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:1191

Referenced by CRYPT_AsnDecodeCRL().

◆ CRYPT_AsnDecodeCTL()

static BOOL WINAPI CRYPT_AsnDecodeCTL ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 2261 of file decode.c.

2264{
2265 BOOL ret = FALSE;
2266
2267 TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
2268 pDecodePara, pvStructInfo, *pcbStructInfo);
2269
2270 __TRY
2271 {
2272 struct AsnDecodeSequenceItem items[] = {
2274 CRYPT_AsnDecodeIntInternal, sizeof(DWORD), TRUE, FALSE, 0, 0 },
2275 { ASN_SEQUENCEOF, offsetof(CTL_INFO, SubjectUsage),
2277 offsetof(CTL_INFO, SubjectUsage.rgpszUsageIdentifier), 0 },
2280 TRUE, offsetof(CTL_INFO, ListIdentifier.pbData), 0 },
2281 { ASN_INTEGER, offsetof(CTL_INFO, SequenceNumber),
2283 TRUE, TRUE, offsetof(CTL_INFO, SequenceNumber.pbData), 0 },
2284 { 0, offsetof(CTL_INFO, ThisUpdate),
2286 0 },
2287 { 0, offsetof(CTL_INFO, NextUpdate),
2289 0 },
2290 { ASN_SEQUENCEOF, offsetof(CTL_INFO, SubjectAlgorithm),
2292 FALSE, TRUE, offsetof(CTL_INFO, SubjectAlgorithm.pszObjId), 0 },
2293 { ASN_SEQUENCEOF, offsetof(CTL_INFO, cCTLEntry),
2295 MEMBERSIZE(CTL_INFO, cCTLEntry, cExtension),
2296 TRUE, TRUE, offsetof(CTL_INFO, rgCTLEntry), 0 },
2297 { ASN_CONTEXT | ASN_CONSTRUCTOR | 0, offsetof(CTL_INFO, cExtension),
2299 TRUE, TRUE, offsetof(CTL_INFO, rgExtension), 0 },
2300 };
2301
2303 pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
2304 pcbStructInfo, NULL, NULL);
2305 }
2307 {
2309 }
2310 __ENDTRY
2311 return ret;
2312}
_In_ PTRANSFER_PACKET _In_ ULONG _In_ PIRP _In_ ULONG ListIdentifier
Definition: classp.h:1759
static BOOL CRYPT_AsnDecodeCTLEntries(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2205
static BOOL CRYPT_AsnDecodeCTLExtensions(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2242
static BOOL CRYPT_AsnDecodeCTLUsage(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2150
struct _CTL_USAGE CTL_USAGE

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeCTLEntries()

static BOOL CRYPT_AsnDecodeCTLEntries ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 2205 of file decode.c.

2207{
2208 BOOL ret;
2209 struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
2210 offsetof(CTL_INFO, cCTLEntry), offsetof(CTL_INFO, rgCTLEntry),
2211 FINALMEMBERSIZE(CTL_INFO, cExtension),
2213 offsetof(CTL_ENTRY, SubjectIdentifier.pbData) };
2214
2215 TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
2216 pvStructInfo, *pcbStructInfo, pcbDecoded);
2217
2218 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
2219 dwFlags, NULL, pvStructInfo, pcbStructInfo, pcbDecoded);
2220 return ret;
2221}
static BOOL CRYPT_AsnDecodeCTLEntry(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2181
Definition: wincrypt.h:723
struct _CTL_ENTRY CTL_ENTRY

Referenced by CRYPT_AsnDecodeCTL().

◆ CRYPT_AsnDecodeCTLEntry()

static BOOL CRYPT_AsnDecodeCTLEntry ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 2181 of file decode.c.

2183{
2184 struct AsnDecodeSequenceItem items[] = {
2185 { ASN_OCTETSTRING, offsetof(CTL_ENTRY, SubjectIdentifier),
2187 offsetof(CTL_ENTRY, SubjectIdentifier.pbData), 0 },
2188 { ASN_CONSTRUCTOR | ASN_SETOF, offsetof(CTL_ENTRY, cAttribute),
2190 FINALMEMBERSIZE(CTL_ENTRY, cAttribute), FALSE, TRUE,
2191 offsetof(CTL_ENTRY, rgAttribute), 0 },
2192 };
2193 BOOL ret = TRUE;
2194 CTL_ENTRY *entry = pvStructInfo;
2195
2196 TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags, entry,
2197 *pcbStructInfo);
2198
2200 pbEncoded, cbEncoded, dwFlags, NULL, entry, pcbStructInfo,
2201 pcbDecoded, entry ? entry->SubjectIdentifier.pbData : NULL);
2202 return ret;
2203}
static BOOL CRYPT_AsnDecodeCTLEntryAttributes(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2165

Referenced by CRYPT_AsnDecodeCTLEntries().

◆ CRYPT_AsnDecodeCTLEntryAttributes()

static BOOL CRYPT_AsnDecodeCTLEntryAttributes ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 2165 of file decode.c.

2168{
2169 struct AsnArrayDescriptor arrayDesc = { 0,
2170 offsetof(CTL_ENTRY, cAttribute), offsetof(CTL_ENTRY, rgAttribute),
2171 FINALMEMBERSIZE(CTL_ENTRY, cAttribute),
2173 offsetof(CRYPT_ATTRIBUTE, pszObjId) };
2174 BOOL ret;
2175
2176 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
2177 dwFlags, NULL, pvStructInfo, pcbStructInfo, pcbDecoded);
2178 return ret;
2179}
static BOOL CRYPT_AsnDecodePKCSAttributeInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2729
struct _CRYPT_ATTRIBUTE CRYPT_ATTRIBUTE

Referenced by CRYPT_AsnDecodeCTLEntry().

◆ CRYPT_AsnDecodeCTLExtensions()

static BOOL CRYPT_AsnDecodeCTLExtensions ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 2242 of file decode.c.

2245{
2246 BOOL ret;
2247 DWORD dataLen;
2248
2249 if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
2250 {
2251 BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]);
2252
2254 dataLen, dwFlags, pvStructInfo, pcbStructInfo, NULL);
2255 if (ret && pcbDecoded)
2256 *pcbDecoded = 1 + lenBytes + dataLen;
2257 }
2258 return ret;
2259}
static BOOL CRYPT_AsnDecodeCTLExtensionsInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2223

Referenced by CRYPT_AsnDecodeCTL().

◆ CRYPT_AsnDecodeCTLExtensionsInternal()

static BOOL CRYPT_AsnDecodeCTLExtensionsInternal ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 2223 of file decode.c.

2226{
2227 BOOL ret = TRUE;
2228 struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
2229 offsetof(CTL_INFO, cExtension), offsetof(CTL_INFO, rgExtension),
2230 FINALMEMBERSIZE(CTL_INFO, cExtension),
2232 offsetof(CERT_EXTENSION, pszObjId) };
2233
2234 TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
2235 pvStructInfo, *pcbStructInfo, pcbDecoded);
2236
2237 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
2238 dwFlags, NULL, pvStructInfo, pcbStructInfo, pcbDecoded);
2239 return ret;
2240}

Referenced by CRYPT_AsnDecodeCTLExtensions().

◆ CRYPT_AsnDecodeCTLUsage()

static BOOL CRYPT_AsnDecodeCTLUsage ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 2150 of file decode.c.

2152{
2153 BOOL ret;
2154 struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
2155 offsetof(CTL_USAGE, cUsageIdentifier),
2156 offsetof(CTL_USAGE, rgpszUsageIdentifier),
2157 sizeof(CTL_USAGE),
2158 CRYPT_AsnDecodeOidInternal, sizeof(LPSTR), TRUE, 0 };
2159
2160 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded, dwFlags,
2161 NULL, pvStructInfo, pcbStructInfo, pcbDecoded);
2162 return ret;
2163}

Referenced by CRYPT_AsnDecodeCTL().

◆ CRYPT_AsnDecodeDerBlob()

static BOOL CRYPT_AsnDecodeDerBlob ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 784 of file decode.c.

786{
787 BOOL ret;
788 DWORD dataLen;
789
790 if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
791 {
792 BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]);
793 DWORD bytesNeeded = sizeof(CRYPT_DER_BLOB);
794
796 bytesNeeded += 1 + lenBytes + dataLen;
797
798 if (pcbDecoded)
799 *pcbDecoded = 1 + lenBytes + dataLen;
800 if (!pvStructInfo)
801 *pcbStructInfo = bytesNeeded;
802 else if ((ret = CRYPT_DecodeCheckSpace(pcbStructInfo, bytesNeeded)))
803 {
805
807 pvStructInfo = *(BYTE **)pvStructInfo;
808 blob = pvStructInfo;
809 blob->cbData = 1 + lenBytes + dataLen;
810 if (blob->cbData)
811 {
813 blob->pbData = (BYTE *)pbEncoded;
814 else
815 {
816 assert(blob->pbData);
817 memcpy(blob->pbData, pbEncoded, blob->cbData);
818 }
819 }
820 else
821 {
823 ret = FALSE;
824 }
825 }
826 }
827 return ret;
828}
static BOOL CRYPT_DecodeCheckSpace(DWORD *pcbStructInfo, DWORD bytesNeeded)
Definition: decode.c:246

Referenced by CRYPT_AsnDecodeCertInfo(), CRYPT_AsnDecodeCertSignedContent(), CRYPT_AsnDecodeCRLInfo(), CRYPT_AsnDecodeIssuerSerialNumber(), and CRYPT_AsnDecodePolicyQualifier().

◆ CRYPT_AsnDecodeDistPoint()

static BOOL CRYPT_AsnDecodeDistPoint ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 5224 of file decode.c.

5226{
5227 struct AsnDecodeSequenceItem items[] = {
5229 DistPointName), CRYPT_AsnDecodeDistPointName,
5231 DistPointName.u.FullName.rgAltEntry), 0 },
5232 { ASN_CONTEXT | 1, offsetof(CRL_DIST_POINT, ReasonFlags),
5234 offsetof(CRL_DIST_POINT, ReasonFlags.pbData), 0 },
5237 offsetof(CRL_DIST_POINT, CRLIssuer.rgAltEntry), 0 },
5238 };
5239 CRL_DIST_POINT *point = pvStructInfo;
5240 BOOL ret;
5241
5243 pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
5244 pcbDecoded, point ? point->DistPointName.u.FullName.rgAltEntry : NULL);
5245 return ret;
5246}
static BOOL CRYPT_AsnDecodeDistPointName(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5156
POINTL point
Definition: edittest.c:50
struct _CRL_DIST_POINT_NAME CRL_DIST_POINT_NAME

Referenced by CRYPT_AsnDecodeCRLDistPoints().

◆ CRYPT_AsnDecodeDistPointName()

static BOOL CRYPT_AsnDecodeDistPointName ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 5156 of file decode.c.

5159{
5160 BOOL ret;
5161
5162 if (pbEncoded[0] == (ASN_CONTEXT | ASN_CONSTRUCTOR | 0))
5163 {
5164 DWORD bytesNeeded = 0, dataLen;
5165
5166 if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
5167 {
5168 struct AsnArrayDescriptor arrayDesc = {
5170 offsetof(CRL_DIST_POINT_NAME, u.FullName.cAltEntry),
5171 offsetof(CRL_DIST_POINT_NAME, u.FullName.rgAltEntry),
5174 offsetof(CERT_ALT_NAME_ENTRY, u.pwszURL) };
5175 BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]);
5176 DWORD nameLen;
5177
5178 if (dataLen)
5179 {
5180 ret = CRYPT_AsnDecodeArray(&arrayDesc,
5181 pbEncoded + 1 + lenBytes, cbEncoded - 1 - lenBytes,
5182 dwFlags, NULL, NULL, &nameLen, NULL);
5183 bytesNeeded = sizeof(CRL_DIST_POINT_NAME) + nameLen -
5185 }
5186 else
5187 bytesNeeded = sizeof(CRL_DIST_POINT_NAME);
5188 if (pcbDecoded)
5189 *pcbDecoded = 1 + lenBytes + dataLen;
5190 if (!pvStructInfo)
5191 *pcbStructInfo = bytesNeeded;
5192 else if (*pcbStructInfo < bytesNeeded)
5193 {
5194 *pcbStructInfo = bytesNeeded;
5196 ret = FALSE;
5197 }
5198 else
5199 {
5200 CRL_DIST_POINT_NAME *name = pvStructInfo;
5201
5202 *pcbStructInfo = bytesNeeded;
5203 if (dataLen)
5204 {
5205 name->dwDistPointNameChoice = CRL_DIST_POINT_FULL_NAME;
5206 ret = CRYPT_AsnDecodeArray(&arrayDesc,
5207 pbEncoded + 1 + lenBytes, cbEncoded - 1 - lenBytes,
5208 dwFlags, NULL, &name->u.FullName.cAltEntry, &nameLen,
5209 NULL);
5210 }
5211 else
5212 name->dwDistPointNameChoice = CRL_DIST_POINT_NO_NAME;
5213 }
5214 }
5215 }
5216 else
5217 {
5219 ret = FALSE;
5220 }
5221 return ret;
5222}
#define CRL_DIST_POINT_NO_NAME
Definition: wincrypt.h:513
#define CRL_DIST_POINT_FULL_NAME
Definition: wincrypt.h:514

Referenced by CRYPT_AsnDecodeDistPoint(), and CRYPT_AsnDecodeIssuingDistPoint().

◆ CRYPT_AsnDecodeEccSignature()

static BOOL WINAPI CRYPT_AsnDecodeEccSignature ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
CRYPT_DECODE_PARA pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 6019 of file decode.c.

6022{
6023 BOOL ret;
6024 struct AsnDecodeSequenceItem items[] = {
6027 TRUE, offsetof(CERT_ECC_SIGNATURE, r.pbData), 0 },
6030 TRUE, offsetof(CERT_ECC_SIGNATURE, s.pbData), 0 },
6031 };
6032
6033 __TRY
6034 {
6036 pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo,
6037 pcbStructInfo, NULL, NULL);
6038 }
6040 {
6042 ret = FALSE;
6043 }
6044 __ENDTRY
6045 return ret;
6046}
static BOOL CRYPT_AsnDecodeUnsignedIntegerInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4565
GLdouble s
Definition: gl.h:2039
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
struct _CRYPTOAPI_BLOB CRYPT_UINT_BLOB

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeEncryptedContentInfo()

static BOOL CRYPT_AsnDecodeEncryptedContentInfo ( const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
void pvStructInfo,
DWORD pcbStructInfo,
DWORD pcbDecoded 
)
static

Definition at line 5919 of file decode.c.

5922{
5923 BOOL ret;
5924 CRYPT_ENCRYPTED_CONTENT_INFO *info = pvStructInfo;
5925 struct AsnDecodeSequenceItem items[] = {
5927 contentType), CRYPT_AsnDecodeOidInternal, sizeof(LPSTR),
5929 contentType), 0 },
5931 contentEncryptionAlgorithm), CRYPT_AsnDecodeAlgorithmId,
5934 contentEncryptionAlgorithm.pszObjId), 0 },
5936 encryptedContent), CRYPT_AsnDecodeOctets,
5937 sizeof(CRYPT_DATA_BLOB), TRUE, TRUE,
5938 offsetof(CRYPT_ENCRYPTED_CONTENT_INFO, encryptedContent.pbData) },
5939 };
5940
5941 TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
5942 pvStructInfo, *pcbStructInfo, pcbDecoded);
5943
5945 pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
5946 pcbDecoded, info ? info->contentType : NULL);
5947 TRACE("returning %d\n", ret);
5948 return ret;
5949}

Referenced by CRYPT_AsnDecodePKCSEnvelopedData().

◆ CRYPT_AsnDecodeEnhancedKeyUsage()

static BOOL WINAPI CRYPT_AsnDecodeEnhancedKeyUsage ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 5281 of file decode.c.

5284{
5285 BOOL ret;
5286
5287 TRACE("%p, %d, %08x, %p, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
5288 pDecodePara, pvStructInfo, *pcbStructInfo);
5289
5290 __TRY
5291 {
5292 struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
5293 offsetof(CERT_ENHKEY_USAGE, cUsageIdentifier),
5294 offsetof(CERT_ENHKEY_USAGE, rgpszUsageIdentifier),
5295 sizeof(CERT_ENHKEY_USAGE),
5296 CRYPT_AsnDecodeOidInternal, sizeof(LPSTR), TRUE, 0 };
5297 CERT_ENHKEY_USAGE *usage = pvStructInfo;
5298
5299 if (pvStructInfo && !(dwFlags & CRYPT_DECODE_ALLOC_FLAG))
5300 usage->rgpszUsageIdentifier = (LPSTR *)(usage + 1);
5301 ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
5302 dwFlags, pDecodePara, pvStructInfo, pcbStructInfo, NULL);
5303 }
5305 {
5307 ret = FALSE;
5308 }
5309 __ENDTRY
5310 return ret;
5311}
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
struct _CTL_USAGE CERT_ENHKEY_USAGE

Referenced by CRYPT_GetBuiltinDecoder().

◆ CRYPT_AsnDecodeEnumerated()

static BOOL WINAPI CRYPT_AsnDecodeEnumerated ( DWORD  dwCertEncodingType,
LPCSTR  lpszStructType,
const BYTE pbEncoded,
DWORD  cbEncoded,
DWORD  dwFlags,
PCRYPT_DECODE_PARA  pDecodePara,
void pvStructInfo,
DWORD pcbStructInfo 
)
static

Definition at line 4666 of file decode.c.

4669{
4670 BOOL ret;
4671
4672 if (!pvStructInfo)
4673 {
4674 *pcbStructInfo = sizeof(int);
4675 return TRUE;
4676 }
4677 __TRY
4678 {
4679 if (pbEncoded[0] == ASN_ENUMERATED)
4680 {
4681 unsigned int val = 0, i;
4682
4683 if (cbEncoded <= 1)
4684 {
4686 ret = FALSE;
4687 }
4688 else if (pbEncoded[1] == 0)
4689 {
4690 S