ReactOS  0.4.14-dev-49-gfb4591c
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 CRYPT_E_ASN1_CORRUPT
Definition: winerror.h:3087
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
#define isdigit(c)
Definition: acclib.h:68
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
GLenum GLsizei len
Definition: glext.h:6722
const WCHAR * word
Definition: lex.c:78

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 TRUE
Definition: types.h:120
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
struct _CERT_ALT_NAME_ENTRY CERT_ALT_NAME_ENTRY
char * LPSTR
Definition: xmlstorage.h:182
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
const char * descr
Definition: boot.c:45
static BOOL CRYPT_AsnDecodeAltNameEntry(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2984
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ARRAY_SIZE(a)
Definition: main.h:24
static TCHAR * items[]
Definition: page1.c:45
static BOOL CRYPT_AsnDecodeOidInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:1395

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 }
#define ASN_OBJECTIDENTIFIER
Definition: snmp.h:107
#define TRUE
Definition: types.h:120
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
static BOOL CRYPT_AsnDecodeOidIgnoreTag(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:1296
char * LPSTR
Definition: xmlstorage.h:182
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
static BOOL CRYPT_AsnDecodeCopyBytes(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2103
int ret
_In_ PPCI_DEVICE_PRESENCE_PARAMETERS Parameters
Definition: iotypes.h:872
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ARRAY_SIZE(a)
Definition: main.h:24
struct _CRYPTOAPI_BLOB CRYPT_OBJID_BLOB
static TCHAR * items[]
Definition: page1.c:45

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 
3411  if ((ret = CRYPT_AsnDecodeAltNameInternal(pbEncoded, cbEncoded,
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);
3429  if (!ret && (dwFlags & CRYPT_DECODE_ALLOC_FLAG))
3430  CRYPT_FreeSpace(pDecodePara, name);
3431  }
3432  }
3433  }
3435  {
3437  ret = FALSE;
3438  }
3439  __ENDTRY
3440  return ret;
3441 }
#define TRUE
Definition: types.h:120
static BOOL CRYPT_AsnDecodeAltNameInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3108
struct _CERT_ALT_NAME_ENTRY * PCERT_ALT_NAME_ENTRY
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define __TRY
Definition: compat.h:70
#define TRACE(s)
Definition: solgame.cpp:4
struct _CERT_ALT_NAME_INFO CERT_ALT_NAME_INFO
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
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
#define __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
unsigned char BYTE
Definition: mem.h:68
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
Definition: name.c:36
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71
GLuint const GLchar * name
Definition: glext.h:6031

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 */
3025  ret = CRYPT_AsnDecodeOidIgnoreTag(pbEncoded, cbEncoded, 0, NULL,
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 */
3098  ret = CRYPT_AsnDecodeOidIgnoreTag(pbEncoded, cbEncoded, 0,
3099  &entry->u.pszRegisteredID, &dataLen, NULL);
3100  break;
3101  }
3102  }
3103  }
3104  }
3105  return ret;
3106 }
#define CRYPT_E_ASN1_BADTAG
Definition: winerror.h:3095
#define CRYPT_E_ASN1_CORRUPT
Definition: winerror.h:3087
#define memchr(s, c, n)
Definition: mkisofs.h:875
static BOOL CRYPT_GetLen(const BYTE *pbEncoded, DWORD cbEncoded, DWORD *len)
Definition: decode.c:189
Definition: wincrypt.h:332
#define GET_LEN_BYTES(b)
Definition: decode.c:113
struct _CERT_ALT_NAME_ENTRY CERT_ALT_NAME_ENTRY
static BOOL CRYPT_AsnDecodeOidIgnoreTag(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:1296
#define ASN_TYPE_MASK
Definition: decode.c:56
char * LPSTR
Definition: xmlstorage.h:182
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
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
#define CRYPT_E_ASN1_RULE
Definition: winerror.h:3097
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
uint32_t entry
Definition: isohybrid.c:63
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERROR_MORE_DATA
Definition: dderror.h:13

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 }
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
#define TRUE
Definition: types.h:120
Definition: wincrypt.h:332
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
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
#define TRACE(s)
Definition: solgame.cpp:4
struct _CERT_ALT_NAME_INFO CERT_ALT_NAME_INFO
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
int ret
static BOOL CRYPT_AsnDecodeAltNameEntry(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2984
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

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  }
762  if (!ret && (dwFlags & CRYPT_DECODE_ALLOC_FLAG))
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 }
#define CRYPT_E_ASN1_BADTAG
Definition: winerror.h:3095
#define CMSG_INDEFINITE_LENGTH
Definition: wincrypt.h:3648
#define CRYPT_E_ASN1_CORRUPT
Definition: winerror.h:3087
#define TRUE
Definition: types.h:120
DWORD encodedLen
Definition: decode.c:606
InternalDecodeFunc decodeFunc
Definition: decode.c:598
#define GET_LEN_BYTES(b)
Definition: decode.c:113
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM ULONG int * pcItems
Definition: usp10.c:62
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
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
unsigned int BOOL
Definition: ntddk_ex.h:94
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
DWORD minArraySize
Definition: decode.c:597
DWORD pointerOffset
Definition: decode.c:601
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define CRYPT_E_ASN1_EOD
Definition: winerror.h:3086
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define for
Definition: utility.h:88
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD countOffset
Definition: decode.c:595
#define SetLastError(x)
Definition: compat.h:409
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
LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize)
Definition: main.c:136
DWORD arrayOffset
Definition: decode.c:596
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
unsigned char BYTE
Definition: mem.h:68
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
static BOOL CRYPT_GetLengthIndefinite(const BYTE *pbEncoded, DWORD cbEncoded, DWORD *len)
Definition: decode.c:121

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,
3232  offsetof(CERT_AUTHORITY_INFO_ACCESS, rgAccDescr),
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 }
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL CRYPT_AsnDecodeAccessDescription(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3200
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
#define __TRY
Definition: compat.h:70
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
struct _CERT_AUTHORITY_INFO_ACCESS CERT_AUTHORITY_INFO_ACCESS
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define SetLastError(x)
Definition: compat.h:409
#define __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define ASN_SEQUENCEOF
Definition: snmp.h:111
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

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 },
3141  offsetof(CERT_AUTHORITY_KEY_ID_INFO, CertIssuer),
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 }
#define TRUE
Definition: types.h:120
#define ASN_CONSTRUCTOR
Definition: snmp.h:92
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
struct _CRYPTOAPI_BLOB CERT_NAME_BLOB
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
struct _CRYPTOAPI_BLOB CRYPT_DATA_BLOB
#define __TRY
Definition: compat.h:70
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define SetLastError(x)
Definition: compat.h:409
#define __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define ARRAY_SIZE(a)
Definition: main.h:24
static BOOL CRYPT_AsnDecodeIntegerInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4472
struct _CRYPTOAPI_BLOB CRYPT_INTEGER_BLOB
#define ASN_CONTEXT
Definition: snmp.h:89
static TCHAR * items[]
Definition: page1.c:45
static BOOL CRYPT_AsnDecodeOctets(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4080
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

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 }
#define TRUE
Definition: types.h:120
#define ASN_CONSTRUCTOR
Definition: snmp.h:92
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
static BOOL CRYPT_AsnDecodeAltNameInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3108
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
struct _CRYPTOAPI_BLOB CRYPT_DATA_BLOB
#define __TRY
Definition: compat.h:70
struct _CERT_ALT_NAME_INFO CERT_ALT_NAME_INFO
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define SetLastError(x)
Definition: compat.h:409
#define __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define ARRAY_SIZE(a)
Definition: main.h:24
static BOOL CRYPT_AsnDecodeIntegerInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4472
struct _CRYPTOAPI_BLOB CRYPT_INTEGER_BLOB
#define ASN_CONTEXT
Definition: snmp.h:89
static TCHAR * items[]
Definition: page1.c:45
static BOOL CRYPT_AsnDecodeOctets(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4080
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

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 }
#define TRUE
Definition: types.h:120
static BOOL CRYPT_AsnDecodeSequence(struct AsnDecodeSequenceItem items[], DWORD cItem, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded, void *startingPointer)
Definition: decode.c:451
#define ASN_BITSTRING
struct _CRYPT_BIT_BLOB CRYPT_BIT_BLOB
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
#define __TRY
Definition: compat.h:70
static BOOL CRYPT_AsnDecodeBitsInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4271
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define SetLastError(x)
Definition: compat.h:409
#define __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static BOOL CRYPT_AsnDecodePathLenConstraint(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3449
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define ARRAY_SIZE(a)
Definition: main.h:24
static BOOL CRYPT_AsnDecodeSubtreeConstraints(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3488
#define FINALMEMBERSIZE(s, member)
Definition: decode.c:298
#define ASN_SEQUENCEOF
Definition: snmp.h:111
#define ASN_INTEGER
Definition: snmp.h:103
static TCHAR * items[]
Definition: page1.c:45
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

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 }
#define TRUE
Definition: types.h:120
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
static BOOL CRYPT_AsnDecodeBool(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2941
#define BOOL
Definition: nt_native.h:43
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
#define __TRY
Definition: compat.h:70
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define SetLastError(x)
Definition: compat.h:409
#define __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static BOOL CRYPT_AsnDecodePathLenConstraint(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3449
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ASN_BOOL
#define ASN_INTEGER
Definition: snmp.h:103
static TCHAR * items[]
Definition: page1.c:45
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

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);
4366  if (!ret && (dwFlags & CRYPT_DECODE_ALLOC_FLAG))
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 }
#define CRYPT_E_ASN1_BADTAG
Definition: winerror.h:3095
#define CRYPT_E_ASN1_CORRUPT
Definition: winerror.h:3087
Definition: image.c:133
#define ASN_BITSTRING
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define __TRY
Definition: compat.h:70
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL CRYPT_AsnDecodeBitsInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4271
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
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
#define __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
unsigned char BYTE
Definition: mem.h:68
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

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 }
Definition: image.c:133
static BOOL CRYPT_GetLen(const BYTE *pbEncoded, DWORD cbEncoded, DWORD *len)
Definition: decode.c:189
#define GET_LEN_BYTES(b)
Definition: decode.c:113
#define assert(x)
Definition: debug.h:53
struct _CRYPT_BIT_BLOB CRYPT_BIT_BLOB
GLenum GLint GLuint mask
Definition: glext.h:6028
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
#define ERROR_MORE_DATA
Definition: dderror.h:13
#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 }
Definition: image.c:133
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL CRYPT_AsnDecodeBitsInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4271
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
unsigned char BYTE
Definition: mem.h:68
static calc_node_t temp
Definition: rpn_ieee.c:38
#define CRYPT_DECODE_NOCOPY_FLAG
Definition: wincrypt.h:3450

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 }
#define CRYPT_E_ASN1_CORRUPT
Definition: winerror.h:3087
#define TRUE
Definition: types.h:120
#define GET_LEN_BYTES(b)
Definition: decode.c:113
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define BOOL
Definition: nt_native.h:43
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define SetLastError(x)
Definition: compat.h:409
int ret
#define ERROR_MORE_DATA
Definition: dderror.h:13

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
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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
CRYPT_DER_BLOB ToBeSigned
Definition: wincrypt.h:613
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define CRYPT_DECODE_TO_BE_SIGNED_FLAG
Definition: wincrypt.h:3451
#define __TRY
Definition: compat.h:70
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
#define X509_CERT_TO_BE_SIGNED
Definition: wincrypt.h:3366
#define __ENDTRY
Definition: compat.h:72
int ret
BYTE * pbData
Definition: wincrypt.h:103
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define X509_CERT
Definition: wincrypt.h:3365
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

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_GetLen(const BYTE *pbEncoded, DWORD cbEncoded, DWORD *len)
Definition: decode.c:189
#define GET_LEN_BYTES(b)
Definition: decode.c:113
static BOOL CRYPT_AsnDecodeCertExtensionsInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:944
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
unsigned char BYTE
Definition: mem.h:68

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 }
#define TRUE
Definition: types.h:120
static BOOL CRYPT_AsnDecodeExtension(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:1414
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
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
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
struct _CERT_EXTENSION CERT_EXTENSION
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define FINALMEMBERSIZE(s, member)
Definition: decode.c:298
#define ASN_SEQUENCEOF
Definition: snmp.h:111

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 },
1002  { 0, offsetof(CERT_INFO, Subject), CRYPT_AsnDecodeDerBlob,
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 }
#define CRYPT_E_ASN1_CORRUPT
Definition: winerror.h:3087
#define TRUE
Definition: types.h:120
static BOOL CRYPT_AsnDecodeCertExtensions(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:963
#define ASN_CONSTRUCTOR
Definition: snmp.h:92
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
struct _CERT_PRIVATE_KEY_VALIDITY CERT_PRIVATE_KEY_VALIDITY
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define DWORD
Definition: nt_native.h:44
struct _CRYPT_BIT_BLOB CRYPT_BIT_BLOB
struct _test_info info[]
Definition: SetCursorPos.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
static BOOL CRYPT_AsnDecodeValidity(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:926
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL CRYPT_AsnDecodeCertVersion(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:908
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_AsnDecodeBitsInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4271
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
static BOOL CRYPT_AsnDecodePubKeyInfoInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2877
#define SetLastError(x)
Definition: compat.h:409
struct _CRYPT_ALGORITHM_IDENTIFIER CRYPT_ALGORITHM_IDENTIFIER
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
ULONG SerialNumber
Definition: rxce.c:117
#define ARRAY_SIZE(a)
Definition: main.h:24
static BOOL CRYPT_AsnDecodeIntegerInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4472
struct _CRYPTOAPI_BLOB CRYPT_INTEGER_BLOB
#define FINALMEMBERSIZE(s, member)
Definition: decode.c:298
#define ASN_CONTEXT
Definition: snmp.h:89
struct _CERT_PUBLIC_KEY_INFO CERT_PUBLIC_KEY_INFO
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define ASN_SEQUENCEOF
Definition: snmp.h:111
#define ASN_INTEGER
Definition: snmp.h:103
static TCHAR * items[]
Definition: page1.c:45
struct _CRYPTOAPI_BLOB CRYPT_DER_BLOB

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 }
#define TRUE
Definition: types.h:120
struct _CERT_POLICIES_INFO CERT_POLICIES_INFO
static BOOL CRYPT_AsnDecodeCertPolicy(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3619
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
#define __TRY
Definition: compat.h:70
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
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define SetLastError(x)
Definition: compat.h:409
#define __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define ASN_SEQUENCEOF
Definition: snmp.h:111
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

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 }
#define ASN_OBJECTIDENTIFIER
Definition: snmp.h:107
#define TRUE
Definition: types.h:120
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
char * LPSTR
Definition: xmlstorage.h:182
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ARRAY_SIZE(a)
Definition: main.h:24
static BOOL CRYPT_AsnDecodePolicyQualifiers(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3598
#define FINALMEMBERSIZE(s, member)
Definition: decode.c:298
#define ASN_SEQUENCEOF
Definition: snmp.h:111
static TCHAR * items[]
Definition: page1.c:45
static BOOL CRYPT_AsnDecodeOidInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:1395

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
#define TRUE
Definition: types.h:120
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
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
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
#define __TRY
Definition: compat.h:70
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define SetLastError(x)
Definition: compat.h:409
#define __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define ARRAY_SIZE(a)
Definition: main.h:24
#define FINALMEMBERSIZE(s, member)
Definition: decode.c:298
#define ASN_CONTEXT
Definition: snmp.h:89
static TCHAR * items[]
Definition: page1.c:45
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

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 }
#define ASN_OBJECTIDENTIFIER
Definition: snmp.h:107
#define TRUE
Definition: types.h:120
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
char * LPSTR
Definition: xmlstorage.h:182
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ARRAY_SIZE(a)
Definition: main.h:24
static TCHAR * items[]
Definition: page1.c:45
static BOOL CRYPT_AsnDecodeOidInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:1395

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 }
#define TRUE
Definition: types.h:120
static BOOL CRYPT_AsnDecodeCertPolicyMapping(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3676
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
#define __TRY
Definition: compat.h:70
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
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define SetLastError(x)
Definition: compat.h:409
#define __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define ASN_SEQUENCEOF
Definition: snmp.h:111
struct _CERT_POLICY_MAPPING CERT_POLICY_MAPPING
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

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  }
902  __ENDTRY
903 
904  TRACE("Returning %d (%08x)\n", ret, GetLastError());
905  return ret;
906 }
#define CRYPT_DECODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG
Definition: wincrypt.h:3453
#define TRUE
Definition: types.h:120
static BOOL CRYPT_AsnDecodeSequence(struct AsnDecodeSequenceItem items[], DWORD cItem, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded, void *startingPointer)
Definition: decode.c:451
#define ASN_BITSTRING
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
struct _CRYPT_BIT_BLOB CRYPT_BIT_BLOB
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
#define __TRY
Definition: compat.h:70
#define TRACE(s)
Definition: solgame.cpp:4
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_AsnDecodeBitsInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4271
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define SetLastError(x)
Definition: compat.h:409
struct _CRYPT_ALGORITHM_IDENTIFIER CRYPT_ALGORITHM_IDENTIFIER
#define __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static BOOL CRYPT_AsnDecodeBitsSwapBytes(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:831
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ASN_SEQUENCEOF
Definition: snmp.h:111
static TCHAR * items[]
Definition: page1.c:45
static const WCHAR Signature[]
Definition: parser.c:141
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71
struct _CRYPTOAPI_BLOB CRYPT_DER_BLOB

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_GetLen(const BYTE *pbEncoded, DWORD cbEncoded, DWORD *len)
Definition: decode.c:189
#define GET_LEN_BYTES(b)
Definition: decode.c:113
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
unsigned char BYTE
Definition: mem.h:68
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);
5035  if (!ret && (dwFlags & CRYPT_DECODE_ALLOC_FLAG))
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
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define __TRY
Definition: compat.h:70
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
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
#define __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
unsigned char BYTE
Definition: mem.h:68
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

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 }
#define CRYPT_E_ASN1_BADTAG
Definition: winerror.h:3095
#define ASN_GENERALTIME
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL CRYPT_AsnDecodeGeneralizedTime(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4917
smooth NULL
Definition: ftsmooth.c:416
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define SetLastError(x)
Definition: compat.h:409
int ret
#define ASN_UTCTIME
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
BOOL(* InternalDecodeFunc)(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:69
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

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 }
#define MEMBERSIZE(s, member, nextmember)
Definition: decode.c:299
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
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
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
static BOOL CRYPT_AsnDecodeCopyBytes(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2103
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
struct _CRYPTOAPI_BLOB CRYPT_DER_BLOB
_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 }
#define MEMBERSIZE(s, member, nextmember)
Definition: decode.c:299
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
content
Definition: atl_ax.c:994
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
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
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
static BOOL CRYPT_AsnDecodeCopyBytes(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2103
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
struct _CRYPTOAPI_BLOB CRYPT_DER_BLOB
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_updates_bytes_to_ pdwDataLen BYTE * pbData
Definition: wincrypt.h:4201

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 },
5837  { ASN_CONSTRUCTOR | ASN_CONTEXT | 0,
5839  MEMBERSIZE(CRYPT_SIGNED_INFO, cCertEncoded, cCrlEncoded), TRUE, TRUE,
5840  offsetof(CRYPT_SIGNED_INFO, rgCertEncoded), 0 },
5841  { ASN_CONSTRUCTOR | ASN_CONTEXT | 1,
5843  MEMBERSIZE(CRYPT_SIGNED_INFO, cCrlEncoded, content), TRUE, TRUE,
5844  offsetof(CRYPT_SIGNED_INFO, rgCrlEncoded), 0 },
5847  FINALMEMBERSIZE(CRYPT_SIGNED_INFO, cSignerInfo), TRUE, TRUE,
5848  offsetof(CRYPT_SIGNED_INFO, rgSignerInfo), 0 },
5849  };
5850 
5851  TRACE("%p, %d, %08x, %p, %p, %p\n", pbEncoded, cbEncoded, dwFlags,
5852  pDecodePara, signedInfo, pcbSignedInfo);
5853 
5855  pbEncoded, cbEncoded, dwFlags, pDecodePara, signedInfo, pcbSignedInfo,
5856  NULL, NULL);
5857  TRACE("returning %d\n", ret);
5858  return ret;
5859 }
#define MEMBERSIZE(s, member, nextmember)
Definition: decode.c:299
#define TRUE
Definition: types.h:120
#define ASN_SETOF
#define ASN_CONSTRUCTOR
Definition: snmp.h:92
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 DWORD
Definition: nt_native.h:44
unsigned int BOOL
Definition: ntddk_ex.h:94
content
Definition: atl_ax.c:994
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:64
#define offsetof(TYPE, MEMBER)
struct _CRYPT_CONTENT_INFO CRYPT_CONTENT_INFO
static BOOL CRYPT_AsnDecodePKCSContentInfoInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:3304
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL CRYPT_AsnDecodeCMSCrlEncoded(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5654
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static BOOL CRYPT_AsnDecodeCMSCertEncoded(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5634
#define ARRAY_SIZE(a)
Definition: main.h:24
#define FINALMEMBERSIZE(s, member)
Definition: decode.c:298
#define ASN_CONTEXT
Definition: snmp.h:89
static BOOL CRYPT_AsnDecodeIntInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4382
#define ASN_INTEGER
Definition: snmp.h:103
#define ASN_SEQUENCE
Definition: snmp.h:110
static TCHAR * items[]
Definition: page1.c:45
static BOOL CRYPT_DecodeSignerArray(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5803

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 -
5691  sizeof(CERT_ISSUER_SERIAL_NUMBER);
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 }
#define CRYPT_E_ASN1_BADTAG
Definition: winerror.h:3095
static BOOL CRYPT_AsnDecodeIssuerSerialNumber(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5520
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define CERT_ID_KEY_IDENTIFIER
Definition: wincrypt.h:3674
#define SetLastError(x)
Definition: compat.h:409
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define CERT_ID_ISSUER_SERIAL_NUMBER
Definition: wincrypt.h:3673
#define ASN_CONTEXT
Definition: snmp.h:89
GLenum GLuint id
Definition: glext.h:5579
#define ASN_SEQUENCEOF
Definition: snmp.h:111
struct _CERT_ID CERT_ID
static BOOL CRYPT_AsnDecodeOctets(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4080

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);
5789  if (!ret && (dwFlags & CRYPT_DECODE_ALLOC_FLAG))
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
struct _test_info info[]
Definition: SetCursorPos.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define __TRY
Definition: compat.h:70
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define SetLastError(x)
Definition: compat.h:409
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
#define __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
unsigned char BYTE
Definition: mem.h:68
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

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[] = {
5722  { ASN_INTEGER, offsetof(CMSG_CMS_SIGNER_INFO, dwVersion),
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 },
5730  { ASN_CONSTRUCTOR | ASN_CONTEXT | 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 },
5741  { ASN_OCTETSTRING, offsetof(CMSG_CMS_SIGNER_INFO, EncryptedHash),
5743  FALSE, TRUE, offsetof(CMSG_CMS_SIGNER_INFO, EncryptedHash.pbData), 0 },
5744  { ASN_CONSTRUCTOR | ASN_CONTEXT | 1,
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 }
#define TRUE
Definition: types.h:120
#define ASN_OCTETSTRING
Definition: snmp.h:105
#define ASN_CONSTRUCTOR
Definition: snmp.h:92
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
_In_ BOOLEAN _In_ ULONG HashAlgorithm
Definition: rtlfuncs.h:2039
#define DWORD
Definition: nt_native.h:44
#define ASN_UNIVERSAL
Definition: snmp.h:87
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL CRYPT_AsnDecodePKCSAttributesInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2801
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
static BOOL CRYPT_AsnDecodeCMSSignerId(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:5674
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL CRYPT_AsnDecodeAlgorithmId(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:2849
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
struct _CRYPT_ALGORITHM_IDENTIFIER CRYPT_ALGORITHM_IDENTIFIER
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ASN_CONTEXT
Definition: snmp.h:89
#define ASN_SEQUENCEOF
Definition: snmp.h:111
struct _CRYPT_ATTRIBUTES CRYPT_ATTRIBUTES
static BOOL CRYPT_AsnDecodeIntInternal(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4382
#define ASN_INTEGER
Definition: snmp.h:103
struct _CERT_ID CERT_ID
static TCHAR * items[]
Definition: page1.c:45
static BOOL CRYPT_AsnDecodeOctets(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
Definition: decode.c:4080
struct _CRYPTOAPI_BLOB CRYPT_DER_BLOB

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 }
#define TRUE
Definition: types.h:120