ReactOS  0.4.13-dev-257-gfabbd7c
encode.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 "snmp.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/unicode.h"
#include "crypt32_private.h"
Include dependency graph for encode.c:

Go to the source code of this file.

Classes

struct  AsnEncodeTagSwappedItem
 
struct  DERSetDescriptor
 
struct  CTLEntries
 

Macros

#define NONAMELESSUNION
 

Typedefs

typedef BOOL(WINAPICryptEncodeObjectFunc) (DWORD, LPCSTR, const void *, BYTE *, DWORD *)
 
typedef BOOL(WINAPIEncodePublicKeyAndParametersFunc) (DWORD dwCertEncodingType, LPSTR pszPublicKeyObjId, BYTE *pbPubKey, DWORD cbPubKey, DWORD dwFlags, void *pvAuxInfo, BYTE **ppPublicKey, DWORD *pcbPublicKey, BYTE **ppbParams, DWORD *pcbParams)
 
typedef BOOL(WINAPIExportPublicKeyInfoExFunc) (HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProv, DWORD dwKeySpec, DWORD dwCertEncodingType, LPSTR pszPublicKeyObjId, DWORD dwFlags, void *pvAuxInfo, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo)
 
typedef BOOL(WINAPIConvertPublicKeyInfoFunc) (DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, ALG_ID aiKeyAlg, DWORD dwFlags, BYTE **ppbData, DWORD *dwDataLen)
 
typedef BOOL(WINAPIImportPublicKeyInfoExFunc) (HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, ALG_ID aiKeyAlg, DWORD dwFlags, void *pvAuxInfo, HCRYPTKEY *phKey)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (cryptasn)
 
 WINE_DECLARE_DEBUG_CHANNEL (crypt)
 
BOOL WINAPI CRYPT_AsnEncodeOid (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeExtensions (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeSequenceOfAny (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeBool (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodePubKeyInfo (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeBits (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeBitsSwapBytes (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeInt (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeInteger (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeUnsignedInteger (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeChoiceOfTime (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeEnhancedKeyUsage (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodePKCSAttributes (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
BOOL CRYPT_EncodeEnsureSpace (DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded)
 
static void CRYPT_FreeSpace (const CRYPT_ENCODE_PARA *pEncodePara, LPVOID pv)
 
BOOL CRYPT_EncodeLen (DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded)
 
BOOL WINAPI CRYPT_AsnEncodeSequence (DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
BOOL WINAPI CRYPT_AsnEncodeConstructed (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeSwapTag (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCertVersion (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_CopyEncodedBlob (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeValidity (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeAlgorithmIdWithNullParams (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeAlgorithmId (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCert (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
BOOL WINAPI CRYPT_AsnEncodePubKeyInfoNoNull (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCertInfo (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeCRLEntry (const CRL_ENTRY *entry, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCRLEntries (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCRLVersion (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCRLInfo (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeExtension (CERT_EXTENSION *ext, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeStringCoerce (const CERT_NAME_VALUE *value, BYTE tag, DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeBMPString (const CERT_NAME_VALUE *value, DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeUTF8String (const CERT_NAME_VALUE *value, DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeNameValue (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeRdnAttr (DWORD dwCertEncodingType, const CERT_RDN_ATTR *attr, CryptEncodeObjectExFunc nameValueEncodeFunc, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static int BLOBComp (const void *l, const void *r)
 
static BOOL WINAPI CRYPT_DEREncodeSet (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_DEREncodeItemsAsSet (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeRdn (DWORD dwCertEncodingType, const CERT_RDN *rdn, CryptEncodeObjectExFunc nameValueEncodeFunc, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeUnicodeNameValue (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeOrCopyUnicodeNameValue (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeUnicodeName (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCTLVersion (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCTLSubjectAlgorithm (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeCTLEntry (const CTL_ENTRY *entry, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCTLEntries (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCTL (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeSMIMECapability (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeSMIMECapabilities (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeNoticeNumbers (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeNoticeReference (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodePolicyQualifierUserNotice (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodePKCSAttribute (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodePKCSContentInfoInternal (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
BOOL CRYPT_AsnEncodePKCSDigestedData (const CRYPT_DIGESTED_DATA *digestedData, void *pvData, DWORD *pcbData)
 
static BOOL WINAPI CRYPT_AsnEncodePKCSContentInfo (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeUnicodeStringCoerce (const CERT_NAME_VALUE *value, BYTE tag, DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeNumericString (const CERT_NAME_VALUE *value, DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL isprintableW (WCHAR wc)
 
static BOOL CRYPT_AsnEncodePrintableString (const CERT_NAME_VALUE *value, DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeIA5String (const CERT_NAME_VALUE *value, DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeUniversalString (const CERT_NAME_VALUE *value, DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeName (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeAltNameEntry (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeAuthorityKeyId (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeAltName (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeAuthorityKeyId2 (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeAccessDescription (const CERT_ACCESS_DESCRIPTION *descr, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeAuthorityInfoAccess (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeBasicConstraints (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeBasicConstraints2 (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCertPolicyQualifiers (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeCertPolicy (DWORD dwCertEncodingType, const CERT_POLICY_INFO *info, DWORD dwFlags, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCertPolicies (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeCertPolicyMapping (DWORD dwCertEncodingType, const CERT_POLICY_MAPPING *mapping, DWORD dwFlags, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCertPolicyMappings (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCertPolicyConstraints (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeRsaPubKey (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
BOOL WINAPI CRYPT_AsnEncodeOctets (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeEnumerated (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeUtcTime (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeGeneralizedTime (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeDistPoint (const CRL_DIST_POINT *distPoint, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCRLDistPoints (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeIssuingDistPoint (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL CRYPT_AsnEncodeGeneralSubtree (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeNameConstraints (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeIssuerSerialNumber (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodePKCSSignerInfo (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeCMSSignerInfo (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
BOOL CRYPT_AsnEncodeCMSSignedInfo (CRYPT_SIGNED_INFO *signedInfo, void *pvData, DWORD *pcbData)
 
static BOOL WINAPI CRYPT_AsnEncodeRecipientInfo (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
static BOOL WINAPI CRYPT_AsnEncodeEncryptedContentInfo (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
 
BOOL CRYPT_AsnEncodePKCSEnvelopedData (const CRYPT_ENVELOPED_DATA *envelopedData, void *pvData, DWORD *pcbData)
 
static CryptEncodeObjectExFunc CRYPT_GetBuiltinEncoder (DWORD dwCertEncodingType, LPCSTR lpszStructType)
 
static CryptEncodeObjectFunc CRYPT_LoadEncoderFunc (DWORD dwCertEncodingType, LPCSTR lpszStructType, HCRYPTOIDFUNCADDR *hFunc)
 
static CryptEncodeObjectExFunc CRYPT_LoadEncoderExFunc (DWORD dwCertEncodingType, LPCSTR lpszStructType, HCRYPTOIDFUNCADDR *hFunc)
 
BOOL WINAPI CryptEncodeObject (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, BYTE *pbEncoded, DWORD *pcbEncoded)
 
BOOL WINAPI CryptEncodeObjectEx (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, void *pvEncoded, DWORD *pcbEncoded)
 
BOOL WINAPI PFXExportCertStore (HCERTSTORE hStore, CRYPT_DATA_BLOB *pPFX, LPCWSTR szPassword, DWORD dwFlags)
 
BOOL WINAPI PFXExportCertStoreEx (HCERTSTORE hStore, CRYPT_DATA_BLOB *pPFX, LPCWSTR szPassword, void *pvReserved, DWORD dwFlags)
 
BOOL WINAPI CryptExportPublicKeyInfo (HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProv, DWORD dwKeySpec, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo)
 
static BOOL WINAPI CRYPT_ExportPublicKeyInfoEx (HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProv, DWORD dwKeySpec, DWORD dwCertEncodingType, LPSTR pszPublicKeyObjId, DWORD dwFlags, void *pvAuxInfo, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo)
 
BOOL WINAPI CryptExportPublicKeyInfoEx (HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProv, DWORD dwKeySpec, DWORD dwCertEncodingType, LPSTR pszPublicKeyObjId, DWORD dwFlags, void *pvAuxInfo, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo)
 
BOOL WINAPI CryptImportPublicKeyInfo (HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, HCRYPTKEY *phKey)
 
static BOOL WINAPI CRYPT_ImportPublicKeyInfoEx (HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, ALG_ID aiKeyAlg, DWORD dwFlags, void *pvAuxInfo, HCRYPTKEY *phKey)
 
BOOL WINAPI CryptImportPublicKeyInfoEx (HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, ALG_ID aiKeyAlg, DWORD dwFlags, void *pvAuxInfo, HCRYPTKEY *phKey)
 

Macro Definition Documentation

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 41 of file encode.c.

Typedef Documentation

◆ ConvertPublicKeyInfoFunc

typedef BOOL(WINAPI * ConvertPublicKeyInfoFunc) (DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, ALG_ID aiKeyAlg, DWORD dwFlags, BYTE **ppbData, DWORD *dwDataLen)

Definition at line 4977 of file encode.c.

◆ CryptEncodeObjectFunc

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

Definition at line 55 of file encode.c.

◆ EncodePublicKeyAndParametersFunc

typedef BOOL(WINAPI * EncodePublicKeyAndParametersFunc) (DWORD dwCertEncodingType, LPSTR pszPublicKeyObjId, BYTE *pbPubKey, DWORD cbPubKey, DWORD dwFlags, void *pvAuxInfo, BYTE **ppPublicKey, DWORD *pcbPublicKey, BYTE **ppbParams, DWORD *pcbParams)

Definition at line 4782 of file encode.c.

◆ ExportPublicKeyInfoExFunc

typedef BOOL(WINAPI * ExportPublicKeyInfoExFunc) (HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProv, DWORD dwKeySpec, DWORD dwCertEncodingType, LPSTR pszPublicKeyObjId, DWORD dwFlags, void *pvAuxInfo, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo)

Definition at line 4930 of file encode.c.

◆ ImportPublicKeyInfoExFunc

typedef BOOL(WINAPI * ImportPublicKeyInfoExFunc) (HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, ALG_ID aiKeyAlg, DWORD dwFlags, void *pvAuxInfo, HCRYPTKEY *phKey)

Definition at line 5040 of file encode.c.

Function Documentation

◆ BLOBComp()

static int BLOBComp ( const void l,
const void r 
)
static

Definition at line 1189 of file encode.c.

1190 {
1191  const CRYPT_DER_BLOB *a = l, *b = r;
1192  int ret;
1193 
1194  if (!(ret = memcmp(a->pbData, b->pbData, min(a->cbData, b->cbData))))
1195  ret = a->cbData - b->cbData;
1196  return ret;
1197 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
r l[0]
Definition: byte_order.h:167
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
int ret
#define min(a, b)
Definition: monoChain.cc:55
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by CRYPT_DEREncodeItemsAsSet(), and CRYPT_DEREncodeSet().

◆ CRYPT_AsnEncodeAccessDescription()

static BOOL CRYPT_AsnEncodeAccessDescription ( const CERT_ACCESS_DESCRIPTION descr,
BYTE pbEncoded,
DWORD pcbEncoded 
)
static

Definition at line 2697 of file encode.c.

2699 {
2700  struct AsnEncodeSequenceItem items[] = {
2701  { descr->pszAccessMethod, CRYPT_AsnEncodeOid, 0 },
2702  { &descr->AccessLocation, CRYPT_AsnEncodeAltNameEntry, 0 },
2703  };
2704 
2705  if (!descr->pszAccessMethod)
2706  {
2708  return FALSE;
2709  }
2711 }
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
BOOL WINAPI CRYPT_AsnEncodeOid(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:820
#define SetLastError(x)
Definition: compat.h:409
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define ARRAY_SIZE(a)
Definition: main.h:24
const char * descr
Definition: boot.c:42
static TCHAR * items[]
Definition: page1.c:45
static BOOL WINAPI CRYPT_AsnEncodeAltNameEntry(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:2400

Referenced by CRYPT_AsnEncodeAuthorityInfoAccess().

◆ CRYPT_AsnEncodeAlgorithmId()

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

Definition at line 408 of file encode.c.

411 {
413  BOOL ret;
414  struct AsnEncodeSequenceItem items[] = {
415  { algo->pszObjId, CRYPT_AsnEncodeOid, 0 },
416  { &algo->Parameters, CRYPT_CopyEncodedBlob, 0 },
417  };
418 
420  ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded,
421  pcbEncoded);
422  return ret;
423 }
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
CRYPT_OBJID_BLOB Parameters
Definition: wincrypt.h:127
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL WINAPI CRYPT_CopyEncodedBlob(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:335
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
BOOL WINAPI CRYPT_AsnEncodeOid(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:820
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define ARRAY_SIZE(a)
Definition: main.h:24
static TCHAR * items[]
Definition: page1.c:45
const void * pvStructInfo

Referenced by CRYPT_AsnEncodeCert(), CRYPT_AsnEncodeCertInfo(), CRYPT_AsnEncodeCRLInfo(), and CRYPT_AsnEncodePubKeyInfoNoNull().

◆ CRYPT_AsnEncodeAlgorithmIdWithNullParams()

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

Definition at line 383 of file encode.c.

387 {
389  static const BYTE asn1Null[] = { ASN_NULL, 0 };
390  static const CRYPT_DATA_BLOB nullBlob = { sizeof(asn1Null),
391  (LPBYTE)asn1Null };
392  BOOL ret;
393  struct AsnEncodeSequenceItem items[2] = {
394  { algo->pszObjId, CRYPT_AsnEncodeOid, 0 },
395  { NULL, CRYPT_CopyEncodedBlob, 0 },
396  };
397 
398  if (algo->Parameters.cbData)
399  items[1].pvStructInfo = &algo->Parameters;
400  else
401  items[1].pvStructInfo = &nullBlob;
403  ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded,
404  pcbEncoded);
405  return ret;
406 }
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
CRYPT_OBJID_BLOB Parameters
Definition: wincrypt.h:127
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL WINAPI CRYPT_CopyEncodedBlob(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:335
smooth NULL
Definition: ftsmooth.c:416
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
BOOL WINAPI CRYPT_AsnEncodeOid(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:820
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
unsigned char BYTE
Definition: mem.h:68
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
#define ASN_NULL
Definition: snmp.h:106
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define ARRAY_SIZE(a)
Definition: main.h:24
static TCHAR * items[]
Definition: page1.c:45
const void * pvStructInfo

Referenced by CRYPT_AsnEncodeCMSSignedInfo(), CRYPT_AsnEncodeCMSSignerInfo(), CRYPT_AsnEncodeEncryptedContentInfo(), CRYPT_AsnEncodePKCSDigestedData(), CRYPT_AsnEncodePKCSSignerInfo(), CRYPT_AsnEncodePubKeyInfo(), and CRYPT_AsnEncodeRecipientInfo().

◆ CRYPT_AsnEncodeAltName()

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

Definition at line 2560 of file encode.c.

2563 {
2564  BOOL ret;
2565 
2566  __TRY
2567  {
2569  DWORD bytesNeeded, dataLen, lenBytes, i;
2570 
2571  ret = TRUE;
2572  /* FIXME: should check that cAltEntry is not bigger than 0xff, since we
2573  * can't encode an erroneous entry index if it's bigger than this.
2574  */
2575  for (i = 0, dataLen = 0; ret && i < info->cAltEntry; i++)
2576  {
2577  DWORD len;
2578 
2580  &info->rgAltEntry[i], 0, NULL, NULL, &len);
2581  if (ret)
2582  dataLen += len;
2584  {
2585  /* CRYPT_AsnEncodeAltNameEntry encoded the index of
2586  * the bad character, now set the index of the bad
2587  * entry
2588  */
2589  *pcbEncoded = (BYTE)i <<
2591  }
2592  }
2593  if (ret)
2594  {
2595  CRYPT_EncodeLen(dataLen, NULL, &lenBytes);
2596  bytesNeeded = 1 + lenBytes + dataLen;
2597  if (!pbEncoded)
2598  {
2599  *pcbEncoded = bytesNeeded;
2600  ret = TRUE;
2601  }
2602  else
2603  {
2604  if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara,
2605  pbEncoded, pcbEncoded, bytesNeeded)))
2606  {
2607  BYTE *out;
2608 
2610  pbEncoded = *(BYTE **)pbEncoded;
2611  out = pbEncoded;
2612  *out++ = ASN_SEQUENCEOF;
2613  CRYPT_EncodeLen(dataLen, out, &lenBytes);
2614  out += lenBytes;
2615  for (i = 0; ret && i < info->cAltEntry; i++)
2616  {
2617  DWORD len = dataLen;
2618 
2620  NULL, &info->rgAltEntry[i], 0, NULL, out, &len);
2621  if (ret)
2622  {
2623  out += len;
2624  dataLen -= len;
2625  }
2626  }
2627  if (!ret && (dwFlags & CRYPT_ENCODE_ALLOC_FLAG))
2628  CRYPT_FreeSpace(pEncodePara, pbEncoded);
2629  }
2630  }
2631  }
2632  }
2634  {
2636  ret = FALSE;
2637  }
2638  __ENDTRY
2639  return ret;
2640 }
#define TRUE
Definition: types.h:120
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
smooth NULL
Definition: ftsmooth.c:416
#define __TRY
Definition: compat.h:70
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
#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
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
static void CRYPT_FreeSpace(const CRYPT_ENCODE_PARA *pEncodePara, LPVOID pv)
Definition: encode.c:130
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT
Definition: wincrypt.h:361
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3441
#define CRYPT_E_INVALID_IA5_STRING
Definition: winerror.h:3026
#define ASN_SEQUENCEOF
Definition: snmp.h:111
BOOL CRYPT_EncodeEnsureSpace(DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded)
Definition: encode.c:103
const void * pvStructInfo
static BOOL WINAPI CRYPT_AsnEncodeAltNameEntry(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:2400
BOOL CRYPT_EncodeLen(DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:138
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

Referenced by CRYPT_AsnEncodeAuthorityKeyId2(), CRYPT_AsnEncodeDistPoint(), CRYPT_AsnEncodeIssuingDistPoint(), and CRYPT_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeAltNameEntry()

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

Definition at line 2400 of file encode.c.

2403 {
2405  BOOL ret;
2406  DWORD dataLen;
2407  BYTE tag;
2408 
2409  ret = TRUE;
2410  switch (entry->dwAltNameChoice)
2411  {
2414  case CERT_ALT_NAME_URL:
2415  tag = ASN_CONTEXT | (entry->dwAltNameChoice - 1);
2416  if (entry->u.pwszURL)
2417  {
2418  DWORD i;
2419 
2420  /* Not + 1: don't encode the NULL-terminator */
2421  dataLen = lstrlenW(entry->u.pwszURL);
2422  for (i = 0; ret && i < dataLen; i++)
2423  {
2424  if (entry->u.pwszURL[i] > 0x7f)
2425  {
2427  ret = FALSE;
2428  *pcbEncoded = i;
2429  }
2430  }
2431  }
2432  else
2433  dataLen = 0;
2434  break;
2436  tag = ASN_CONTEXT | ASN_CONSTRUCTOR | (entry->dwAltNameChoice - 1);
2437  dataLen = entry->u.DirectoryName.cbData;
2438  break;
2440  tag = ASN_CONTEXT | (entry->dwAltNameChoice - 1);
2441  dataLen = entry->u.IPAddress.cbData;
2442  break;
2444  {
2445  struct AsnEncodeTagSwappedItem swapped =
2446  { ASN_CONTEXT | (entry->dwAltNameChoice - 1), entry->u.pszRegisteredID,
2448 
2449  return CRYPT_AsnEncodeSwapTag(0, NULL, &swapped, 0, NULL, pbEncoded,
2450  pcbEncoded);
2451  }
2453  FIXME("name type %d unimplemented\n", entry->dwAltNameChoice);
2454  return FALSE;
2455  default:
2457  return FALSE;
2458  }
2459  if (ret)
2460  {
2461  DWORD bytesNeeded, lenBytes;
2462 
2463  CRYPT_EncodeLen(dataLen, NULL, &lenBytes);
2464  bytesNeeded = 1 + dataLen + lenBytes;
2465  if (!pbEncoded)
2466  *pcbEncoded = bytesNeeded;
2467  else if (*pcbEncoded < bytesNeeded)
2468  {
2470  *pcbEncoded = bytesNeeded;
2471  ret = FALSE;
2472  }
2473  else
2474  {
2475  *pbEncoded++ = tag;
2476  CRYPT_EncodeLen(dataLen, pbEncoded, &lenBytes);
2477  pbEncoded += lenBytes;
2478  switch (entry->dwAltNameChoice)
2479  {
2482  case CERT_ALT_NAME_URL:
2483  {
2484  DWORD i;
2485 
2486  for (i = 0; i < dataLen; i++)
2487  *pbEncoded++ = (BYTE)entry->u.pwszURL[i];
2488  break;
2489  }
2491  memcpy(pbEncoded, entry->u.DirectoryName.pbData, dataLen);
2492  break;
2494  memcpy(pbEncoded, entry->u.IPAddress.pbData, dataLen);
2495  break;
2496  }
2497  if (ret)
2498  *pcbEncoded = bytesNeeded;
2499  }
2500  }
2501  TRACE("returning %d (%08x)\n", ret, GetLastError());
2502  return ret;
2503 }
#define TRUE
Definition: types.h:120
#define CERT_ALT_NAME_DNS_NAME
Definition: wincrypt.h:347
#define ASN_CONSTRUCTOR
Definition: snmp.h:92
#define CERT_ALT_NAME_DIRECTORY_NAME
Definition: wincrypt.h:349
#define CERT_ALT_NAME_URL
Definition: wincrypt.h:351
Definition: wincrypt.h:332
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
Definition: ecma_167.h:138
#define lstrlenW
Definition: compat.h:407
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
static BOOL WINAPI CRYPT_AsnEncodeSwapTag(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:298
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define CERT_ALT_NAME_RFC822_NAME
Definition: wincrypt.h:346
#define CERT_ALT_NAME_OTHER_NAME
Definition: wincrypt.h:345
BOOL WINAPI CRYPT_AsnEncodeOid(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:820
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
uint32_t entry
Definition: isohybrid.c:63
#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 CERT_ALT_NAME_IP_ADDRESS
Definition: wincrypt.h:352
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define CRYPT_E_INVALID_IA5_STRING
Definition: winerror.h:3026
#define ASN_CONTEXT
Definition: snmp.h:89
const void * pvStructInfo
BOOL CRYPT_EncodeLen(DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:138
#define CERT_ALT_NAME_REGISTERED_ID
Definition: wincrypt.h:353
char * tag
Definition: main.c:59

Referenced by CRYPT_AsnEncodeAccessDescription(), CRYPT_AsnEncodeAltName(), and CRYPT_AsnEncodeGeneralSubtree().

◆ CRYPT_AsnEncodeAuthorityInfoAccess()

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

Definition at line 2713 of file encode.c.

2716 {
2717  BOOL ret;
2718 
2719  __TRY
2720  {
2721  DWORD bytesNeeded, dataLen, lenBytes, i;
2723 
2724  ret = TRUE;
2725  for (i = 0, dataLen = 0; ret && i < info->cAccDescr; i++)
2726  {
2727  DWORD size;
2728 
2729  ret = CRYPT_AsnEncodeAccessDescription(&info->rgAccDescr[i], NULL,
2730  &size);
2731  if (ret)
2732  dataLen += size;
2733  }
2734  if (ret)
2735  {
2736  CRYPT_EncodeLen(dataLen, NULL, &lenBytes);
2737  bytesNeeded = 1 + lenBytes + dataLen;
2738  if (!pbEncoded)
2739  *pcbEncoded = bytesNeeded;
2740  else
2741  {
2742  if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara,
2743  pbEncoded, pcbEncoded, bytesNeeded)))
2744  {
2745  BYTE *out;
2746 
2748  pbEncoded = *(BYTE **)pbEncoded;
2749  out = pbEncoded;
2750  *out++ = ASN_SEQUENCEOF;
2751  CRYPT_EncodeLen(dataLen, out, &lenBytes);
2752  out += lenBytes;
2753  for (i = 0; i < info->cAccDescr; i++)
2754  {
2755  DWORD size = dataLen;
2756 
2758  &info->rgAccDescr[i], out, &size);
2759  out += size;
2760  dataLen -= size;
2761  }
2762  if (!ret && (dwFlags & CRYPT_ENCODE_ALLOC_FLAG))
2763  CRYPT_FreeSpace(pEncodePara, pbEncoded);
2764  }
2765  }
2766  }
2767  }
2769  {
2771  ret = FALSE;
2772  }
2773  __ENDTRY
2774  return ret;
2775 }
#define TRUE
Definition: types.h:120
static BOOL CRYPT_AsnEncodeAccessDescription(const CERT_ACCESS_DESCRIPTION *descr, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:2697
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
smooth NULL
Definition: ftsmooth.c:416
#define __TRY
Definition: compat.h:70
GLsizeiptr size
Definition: glext.h:5919
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
#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
unsigned char BYTE
Definition: mem.h:68
static void CRYPT_FreeSpace(const CRYPT_ENCODE_PARA *pEncodePara, LPVOID pv)
Definition: encode.c:130
const void * pvStructInfo
Definition: encode.c:290
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3441
#define ASN_SEQUENCEOF
Definition: snmp.h:111
BOOL CRYPT_EncodeEnsureSpace(DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded)
Definition: encode.c:103
BOOL CRYPT_EncodeLen(DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:138
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

Referenced by CRYPT_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeAuthorityKeyId()

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

Definition at line 2505 of file encode.c.

2508 {
2509  BOOL ret;
2510 
2511  __TRY
2512  {
2514  struct AsnEncodeSequenceItem items[3] = { { 0 } };
2515  struct AsnEncodeTagSwappedItem swapped[3] = { { 0 } };
2516  struct AsnConstructedItem constructed = { 0 };
2517  DWORD cItem = 0, cSwapped = 0;
2518 
2519  if (info->KeyId.cbData)
2520  {
2521  swapped[cSwapped].tag = ASN_CONTEXT | 0;
2522  swapped[cSwapped].pvStructInfo = &info->KeyId;
2523  swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeOctets;
2524  items[cItem].pvStructInfo = &swapped[cSwapped];
2525  items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
2526  cSwapped++;
2527  cItem++;
2528  }
2529  if (info->CertIssuer.cbData)
2530  {
2531  constructed.tag = 1;
2532  constructed.pvStructInfo = &info->CertIssuer;
2533  constructed.encodeFunc = CRYPT_CopyEncodedBlob;
2534  items[cItem].pvStructInfo = &constructed;
2535  items[cItem].encodeFunc = CRYPT_AsnEncodeConstructed;
2536  cItem++;
2537  }
2538  if (info->CertSerialNumber.cbData)
2539  {
2540  swapped[cSwapped].tag = ASN_CONTEXT | 2;
2541  swapped[cSwapped].pvStructInfo = &info->CertSerialNumber;
2542  swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeInteger;
2543  items[cItem].pvStructInfo = &swapped[cSwapped];
2544  items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
2545  cSwapped++;
2546  cItem++;
2547  }
2549  pEncodePara, pbEncoded, pcbEncoded);
2550  }
2552  {
2554  ret = FALSE;
2555  }
2556  __ENDTRY
2557  return ret;
2558 }
static BOOL WINAPI CRYPT_AsnEncodeInteger(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3343
const void * pvStructInfo
CryptEncodeObjectExFunc encodeFunc
Definition: encode.c:291
BOOL WINAPI CRYPT_AsnEncodeConstructed(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:239
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
static BOOL WINAPI CRYPT_AsnEncodeSwapTag(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:298
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL WINAPI CRYPT_CopyEncodedBlob(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:335
#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
#define __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
const void * pvStructInfo
Definition: encode.c:290
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
BOOL WINAPI CRYPT_AsnEncodeOctets(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3178
#define ASN_CONTEXT
Definition: snmp.h:89
CryptEncodeObjectExFunc encodeFunc
static TCHAR * items[]
Definition: page1.c:45
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

Referenced by CRYPT_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeAuthorityKeyId2()

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

Definition at line 2642 of file encode.c.

2645 {
2646  BOOL ret;
2647 
2648  __TRY
2649  {
2651  struct AsnEncodeSequenceItem items[3] = { { 0 } };
2652  struct AsnEncodeTagSwappedItem swapped[3] = { { 0 } };
2653  DWORD cItem = 0, cSwapped = 0;
2654 
2655  if (info->KeyId.cbData)
2656  {
2657  swapped[cSwapped].tag = ASN_CONTEXT | 0;
2658  swapped[cSwapped].pvStructInfo = &info->KeyId;
2659  swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeOctets;
2660  items[cItem].pvStructInfo = &swapped[cSwapped];
2661  items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
2662  cSwapped++;
2663  cItem++;
2664  }
2665  if (info->AuthorityCertIssuer.cAltEntry)
2666  {
2667  swapped[cSwapped].tag = ASN_CONTEXT | ASN_CONSTRUCTOR | 1;
2668  swapped[cSwapped].pvStructInfo = &info->AuthorityCertIssuer;
2669  swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeAltName;
2670  items[cItem].pvStructInfo = &swapped[cSwapped];
2671  items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
2672  cSwapped++;
2673  cItem++;
2674  }
2675  if (info->AuthorityCertSerialNumber.cbData)
2676  {
2677  swapped[cSwapped].tag = ASN_CONTEXT | 2;
2678  swapped[cSwapped].pvStructInfo = &info->AuthorityCertSerialNumber;
2679  swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeInteger;
2680  items[cItem].pvStructInfo = &swapped[cSwapped];
2681  items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
2682  cSwapped++;
2683  cItem++;
2684  }
2686  pEncodePara, pbEncoded, pcbEncoded);
2687  }
2689  {
2691  ret = FALSE;
2692  }
2693  __ENDTRY
2694  return ret;
2695 }
static BOOL WINAPI CRYPT_AsnEncodeInteger(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3343
const void * pvStructInfo
#define ASN_CONSTRUCTOR
Definition: snmp.h:92
CryptEncodeObjectExFunc encodeFunc
Definition: encode.c:291
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
static BOOL WINAPI CRYPT_AsnEncodeSwapTag(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:298
unsigned int BOOL
Definition: ntddk_ex.h:94
#define __TRY
Definition: compat.h:70
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL WINAPI CRYPT_AsnEncodeAltName(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:2560
#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
const void * pvStructInfo
Definition: encode.c:290
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
BOOL WINAPI CRYPT_AsnEncodeOctets(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3178
#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_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeBasicConstraints()

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

Definition at line 2777 of file encode.c.

2780 {
2781  BOOL ret;
2782 
2783  __TRY
2784  {
2786  struct AsnEncodeSequenceItem items[3] = {
2787  { &info->SubjectType, CRYPT_AsnEncodeBits, 0 },
2788  { 0 }
2789  };
2790  DWORD cItem = 1;
2791 
2792  if (info->fPathLenConstraint)
2793  {
2794  items[cItem].pvStructInfo = &info->dwPathLenConstraint;
2795  items[cItem].encodeFunc = CRYPT_AsnEncodeInt;
2796  cItem++;
2797  }
2798  if (info->cSubtreesConstraint)
2799  {
2800  items[cItem].pvStructInfo = &info->cSubtreesConstraint;
2801  items[cItem].encodeFunc = CRYPT_AsnEncodeSequenceOfAny;
2802  cItem++;
2803  }
2805  dwFlags, pEncodePara, pbEncoded, pcbEncoded);
2806  }
2808  {
2810  ret = FALSE;
2811  }
2812  __ENDTRY
2813  return ret;
2814 }
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
unsigned int BOOL
Definition: ntddk_ex.h:94
#define __TRY
Definition: compat.h:70
static BOOL WINAPI CRYPT_AsnEncodeBits(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3224
static 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 __ENDTRY
Definition: compat.h:72
int ret
static BOOL WINAPI CRYPT_AsnEncodeInt(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3333
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
const void * pvStructInfo
Definition: encode.c:290
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
static TCHAR * items[]
Definition: page1.c:45
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71
static BOOL WINAPI CRYPT_AsnEncodeSequenceOfAny(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3656

Referenced by CRYPT_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeBasicConstraints2()

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

Definition at line 2816 of file encode.c.

2819 {
2820  BOOL ret;
2821 
2822  __TRY
2823  {
2825  struct AsnEncodeSequenceItem items[2] = { { 0 } };
2826  DWORD cItem = 0;
2827 
2828  if (info->fCA)
2829  {
2830  items[cItem].pvStructInfo = &info->fCA;
2831  items[cItem].encodeFunc = CRYPT_AsnEncodeBool;
2832  cItem++;
2833  }
2834  if (info->fPathLenConstraint)
2835  {
2836  items[cItem].pvStructInfo = &info->dwPathLenConstraint;
2837  items[cItem].encodeFunc = CRYPT_AsnEncodeInt;
2838  cItem++;
2839  }
2841  dwFlags, pEncodePara, pbEncoded, pcbEncoded);
2842  }
2844  {
2846  ret = FALSE;
2847  }
2848  __ENDTRY
2849  return ret;
2850 }
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
static BOOL WINAPI CRYPT_AsnEncodeBool(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:2369
unsigned int BOOL
Definition: ntddk_ex.h:94
#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
#define __ENDTRY
Definition: compat.h:72
int ret
static BOOL WINAPI CRYPT_AsnEncodeInt(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3333
_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
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
static TCHAR * items[]
Definition: page1.c:45
const void * pvStructInfo
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

Referenced by CRYPT_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeBits()

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

Definition at line 3224 of file encode.c.

3227 {
3228  BOOL ret;
3229 
3230  __TRY
3231  {
3232  const CRYPT_BIT_BLOB *blob = pvStructInfo;
3233  DWORD bytesNeeded, lenBytes, dataBytes;
3234  BYTE unusedBits;
3235 
3236  /* yep, MS allows cUnusedBits to be >= 8 */
3237  if (!blob->cUnusedBits)
3238  {
3239  dataBytes = blob->cbData;
3240  unusedBits = 0;
3241  }
3242  else if (blob->cbData * 8 > blob->cUnusedBits)
3243  {
3244  dataBytes = (blob->cbData * 8 - blob->cUnusedBits) / 8 + 1;
3245  unusedBits = blob->cUnusedBits >= 8 ? blob->cUnusedBits / 8 :
3246  blob->cUnusedBits;
3247  }
3248  else
3249  {
3250  dataBytes = 0;
3251  unusedBits = 0;
3252  }
3253  CRYPT_EncodeLen(dataBytes + 1, NULL, &lenBytes);
3254  bytesNeeded = 1 + lenBytes + dataBytes + 1;
3255  if (!pbEncoded)
3256  {
3257  *pcbEncoded = bytesNeeded;
3258  ret = TRUE;
3259  }
3260  else
3261  {
3262  if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara, pbEncoded,
3263  pcbEncoded, bytesNeeded)))
3264  {
3266  pbEncoded = *(BYTE **)pbEncoded;
3267  *pbEncoded++ = ASN_BITSTRING;
3268  CRYPT_EncodeLen(dataBytes + 1, pbEncoded, &lenBytes);
3269  pbEncoded += lenBytes;
3270  *pbEncoded++ = unusedBits;
3271  if (dataBytes)
3272  {
3273  BYTE mask = 0xff << unusedBits;
3274 
3275  if (dataBytes > 1)
3276  {
3277  memcpy(pbEncoded, blob->pbData, dataBytes - 1);
3278  pbEncoded += dataBytes - 1;
3279  }
3280  *pbEncoded = *(blob->pbData + dataBytes - 1) & mask;
3281  }
3282  }
3283  }
3284  }
3286  {
3288  ret = FALSE;
3289  }
3290  __ENDTRY
3291  return ret;
3292 }
#define TRUE
Definition: types.h:120
Definition: image.c:133
#define ASN_BITSTRING
GLenum GLint GLuint mask
Definition: glext.h:6028
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
#define __ENDTRY
Definition: compat.h:72
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 STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3441
BOOL CRYPT_EncodeEnsureSpace(DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded)
Definition: encode.c:103
const void * pvStructInfo
BOOL CRYPT_EncodeLen(DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:138
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

Referenced by CRYPT_AsnEncodeBasicConstraints(), CRYPT_AsnEncodeBitsSwapBytes(), CRYPT_AsnEncodeCert(), CRYPT_AsnEncodeCertInfo(), CRYPT_AsnEncodeDistPoint(), CRYPT_AsnEncodeIssuingDistPoint(), CRYPT_AsnEncodePubKeyInfo(), CRYPT_AsnEncodePubKeyInfoNoNull(), and CRYPT_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeBitsSwapBytes()

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

Definition at line 3294 of file encode.c.

3297 {
3298  BOOL ret;
3299 
3300  __TRY
3301  {
3302  const CRYPT_BIT_BLOB *blob = pvStructInfo;
3303  CRYPT_BIT_BLOB newBlob = { blob->cbData, NULL, blob->cUnusedBits };
3304 
3305  ret = TRUE;
3306  if (newBlob.cbData)
3307  {
3308  newBlob.pbData = CryptMemAlloc(newBlob.cbData);
3309  if (newBlob.pbData)
3310  {
3311  DWORD i;
3312 
3313  for (i = 0; i < newBlob.cbData; i++)
3314  newBlob.pbData[newBlob.cbData - i - 1] = blob->pbData[i];
3315  }
3316  else
3317  ret = FALSE;
3318  }
3319  if (ret)
3320  ret = CRYPT_AsnEncodeBits(dwCertEncodingType, lpszStructType,
3321  &newBlob, dwFlags, pEncodePara, pbEncoded, pcbEncoded);
3322  CryptMemFree(newBlob.pbData);
3323  }
3325  {
3327  ret = FALSE;
3328  }
3329  __ENDTRY
3330  return ret;
3331 }
#define TRUE
Definition: types.h:120
Definition: image.c:133
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
smooth NULL
Definition: ftsmooth.c:416
#define __TRY
Definition: compat.h:70
static BOOL WINAPI CRYPT_AsnEncodeBits(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3224
static 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 __ENDTRY
Definition: compat.h:72
int ret
_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
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
const void * pvStructInfo
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71
BYTE * pbData
Definition: wincrypt.h:197

Referenced by CRYPT_AsnEncodeCert().

◆ CRYPT_AsnEncodeBMPString()

static BOOL CRYPT_AsnEncodeBMPString ( const CERT_NAME_VALUE value,
DWORD  dwFlags,
const CRYPT_ENCODE_PARA pEncodePara,
BYTE pbEncoded,
DWORD pcbEncoded 
)
static

Definition at line 967 of file encode.c.

970 {
971  BOOL ret = TRUE;
972  LPCWSTR str = (LPCWSTR)value->Value.pbData;
973  DWORD bytesNeeded, lenBytes, strLen;
974 
975  if (value->Value.cbData)
976  strLen = value->Value.cbData / sizeof(WCHAR);
977  else if (value->Value.pbData)
978  strLen = lstrlenW(str);
979  else
980  strLen = 0;
981  CRYPT_EncodeLen(strLen * 2, NULL, &lenBytes);
982  bytesNeeded = 1 + lenBytes + strLen * 2;
983  if (!pbEncoded)
984  *pcbEncoded = bytesNeeded;
985  else
986  {
987  if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara,
988  pbEncoded, pcbEncoded, bytesNeeded)))
989  {
990  DWORD i;
991 
993  pbEncoded = *(BYTE **)pbEncoded;
995  CRYPT_EncodeLen(strLen * 2, pbEncoded, &lenBytes);
996  pbEncoded += lenBytes;
997  for (i = 0; i < strLen; i++)
998  {
999  *pbEncoded++ = (str[i] & 0xff00) >> 8;
1000  *pbEncoded++ = str[i] & 0x00ff;
1001  }
1002  }
1003  }
1004  return ret;
1005 }
#define TRUE
Definition: types.h:120
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define lstrlenW
Definition: compat.h:407
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 ASN_BMPSTRING
unsigned int BOOL
Definition: ntddk_ex.h:94
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
if(!(yy_init))
Definition: macro.lex.yy.c:714
__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
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
unsigned char BYTE
Definition: mem.h:68
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3441
BOOL CRYPT_EncodeEnsureSpace(DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded)
Definition: encode.c:103
BOOL CRYPT_EncodeLen(DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:138

Referenced by CRYPT_AsnEncodeNameValue(), and CRYPT_AsnEncodeUnicodeNameValue().

◆ CRYPT_AsnEncodeBool()

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

Definition at line 2369 of file encode.c.

2372 {
2373  BOOL val = *(const BOOL *)pvStructInfo, ret;
2374 
2375  TRACE("%d\n", val);
2376 
2377  if (!pbEncoded)
2378  {
2379  *pcbEncoded = 3;
2380  ret = TRUE;
2381  }
2382  else if (*pcbEncoded < 3)
2383  {
2384  *pcbEncoded = 3;
2386  ret = FALSE;
2387  }
2388  else
2389  {
2390  *pcbEncoded = 3;
2391  *pbEncoded++ = ASN_BOOL;
2392  *pbEncoded++ = 1;
2393  *pbEncoded++ = val ? 0xff : 0;
2394  ret = TRUE;
2395  }
2396  TRACE("returning %d (%08x)\n", ret, GetLastError());
2397  return ret;
2398 }
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLfloat * val
Definition: glext.h:7180
#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
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define ASN_BOOL
const void * pvStructInfo

Referenced by CRYPT_AsnEncodeBasicConstraints2(), CRYPT_AsnEncodeExtension(), and CRYPT_AsnEncodeIssuingDistPoint().

◆ CRYPT_AsnEncodeCert()

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

Definition at line 454 of file encode.c.

457 {
458  BOOL ret;
459 
460  __TRY
461  {
463  struct AsnEncodeSequenceItem items[] = {
464  { &info->ToBeSigned, CRYPT_CopyEncodedBlob, 0 },
465  { &info->SignatureAlgorithm, CRYPT_AsnEncodeAlgorithmId, 0 },
466  { &info->Signature, CRYPT_AsnEncodeBitsSwapBytes, 0 },
467  };
468 
470  items[2].encodeFunc = CRYPT_AsnEncodeBits;
472  ARRAY_SIZE(items), dwFlags, pEncodePara, pbEncoded,
473  pcbEncoded);
474  }
476  {
478  ret = FALSE;
479  }
480  __ENDTRY
481  return ret;
482 }
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL WINAPI CRYPT_CopyEncodedBlob(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:335
#define __TRY
Definition: compat.h:70
static BOOL WINAPI CRYPT_AsnEncodeAlgorithmId(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:408
static BOOL WINAPI CRYPT_AsnEncodeBits(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3224
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
static BOOL WINAPI CRYPT_AsnEncodeBitsSwapBytes(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3294
#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
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
#define CRYPT_ENCODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG
Definition: wincrypt.h:3440
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define ARRAY_SIZE(a)
Definition: main.h:24
static TCHAR * items[]
Definition: page1.c:45
const void * pvStructInfo
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

Referenced by CRYPT_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeCertInfo()

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

Definition at line 507 of file encode.c.

510 {
511  BOOL ret;
512 
513  __TRY
514  {
515  const CERT_INFO *info = pvStructInfo;
516  struct AsnEncodeSequenceItem items[10] = {
517  { &info->dwVersion, CRYPT_AsnEncodeCertVersion, 0 },
518  { &info->SerialNumber, CRYPT_AsnEncodeInteger, 0 },
519  { &info->SignatureAlgorithm, CRYPT_AsnEncodeAlgorithmId, 0 },
520  { &info->Issuer, CRYPT_CopyEncodedBlob, 0 },
521  { &info->NotBefore, CRYPT_AsnEncodeValidity, 0 },
522  { &info->Subject, CRYPT_CopyEncodedBlob, 0 },
523  { &info->SubjectPublicKeyInfo, CRYPT_AsnEncodePubKeyInfoNoNull, 0 },
524  { 0 }
525  };
526  struct AsnConstructedItem constructed = { 0 };
527  struct AsnEncodeTagSwappedItem swapped[2] = { { 0 } };
528  DWORD cItem = 7, cSwapped = 0;
529 
530  if (info->IssuerUniqueId.cbData)
531  {
532  swapped[cSwapped].tag = ASN_CONTEXT | 1;
533  swapped[cSwapped].pvStructInfo = &info->IssuerUniqueId;
534  swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeBits;
535  items[cItem].pvStructInfo = &swapped[cSwapped];
536  items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
537  cSwapped++;
538  cItem++;
539  }
540  if (info->SubjectUniqueId.cbData)
541  {
542  swapped[cSwapped].tag = ASN_CONTEXT | 2;
543  swapped[cSwapped].pvStructInfo = &info->SubjectUniqueId;
544  swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeBits;
545  items[cItem].pvStructInfo = &swapped[cSwapped];
546  items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
547  cSwapped++;
548  cItem++;
549  }
550  if (info->cExtension)
551  {
552  constructed.tag = 3;
553  constructed.pvStructInfo = &info->cExtension;
555  items[cItem].pvStructInfo = &constructed;
556  items[cItem].encodeFunc = CRYPT_AsnEncodeConstructed;
557  cItem++;
558  }
559 
561  dwFlags, pEncodePara, pbEncoded, pcbEncoded);
562  }
564  {
566  ret = FALSE;
567  }
568  __ENDTRY
569  return ret;
570 }
static BOOL WINAPI CRYPT_AsnEncodeValidity(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:362
static BOOL WINAPI CRYPT_AsnEncodeInteger(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3343
const void * pvStructInfo
CryptEncodeObjectExFunc encodeFunc
Definition: encode.c:291
BOOL WINAPI CRYPT_AsnEncodeConstructed(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:239
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
static BOOL WINAPI CRYPT_AsnEncodeSwapTag(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:298
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL WINAPI CRYPT_CopyEncodedBlob(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:335
#define __TRY
Definition: compat.h:70
static BOOL WINAPI CRYPT_AsnEncodeAlgorithmId(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:408
static BOOL WINAPI CRYPT_AsnEncodeBits(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3224
static 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 __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
const void * pvStructInfo
Definition: encode.c:290
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define ASN_CONTEXT
Definition: snmp.h:89
CryptEncodeObjectExFunc encodeFunc
static BOOL WINAPI CRYPT_AsnEncodeExtensions(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:757
static TCHAR * items[]
Definition: page1.c:45
const void * pvStructInfo
BOOL WINAPI CRYPT_AsnEncodePubKeyInfoNoNull(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:484
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71
static BOOL WINAPI CRYPT_AsnEncodeCertVersion(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:312

Referenced by CRYPT_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeCertPolicies()

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

Definition at line 2945 of file encode.c.

2948 {
2949  BOOL ret = FALSE;
2950 
2951  __TRY
2952  {
2954  DWORD bytesNeeded = 0, lenBytes, size, i;
2955 
2956  ret = TRUE;
2957  for (i = 0; ret && i < info->cPolicyInfo; i++)
2958  {
2960  &info->rgPolicyInfo[i], dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL,
2961  &size);
2962  if (ret)
2963  bytesNeeded += size;
2964  }
2965  CRYPT_EncodeLen(bytesNeeded, NULL, &lenBytes);
2966  bytesNeeded += 1 + lenBytes;
2967  if (ret)
2968  {
2969  if (!pbEncoded)
2970  *pcbEncoded = bytesNeeded;
2971  else
2972  {
2973  if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara,
2974  pbEncoded, pcbEncoded, bytesNeeded)))
2975  {
2976  BYTE *out;
2977 
2979  pbEncoded = *(BYTE **)pbEncoded;
2980  out = pbEncoded;
2981  *out++ = ASN_SEQUENCEOF;
2982  CRYPT_EncodeLen(bytesNeeded - lenBytes - 1, out, &lenBytes);
2983  out += lenBytes;
2984  for (i = 0; ret && i < info->cPolicyInfo; i++)
2985  {
2986  size = bytesNeeded;
2988  &info->rgPolicyInfo[i],
2990  if (ret)
2991  {
2992  out += size;
2993  bytesNeeded -= size;
2994  }
2995  }
2996  if (!ret && (dwFlags & CRYPT_ENCODE_ALLOC_FLAG))
2997  CRYPT_FreeSpace(pEncodePara, pbEncoded);
2998  }
2999  }
3000  }
3001  }
3003  {
3005  }
3006  __ENDTRY
3007  return ret;
3008 }
#define TRUE
Definition: types.h:120
static BOOL CRYPT_AsnEncodeCertPolicy(DWORD dwCertEncodingType, const CERT_POLICY_INFO *info, DWORD dwFlags, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:2926
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
smooth NULL
Definition: ftsmooth.c:416
#define __TRY
Definition: compat.h:70
GLsizeiptr size
Definition: glext.h:5919
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
#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
unsigned char BYTE
Definition: mem.h:68
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
static void CRYPT_FreeSpace(const CRYPT_ENCODE_PARA *pEncodePara, LPVOID pv)
Definition: encode.c:130
const void * pvStructInfo
Definition: encode.c:290
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3441
#define ASN_SEQUENCEOF
Definition: snmp.h:111
BOOL CRYPT_EncodeEnsureSpace(DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded)
Definition: encode.c:103
BOOL CRYPT_EncodeLen(DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:138
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

Referenced by CRYPT_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeCertPolicy()

static BOOL CRYPT_AsnEncodeCertPolicy ( DWORD  dwCertEncodingType,
const CERT_POLICY_INFO info,
DWORD  dwFlags,
BYTE pbEncoded,
DWORD pcbEncoded 
)
static

Definition at line 2926 of file encode.c.

2929 {
2930  struct AsnEncodeSequenceItem items[2] = {
2931  { info->pszPolicyIdentifier, CRYPT_AsnEncodeOid, 0 },
2933  };
2934  BOOL ret;
2935 
2936  if (!info->pszPolicyIdentifier)
2937  {
2939  return FALSE;
2940  }
2942  return ret;
2943 }
static BOOL WINAPI CRYPT_AsnEncodeCertPolicyQualifiers(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:2852
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
struct _test_info info[]
Definition: SetCursorPos.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
BOOL WINAPI CRYPT_AsnEncodeOid(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:820
#define SetLastError(x)
Definition: compat.h:409
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define ARRAY_SIZE(a)
Definition: main.h:24
static TCHAR * items[]
Definition: page1.c:45

Referenced by CRYPT_AsnEncodeCertPolicies().

◆ CRYPT_AsnEncodeCertPolicyConstraints()

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

Definition at line 3092 of file encode.c.

3096 {
3097  BOOL ret = FALSE;
3098 
3099  __TRY
3100  {
3102  struct AsnEncodeSequenceItem items[2];
3103  struct AsnEncodeTagSwappedItem swapped[2];
3104  DWORD cItem = 0, cSwapped = 0;
3105 
3106  if (info->fRequireExplicitPolicy)
3107  {
3108  swapped[cSwapped].tag = ASN_CONTEXT | 0;
3109  swapped[cSwapped].pvStructInfo =
3110  &info->dwRequireExplicitPolicySkipCerts;
3111  swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeInt;
3112  items[cItem].pvStructInfo = &swapped[cSwapped];
3113  items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
3114  cSwapped++;
3115  cItem++;
3116  }
3117  if (info->fInhibitPolicyMapping)
3118  {
3119  swapped[cSwapped].tag = ASN_CONTEXT | 1;
3120  swapped[cSwapped].pvStructInfo =
3121  &info->dwInhibitPolicyMappingSkipCerts;
3122  swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeInt;
3123  items[cItem].pvStructInfo = &swapped[cSwapped];
3124  items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
3125  cSwapped++;
3126  cItem++;
3127  }
3130  }
3132  {
3134  }
3135  __ENDTRY
3136  return ret;
3137 }
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
static BOOL WINAPI CRYPT_AsnEncodeSwapTag(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:298
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
#define __ENDTRY
Definition: compat.h:72
int ret
static BOOL WINAPI CRYPT_AsnEncodeInt(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3333
_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
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define ASN_CONTEXT
Definition: snmp.h:89
static TCHAR * items[]
Definition: page1.c:45
const void * pvStructInfo
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

Referenced by CRYPT_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeCertPolicyMapping()

static BOOL CRYPT_AsnEncodeCertPolicyMapping ( DWORD  dwCertEncodingType,
const CERT_POLICY_MAPPING mapping,
DWORD  dwFlags,
BYTE pbEncoded,
DWORD pcbEncoded 
)
static

Definition at line 3010 of file encode.c.

3013 {
3014  struct AsnEncodeSequenceItem items[] = {
3015  { mapping->pszIssuerDomainPolicy, CRYPT_AsnEncodeOid, 0 },
3016  { mapping->pszSubjectDomainPolicy, CRYPT_AsnEncodeOid, 0 },
3017  };
3018 
3019  if (!mapping->pszIssuerDomainPolicy || !mapping->pszSubjectDomainPolicy)
3020  {
3022  return FALSE;
3023  }
3025 }
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
BOOL WINAPI CRYPT_AsnEncodeOid(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:820
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
#define SetLastError(x)
Definition: compat.h:409
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define ARRAY_SIZE(a)
Definition: main.h:24
static TCHAR * items[]
Definition: page1.c:45

Referenced by CRYPT_AsnEncodeCertPolicyMappings().

◆ CRYPT_AsnEncodeCertPolicyMappings()

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

Definition at line 3027 of file encode.c.

3030 {
3031  BOOL ret = FALSE;
3032 
3033  __TRY
3034  {
3036  DWORD bytesNeeded = 0, lenBytes, size, i;
3037 
3038  ret = TRUE;
3039  for (i = 0; ret && i < info->cPolicyMapping; i++)
3040  {
3042  &info->rgPolicyMapping[i], dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG,
3043  NULL, &size);
3044  if (ret)
3045  bytesNeeded += size;
3046  }
3047  CRYPT_EncodeLen(bytesNeeded, NULL, &lenBytes);
3048  bytesNeeded += 1 + lenBytes;
3049  if (ret)
3050  {
3051  if (!pbEncoded)
3052  *pcbEncoded = bytesNeeded;
3053  else
3054  {
3055  if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara,
3056  pbEncoded, pcbEncoded, bytesNeeded)))
3057  {
3058  BYTE *out;
3059 
3061  pbEncoded = *(BYTE **)pbEncoded;
3062  out = pbEncoded;
3063  *out++ = ASN_SEQUENCEOF;
3064  CRYPT_EncodeLen(bytesNeeded - lenBytes - 1, out, &lenBytes);
3065  out += lenBytes;
3066  for (i = 0; ret && i < info->cPolicyMapping; i++)
3067  {
3068  size = bytesNeeded;
3070  dwCertEncodingType, &info->rgPolicyMapping[i],
3072  if (ret)
3073  {
3074  out += size;
3075  bytesNeeded -= size;
3076  }
3077  }
3078  if (!ret && (dwFlags & CRYPT_ENCODE_ALLOC_FLAG))
3079  CRYPT_FreeSpace(pEncodePara, pbEncoded);
3080  }
3081  }
3082  }
3083  }
3085  {
3087  }
3088  __ENDTRY
3089  return ret;
3090 }
static BOOL CRYPT_AsnEncodeCertPolicyMapping(DWORD dwCertEncodingType, const CERT_POLICY_MAPPING *mapping, DWORD dwFlags, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3010
#define TRUE
Definition: types.h:120
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
smooth NULL
Definition: ftsmooth.c:416
#define __TRY
Definition: compat.h:70
GLsizeiptr size
Definition: glext.h:5919
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
#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
unsigned char BYTE
Definition: mem.h:68
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
static void CRYPT_FreeSpace(const CRYPT_ENCODE_PARA *pEncodePara, LPVOID pv)
Definition: encode.c:130
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3441
#define ASN_SEQUENCEOF
Definition: snmp.h:111
BOOL CRYPT_EncodeEnsureSpace(DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded)
Definition: encode.c:103
const void * pvStructInfo
BOOL CRYPT_EncodeLen(DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:138
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

Referenced by CRYPT_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeCertPolicyQualifiers()

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

Definition at line 2852 of file encode.c.

2855 {
2857  BOOL ret;
2858 
2859  if (!info->cPolicyQualifier)
2860  {
2861  *pcbEncoded = 0;
2862  ret = TRUE;
2863  }
2864  else
2865  {
2866  struct AsnEncodeSequenceItem items[2] = {
2867  { NULL, CRYPT_AsnEncodeOid, 0 },
2868  { NULL, CRYPT_CopyEncodedBlob, 0 },
2869  };
2870  DWORD bytesNeeded = 0, lenBytes, size, i;
2871 
2872  ret = TRUE;
2873  for (i = 0; ret && i < info->cPolicyQualifier; i++)
2874  {
2875  items[0].pvStructInfo =
2876  info->rgPolicyQualifier[i].pszPolicyQualifierId;
2877  items[1].pvStructInfo = &info->rgPolicyQualifier[i].Qualifier;
2880  if (ret)
2881  bytesNeeded += size;
2882  }
2883  CRYPT_EncodeLen(bytesNeeded, NULL, &lenBytes);
2884  bytesNeeded += 1 + lenBytes;
2885  if (ret)
2886  {
2887  if (!pbEncoded)
2888  *pcbEncoded = bytesNeeded;
2889  else
2890  {
2891  if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara,
2892  pbEncoded, pcbEncoded, bytesNeeded)))
2893  {
2894  BYTE *out;
2895 
2897  pbEncoded = *(BYTE **)pbEncoded;
2898  out = pbEncoded;
2899  *out++ = ASN_SEQUENCEOF;
2900  CRYPT_EncodeLen(bytesNeeded - lenBytes - 1, out, &lenBytes);
2901  out += lenBytes;
2902  for (i = 0; ret && i < info->cPolicyQualifier; i++)
2903  {
2904  items[0].pvStructInfo =
2905  info->rgPolicyQualifier[i].pszPolicyQualifierId;
2906  items[1].pvStructInfo =
2907  &info->rgPolicyQualifier[i].Qualifier;
2908  size = bytesNeeded;
2911  if (ret)
2912  {
2913  out += size;
2914  bytesNeeded -= size;
2915  }
2916  }
2917  if (!ret && (dwFlags & CRYPT_ENCODE_ALLOC_FLAG))
2918  CRYPT_FreeSpace(pEncodePara, pbEncoded);
2919  }
2920  }
2921  }
2922  }
2923  return ret;
2924 }
#define TRUE
Definition: types.h:120
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
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
static BOOL WINAPI CRYPT_CopyEncodedBlob(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:335
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
static FILE * out
Definition: regtests2xml.c:44
BOOL WINAPI CRYPT_AsnEncodeOid(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:820
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
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
static void CRYPT_FreeSpace(const CRYPT_ENCODE_PARA *pEncodePara, LPVOID pv)
Definition: encode.c:130
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define ARRAY_SIZE(a)
Definition: main.h:24
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3441
#define ASN_SEQUENCEOF
Definition: snmp.h:111
BOOL CRYPT_EncodeEnsureSpace(DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded)
Definition: encode.c:103
static TCHAR * items[]
Definition: page1.c:45
const void * pvStructInfo
BOOL CRYPT_EncodeLen(DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:138

Referenced by CRYPT_AsnEncodeCertPolicy().

◆ CRYPT_AsnEncodeCertVersion()

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

Definition at line 312 of file encode.c.

315 {
316  const DWORD *ver = pvStructInfo;
317  BOOL ret;
318 
319  /* CERT_V1 is not encoded */
320  if (*ver == CERT_V1)
321  {
322  *pcbEncoded = 0;
323  ret = TRUE;
324  }
325  else
326  {
327  struct AsnConstructedItem item = { 0, ver, CRYPT_AsnEncodeInt };
328 
330  &item, dwFlags, pEncodePara, pbEncoded, pcbEncoded);
331  }
332  return ret;
333 }
#define TRUE
Definition: types.h:120
#define CERT_V1
Definition: wincrypt.h:2656
BOOL WINAPI CRYPT_AsnEncodeConstructed(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:239
unsigned int BOOL
Definition: ntddk_ex.h:94
#define X509_INTEGER
Definition: wincrypt.h:3393
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static BOOL WINAPI CRYPT_AsnEncodeInt(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3333
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
static ATOM item
Definition: dde.c:856
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
const void * pvStructInfo

Referenced by CRYPT_AsnEncodeCertInfo().

◆ CRYPT_AsnEncodeChoiceOfTime()

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

Definition at line 3626 of file encode.c.

3629 {
3630  BOOL ret;
3631 
3632  __TRY
3633  {
3634  SYSTEMTIME sysTime;
3635 
3636  /* Check the year, if it's in the UTCTime range call that encode func */
3637  if (!FileTimeToSystemTime(pvStructInfo, &sysTime))
3638  return FALSE;
3639  if (sysTime.wYear >= 1950 && sysTime.wYear <= 2050)
3640  ret = CRYPT_AsnEncodeUtcTime(dwCertEncodingType, lpszStructType,
3641  pvStructInfo, dwFlags, pEncodePara, pbEncoded, pcbEncoded);
3642  else
3644  lpszStructType, pvStructInfo, dwFlags, pEncodePara, pbEncoded,
3645  pcbEncoded);
3646  }
3648  {
3650  ret = FALSE;
3651  }
3652  __ENDTRY
3653  return ret;
3654 }
static BOOL WINAPI CRYPT_AsnEncodeUtcTime(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3521
const void * pvStructInfo
static BOOL CRYPT_AsnEncodeGeneralizedTime(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3578
WORD wYear
Definition: winbase.h:870
unsigned int BOOL
Definition: ntddk_ex.h:94
#define __TRY
Definition: compat.h:70
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:178
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
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

Referenced by CRYPT_AsnEncodeCRLEntry(), CRYPT_AsnEncodeCRLInfo(), CRYPT_AsnEncodeCTL(), CRYPT_AsnEncodeValidity(), and CRYPT_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeCMSSignedInfo()

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

Definition at line 4307 of file encode.c.

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

Referenced by CRYPT_SavePKCSToMem(), and CSignedEncodeMsg_GetParam().

◆ CRYPT_AsnEncodeCMSSignerInfo()

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

Definition at line 4218 of file encode.c.

4221 {
4222  BOOL ret = FALSE;
4223 
4225  {
4227  return FALSE;
4228  }
4229 
4230  __TRY
4231  {
4233 
4234  if (info->SignerId.dwIdChoice != CERT_ID_ISSUER_SERIAL_NUMBER &&
4235  info->SignerId.dwIdChoice != CERT_ID_KEY_IDENTIFIER)
4237  else if (info->SignerId.dwIdChoice == CERT_ID_ISSUER_SERIAL_NUMBER &&
4238  !info->SignerId.u.IssuerSerialNumber.Issuer.cbData)
4240  else
4241  {
4242  struct AsnEncodeSequenceItem items[7] = {
4243  { &info->dwVersion, CRYPT_AsnEncodeInt, 0 },
4244  };
4245  struct AsnEncodeTagSwappedItem swapped[3] = { { 0 } };
4246  DWORD cItem = 1, cSwapped = 0;
4247 
4248  if (info->SignerId.dwIdChoice == CERT_ID_ISSUER_SERIAL_NUMBER)
4249  {
4250  items[cItem].pvStructInfo =
4251  &info->SignerId.u.IssuerSerialNumber.Issuer;
4252  items[cItem].encodeFunc =
4254  cItem++;
4255  }
4256  else
4257  {
4258  swapped[cSwapped].tag = ASN_CONTEXT | 0;
4259  swapped[cSwapped].pvStructInfo = &info->SignerId.u.KeyId;
4260  swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeOctets;
4261  items[cItem].pvStructInfo = &swapped[cSwapped];
4262  items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
4263  cSwapped++;
4264  cItem++;
4265  }
4266  items[cItem].pvStructInfo = &info->HashAlgorithm;
4267  items[cItem].encodeFunc = CRYPT_AsnEncodeAlgorithmIdWithNullParams;
4268  cItem++;
4269  if (info->AuthAttrs.cAttr)
4270  {
4271  swapped[cSwapped].tag = ASN_CONTEXT | ASN_CONSTRUCTOR | 0;
4272  swapped[cSwapped].pvStructInfo = &info->AuthAttrs;
4273  swapped[cSwapped].encodeFunc = CRYPT_AsnEncodePKCSAttributes;
4274  items[cItem].pvStructInfo = &swapped[cSwapped];
4275  items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
4276  cSwapped++;
4277  cItem++;
4278  }
4279  items[cItem].pvStructInfo = &info->HashEncryptionAlgorithm;
4280  items[cItem].encodeFunc = CRYPT_AsnEncodeAlgorithmIdWithNullParams;
4281  cItem++;
4282  items[cItem].pvStructInfo = &info->EncryptedHash;
4283  items[cItem].encodeFunc = CRYPT_AsnEncodeOctets;
4284  cItem++;
4285  if (info->UnauthAttrs.cAttr)
4286  {
4287  swapped[cSwapped].tag = ASN_CONTEXT | ASN_CONSTRUCTOR | 1;
4288  swapped[cSwapped].pvStructInfo = &info->UnauthAttrs;
4289  swapped[cSwapped].encodeFunc = CRYPT_AsnEncodePKCSAttributes;
4290  items[cItem].pvStructInfo = &swapped[cSwapped];
4291  items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
4292  cSwapped++;
4293  cItem++;
4294  }
4296  dwFlags, pEncodePara, pbEncoded, pcbEncoded);
4297  }
4298  }
4300  {
4302  }
4303  __ENDTRY
4304  return ret;
4305 }
#define ASN_CONSTRUCTOR
Definition: snmp.h:92
CryptEncodeObjectExFunc encodeFunc
Definition: encode.c:291
#define PKCS_7_ASN_ENCODING
Definition: wincrypt.h:2299
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
static BOOL WINAPI CRYPT_AsnEncodeSwapTag(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:298
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL WINAPI CRYPT_AsnEncodeAlgorithmIdWithNullParams(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:383
#define E_INVALIDARG
Definition: ddrawi.h:101
static BOOL WINAPI CRYPT_AsnEncodeIssuerSerialNumber(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:4134
static BOOL WINAPI CRYPT_AsnEncodePKCSAttributes(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:1902
#define __TRY
Definition: compat.h:70
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
#define CERT_ID_KEY_IDENTIFIER
Definition: wincrypt.h:3674
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
#define __ENDTRY
Definition: compat.h:72
int ret
static BOOL WINAPI CRYPT_AsnEncodeInt(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3333
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define CERT_ID_ISSUER_SERIAL_NUMBER
Definition: wincrypt.h:3673
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
const void * pvStructInfo
Definition: encode.c:290
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
BOOL WINAPI CRYPT_AsnEncodeOctets(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3178
#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_AsnEncodeCMSSignedInfo(), and CRYPT_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeConstructed()

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

Definition at line 239 of file encode.c.

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

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

◆ CRYPT_AsnEncodeCRLDistPoints()

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

Definition at line 3763 of file encode.c.

3766 {
3767  BOOL ret;
3768 
3769  __TRY
3770  {
3772 
3773  if (!info->cDistPoint)
3774  {
3776  ret = FALSE;
3777  }
3778  else
3779  {
3780  DWORD bytesNeeded, dataLen, lenBytes, i;
3781 
3782  ret = TRUE;
3783  for (i = 0, dataLen = 0; ret && i < info->cDistPoint; i++)
3784  {
3785  DWORD len;
3786 
3787  ret = CRYPT_AsnEncodeDistPoint(&info->rgDistPoint[i], NULL,
3788  &len);
3789  if (ret)
3790  dataLen += len;
3792  {
3793  /* Have to propagate index of failing character */
3794  *pcbEncoded = len;
3795  }
3796  }
3797  if (ret)
3798  {
3799  CRYPT_EncodeLen(dataLen, NULL, &lenBytes);
3800  bytesNeeded = 1 + lenBytes + dataLen;
3801  if (!pbEncoded)
3802  {
3803  *pcbEncoded = bytesNeeded;
3804  ret = TRUE;
3805  }
3806  else
3807  {
3808  if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara,
3809  pbEncoded, pcbEncoded, bytesNeeded)))
3810  {
3811  BYTE *out;
3812 
3814  pbEncoded = *(BYTE **)pbEncoded;
3815  out = pbEncoded;
3816  *out++ = ASN_SEQUENCEOF;
3817  CRYPT_EncodeLen(dataLen, out, &lenBytes);
3818  out += lenBytes;
3819  for (i = 0; ret && i < info->cDistPoint; i++)
3820  {
3821  DWORD len = dataLen;
3822 
3824  &info->rgDistPoint[i], out, &len);
3825  if (ret)
3826  {
3827  out += len;
3828  dataLen -= len;
3829  }
3830  }
3831  if (!ret && (dwFlags & CRYPT_ENCODE_ALLOC_FLAG))
3832  CRYPT_FreeSpace(pEncodePara, pbEncoded);
3833  }
3834  }
3835  }
3836  }
3837  }
3839  {
3841  ret = FALSE;
3842  }
3843  __ENDTRY
3844  return ret;
3845 }
#define TRUE
Definition: types.h:120
const void * pvStructInfo
static BOOL CRYPT_AsnEncodeDistPoint(const CRL_DIST_POINT *distPoint, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3704
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 E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define __TRY
Definition: compat.h:70
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
#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
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
static void CRYPT_FreeSpace(const CRYPT_ENCODE_PARA *pEncodePara, LPVOID pv)
Definition: encode.c:130
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3441
#define CRYPT_E_INVALID_IA5_STRING
Definition: winerror.h:3026
#define ASN_SEQUENCEOF
Definition: snmp.h:111
BOOL CRYPT_EncodeEnsureSpace(DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded)
Definition: encode.c:103
BOOL CRYPT_EncodeLen(DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:138
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

Referenced by CRYPT_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeCRLEntries()

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

Definition at line 599 of file encode.c.

602 {
603  DWORD bytesNeeded, dataLen, lenBytes, i;
604  const CRL_INFO *info = pvStructInfo;
605  const CRL_ENTRY *rgCRLEntry = info->rgCRLEntry;
606  BOOL ret = TRUE;
607 
608  for (i = 0, dataLen = 0; ret && i < info->cCRLEntry; i++)
609  {
610  DWORD size;
611 
612  ret = CRYPT_AsnEncodeCRLEntry(&rgCRLEntry[i], NULL, &size);
613  if (ret)
614  dataLen += size;
615  }
616  if (ret)
617  {
618  CRYPT_EncodeLen(dataLen, NULL, &lenBytes);
619  bytesNeeded = 1 + lenBytes + dataLen;
620  if (!pbEncoded)
621  *pcbEncoded = bytesNeeded;
622  else
623  {
624  if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara, pbEncoded,
625  pcbEncoded, bytesNeeded)))
626  {
627  BYTE *out;
628 
630  pbEncoded = *(BYTE **)pbEncoded;
631  out = pbEncoded;
632  *out++ = ASN_SEQUENCEOF;
633  CRYPT_EncodeLen(dataLen, out, &lenBytes);
634  out += lenBytes;
635  for (i = 0; i < info->cCRLEntry; i++)
636  {
637  DWORD size = dataLen;
638 
639  ret = CRYPT_AsnEncodeCRLEntry(&rgCRLEntry[i], out, &size);
640  out += size;
641  dataLen -= size;
642  }
643  if (!ret && (dwFlags & CRYPT_ENCODE_ALLOC_FLAG))
644  CRYPT_FreeSpace(pEncodePara, pbEncoded);
645  }
646  }
647  }
648  return ret;
649 }
#define TRUE
Definition: types.h:120
const void * pvStructInfo
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
smooth NULL
Definition: ftsmooth.c:416
static BOOL CRYPT_AsnEncodeCRLEntry(const CRL_ENTRY *entry, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:572
GLsizeiptr size
Definition: glext.h:5919
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
static FILE * out
Definition: regtests2xml.c:44
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 void CRYPT_FreeSpace(const CRYPT_ENCODE_PARA *pEncodePara, LPVOID pv)
Definition: encode.c:130
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3441
Definition: wincrypt.h:487
#define ASN_SEQUENCEOF
Definition: snmp.h:111
BOOL CRYPT_EncodeEnsureSpace(DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded)
Definition: encode.c:103
BOOL CRYPT_EncodeLen(DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:138

Referenced by CRYPT_AsnEncodeCRLInfo().

◆ CRYPT_AsnEncodeCRLEntry()

static BOOL CRYPT_AsnEncodeCRLEntry ( const CRL_ENTRY entry,
BYTE pbEncoded,
DWORD pcbEncoded 
)
static

Definition at line 572 of file encode.c.

574 {
575  struct AsnEncodeSequenceItem items[3] = {
576  { &entry->SerialNumber, CRYPT_AsnEncodeInteger, 0 },
577  { &entry->RevocationDate, CRYPT_AsnEncodeChoiceOfTime, 0 },
578  { 0 }
579  };
580  DWORD cItem = 2;
581  BOOL ret;
582 
583  TRACE("%p, %p, %d\n", entry, pbEncoded, pbEncoded ? *pcbEncoded : 0);
584 
585  if (entry->cExtension)
586  {
587  items[cItem].pvStructInfo = &entry->cExtension;
588  items[cItem].encodeFunc = CRYPT_AsnEncodeExtensions;
589  cItem++;
590  }
591 
594 
595  TRACE("returning %d (%08x)\n", ret, GetLastError());
596  return ret;
597 }
static BOOL WINAPI CRYPT_AsnEncodeInteger(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3343
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#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
int ret
static BOOL WINAPI CRYPT_AsnEncodeChoiceOfTime(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3626
uint32_t entry
Definition: isohybrid.c:63
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
static BOOL WINAPI CRYPT_AsnEncodeExtensions(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:757
static TCHAR * items[]
Definition: page1.c:45

Referenced by CRYPT_AsnEncodeCRLEntries().

◆ CRYPT_AsnEncodeCRLInfo()

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

Definition at line 674 of file encode.c.

677 {
678  BOOL ret;
679 
680  __TRY
681  {
682  const CRL_INFO *info = pvStructInfo;
683  struct AsnEncodeSequenceItem items[7] = {
684  { &info->dwVersion, CRYPT_AsnEncodeCRLVersion, 0 },
685  { &info->SignatureAlgorithm, CRYPT_AsnEncodeAlgorithmId, 0 },
686  { &info->Issuer, CRYPT_CopyEncodedBlob, 0 },
687  { &info->ThisUpdate, CRYPT_AsnEncodeChoiceOfTime, 0 },
688  { 0 }
689  };
690  struct AsnConstructedItem constructed[1] = { { 0 } };
691  DWORD cItem = 4, cConstructed = 0;
692 
693  if (info->NextUpdate.dwLowDateTime || info->NextUpdate.dwHighDateTime)
694  {
695  items[cItem].pvStructInfo = &info->NextUpdate;
696  items[cItem].encodeFunc = CRYPT_AsnEncodeChoiceOfTime;
697  cItem++;
698  }
699  if (info->cCRLEntry)
700  {
701  items[cItem].pvStructInfo = info;
702  items[cItem].encodeFunc = CRYPT_AsnEncodeCRLEntries;
703  cItem++;
704  }
705  if (info->cExtension)
706  {
707  constructed[cConstructed].tag = 0;
708  constructed[cConstructed].pvStructInfo = &info->cExtension;
709  constructed[cConstructed].encodeFunc = CRYPT_AsnEncodeExtensions;
710  items[cItem].pvStructInfo = &constructed[cConstructed];
711  items[cItem].encodeFunc = CRYPT_AsnEncodeConstructed;
712  cConstructed++;
713  cItem++;
714  }
715 
717  dwFlags, pEncodePara, pbEncoded, pcbEncoded);
718  }
720  {
722  ret = FALSE;
723  }
724  __ENDTRY
725  return ret;
726 }
const void * pvStructInfo
BOOL WINAPI CRYPT_AsnEncodeConstructed(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:239
BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:180
struct _test_info info[]
Definition: SetCursorPos.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL WINAPI CRYPT_CopyEncodedBlob(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:335
#define __TRY
Definition: compat.h:70
static BOOL WINAPI CRYPT_AsnEncodeCRLEntries(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:599
static BOOL WINAPI CRYPT_AsnEncodeAlgorithmId(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:408
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 __ENDTRY
Definition: compat.h:72
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static BOOL WINAPI CRYPT_AsnEncodeChoiceOfTime(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3626
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
static BOOL WINAPI CRYPT_AsnEncodeCRLVersion(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:651
CryptEncodeObjectExFunc encodeFunc
static BOOL WINAPI CRYPT_AsnEncodeExtensions(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:757
static TCHAR * items[]
Definition: page1.c:45
const void * pvStructInfo
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

Referenced by CRYPT_GetBuiltinEncoder().

◆ CRYPT_AsnEncodeCRLVersion()

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

Definition at line 651 of file encode.c.

654 {
655  const DWORD *ver = pvStructInfo;
656  BOOL ret;
657 
658  /* CRL_V1 is not encoded */
659  if (*ver == CRL_V1)
660  {
661  *pcbEncoded = 0;
662  ret = TRUE;
663  }
664  else
666  dwFlags, pEncodePara, pbEncoded, pcbEncoded);
667  return ret;
668 }
#define TRUE
Definition: types.h:120
#define CRL_V1
Definition: wincrypt.h:2678
const void * pvStructInfo
unsigned int BOOL
Definition: ntddk_ex.h:94
#define X509_INTEGER
Definition: wincrypt.h:3393
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static BOOL WINAPI CRYPT_AsnEncodeInt(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
Definition: encode.c:3333
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196

Referenced by CRYPT_AsnEncodeCRLInfo().

◆ CRYPT_AsnEncodeCTL()

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

Definition at line 1596 of file encode.c.

1599 {
1600  BOOL ret = FALSE;
1601 
1602  __TRY
1603  {
1604  const CTL_INFO *info = pvStructInfo;
1605  struct AsnEncodeSequenceItem items[9] = {
1606  { &info->dwVersion, CRYPT_AsnEncodeCTLVersion, 0 },
1607  { &info->SubjectUsage, CRYPT_AsnEncodeEnhancedKeyUsage, 0 },
1608  };
1609  struct AsnConstructedItem constructed = { 0 };
1610  DWORD cItem = 2;
1611 
1612  if (info->ListIdentifier.cbData)
1613  {
1614  items[cItem].pvStructInfo = &info->ListIdentifier;
1615  items[cItem].encodeFunc = CRYPT_AsnEncodeOctets;
1616  cItem++;
1617  }
1618  if (info->SequenceNumber.cbData)
1619  {
1620  items[cItem].pvStructInfo = &info->SequenceNumber;
1621  items[cItem].encodeFunc = CRYPT_AsnEncodeInteger;
1622  cItem++;
1623  }
1624  items[cItem].pvStructInfo = &info->ThisUpdate;
1625  items[cItem].encodeFunc = CRYPT_AsnEncodeChoiceOfTime;
1626  cItem++;
1627  if (info->NextUpdate.dwLowDateTime || info->NextUpdate.dwHighDateTime)
1628  {
1629  items[cItem].pvStructInfo = &info->NextUpdate;
1630  items[cItem].encodeFunc = CRYPT_AsnEncodeChoiceOfTime;
1631  cItem++;
1632  }
1633  items[cItem].pvStructInfo = &info->SubjectAlgorithm;
1634  items[cItem].encodeFunc = CRYPT_AsnEncodeCTLSubjectAlgorithm;
1635  cItem++;
1636  if (info->cCTLEntry)
1637  {
1638  items[cItem].pvStructInfo = &info->cCTLEntry;
1639  items[cItem].encodeFunc = CRYPT_AsnEncodeCTLEntries;
1640  cItem++;
1641  }
1642  if (info->cExtension)
1643  {
1644  constructed.tag = 0;
1645  constructed.pvStructInfo = &info->cExtension;
1646  constructed.encodeFunc = CRYPT_AsnEncodeExtensions;
1647  items[cItem].pvStructInfo = &constructed;
1648  items[cItem].encodeFunc = CRYPT_AsnEncodeConstructed;
1649  cItem++;
1650  }
1652  dwFlags, pEncodePara, pbEncoded, pcbEncoded);
1653  }
1655  {
1657  }
1658  __ENDTRY
1659  return ret;