ReactOS  0.4.13-dev-39-g8b6696f
encode.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winerror.h>
#include <wincrypt.h>
#include <snmp.h>
#include "wine/test.h"
Include dependency graph for encode.c:

Go to the source code of this file.

Classes

struct  encodedInt
 
struct  encodedBigInt
 
struct  encodedFiletime
 
struct  EncodedNameValue
 
struct  UnicodeExpectedError
 
struct  UnicodeExpectedResult
 
struct  encodedBits
 
struct  Constraints2
 
struct  EncodedRSAPubKey
 
struct  encodedExtensions
 
struct  encodedPublicKey
 
struct  EncodedNameConstraints
 

Macros

#define RDNA(arr)   oid_ ## arr, CERT_RDN_PRINTABLE_STRING, { sizeof(arr), (LPBYTE)arr }
 
#define RDNIA5(arr)   oid_ ## arr, CERT_RDN_IA5_STRING, { sizeof(arr), (LPBYTE)arr }
 

Functions

static BOOL (WINAPI *pCryptDecodeObjectEx)(DWORD
 
static void test_encodeInt (DWORD dwEncoding)
 
static void test_decodeInt (DWORD dwEncoding)
 
static void test_encodeEnumerated (DWORD dwEncoding)
 
static void test_decodeEnumerated (DWORD dwEncoding)
 
static void testTimeEncoding (DWORD dwEncoding, LPCSTR structType, const struct encodedFiletime *time)
 
static const charprintSystemTime (const SYSTEMTIME *st)
 
static const charprintFileTime (const FILETIME *ft)
 
static void compareTime (const SYSTEMTIME *expected, const FILETIME *got)
 
static void testTimeDecoding (DWORD dwEncoding, LPCSTR structType, const struct encodedFiletime *time)
 
static void test_encodeFiletime (DWORD dwEncoding)
 
static void test_decodeFiletime (DWORD dwEncoding)
 
static void test_encodeName (DWORD dwEncoding)
 
static void test_encodeUnicodeName (DWORD dwEncoding)
 
static void compareNameValues (const CERT_NAME_VALUE *expected, const CERT_NAME_VALUE *got)
 
static void compareRDNAttrs (const CERT_RDN_ATTR *expected, const CERT_RDN_ATTR *got)
 
static void compareRDNs (const CERT_RDN *expected, const CERT_RDN *got)
 
static void compareNames (const CERT_NAME_INFO *expected, const CERT_NAME_INFO *got)
 
static void test_decodeName (DWORD dwEncoding)
 
static void test_decodeUnicodeName (DWORD dwEncoding)
 
static void test_encodeNameValue (DWORD dwEncoding)
 
static void test_decodeNameValue (DWORD dwEncoding)
 
static void test_encodeAltName (DWORD dwEncoding)
 
static void test_decodeAltName (DWORD dwEncoding)
 
static void test_encodeUnicodeNameValue (DWORD dwEncoding)
 
static int strncmpW (const WCHAR *str1, const WCHAR *str2, int n)
 
static void test_decodeUnicodeNameValue (DWORD dwEncoding)
 
static void test_encodeOctets (DWORD dwEncoding)
 
static void test_decodeOctets (DWORD dwEncoding)
 
static void test_encodeBits (DWORD dwEncoding)
 
static void test_decodeBits (DWORD dwEncoding)
 
static void test_encodeBasicConstraints (DWORD dwEncoding)
 
static void test_decodeBasicConstraints (DWORD dwEncoding)
 
static void test_encodeRsaPublicKey (DWORD dwEncoding)
 
static void test_decodeRsaPublicKey (DWORD dwEncoding)
 
static void test_encodeSequenceOfAny (DWORD dwEncoding)
 
static void test_decodeSequenceOfAny (DWORD dwEncoding)
 
static void test_encodeExtensions (DWORD dwEncoding)
 
static void test_decodeExtensions (DWORD dwEncoding)
 
static void test_encodePublicKeyInfo (DWORD dwEncoding)
 
static void comparePublicKeyInfo (const CERT_PUBLIC_KEY_INFO *expected, const CERT_PUBLIC_KEY_INFO *got)
 
static void test_decodePublicKeyInfo (DWORD dwEncoding)
 
static void test_encodeCertToBeSigned (DWORD dwEncoding)
 
static void test_decodeCertToBeSigned (DWORD dwEncoding)
 
static void test_encodeCert (DWORD dwEncoding)
 
static void test_decodeCert (DWORD dwEncoding)
 
static void test_encodeCRLDistPoints (DWORD dwEncoding)
 
static void test_decodeCRLDistPoints (DWORD dwEncoding)
 
static void test_encodeCRLIssuingDistPoint (DWORD dwEncoding)
 
static void compareAltNameEntry (const CERT_ALT_NAME_ENTRY *expected, const CERT_ALT_NAME_ENTRY *got)
 
static void compareAltNameInfo (const CERT_ALT_NAME_INFO *expected, const CERT_ALT_NAME_INFO *got)
 
static void compareDistPointName (const CRL_DIST_POINT_NAME *expected, const CRL_DIST_POINT_NAME *got)
 
static void compareCRLIssuingDistPoints (const CRL_ISSUING_DIST_POINT *expected, const CRL_ISSUING_DIST_POINT *got)
 
static void test_decodeCRLIssuingDistPoint (DWORD dwEncoding)
 
static void test_encodeCRLToBeSigned (DWORD dwEncoding)
 
static void test_decodeCRLToBeSigned (DWORD dwEncoding)
 
static void test_encodeEnhancedKeyUsage (DWORD dwEncoding)
 
static void test_decodeEnhancedKeyUsage (DWORD dwEncoding)
 
static void test_encodeAuthorityKeyId (DWORD dwEncoding)
 
static void test_decodeAuthorityKeyId (DWORD dwEncoding)
 
static void test_encodeAuthorityKeyId2 (DWORD dwEncoding)
 
static void test_decodeAuthorityKeyId2 (DWORD dwEncoding)
 
static void test_encodeAuthorityInfoAccess (DWORD dwEncoding)
 
static void compareAuthorityInfoAccess (LPCSTR header, const CERT_AUTHORITY_INFO_ACCESS *expected, const CERT_AUTHORITY_INFO_ACCESS *got)
 
static void test_decodeAuthorityInfoAccess (DWORD dwEncoding)
 
static void test_encodeCTL (DWORD dwEncoding)
 
static void compareCTLInfo (LPCSTR header, const CTL_INFO *expected, const CTL_INFO *got)
 
static void test_decodeCTL (DWORD dwEncoding)
 
static void test_encodePKCSContentInfo (DWORD dwEncoding)
 
static void test_decodePKCSContentInfo (DWORD dwEncoding)
 
static void test_encodePKCSAttribute (DWORD dwEncoding)
 
static void test_decodePKCSAttribute (DWORD dwEncoding)
 
static void test_encodePKCSAttributes (DWORD dwEncoding)
 
static void test_decodePKCSAttributes (DWORD dwEncoding)
 
static void test_encodePKCSSMimeCapabilities (DWORD dwEncoding)
 
static void compareSMimeCapabilities (LPCSTR header, const CRYPT_SMIME_CAPABILITIES *expected, const CRYPT_SMIME_CAPABILITIES *got)
 
static void test_decodePKCSSMimeCapabilities (DWORD dwEncoding)
 
static void test_encodePKCSSignerInfo (DWORD dwEncoding)
 
static void test_decodePKCSSignerInfo (DWORD dwEncoding)
 
static void test_encodeCMSSignerInfo (DWORD dwEncoding)
 
static void test_decodeCMSSignerInfo (DWORD dwEncoding)
 
static void test_encodeNameConstraints (DWORD dwEncoding)
 
static void test_decodeNameConstraints (DWORD dwEncoding)
 
static void test_encodePolicyQualifierUserNotice (DWORD dwEncoding)
 
static void test_decodePolicyQualifierUserNotice (DWORD dwEncoding)
 
static void test_encodeCertPolicies (DWORD dwEncoding)
 
static void test_decodeCertPolicies (DWORD dwEncoding)
 
static void test_encodeCertPolicyMappings (DWORD dwEncoding)
 
static void test_decodeCertPolicyMappings (DWORD dwEncoding)
 
static void test_encodeCertPolicyConstraints (DWORD dwEncoding)
 
static void test_decodeCertPolicyConstraints (DWORD dwEncoding)
 
static void test_decodeRsaPrivateKey (DWORD dwEncoding)
 
static void testExportPublicKey (HCRYPTPROV csp, PCERT_PUBLIC_KEY_INFO *pInfo)
 
static void testImportPublicKey (HCRYPTPROV csp, PCERT_PUBLIC_KEY_INFO info)
 
static void testPortPublicKeyInfo (void)
 
 START_TEST (encode)
 

Variables

static LPCSTR
 
static const BYTE DWORD
 
static const BYTE PCRYPT_DECODE_PARA
 
static const BYTE void DWORD *static const void PCRYPT_ENCODE_PARA
 
static const BYTE bin1 [] = {0x02,0x01,0x01}
 
static const BYTE bin2 [] = {0x02,0x01,0x7f}
 
static const BYTE bin3 [] = {0x02,0x02,0x00,0x80}
 
static const BYTE bin4 [] = {0x02,0x02,0x01,0x00}
 
static const BYTE bin5 [] = {0x02,0x01,0x80}
 
static const BYTE bin6 [] = {0x02,0x02,0xff,0x7f}
 
static const BYTE bin7 [] = {0x02,0x04,0xba,0xdd,0xf0,0x0d}
 
static const struct encodedInt ints []
 
static const BYTE bin8 [] = {0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}
 
static const BYTE bin9 [] = {0x02,0x0a,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0}
 
static const BYTE bin10 [] = {0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}
 
static const BYTE bin11 [] = {0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0xff,0}
 
static const BYTE bin12 [] = {0x02,0x09,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}
 
static const BYTE bin13 [] = {0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0}
 
static const struct encodedBigInt bigInts []
 
static const BYTE bin14 [] = {0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}
 
static const BYTE bin15 [] = {0x02,0x0a,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0}
 
static const BYTE bin16 [] = {0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0xff,0}
 
static const BYTE bin17 [] = {0x02,0x0c,0x00,0xff,0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}
 
static const struct encodedBigInt bigUInts []
 
static const BYTE bin18 [] = {0x0a,0x01,0x01}
 
static const BYTE bin19 [] = {0x0a,0x05,0x00,0xff,0xff,0xff,0x80}
 
static const struct encodedInt enums []
 
static const LPCSTR enumeratedTypes []
 
static const BYTE bin20 []
 
static const BYTE bin21 []
 
static const BYTE bin22 []
 
static const struct encodedFiletime times []
 
static const BYTE bin23 []
 
static const BYTE bin24 []
 
static const BYTE bin25 []
 
static const BYTE bin26 []
 
static const BYTE bin27 []
 
static const BYTE bin28 []
 
static const BYTE bin29 []
 
static const BYTE bin30 []
 
static const BYTE bin31 []
 
static const BYTE bin32 []
 
static const BYTE bin33 []
 
static const BYTE bin34 []
 
static const BYTE bin35 []
 
static const BYTE bin36 []
 
static const BYTE bin37 []
 
static const BYTE bin38 []
 
static const char commonName [] = "Juan Lang"
 
static const char surName [] = "Lang"
 
static const BYTE emptySequence [] = { 0x30, 0 }
 
static const BYTE emptyRDNs [] = { 0x30, 0x02, 0x31, 0 }
 
static const BYTE twoRDNs []
 
static const BYTE encodedTwoRDNs []
 
static const BYTE us [] = { 0x55, 0x53 }
 
static const BYTE minnesota []
 
static const BYTE minneapolis []
 
static const BYTE codeweavers []
 
static const BYTE wine []
 
static const BYTE localhostAttr []
 
static const BYTE aric []
 
static CHAR oid_us [] = "2.5.4.6"
 
static CHAR oid_minnesota [] = "2.5.4.8"
 
static CHAR oid_minneapolis [] = "2.5.4.7"
 
static CHAR oid_codeweavers [] = "2.5.4.10"
 
static CHAR oid_wine [] = "2.5.4.11"
 
static CHAR oid_localhostAttr [] = "2.5.4.3"
 
static CHAR oid_aric [] = "1.2.840.113549.1.9.1"
 
static CERT_RDN_ATTR rdnAttrs []
 
static CERT_RDN_ATTR decodedRdnAttrs []
 
static const BYTE encodedRDNAttrs []
 
static WCHAR commonNameW [] = { 'J','u','a','n',' ','L','a','n','g',0 }
 
static WCHAR surNameW [] = { 'L','a','n','g',0 }
 
static const BYTE twoRDNsNoNull []
 
static const BYTE anyType []
 
static const BYTE emptyIndefiniteSequence [] = { 0x30,0x80,0x00,0x00 }
 
static const BYTE twoRDNsExtraBytes []
 
static const char bogusIA5 [] = "\x80"
 
static const char bogusPrintable [] = "~"
 
static const char bogusNumeric [] = "A"
 
static const BYTE bin42 [] = { 0x16,0x02,0x80,0x00 }
 
static const BYTE bin43 [] = { 0x13,0x02,0x7e,0x00 }
 
static const BYTE bin44 [] = { 0x12,0x02,0x41,0x00 }
 
static BYTE octetCommonNameValue []
 
static BYTE numericCommonNameValue []
 
static BYTE printableCommonNameValue []
 
static BYTE t61CommonNameValue []
 
static BYTE videotexCommonNameValue []
 
static BYTE ia5CommonNameValue []
 
static BYTE graphicCommonNameValue []
 
static BYTE visibleCommonNameValue []
 
static BYTE generalCommonNameValue []
 
static BYTE bmpCommonNameValue []
 
static BYTE utf8CommonNameValue []
 
static char embedded_null [] = "foo\0com"
 
static BYTE ia5EmbeddedNull []
 
static struct EncodedNameValue nameValues []
 
static struct EncodedNameValue embeddedNullNameValue
 
static const BYTE emptyURL [] = { 0x30, 0x02, 0x86, 0x00 }
 
static const BYTE emptyURLExtraBytes [] = { 0x30, 0x02, 0x86, 0x00, 0, 0, 0 }
 
static const WCHAR url []
 
static const BYTE encodedURL []
 
static const WCHAR nihongoURL []
 
static const WCHAR dnsName [] = { 'w','i','n','e','h','q','.','o','r','g',0 }
 
static const BYTE encodedDnsName []
 
static const BYTE localhost [] = { 127, 0, 0, 1 }
 
static const BYTE encodedIPAddr []
 
static const unsigned char encodedCommonName []
 
static const BYTE encodedOidName [] = { 0x30,0x04,0x88,0x02,0x2a,0x03 }
 
static const BYTE encodedDirectoryName []
 
static const WCHAR oneW [] = { '1',0 }
 
static const WCHAR aW [] = { 'a',0 }
 
static const WCHAR quoteW [] = { '"', 0 }
 
static struct UnicodeExpectedError unicodeErrors []
 
static BYTE oneNumeric [] = { 0x12, 0x01, 0x31 }
 
static BYTE onePrintable [] = { 0x13, 0x01, 0x31 }
 
static BYTE oneTeletex [] = { 0x14, 0x01, 0x31 }
 
static BYTE oneVideotex [] = { 0x15, 0x01, 0x31 }
 
static BYTE oneIA5 [] = { 0x16, 0x01, 0x31 }
 
static BYTE oneGraphic [] = { 0x19, 0x01, 0x31 }
 
static BYTE oneVisible [] = { 0x1a, 0x01, 0x31 }
 
static BYTE oneUniversal [] = { 0x1c, 0x04, 0x00, 0x00, 0x00, 0x31 }
 
static BYTE oneGeneral [] = { 0x1b, 0x01, 0x31 }
 
static BYTE oneBMP [] = { 0x1e, 0x02, 0x00, 0x31 }
 
static BYTE oneUTF8 [] = { 0x0c, 0x01, 0x31 }
 
static BYTE nihongoT61 []
 
static BYTE nihongoGeneral []
 
static BYTE nihongoBMP []
 
static BYTE nihongoUTF8 []
 
static struct UnicodeExpectedResult unicodeResults []
 
static struct UnicodeExpectedResult unicodeWeirdness []
 
static const unsigned char decoded_hi_octet [] = { 'h','i' }
 
static const unsigned char encoded_hi_octet [] = { ASN_OCTETSTRING,2,'h','i' }
 
static const unsigned char decoded_something_long_octet []
 
static const unsigned char encoded_something_long_octet []
 
static const unsigned char encoded_empty_octet [] = { ASN_OCTETSTRING,0 }
 
static const unsigned char encoded_constructed_hi_octet []
 
static const unsigned char encoded_constructed_hi_octet2 []
 
static const unsigned char encoded_constructed_hi_octet3 []
 
static const unsigned char encoded_constructed_hi_octet_invalid_end []
 
static const BYTE bytesToEncode [] = { 0xff, 0xff }
 
static const unsigned char bin52 [] = { 0x03,0x03,0x00,0xff,0xff }
 
static const unsigned char bin53 [] = { 0xff,0xff }
 
static const unsigned char bin54 [] = { 0x03,0x03,0x01,0xff,0xfe }
 
static const unsigned char bin55 [] = { 0xff,0xfe }
 
static const unsigned char bin56 [] = { 0x03,0x02,0x01,0xfe }
 
static const unsigned char bin57 [] = { 0xfe }
 
static const struct encodedBits bits []
 
static const unsigned char bin59 [] = { 0x30,0x00 }
 
static const unsigned char bin60 [] = { 0x30,0x03,0x01,0x01,0xff }
 
static const unsigned char bin61 [] = { 0x30,0x03,0x02,0x01,0x00 }
 
static const unsigned char bin62 [] = { 0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }
 
static const struct Constraints2 constraints2 []
 
static const BYTE emptyConstraint [] = { 0x30, 0x03, 0x03, 0x01, 0x00 }
 
static const BYTE encodedDomainName []
 
static const BYTE constraintWithDomainName []
 
static const unsigned char bin63 [] = { 0x30,0x06,0x01,0x01,0x01,0x02,0x01,0x01 }
 
static const BYTE modulus1 [] = { 0,0,0,1,1,1,1,1 }
 
static const BYTE modulus2 [] = { 1,1,1,1,1,0,0,0 }
 
static const BYTE modulus3 [] = { 0x80,1,1,1,1,0,0,0 }
 
static const BYTE modulus4 [] = { 1,1,1,1,1,0,0,0x80 }
 
static const BYTE mod1_encoded [] = { 0x30,0x0f,0x02,0x08,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x02,0x03,0x01,0x00,0x01 }
 
static const BYTE mod2_encoded [] = { 0x30,0x0c,0x02,0x05,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x01,0x00,0x01 }
 
static const BYTE mod3_encoded [] = { 0x30,0x0c,0x02,0x05,0x01,0x01,0x01,0x01,0x80,0x02,0x03,0x01,0x00,0x01 }
 
static const BYTE mod4_encoded [] = { 0x30,0x10,0x02,0x09,0x00,0x80,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x01,0x00,0x01 }
 
static const struct EncodedRSAPubKey rsaPubKeys []
 
static const BYTE intSequence []
 
static const BYTE mixedSequence []
 
static BYTE crit_ext_data [] = { 0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }
 
static BYTE noncrit_ext_data [] = { 0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }
 
static CHAR oid_basic_constraints2 [] = szOID_BASIC_CONSTRAINTS2
 
static CERT_EXTENSION criticalExt
 
static CERT_EXTENSION nonCriticalExt
 
static CHAR oid_short [] = "1.1"
 
static CERT_EXTENSION extWithShortOid
 
static const BYTE ext0 [] = { 0x30,0x00 }
 
static const BYTE ext1 []
 
static const BYTE ext2 []
 
static const BYTE ext3 [] = { 0x30,0x07,0x30,0x05,0x06,0x01,0x29,0x04,0x00 }
 
static const struct encodedExtensions exts []
 
static const BYTE aKey []
 
static const BYTE params [] = { 0x02, 0x01, 0x01 }
 
static const unsigned char bin64 []
 
static const unsigned char bin65 []
 
static const unsigned char bin66 []
 
static const unsigned char bin67 []
 
static const unsigned char bin68 []
 
static const unsigned char bin69 []
 
static const unsigned char bin70 []
 
static const unsigned char bin71 []
 
static unsigned char bin72 [] = { 0x05,0x00}
 
static CHAR oid_bogus [] = "1.2.3"
 
static CHAR oid_rsa [] = szOID_RSA
 
static const struct encodedPublicKey pubKeys []
 
static const BYTE v1Cert []
 
static const BYTE v2Cert []
 
static const BYTE v3Cert []
 
static const BYTE v4Cert []
 
static const BYTE v1CertWithConstraints []
 
static const BYTE v1CertWithSerial []
 
static const BYTE bigCert []
 
static const BYTE v1CertWithPubKey []
 
static const BYTE v1CertWithPubKeyNoNull []
 
static const BYTE v1CertWithSubjectKeyId []
 
static const BYTE v1CertWithIssuerUniqueId []
 
static const BYTE v1CertWithSubjectIssuerSerialAndIssuerUniqueId []
 
static const BYTE v1CertWithSubjectIssuerSerialAndIssuerUniqueIdNoNull []
 
static const BYTE serialNum [] = { 0x01 }
 
static const BYTE hash []
 
static const BYTE signedBigCert []
 
static const BYTE signedBigCertWithIndefiniteSeq []
 
static const BYTE emptyDistPoint [] = { 0x30, 0x02, 0x30, 0x00 }
 
static const BYTE distPointWithUrl []
 
static const BYTE distPointWithReason []
 
static const BYTE distPointWithIssuer []
 
static const BYTE distPointWithUrlAndIssuer []
 
static const BYTE crlReason
 
static const BYTE badFlagsIDP [] = { 0x30,0x06,0x81,0x01,0xff,0x82,0x01,0xff }
 
static const BYTE emptyNameIDP [] = { 0x30,0x04,0xa0,0x02,0xa0,0x00 }
 
static const BYTE urlIDP []
 
static const BYTE v1CRL []
 
static const BYTE v2CRL []
 
static const BYTE v1CRLWithIssuer []
 
static const BYTE v1CRLWithIssuerAndEmptyEntry []
 
static const BYTE v1CRLWithIssuerAndEntry []
 
static const BYTE v1CRLWithEntryExt []
 
static const BYTE v1CRLWithExt []
 
static const BYTE v2CRLWithExt []
 
static const BYTE verisignCRL []
 
static const BYTE verisignCRLWithLotsOfEntries []
 
static const LPCSTR keyUsages []
 
static const BYTE encodedUsage []
 
static BYTE keyId [] = { 1,2,3,4 }
 
static const BYTE authorityKeyIdWithId []
 
static const BYTE authorityKeyIdWithIssuer []
 
static const BYTE authorityKeyIdWithSerial [] = { 0x30,0x03,0x82,0x01,0x01 }
 
static const BYTE authorityKeyIdWithIssuerUrl []
 
static const BYTE authorityInfoAccessWithUrl []
 
static const BYTE authorityInfoAccessWithUrlAndIPAddr []
 
static const BYTE emptyCTL []
 
static const BYTE emptyCTLWithVersion1 []
 
static const BYTE ctlWithUsageIdentifier []
 
static const BYTE ctlWithListIdentifier []
 
static const BYTE ctlWithSequenceNumber []
 
static const BYTE ctlWithThisUpdate []
 
static const BYTE ctlWithThisAndNextUpdate []
 
static const BYTE ctlWithAlgId []
 
static const BYTE ctlWithBogusEntry []
 
static const BYTE ctlWithOneEntry []
 
static const BYTE ctlWithTwoEntries []
 
static const BYTE signedCTL []
 
static const BYTE signedCTLWithCTLInnerContent []
 
static const BYTE emptyPKCSContentInfo [] = { 0x30,0x04,0x06,0x02,0x2a,0x03 }
 
static const BYTE emptyPKCSContentInfoExtraBytes []
 
static const BYTE bogusPKCSContentInfo []
 
static const BYTE intPKCSContentInfo []
 
static BYTE bogusDER [] = { 1 }
 
static const BYTE indefiniteSignedPKCSContent []
 
static const BYTE content_abcd []
 
static const BYTE encoded_abcd []
 
static const BYTE content_constructed_abcd []
 
static const BYTE emptyPKCSAttr []
 
static const BYTE bogusPKCSAttr []
 
static const BYTE intPKCSAttr []
 
static const BYTE emptyPKCSAttributes [] = { 0x31,0x00 }
 
static const BYTE singlePKCSAttributes []
 
static const BYTE doublePKCSAttributes []
 
static const BYTE singleCapability []
 
static const BYTE twoCapabilities []
 
static const BYTE singleCapabilitywithNULL []
 
static BYTE encodedCommonNameNoNull []
 
static const BYTE minimalPKCSSigner []
 
static const BYTE PKCSSignerWithSerial []
 
static const BYTE PKCSSignerWithHashAlgo []
 
static const BYTE PKCSSignerWithHashAndEncryptionAlgo []
 
static const BYTE PKCSSignerWithHash []
 
static const BYTE PKCSSignerWithAuthAttr []
 
static const BYTE CMSSignerWithKeyId []
 
static BYTE emptyDNSPermittedConstraints []
 
static BYTE emptyDNSExcludedConstraints []
 
static BYTE DNSExcludedConstraints []
 
static BYTE permittedAndExcludedConstraints []
 
static BYTE permittedAndExcludedWithMinConstraints []
 
static BYTE permittedAndExcludedWithMinMaxConstraints []
 
static CERT_GENERAL_SUBTREE emptyDNSSubtree
 
static CERT_GENERAL_SUBTREE DNSSubtree
 
static CERT_GENERAL_SUBTREE IPAddressSubtree
 
static CERT_GENERAL_SUBTREE IPAddressWithMinSubtree
 
static CERT_GENERAL_SUBTREE IPAddressWithMinMaxSubtree
 
static const struct EncodedNameConstraints encodedNameConstraints []
 
static WCHAR noticeText []
 
static const BYTE noticeWithDisplayText []
 
static char org [] = "Wine"
 
static int noticeNumbers [] = { 2,3 }
 
static BYTE noticeWithReference []
 
static char oid_any_policy [] = "2.5.29.32.0"
 
static const BYTE policiesWithAnyPolicy []
 
static char oid1 [] = "1.2.3"
 
static char oid_user_notice [] = "1.3.6.1.5.5.7.2.2"
 
static const BYTE twoPolicies []
 
static const BYTE policyMappingWithOneMapping []
 
static const BYTE policyMappingWithTwoMappings []
 
static const LPCSTR mappingOids []
 
static const BYTE policyConstraintsWithRequireExplicit []
 
static const BYTE policyConstraintsWithInhibitMapping []
 
static const BYTE policyConstraintsWithBoth []
 
static const BYTE rsaPrivKeyDer []
 
static const BYTE rsaPrivKeyModulus []
 
static const BYTE rsaPrivKeyPrime1 []
 
static const BYTE rsaPrivKeyPrime2 []
 
static const BYTE rsaPrivKeyExponent1 []
 
static const BYTE rsaPrivKeyExponent2 []
 
static const BYTE rsaPrivKeyCoefficient []
 
static const BYTE rsaPrivKeyPrivateExponent []
 
static const BYTE expiredCert []
 
static const char cspName [] = "WineCryptTemp"
 

Macro Definition Documentation

◆ RDNA

#define RDNA (   arr)    oid_ ## arr, CERT_RDN_PRINTABLE_STRING, { sizeof(arr), (LPBYTE)arr }

Definition at line 703 of file encode.c.

◆ RDNIA5

#define RDNIA5 (   arr)    oid_ ## arr, CERT_RDN_IA5_STRING, { sizeof(arr), (LPBYTE)arr }

Definition at line 704 of file encode.c.

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pCryptDecodeObjectEx)
static

◆ compareAltNameEntry()

static void compareAltNameEntry ( const CERT_ALT_NAME_ENTRY expected,
const CERT_ALT_NAME_ENTRY got 
)
static

Definition at line 3847 of file encode.c.

3849 {
3850  ok(expected->dwAltNameChoice == got->dwAltNameChoice,
3851  "Expected name choice %d, got %d\n", expected->dwAltNameChoice,
3852  got->dwAltNameChoice);
3853  if (expected->dwAltNameChoice == got->dwAltNameChoice)
3854  {
3855  switch (got->dwAltNameChoice)
3856  {
3860  case CERT_ALT_NAME_URL:
3862  ok((!U(*expected).pwszURL && !U(*got).pwszURL) ||
3863  (!U(*expected).pwszURL && !lstrlenW(U(*got).pwszURL)) ||
3864  (!U(*got).pwszURL && !lstrlenW(U(*expected).pwszURL)) ||
3865  !lstrcmpW(U(*expected).pwszURL, U(*got).pwszURL),
3866  "Unexpected name\n");
3867  break;
3871  ok(U(*got).IPAddress.cbData == U(*expected).IPAddress.cbData,
3872  "Unexpected IP address length %d\n", U(*got).IPAddress.cbData);
3873  ok(!memcmp(U(*got).IPAddress.pbData, U(*expected).IPAddress.pbData,
3874  U(*got).IPAddress.cbData), "Unexpected value\n");
3875  break;
3876  }
3877  }
3878 }
DWORD dwAltNameChoice
Definition: wincrypt.h:333
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define CERT_ALT_NAME_DNS_NAME
Definition: wincrypt.h:347
#define CERT_ALT_NAME_DIRECTORY_NAME
Definition: wincrypt.h:349
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define CERT_ALT_NAME_URL
Definition: wincrypt.h:351
#define U(x)
Definition: wordpad.c:44
#define lstrlenW
Definition: compat.h:407
#define CERT_ALT_NAME_X400_ADDRESS
Definition: wincrypt.h:348
#define ok(value,...)
Definition: CComObject.cpp:34
#define CERT_ALT_NAME_RFC822_NAME
Definition: wincrypt.h:346
#define CERT_ALT_NAME_EDI_PARTY_NAME
Definition: wincrypt.h:350
#define CERT_ALT_NAME_IP_ADDRESS
Definition: wincrypt.h:352
#define CERT_ALT_NAME_REGISTERED_ID
Definition: wincrypt.h:353
BOOL expected
Definition: store.c:2063

Referenced by compareAltNameInfo(), compareAuthorityInfoAccess(), and test_decodeNameConstraints().

◆ compareAltNameInfo()

static void compareAltNameInfo ( const CERT_ALT_NAME_INFO expected,
const CERT_ALT_NAME_INFO got 
)
static

Definition at line 3880 of file encode.c.

3882 {
3883  DWORD i;
3884 
3885  ok(expected->cAltEntry == got->cAltEntry, "Expected %d entries, got %d\n",
3886  expected->cAltEntry, got->cAltEntry);
3887  for (i = 0; i < min(expected->cAltEntry, got->cAltEntry); i++)
3888  compareAltNameEntry(&expected->rgAltEntry[i], &got->rgAltEntry[i]);
3889 }
static void compareAltNameEntry(const CERT_ALT_NAME_ENTRY *expected, const CERT_ALT_NAME_ENTRY *got)
Definition: encode.c:3847
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 ok(value,...)
Definition: CComObject.cpp:34
unsigned long DWORD
Definition: ntddk_ex.h:95
PCERT_ALT_NAME_ENTRY rgAltEntry
Definition: wincrypt.h:357
#define min(a, b)
Definition: monoChain.cc:55
BOOL expected
Definition: store.c:2063

Referenced by compareDistPointName().

◆ compareAuthorityInfoAccess()

static void compareAuthorityInfoAccess ( LPCSTR  header,
const CERT_AUTHORITY_INFO_ACCESS expected,
const CERT_AUTHORITY_INFO_ACCESS got 
)
static

Definition at line 5305 of file encode.c.

5308 {
5309  DWORD i;
5310 
5311  ok(expected->cAccDescr == got->cAccDescr,
5312  "%s: expected %d access descriptions, got %d\n", header,
5313  expected->cAccDescr, got->cAccDescr);
5314  for (i = 0; i < expected->cAccDescr; i++)
5315  {
5316  ok(!strcmp(expected->rgAccDescr[i].pszAccessMethod,
5317  got->rgAccDescr[i].pszAccessMethod), "%s[%d]: expected %s, got %s\n",
5318  header, i, expected->rgAccDescr[i].pszAccessMethod,
5319  got->rgAccDescr[i].pszAccessMethod);
5320  compareAltNameEntry(&expected->rgAccDescr[i].AccessLocation,
5321  &got->rgAccDescr[i].AccessLocation);
5322  }
5323 }
static void compareAltNameEntry(const CERT_ALT_NAME_ENTRY *expected, const CERT_ALT_NAME_ENTRY *got)
Definition: encode.c:3847
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 ok(value,...)
Definition: CComObject.cpp:34
unsigned long DWORD
Definition: ntddk_ex.h:95
PCERT_ACCESS_DESCRIPTION rgAccDescr
Definition: wincrypt.h:475
CERT_ALT_NAME_ENTRY AccessLocation
Definition: wincrypt.h:470
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
struct CFHEADER header
Definition: fdi.c:109
BOOL expected
Definition: store.c:2063

Referenced by test_decodeAuthorityInfoAccess().

◆ compareCRLIssuingDistPoints()

static void compareCRLIssuingDistPoints ( const CRL_ISSUING_DIST_POINT expected,
const CRL_ISSUING_DIST_POINT got 
)
static

Definition at line 3900 of file encode.c.

3902 {
3903  compareDistPointName(&expected->DistPointName, &got->DistPointName);
3904  ok(got->fOnlyContainsUserCerts == expected->fOnlyContainsUserCerts,
3905  "Unexpected fOnlyContainsUserCerts\n");
3906  ok(got->fOnlyContainsCACerts == expected->fOnlyContainsCACerts,
3907  "Unexpected fOnlyContainsCACerts\n");
3908  ok(got->OnlySomeReasonFlags.cbData == expected->OnlySomeReasonFlags.cbData,
3909  "Unexpected reason flags\n");
3910  ok(got->fIndirectCRL == expected->fIndirectCRL,
3911  "Unexpected fIndirectCRL\n");
3912 }
CRL_DIST_POINT_NAME DistPointName
Definition: wincrypt.h:563
#define ok(value,...)
Definition: CComObject.cpp:34
CRYPT_BIT_BLOB OnlySomeReasonFlags
Definition: wincrypt.h:566
static void compareDistPointName(const CRL_DIST_POINT_NAME *expected, const CRL_DIST_POINT_NAME *got)
Definition: encode.c:3891
BOOL expected
Definition: store.c:2063

Referenced by test_decodeCRLIssuingDistPoint().

◆ compareCTLInfo()

static void compareCTLInfo ( LPCSTR  header,
const CTL_INFO expected,
const CTL_INFO got 
)
static

Definition at line 5620 of file encode.c.

5622 {
5623  DWORD i, j, k;
5624 
5625  ok(expected->dwVersion == got->dwVersion,
5626  "%s: expected version %d, got %d\n", header, expected->dwVersion,
5627  got->dwVersion);
5628  ok(expected->SubjectUsage.cUsageIdentifier ==
5630  "%s: expected %d usage identifiers, got %d\n", header,
5631  expected->SubjectUsage.cUsageIdentifier,
5633  for (i = 0; i < expected->SubjectUsage.cUsageIdentifier; i++)
5634  ok(!strcmp(expected->SubjectUsage.rgpszUsageIdentifier[i],
5636  "%s[%d]: expected %s, got %s\n", header, i,
5637  expected->SubjectUsage.rgpszUsageIdentifier[i],
5639  ok(expected->ListIdentifier.cbData == got->ListIdentifier.cbData,
5640  "%s: expected list identifier of %d bytes, got %d\n", header,
5641  expected->ListIdentifier.cbData, got->ListIdentifier.cbData);
5642  if (expected->ListIdentifier.cbData)
5643  ok(!memcmp(expected->ListIdentifier.pbData, got->ListIdentifier.pbData,
5644  expected->ListIdentifier.cbData),
5645  "%s: unexpected list identifier value\n", header);
5646  ok(expected->SequenceNumber.cbData == got->SequenceNumber.cbData,
5647  "%s: expected sequence number of %d bytes, got %d\n", header,
5648  expected->SequenceNumber.cbData, got->SequenceNumber.cbData);
5649  if (expected->SequenceNumber.cbData)
5650  ok(!memcmp(expected->SequenceNumber.pbData, got->SequenceNumber.pbData,
5651  expected->SequenceNumber.cbData),
5652  "%s: unexpected sequence number value\n", header);
5653  ok(!memcmp(&expected->ThisUpdate, &got->ThisUpdate, sizeof(FILETIME)),
5654  "%s: expected this update = (%d, %d), got (%d, %d)\n", header,
5655  expected->ThisUpdate.dwLowDateTime, expected->ThisUpdate.dwHighDateTime,
5657  ok(!memcmp(&expected->NextUpdate, &got->NextUpdate, sizeof(FILETIME)),
5658  "%s: expected next update = (%d, %d), got (%d, %d)\n", header,
5659  expected->NextUpdate.dwLowDateTime, expected->NextUpdate.dwHighDateTime,
5661  if (expected->SubjectAlgorithm.pszObjId &&
5662  *expected->SubjectAlgorithm.pszObjId && !got->SubjectAlgorithm.pszObjId)
5663  ok(0, "%s: expected subject algorithm %s, got NULL\n", header,
5664  expected->SubjectAlgorithm.pszObjId);
5665  if (expected->SubjectAlgorithm.pszObjId && got->SubjectAlgorithm.pszObjId)
5666  ok(!strcmp(expected->SubjectAlgorithm.pszObjId,
5667  got->SubjectAlgorithm.pszObjId),
5668  "%s: expected subject algorithm %s, got %s\n", header,
5669  expected->SubjectAlgorithm.pszObjId, got->SubjectAlgorithm.pszObjId);
5670  ok(expected->SubjectAlgorithm.Parameters.cbData ==
5672  "%s: expected subject algorithm parameters of %d bytes, got %d\n", header,
5673  expected->SubjectAlgorithm.Parameters.cbData,
5675  if (expected->SubjectAlgorithm.Parameters.cbData)
5676  ok(!memcmp(expected->SubjectAlgorithm.Parameters.pbData,
5678  expected->SubjectAlgorithm.Parameters.cbData),
5679  "%s: unexpected subject algorithm parameter value\n", header);
5680  ok(expected->cCTLEntry == got->cCTLEntry,
5681  "%s: expected %d CTL entries, got %d\n", header, expected->cCTLEntry,
5682  got->cCTLEntry);
5683  for (i = 0; i < expected->cCTLEntry; i++)
5684  {
5685  ok(expected->rgCTLEntry[i].SubjectIdentifier.cbData ==
5687  "%s[%d]: expected subject identifier of %d bytes, got %d\n",
5688  header, i, expected->rgCTLEntry[i].SubjectIdentifier.cbData,
5690  if (expected->rgCTLEntry[i].SubjectIdentifier.cbData)
5691  ok(!memcmp(expected->rgCTLEntry[i].SubjectIdentifier.pbData,
5693  expected->rgCTLEntry[i].SubjectIdentifier.cbData),
5694  "%s[%d]: unexpected subject identifier value\n",
5695  header, i);
5696  for (j = 0; j < expected->rgCTLEntry[i].cAttribute; j++)
5697  {
5698  ok(!strcmp(expected->rgCTLEntry[i].rgAttribute[j].pszObjId,
5699  got->rgCTLEntry[i].rgAttribute[j].pszObjId),
5700  "%s[%d][%d]: expected attribute OID %s, got %s\n", header, i, j,
5701  expected->rgCTLEntry[i].rgAttribute[j].pszObjId,
5702  got->rgCTLEntry[i].rgAttribute[j].pszObjId);
5703  for (k = 0; k < expected->rgCTLEntry[i].rgAttribute[j].cValue; k++)
5704  {
5705  ok(expected->rgCTLEntry[i].rgAttribute[j].rgValue[k].cbData ==
5707  "%s[%d][%d][%d]: expected value of %d bytes, got %d\n",
5708  header, i, j, k,
5709  expected->rgCTLEntry[i].rgAttribute[j].rgValue[k].cbData,
5711  if (expected->rgCTLEntry[i].rgAttribute[j].rgValue[k].cbData)
5712  ok(!memcmp(
5713  expected->rgCTLEntry[i].rgAttribute[j].rgValue[k].pbData,
5715  expected->rgCTLEntry[i].rgAttribute[j].rgValue[k].cbData),
5716  "%s[%d][%d][%d]: unexpected value\n",
5717  header, i, j, k);
5718  }
5719  }
5720  }
5721  ok(expected->cExtension == got->cExtension,
5722  "%s: expected %d extensions, got %d\n", header, expected->cExtension,
5723  got->cExtension);
5724  for (i = 0; i < expected->cExtension; i++)
5725  {
5726  ok(!strcmp(expected->rgExtension[i].pszObjId,
5727  got->rgExtension[i].pszObjId), "%s[%d]: expected %s, got %s\n",
5728  header, i, expected->rgExtension[i].pszObjId,
5729  got->rgExtension[i].pszObjId);
5730  ok(expected->rgExtension[i].fCritical == got->rgExtension[i].fCritical,
5731  "%s[%d]: expected fCritical = %d, got %d\n", header, i,
5732  expected->rgExtension[i].fCritical, got->rgExtension[i].fCritical);
5733  ok(expected->rgExtension[i].Value.cbData ==
5734  got->rgExtension[i].Value.cbData,
5735  "%s[%d]: expected extension value to have %d bytes, got %d\n",
5736  header, i, expected->rgExtension[i].Value.cbData,
5737  got->rgExtension[i].Value.cbData);
5738  if (expected->rgExtension[i].Value.cbData)
5739  ok(!memcmp(expected->rgExtension[i].Value.pbData,
5740  got->rgExtension[i].Value.pbData,
5741  expected->rgExtension[i].Value.cbData),
5742  "%s[%d]: unexpected extension value\n", header, i);
5743  }
5744 }
DWORD cExtension
Definition: wincrypt.h:739
CRYPT_DATA_BLOB ListIdentifier
Definition: wincrypt.h:732
FILETIME ThisUpdate
Definition: wincrypt.h:734
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
DWORD dwVersion
Definition: wincrypt.h:730
CRYPT_ALGORITHM_IDENTIFIER SubjectAlgorithm
Definition: wincrypt.h:736
PCERT_EXTENSION rgExtension
Definition: wincrypt.h:740
DWORD dwHighDateTime
Definition: mapidefs.h:66
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
CRYPT_OBJID_BLOB Parameters
Definition: wincrypt.h:127
PCRYPT_DATA_BLOB rgValue
Definition: wincrypt.h:590
LPSTR pszObjId
Definition: wincrypt.h:230
FILETIME NextUpdate
Definition: wincrypt.h:735
CRYPT_DATA_BLOB SubjectIdentifier
Definition: wincrypt.h:724
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define ok(value,...)
Definition: CComObject.cpp:34
CRYPT_OBJID_BLOB Value
Definition: wincrypt.h:232
unsigned long DWORD
Definition: ntddk_ex.h:95
PCRYPT_ATTRIBUTE rgAttribute
Definition: wincrypt.h:726
DWORD cCTLEntry
Definition: wincrypt.h:737
BYTE * pbData
Definition: wincrypt.h:103
PCTL_ENTRY rgCTLEntry
Definition: wincrypt.h:738
CTL_USAGE SubjectUsage
Definition: wincrypt.h:731
DWORD cUsageIdentifier
Definition: wincrypt.h:719
LPSTR * rgpszUsageIdentifier
Definition: wincrypt.h:720
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
CRYPT_INTEGER_BLOB SequenceNumber
Definition: wincrypt.h:733
int k
Definition: mpi.c:3369
struct CFHEADER header
Definition: fdi.c:109
DWORD dwLowDateTime
Definition: mapidefs.h:65
BOOL expected
Definition: store.c:2063

Referenced by test_decodeCTL().

◆ compareDistPointName()

static void compareDistPointName ( const CRL_DIST_POINT_NAME expected,
const CRL_DIST_POINT_NAME got 
)
static

Definition at line 3891 of file encode.c.

3893 {
3894  ok(got->dwDistPointNameChoice == expected->dwDistPointNameChoice,
3895  "Unexpected name choice %d\n", got->dwDistPointNameChoice);
3897  compareAltNameInfo(&(U(*expected).FullName), &(U(*got).FullName));
3898 }
static void compareAltNameInfo(const CERT_ALT_NAME_INFO *expected, const CERT_ALT_NAME_INFO *got)
Definition: encode.c:3880
#define U(x)
Definition: wordpad.c:44
#define ok(value,...)
Definition: CComObject.cpp:34
#define CRL_DIST_POINT_FULL_NAME
Definition: wincrypt.h:514
DWORD dwDistPointNameChoice
Definition: wincrypt.h:507
BOOL expected
Definition: store.c:2063

Referenced by compareCRLIssuingDistPoints().

◆ compareNames()

static void compareNames ( const CERT_NAME_INFO expected,
const CERT_NAME_INFO got 
)
static

Definition at line 1048 of file encode.c.

1050 {
1051  ok(got->cRDN == expected->cRDN, "Expected %d RDNs, got %d\n",
1052  expected->cRDN, got->cRDN);
1053  if (got->cRDN)
1054  {
1055  DWORD i;
1056 
1057  for (i = 0; i < got->cRDN; i++)
1058  compareRDNs(&expected->rgRDN[i], &got->rgRDN[i]);
1059  }
1060 }
static void compareRDNs(const CERT_RDN *expected, const CERT_RDN *got)
Definition: encode.c:1035
PCERT_RDN rgRDN
Definition: wincrypt.h:268
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 ok(value,...)
Definition: CComObject.cpp:34
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL expected
Definition: store.c:2063

Referenced by test_decodeName(), and test_decodeUnicodeName().

◆ compareNameValues()

static void compareNameValues ( const CERT_NAME_VALUE expected,
const CERT_NAME_VALUE got 
)
static

Definition at line 994 of file encode.c.

996 {
997  if (expected->dwValueType == CERT_RDN_UTF8_STRING &&
999  {
1000  win_skip("Can't handle CERT_RDN_UTF8_STRING\n");
1001  return;
1002  }
1003 
1004  ok(got->dwValueType == expected->dwValueType,
1005  "Expected string type %d, got %d\n", expected->dwValueType,
1006  got->dwValueType);
1007  ok(got->Value.cbData == expected->Value.cbData ||
1008  got->Value.cbData == expected->Value.cbData - sizeof(WCHAR) /* Win8 */,
1009  "String type %d: unexpected data size, got %d, expected %d\n",
1010  expected->dwValueType, got->Value.cbData, expected->Value.cbData);
1011  if (got->Value.cbData && got->Value.pbData)
1012  ok(!memcmp(got->Value.pbData, expected->Value.pbData,
1013  min(got->Value.cbData, expected->Value.cbData)),
1014  "String type %d: unexpected value\n", expected->dwValueType);
1015 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define CERT_RDN_ENCODED_BLOB
Definition: wincrypt.h:2777
#define ok(value,...)
Definition: CComObject.cpp:34
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CERT_RDN_UTF8_STRING
Definition: wincrypt.h:2793
DWORD dwValueType
Definition: wincrypt.h:272
BYTE * pbData
Definition: wincrypt.h:103
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:273
#define min(a, b)
Definition: monoChain.cc:55
#define win_skip
Definition: test.h:141
BOOL expected
Definition: store.c:2063

Referenced by compareRDNAttrs(), and test_decodeNameValue().

◆ comparePublicKeyInfo()

static void comparePublicKeyInfo ( const CERT_PUBLIC_KEY_INFO expected,
const CERT_PUBLIC_KEY_INFO got 
)
static

Definition at line 2875 of file encode.c.

2877 {
2878  ok(!strcmp(expected->Algorithm.pszObjId, got->Algorithm.pszObjId),
2879  "Expected OID %s, got %s\n", expected->Algorithm.pszObjId,
2880  got->Algorithm.pszObjId);
2881  ok(expected->Algorithm.Parameters.cbData ==
2883  "Expected parameters of %d bytes, got %d\n",
2884  expected->Algorithm.Parameters.cbData, got->Algorithm.Parameters.cbData);
2885  if (expected->Algorithm.Parameters.cbData)
2886  ok(!memcmp(expected->Algorithm.Parameters.pbData,
2888  "Unexpected algorithm parameters\n");
2889  ok(expected->PublicKey.cbData == got->PublicKey.cbData,
2890  "Expected public key of %d bytes, got %d\n",
2891  expected->PublicKey.cbData, got->PublicKey.cbData);
2892  if (expected->PublicKey.cbData)
2893  ok(!memcmp(expected->PublicKey.pbData, got->PublicKey.pbData,
2894  got->PublicKey.cbData), "Unexpected public key value\n");
2895 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
CRYPT_OBJID_BLOB Parameters
Definition: wincrypt.h:127
#define ok(value,...)
Definition: CComObject.cpp:34
BYTE * pbData
Definition: wincrypt.h:103
CRYPT_BIT_BLOB PublicKey
Definition: wincrypt.h:226
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
BOOL expected
Definition: store.c:2063
BYTE * pbData
Definition: wincrypt.h:197
CRYPT_ALGORITHM_IDENTIFIER Algorithm
Definition: wincrypt.h:225

Referenced by test_decodePublicKeyInfo().

◆ compareRDNAttrs()

static void compareRDNAttrs ( const CERT_RDN_ATTR expected,
const CERT_RDN_ATTR got 
)
static

Definition at line 1017 of file encode.c.

1019 {
1020  if (expected->pszObjId && *expected->pszObjId)
1021  {
1022  ok(got->pszObjId != NULL, "Expected OID %s, got NULL\n",
1023  expected->pszObjId);
1024  if (got->pszObjId)
1025  {
1026  ok(!strcmp(got->pszObjId, expected->pszObjId),
1027  "Got unexpected OID %s, expected %s\n", got->pszObjId,
1028  expected->pszObjId);
1029  }
1030  }
1031  compareNameValues((const CERT_NAME_VALUE *)&expected->dwValueType,
1032  (const CERT_NAME_VALUE *)&got->dwValueType);
1033 }
static void compareNameValues(const CERT_NAME_VALUE *expected, const CERT_NAME_VALUE *got)
Definition: encode.c:994
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
DWORD dwValueType
Definition: wincrypt.h:257
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
BOOL expected
Definition: store.c:2063
LPSTR pszObjId
Definition: wincrypt.h:256

Referenced by compareRDNs().

◆ compareRDNs()

static void compareRDNs ( const CERT_RDN expected,
const CERT_RDN got 
)
static

Definition at line 1035 of file encode.c.

1036 {
1037  ok(got->cRDNAttr == expected->cRDNAttr,
1038  "Expected %d RDN attrs, got %d\n", expected->cRDNAttr, got->cRDNAttr);
1039  if (got->cRDNAttr)
1040  {
1041  DWORD i;
1042 
1043  for (i = 0; i < got->cRDNAttr; i++)
1044  compareRDNAttrs(&expected->rgRDNAttr[i], &got->rgRDNAttr[i]);
1045  }
1046 }
PCERT_RDN_ATTR rgRDNAttr
Definition: wincrypt.h:263
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 void compareRDNAttrs(const CERT_RDN_ATTR *expected, const CERT_RDN_ATTR *got)
Definition: encode.c:1017
#define ok(value,...)
Definition: CComObject.cpp:34
DWORD cRDNAttr
Definition: wincrypt.h:262
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL expected
Definition: store.c:2063

Referenced by compareNames().

◆ compareSMimeCapabilities()

static void compareSMimeCapabilities ( LPCSTR  header,
const CRYPT_SMIME_CAPABILITIES expected,
const CRYPT_SMIME_CAPABILITIES got 
)
static

Definition at line 6451 of file encode.c.

6453 {
6454  DWORD i;
6455 
6456  ok(got->cCapability == expected->cCapability,
6457  "%s: expected %d capabilities, got %d\n", header, expected->cCapability,
6458  got->cCapability);
6459  for (i = 0; i < expected->cCapability; i++)
6460  {
6461  ok(!strcmp(expected->rgCapability[i].pszObjId,
6462  got->rgCapability[i].pszObjId), "%s[%d]: expected %s, got %s\n",
6463  header, i, expected->rgCapability[i].pszObjId,
6464  got->rgCapability[i].pszObjId);
6465  ok(expected->rgCapability[i].Parameters.cbData ==
6467  "%s[%d]: expected %d bytes, got %d\n", header, i,
6468  expected->rgCapability[i].Parameters.cbData,
6470  if (expected->rgCapability[i].Parameters.cbData)
6471  ok(!memcmp(expected->rgCapability[i].Parameters.pbData,
6473  expected->rgCapability[i].Parameters.cbData),
6474  "%s[%d]: unexpected value\n", header, i);
6475  }
6476 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
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 ok(value,...)
Definition: CComObject.cpp:34
unsigned long DWORD
Definition: ntddk_ex.h:95
BYTE * pbData
Definition: wincrypt.h:103
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
CRYPT_OBJID_BLOB Parameters
Definition: wincrypt.h:688
struct CFHEADER header
Definition: fdi.c:109
BOOL expected
Definition: store.c:2063
PCRYPT_SMIME_CAPABILITY rgCapability
Definition: wincrypt.h:693

Referenced by test_decodePKCSSMimeCapabilities().

◆ compareTime()

static void compareTime ( const SYSTEMTIME expected,
const FILETIME got 
)
static

Definition at line 498 of file encode.c.

499 {
500  SYSTEMTIME st;
501 
502  FileTimeToSystemTime(got, &st);
503  ok((expected->wYear == st.wYear &&
504  expected->wMonth == st.wMonth &&
505  expected->wDay == st.wDay &&
506  expected->wHour == st.wHour &&
507  expected->wMinute == st.wMinute &&
508  expected->wSecond == st.wSecond &&
509  abs(expected->wMilliseconds - st.wMilliseconds) <= 1) ||
510  /* Some Windows systems only seem to be accurate in their time decoding to
511  * within about an hour.
512  */
513  broken(expected->wYear == st.wYear &&
514  expected->wMonth == st.wMonth &&
515  expected->wDay == st.wDay &&
516  abs(expected->wHour - st.wHour) <= 1),
517  "Got unexpected value for time decoding:\nexpected %s, got %s\n",
519 }
#define abs(i)
Definition: fconv.c:206
WORD wMonth
Definition: winbase.h:871
WORD wYear
Definition: winbase.h:870
WORD wMinute
Definition: winbase.h:875
#define ok(value,...)
Definition: CComObject.cpp:34
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:178
WORD wSecond
Definition: winbase.h:876
WORD wMilliseconds
Definition: winbase.h:877
static const char * printFileTime(const FILETIME *ft)
Definition: encode.c:487
#define broken(x)
Definition: _sntprintf.h:21
WORD wDay
Definition: winbase.h:873
static const char * printSystemTime(const SYSTEMTIME *st)
Definition: encode.c:478
WORD wHour
Definition: winbase.h:874
BOOL expected
Definition: store.c:2063

Referenced by testTimeDecoding().

◆ printFileTime()

static const char* printFileTime ( const FILETIME ft)
static

Definition at line 487 of file encode.c.

488 {
489  static char buf[64];
490  SYSTEMTIME st;
491 
492  FileTimeToSystemTime(ft, &st);
493  sprintf(buf, "%02d-%02d-%04d %02d:%02d:%02d.%03d", st.wMonth, st.wDay,
494  st.wYear, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
495  return buf;
496 }
WORD wMonth
Definition: winbase.h:871
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define sprintf(buf, format,...)
Definition: sprintf.c:55
WORD wYear
Definition: winbase.h:870
WORD wMinute
Definition: winbase.h:875
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:178
WORD wSecond
Definition: winbase.h:876
WORD wMilliseconds
Definition: winbase.h:877
WORD wDay
Definition: winbase.h:873
WORD wHour
Definition: winbase.h:874

Referenced by compareTime().

◆ printSystemTime()

static const char* printSystemTime ( const SYSTEMTIME st)
static

Definition at line 478 of file encode.c.

479 {
480  static char buf[64];
481 
482  sprintf(buf, "%02d-%02d-%04d %02d:%02d:%02d.%03d", st->wMonth, st->wDay,
483  st->wYear, st->wHour, st->wMinute, st->wSecond, st->wMilliseconds);
484  return buf;
485 }
WORD wMonth
Definition: winbase.h:871
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define sprintf(buf, format,...)
Definition: sprintf.c:55
WORD wYear
Definition: winbase.h:870
WORD wMinute
Definition: winbase.h:875
WORD wSecond
Definition: winbase.h:876
WORD wMilliseconds
Definition: winbase.h:877
WORD wDay
Definition: winbase.h:873
WORD wHour
Definition: winbase.h:874

Referenced by compareTime().

◆ START_TEST()

START_TEST ( encode  )

Definition at line 8508 of file encode.c.

8509 {
8510  static const DWORD encodings[] = { X509_ASN_ENCODING, PKCS_7_ASN_ENCODING,
8512  HMODULE hCrypt32;
8513  DWORD i;
8514 
8515  hCrypt32 = GetModuleHandleA("crypt32.dll");
8516  pCryptDecodeObjectEx = (void*)GetProcAddress(hCrypt32, "CryptDecodeObjectEx");
8517  pCryptEncodeObjectEx = (void*)GetProcAddress(hCrypt32, "CryptEncodeObjectEx");
8518  if (!pCryptDecodeObjectEx || !pCryptEncodeObjectEx)
8519  {
8520  win_skip("CryptDecodeObjectEx() is not available\n");
8521  return;
8522  }
8523 
8524  for (i = 0; i < ARRAY_SIZE(encodings); i++)
8525  {
8526  test_encodeInt(encodings[i]);
8527  test_decodeInt(encodings[i]);
8528  test_encodeEnumerated(encodings[i]);
8529  test_decodeEnumerated(encodings[i]);
8530  test_encodeFiletime(encodings[i]);
8531  test_decodeFiletime(encodings[i]);
8532  test_encodeName(encodings[i]);
8533  test_decodeName(encodings[i]);
8534  test_encodeUnicodeName(encodings[i]);
8535  test_decodeUnicodeName(encodings[i]);
8536  test_encodeNameValue(encodings[i]);
8537  test_decodeNameValue(encodings[i]);
8538  test_encodeUnicodeNameValue(encodings[i]);
8539  test_decodeUnicodeNameValue(encodings[i]);
8540  test_encodeAltName(encodings[i]);
8541  test_decodeAltName(encodings[i]);
8542  test_encodeOctets(encodings[i]);
8543  test_decodeOctets(encodings[i]);
8544  test_encodeBits(encodings[i]);
8545  test_decodeBits(encodings[i]);
8546  test_encodeBasicConstraints(encodings[i]);
8547  test_decodeBasicConstraints(encodings[i]);
8548  test_encodeRsaPublicKey(encodings[i]);
8549  test_decodeRsaPublicKey(encodings[i]);
8550  test_encodeSequenceOfAny(encodings[i]);
8551  test_decodeSequenceOfAny(encodings[i]);
8552  test_encodeExtensions(encodings[i]);
8553  test_decodeExtensions(encodings[i]);
8554  test_encodePublicKeyInfo(encodings[i]);
8555  test_decodePublicKeyInfo(encodings[i]);
8556  test_encodeCertToBeSigned(encodings[i]);
8557  test_decodeCertToBeSigned(encodings[i]);
8558  test_encodeCert(encodings[i]);
8559  test_decodeCert(encodings[i]);
8560  test_encodeCRLDistPoints(encodings[i]);
8561  test_decodeCRLDistPoints(encodings[i]);
8562  test_encodeCRLIssuingDistPoint(encodings[i]);
8563  test_decodeCRLIssuingDistPoint(encodings[i]);
8564  test_encodeCRLToBeSigned(encodings[i]);
8565  test_decodeCRLToBeSigned(encodings[i]);
8566  test_encodeEnhancedKeyUsage(encodings[i]);
8567  test_decodeEnhancedKeyUsage(encodings[i]);
8568  test_encodeAuthorityKeyId(encodings[i]);
8569  test_decodeAuthorityKeyId(encodings[i]);
8570  test_encodeAuthorityKeyId2(encodings[i]);
8571  test_decodeAuthorityKeyId2(encodings[i]);
8572  test_encodeAuthorityInfoAccess(encodings[i]);
8573  test_decodeAuthorityInfoAccess(encodings[i]);
8574  test_encodeCTL(encodings[i]);
8575  test_decodeCTL(encodings[i]);
8576  test_encodePKCSContentInfo(encodings[i]);
8577  test_decodePKCSContentInfo(encodings[i]);
8578  test_encodePKCSAttribute(encodings[i]);
8579  test_decodePKCSAttribute(encodings[i]);
8580  test_encodePKCSAttributes(encodings[i]);
8581  test_decodePKCSAttributes(encodings[i]);
8582  test_encodePKCSSMimeCapabilities(encodings[i]);
8583  test_decodePKCSSMimeCapabilities(encodings[i]);
8584  test_encodePKCSSignerInfo(encodings[i]);
8585  test_decodePKCSSignerInfo(encodings[i]);
8586  test_encodeCMSSignerInfo(encodings[i]);
8587  test_decodeCMSSignerInfo(encodings[i]);
8588  test_encodeNameConstraints(encodings[i]);
8589  test_decodeNameConstraints(encodings[i]);
8592  test_encodeCertPolicies(encodings[i]);
8593  test_decodeCertPolicies(encodings[i]);
8594  test_encodeCertPolicyMappings(encodings[i]);
8595  test_decodeCertPolicyMappings(encodings[i]);
8596  test_encodeCertPolicyConstraints(encodings[i]);
8597  test_decodeCertPolicyConstraints(encodings[i]);
8598  test_decodeRsaPrivateKey(encodings[i]);
8599  }
8601 }
static void test_encodeNameConstraints(DWORD dwEncoding)
Definition: encode.c:7241
static void test_decodeEnumerated(DWORD dwEncoding)
Definition: encode.c:409
static void test_encodeAuthorityKeyId(DWORD dwEncoding)
Definition: encode.c:4928
static void test_decodeNameConstraints(DWORD dwEncoding)
Definition: encode.c:7385
static void test_encodeBasicConstraints(DWORD dwEncoding)
Definition: encode.c:2242
static void test_decodePKCSContentInfo(DWORD dwEncoding)
Definition: encode.c:6082
static void test_decodeAltName(DWORD dwEncoding)
Definition: encode.c:1565
static void test_decodePKCSAttributes(DWORD dwEncoding)
Definition: encode.c:6318
static void test_decodeName(DWORD dwEncoding)
Definition: encode.c:1068
static void test_decodePKCSSMimeCapabilities(DWORD dwEncoding)
Definition: encode.c:6478
static void test_encodePolicyQualifierUserNotice(DWORD dwEncoding)
Definition: encode.c:7465
static void test_decodePKCSAttribute(DWORD dwEncoding)
Definition: encode.c:6208
static void test_decodePKCSSignerInfo(DWORD dwEncoding)
Definition: encode.c:6760
static void test_decodeUnicodeNameValue(DWORD dwEncoding)
Definition: encode.c:1932
static void test_decodeCMSSignerInfo(DWORD dwEncoding)
Definition: encode.c:7061
static void testPortPublicKeyInfo(void)
Definition: encode.c:8485
static void test_decodeCertToBeSigned(DWORD dwEncoding)
Definition: encode.c:3235
static void test_decodeUnicodeName(DWORD dwEncoding)
Definition: encode.c:1167
static void test_decodeCTL(DWORD dwEncoding)
Definition: encode.c:5782
#define PKCS_7_ASN_ENCODING
Definition: wincrypt.h:2299
static void test_encodeEnhancedKeyUsage(DWORD dwEncoding)
Definition: encode.c:4836
static void test_decodeOctets(DWORD dwEncoding)
Definition: encode.c:2027
static void test_encodeCertPolicyMappings(DWORD dwEncoding)
Definition: encode.c:7736
static void test_encodeCertPolicyConstraints(DWORD dwEncoding)
Definition: encode.c:7892
static void test_decodeAuthorityKeyId2(DWORD dwEncoding)
Definition: encode.c:5136
static void test_encodePublicKeyInfo(DWORD dwEncoding)
Definition: encode.c:2848
static void test_decodeRsaPublicKey(DWORD dwEncoding)
Definition: encode.c:2516
static void test_encodeCRLIssuingDistPoint(DWORD dwEncoding)
Definition: encode.c:3774
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
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 void test_encodePKCSAttributes(DWORD dwEncoding)
Definition: encode.c:6265
static void test_decodeFiletime(DWORD dwEncoding)
Definition: encode.c:607
static void test_encodeFiletime(DWORD dwEncoding)
Definition: encode.c:562
static void test_encodeEnumerated(DWORD dwEncoding)
Definition: encode.c:376
static void test_encodeCRLDistPoints(DWORD dwEncoding)
Definition: encode.c:3552
static void test_encodeOctets(DWORD dwEncoding)
Definition: encode.c:1971
static void test_decodePublicKeyInfo(DWORD dwEncoding)
Definition: encode.c:2897
static void test_encodePKCSContentInfo(DWORD dwEncoding)
Definition: encode.c:5971
static void test_decodeAuthorityKeyId(DWORD dwEncoding)
Definition: encode.c:4987
static void test_encodeCRLToBeSigned(DWORD dwEncoding)
Definition: encode.c:4018
static void test_decodeSequenceOfAny(DWORD dwEncoding)
Definition: encode.c:2635
static void test_encodeAuthorityInfoAccess(DWORD dwEncoding)
Definition: encode.c:5230
static void test_decodeBits(DWORD dwEncoding)
Definition: encode.c:2155
static void test_encodeExtensions(DWORD dwEncoding)
Definition: encode.c:2710
static void test_encodeUnicodeName(DWORD dwEncoding)
Definition: encode.c:894
static void test_encodeCTL(DWORD dwEncoding)
Definition: encode.c:5447
static void test_encodeName(DWORD dwEncoding)
Definition: encode.c:744
static void test_decodeCert(DWORD dwEncoding)
Definition: encode.c:3463
static void test_decodeCRLToBeSigned(DWORD dwEncoding)
Definition: encode.c:4682
static void test_encodeRsaPublicKey(DWORD dwEncoding)
Definition: encode.c:2425
unsigned long DWORD
Definition: ntddk_ex.h:95
static void test_encodeAltName(DWORD dwEncoding)
Definition: encode.c:1452
static void test_encodeCertPolicies(DWORD dwEncoding)
Definition: encode.c:7594
static void test_decodeAuthorityInfoAccess(DWORD dwEncoding)
Definition: encode.c:5325
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
static void test_decodeRsaPrivateKey(DWORD dwEncoding)
Definition: encode.c:8248
static void test_encodeSequenceOfAny(DWORD dwEncoding)
Definition: encode.c:2591
static void test_encodeCMSSignerInfo(DWORD dwEncoding)
Definition: encode.c:6891
static void test_decodeNameValue(DWORD dwEncoding)
Definition: encode.c:1366
static void test_encodePKCSAttribute(DWORD dwEncoding)
Definition: encode.c:6149
static void test_decodeEnhancedKeyUsage(DWORD dwEncoding)
Definition: encode.c:4868
static void test_encodePKCSSMimeCapabilities(DWORD dwEncoding)
Definition: encode.c:6394
static void test_encodeInt(DWORD dwEncoding)
Definition: encode.c:89
static void test_decodeCertPolicyMappings(DWORD dwEncoding)
Definition: encode.c:7806
static void test_encodeUnicodeNameValue(DWORD dwEncoding)
Definition: encode.c:1820
#define ARRAY_SIZE(a)
Definition: main.h:24
static void test_encodeNameValue(DWORD dwEncoding)
Definition: encode.c:1314
static void test_decodeCRLIssuingDistPoint(DWORD dwEncoding)
Definition: encode.c:3914
static void test_encodeCert(DWORD dwEncoding)
Definition: encode.c:3440
static void test_decodeCRLDistPoints(DWORD dwEncoding)
Definition: encode.c:3643
static void test_encodeAuthorityKeyId2(DWORD dwEncoding)
Definition: encode.c:5067
static void test_decodeExtensions(DWORD dwEncoding)
Definition: encode.c:2734
static void test_decodePolicyQualifierUserNotice(DWORD dwEncoding)
Definition: encode.c:7516
static void test_decodeInt(DWORD dwEncoding)
Definition: encode.c:205
static void test_decodeBasicConstraints(DWORD dwEncoding)
Definition: encode.c:2304
#define GetProcAddress(x, y)
Definition: compat.h:410
static void test_decodeCertPolicies(DWORD dwEncoding)
Definition: encode.c:7650
static void test_encodeCertToBeSigned(DWORD dwEncoding)
Definition: encode.c:3051
static void test_encodeBits(DWORD dwEncoding)
Definition: encode.c:2126
#define win_skip
Definition: test.h:141
static void test_encodePKCSSignerInfo(DWORD dwEncoding)
Definition: encode.c:6594
static void test_decodeCertPolicyConstraints(DWORD dwEncoding)
Definition: encode.c:7965

◆ strncmpW()

static int strncmpW ( const WCHAR str1,
const WCHAR str2,
int  n 
)
inlinestatic

Definition at line 1925 of file encode.c.

1926 {
1927  if (n <= 0) return 0;
1928  while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; }
1929  return *str1 - *str2;
1930 }
GLdouble n
Definition: glext.h:7729

Referenced by test_decodeUnicodeNameValue().

◆ test_decodeAltName()

static void test_decodeAltName ( DWORD  dwEncoding)
static

Definition at line 1565 of file encode.c.

1566 {
1567  static const BYTE unimplementedType[] = { 0x30, 0x06, 0x85, 0x04, 0x7f,
1568  0x00, 0x00, 0x01 };
1569  static const BYTE bogusType[] = { 0x30, 0x06, 0x89, 0x04, 0x7f, 0x00, 0x00,
1570  0x01 };
1571  static const BYTE dns_embedded_null[] = { 0x30,0x10,0x82,0x0e,0x66,0x6f,
1572  0x6f,0x2e,0x63,0x6f,0x6d,0x00,0x62,0x61,0x64,0x64,0x69,0x65 };
1573  static const BYTE dns_embedded_bell[] = { 0x30,0x10,0x82,0x0e,0x66,0x6f,
1574  0x6f,0x2e,0x63,0x6f,0x6d,0x07,0x62,0x61,0x64,0x64,0x69,0x65 };
1575  static const BYTE url_embedded_null[] = { 0x30,0x10,0x86,0x0e,0x66,0x6f,
1576  0x6f,0x2e,0x63,0x6f,0x6d,0x00,0x62,0x61,0x64,0x64,0x69,0x65 };
1577  BOOL ret;
1578  BYTE *buf = NULL;
1579  DWORD bufSize = 0;
1581 
1582  /* Test some bogus ones first */
1583  ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
1584  unimplementedType, sizeof(unimplementedType), CRYPT_DECODE_ALLOC_FLAG,
1585  NULL, &buf, &bufSize);
1586  ok(!ret && (GetLastError() == CRYPT_E_ASN1_BADTAG ||
1587  GetLastError() == OSS_DATA_ERROR /* Win9x */),
1588  "Expected CRYPT_E_ASN1_BADTAG or OSS_DATA_ERROR, got %08x\n",
1589  GetLastError());
1590  ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
1591  bogusType, sizeof(bogusType), CRYPT_DECODE_ALLOC_FLAG, NULL, &buf,
1592  &bufSize);
1594  GetLastError() == OSS_DATA_ERROR /* Win9x */),
1595  "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n",
1596  GetLastError());
1597  /* Now expected cases */
1598  ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, emptySequence,
1600  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1601  if (ret)
1602  {
1604 
1605  ok(info->cAltEntry == 0, "Expected 0 entries, got %d\n",
1606  info->cAltEntry);
1607  LocalFree(buf);
1608  }
1609  ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, emptyURL,
1611  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1612  if (ret)
1613  {
1615 
1616  ok(info->cAltEntry == 1, "Expected 1 entries, got %d\n",
1617  info->cAltEntry);
1618  ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_URL,
1619  "Expected CERT_ALT_NAME_URL, got %d\n",
1620  info->rgAltEntry[0].dwAltNameChoice);
1621  ok(U(info->rgAltEntry[0]).pwszURL == NULL || !*U(info->rgAltEntry[0]).pwszURL,
1622  "Expected empty URL\n");
1623  LocalFree(buf);
1624  }
1625  ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
1627  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1628  ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, encodedURL,
1630  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1631  if (ret)
1632  {
1634 
1635  ok(info->cAltEntry == 1, "Expected 1 entries, got %d\n",
1636  info->cAltEntry);
1637  ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_URL,
1638  "Expected CERT_ALT_NAME_URL, got %d\n",
1639  info->rgAltEntry[0].dwAltNameChoice);
1640  ok(!lstrcmpW(U(info->rgAltEntry[0]).pwszURL, url), "Unexpected URL\n");
1641  LocalFree(buf);
1642  }
1643  ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, encodedDnsName,
1645  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1646  if (ret)
1647  {
1649 
1650  ok(info->cAltEntry == 1, "Expected 1 entries, got %d\n",
1651  info->cAltEntry);
1652  ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_DNS_NAME,
1653  "Expected CERT_ALT_NAME_DNS_NAME, got %d\n",
1654  info->rgAltEntry[0].dwAltNameChoice);
1655  ok(!lstrcmpW(U(info->rgAltEntry[0]).pwszDNSName, dnsName),
1656  "Unexpected DNS name\n");
1657  LocalFree(buf);
1658  }
1659  ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, encodedIPAddr,
1661  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1662  if (ret)
1663  {
1665 
1666  ok(info->cAltEntry == 1, "Expected 1 entries, got %d\n",
1667  info->cAltEntry);
1668  ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_IP_ADDRESS,
1669  "Expected CERT_ALT_NAME_IP_ADDRESS, got %d\n",
1670  info->rgAltEntry[0].dwAltNameChoice);
1671  ok(U(info->rgAltEntry[0]).IPAddress.cbData == sizeof(localhost),
1672  "Unexpected IP address length %d\n",
1673  U(info->rgAltEntry[0]).IPAddress.cbData);
1674  ok(!memcmp(U(info->rgAltEntry[0]).IPAddress.pbData, localhost,
1675  sizeof(localhost)), "Unexpected IP address value\n");
1676  LocalFree(buf);
1677  }
1678  ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, encodedOidName,
1680  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1681  if (ret)
1682  {
1684 
1685  ok(info->cAltEntry == 1, "Expected 1 entries, got %d\n",
1686  info->cAltEntry);
1687  ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_REGISTERED_ID,
1688  "Expected CERT_ALT_NAME_REGISTERED_ID, got %d\n",
1689  info->rgAltEntry[0].dwAltNameChoice);
1690  ok(!strcmp(U(info->rgAltEntry[0]).pszRegisteredID, "1.2.3"),
1691  "Expected OID 1.2.3, got %s\n", U(info->rgAltEntry[0]).pszRegisteredID);
1692  LocalFree(buf);
1693  }
1694  ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
1697  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1698  if (ret)
1699  {
1701 
1702  ok(info->cAltEntry == 1, "Expected 1 entries, got %d\n",
1703  info->cAltEntry);
1704  ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_DIRECTORY_NAME,
1705  "Expected CERT_ALT_NAME_DIRECTORY_NAME, got %d\n",
1706  info->rgAltEntry[0].dwAltNameChoice);
1707  ok(U(info->rgAltEntry[0]).DirectoryName.cbData ==
1708  sizeof(encodedCommonName), "Unexpected directory name length %d\n",
1709  U(info->rgAltEntry[0]).DirectoryName.cbData);
1710  ok(!memcmp(U(info->rgAltEntry[0]).DirectoryName.pbData,
1712  "Unexpected directory name value\n");
1713  LocalFree(buf);
1714  }
1715  ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
1716  dns_embedded_null, sizeof(dns_embedded_null), CRYPT_DECODE_ALLOC_FLAG,
1717  NULL, &buf, &bufSize);
1718  /* Fails on WinXP with CRYPT_E_ASN1_RULE. I'm not too concerned about the
1719  * particular failure, just that it doesn't decode.
1720  * It succeeds on (broken) Windows versions that haven't addressed
1721  * embedded NULLs in alternate names.
1722  */
1723  ok(!ret || broken(ret), "expected failure\n");
1724  /* An embedded bell character is allowed, however. */
1725  ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
1726  dns_embedded_bell, sizeof(dns_embedded_bell), CRYPT_DECODE_ALLOC_FLAG,
1727  NULL, &buf, &bufSize);
1728  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1729  if (ret)
1730  {
1732 
1733  ok(info->cAltEntry == 1, "Expected 1 entries, got %d\n",
1734  info->cAltEntry);
1735  ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_DNS_NAME,
1736  "Expected CERT_ALT_NAME_DNS_NAME, got %d\n",
1737  info->rgAltEntry[0].dwAltNameChoice);
1738  LocalFree(buf);
1739  }
1740  ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
1741  url_embedded_null, sizeof(dns_embedded_null), CRYPT_DECODE_ALLOC_FLAG,
1742  NULL, &buf, &bufSize);
1743  /* Again, fails on WinXP with CRYPT_E_ASN1_RULE. I'm not too concerned
1744  * about the particular failure, just that it doesn't decode.
1745  * It succeeds on (broken) Windows versions that haven't addressed
1746  * embedded NULLs in alternate names.
1747  */
1748  ok(!ret || broken(ret), "expected failure\n");
1749 }
#define CRYPT_E_ASN1_BADTAG
Definition: winerror.h:3095
#define CRYPT_E_ASN1_CORRUPT
Definition: winerror.h:3087
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define CERT_ALT_NAME_DNS_NAME
Definition: wincrypt.h:347
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define CERT_ALT_NAME_DIRECTORY_NAME
Definition: wincrypt.h:349
static const WCHAR dnsName[]
Definition: encode.c:1439
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static const BYTE encodedDirectoryName[]
Definition: encode.c:1448
#define CERT_ALT_NAME_URL
Definition: wincrypt.h:351
#define U(x)
Definition: wordpad.c:44
static const BYTE localhost[]
Definition: encode.c:1442
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static const BYTE emptySequence[]
Definition: encode.c:676
struct _test_info info[]
Definition: SetCursorPos.c:19
GLuint GLsizei bufSize
Definition: glext.h:6040
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static const BYTE emptyURLExtraBytes[]
Definition: encode.c:1431
static const BYTE emptyURL[]
Definition: encode.c:1430
#define ok(value,...)
Definition: CComObject.cpp:34
static const BYTE encodedURL[]
Definition: encode.c:1434
static const WCHAR url[]
Definition: encode.c:1432
unsigned long DWORD
Definition: ntddk_ex.h:95
static const BYTE encodedDnsName[]
Definition: encode.c:1440
int ret
#define OSS_DATA_ERROR
Definition: winerror.h:3042
unsigned char BYTE
Definition: mem.h:68
#define broken(x)
Definition: _sntprintf.h:21
#define CERT_ALT_NAME_IP_ADDRESS
Definition: wincrypt.h:352
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
static const BYTE encodedOidName[]
Definition: encode.c:1447
static const unsigned char encodedCommonName[]
Definition: encode.c:1445
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define X509_ALTERNATE_NAME
Definition: wincrypt.h:3377
#define CERT_ALT_NAME_REGISTERED_ID
Definition: wincrypt.h:353
static const BYTE encodedIPAddr[]
Definition: encode.c:1443

Referenced by START_TEST().

◆ test_decodeAuthorityInfoAccess()

static void test_decodeAuthorityInfoAccess ( DWORD  dwEncoding)
static

Definition at line 5325 of file encode.c.

5326 {
5327  static char oid1[] = "1.2.3";
5328  static char oid2[] = "1.5.6";
5329  BOOL ret;
5330  LPBYTE buf = NULL;
5331  DWORD size = 0;
5332 
5333  ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS,
5335  &buf, &size);
5336  ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
5337  if (ret)
5338  {
5340 
5341  compareAuthorityInfoAccess("empty AIA", &aia,
5343  LocalFree(buf);
5344  buf = NULL;
5345  }
5346  ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS,
5349  ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
5350  if (ret)
5351  {
5352  CERT_ACCESS_DESCRIPTION accessDescription;
5354 
5355  accessDescription.pszAccessMethod = oid1;
5356  accessDescription.AccessLocation.dwAltNameChoice = CERT_ALT_NAME_URL;
5357  U(accessDescription.AccessLocation).pwszURL = (LPWSTR)url;
5358  aia.cAccDescr = 1;
5359  aia.rgAccDescr = &accessDescription;
5360  compareAuthorityInfoAccess("AIA with URL", &aia,
5362  LocalFree(buf);
5363  buf = NULL;
5364  }
5365  ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS,
5368  NULL, &buf, &size);
5369  ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
5370  if (ret)
5371  {
5372  CERT_ACCESS_DESCRIPTION accessDescription[2];
5374 
5375  accessDescription[0].pszAccessMethod = oid1;
5376  accessDescription[0].AccessLocation.dwAltNameChoice = CERT_ALT_NAME_URL;
5377  U(accessDescription[0].AccessLocation).pwszURL = (LPWSTR)url;
5378  accessDescription[1].pszAccessMethod = oid2;
5379  accessDescription[1].AccessLocation.dwAltNameChoice =
5381  U(accessDescription[1].AccessLocation).IPAddress.cbData =
5382  sizeof(encodedIPAddr);
5383  U(accessDescription[1].AccessLocation).IPAddress.pbData =
5385  aia.cAccDescr = 2;
5386  aia.rgAccDescr = accessDescription;
5387  compareAuthorityInfoAccess("AIA with URL and IP addr", &aia,
5389  LocalFree(buf);
5390  buf = NULL;
5391  }
5392  ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS,
5395  ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
5397  if (buf)
5398  {
5399  ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS,
5402  ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
5403  HeapFree(GetProcessHeap(), 0, buf);
5404  }
5405 }
DWORD dwAltNameChoice
Definition: wincrypt.h:333
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define CERT_ALT_NAME_URL
Definition: wincrypt.h:351
#define U(x)
Definition: wordpad.c:44
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static const BYTE emptySequence[]
Definition: encode.c:676
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
#define X509_AUTHORITY_INFO_ACCESS
Definition: wincrypt.h:3399
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static const WCHAR url[]
Definition: encode.c:1432
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
CERT_ALT_NAME_ENTRY AccessLocation
Definition: wincrypt.h:470
static void compareAuthorityInfoAccess(LPCSTR header, const CERT_AUTHORITY_INFO_ACCESS *expected, const CERT_AUTHORITY_INFO_ACCESS *got)
Definition: encode.c:5305
#define CERT_ALT_NAME_IP_ADDRESS
Definition: wincrypt.h:352
static const BYTE authorityInfoAccessWithUrl[]
Definition: encode.c:5222
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static WCHAR aia[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1601
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
static const BYTE authorityInfoAccessWithUrlAndIPAddr[]
Definition: encode.c:5225
static char oid1[]
Definition: encode.c:7583
static const BYTE encodedIPAddr[]
Definition: encode.c:1443

Referenced by START_TEST().

◆ test_decodeAuthorityKeyId()

static void test_decodeAuthorityKeyId ( DWORD  dwEncoding)
static

Definition at line 4987 of file encode.c.

4988 {
4989  BOOL ret;
4990  LPBYTE buf = NULL;
4991  DWORD size = 0;
4992 
4993  ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID,
4995  &buf, &size);
4996  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
4997  if (ret)
4998  {
5000 
5001  ok(size >= sizeof(CERT_AUTHORITY_KEY_ID_INFO), "Unexpected size %d\n",
5002  size);
5003  ok(info->KeyId.cbData == 0, "Expected no key id\n");
5004  ok(info->CertIssuer.cbData == 0, "Expected no issuer name\n");
5005  ok(info->CertSerialNumber.cbData == 0, "Expected no serial number\n");
5006  LocalFree(buf);
5007  }
5008  ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID,
5011  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5012  if (ret)
5013  {
5015 
5016  ok(size >= sizeof(CERT_AUTHORITY_KEY_ID_INFO), "Unexpected size %d\n",
5017  size);
5018  ok(info->KeyId.cbData == sizeof(keyId), "Unexpected key id len\n");
5019  ok(!memcmp(info->KeyId.pbData, keyId, sizeof(keyId)),
5020  "Unexpected key id\n");
5021  ok(info->CertIssuer.cbData == 0, "Expected no issuer name\n");
5022  ok(info->CertSerialNumber.cbData == 0, "Expected no serial number\n");
5023  LocalFree(buf);
5024  }
5025  ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID,
5028  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5029  if (ret)
5030  {
5032 
5033  ok(size >= sizeof(CERT_AUTHORITY_KEY_ID_INFO), "Unexpected size %d\n",
5034  size);
5035  ok(info->KeyId.cbData == 0, "Expected no key id\n");
5036  ok(info->CertIssuer.cbData == sizeof(encodedCommonName),
5037  "Unexpected issuer len\n");
5038  ok(!memcmp(info->CertIssuer.pbData, encodedCommonName,
5039  sizeof(encodedCommonName)), "Unexpected issuer\n");
5040  ok(info->CertSerialNumber.cbData == 0, "Expected no serial number\n");
5041  LocalFree(buf);
5042  }
5043  ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID,
5046  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5047  if (ret)
5048  {
5050 
5051  ok(size >= sizeof(CERT_AUTHORITY_KEY_ID_INFO), "Unexpected size %d\n",
5052  size);
5053  ok(info->KeyId.cbData == 0, "Expected no key id\n");
5054  ok(info->CertIssuer.cbData == 0, "Expected no issuer name\n");
5055  ok(info->CertSerialNumber.cbData == sizeof(serialNum),
5056  "Unexpected serial number len\n");
5057  ok(!memcmp(info->CertSerialNumber.pbData, serialNum, sizeof(serialNum)),
5058  "Unexpected serial number\n");
5059  LocalFree(buf);
5060  }
5061 }
static const BYTE authorityKeyIdWithSerial[]
Definition: encode.c:4926
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static BYTE keyId[]
Definition: encode.c:4920
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static const BYTE emptySequence[]
Definition: encode.c:676
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define X509_AUTHORITY_KEY_ID
Definition: wincrypt.h:3374
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
static const BYTE serialNum[]
Definition: encode.c:3049
static const unsigned char encodedCommonName[]
Definition: encode.c:1445
static const BYTE authorityKeyIdWithIssuer[]
Definition: encode.c:4923
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
static const BYTE authorityKeyIdWithId[]
Definition: encode.c:4921

Referenced by START_TEST().

◆ test_decodeAuthorityKeyId2()

static void test_decodeAuthorityKeyId2 ( DWORD  dwEncoding)
static

Definition at line 5136 of file encode.c.

5137 {
5138  BOOL ret;
5139  LPBYTE buf = NULL;
5140  DWORD size = 0;
5141 
5142  ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID2,
5144  &buf, &size);
5145  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5146  if (ret)
5147  {
5149 
5150  ok(size >= sizeof(CERT_AUTHORITY_KEY_ID2_INFO), "Unexpected size %d\n",
5151  size);
5152  ok(info->KeyId.cbData == 0, "Expected no key id\n");
5153  ok(info->AuthorityCertIssuer.cAltEntry == 0,
5154  "Expected no issuer name entries\n");
5155  ok(info->AuthorityCertSerialNumber.cbData == 0,
5156  "Expected no serial number\n");
5157  LocalFree(buf);
5158  }
5159  ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID2,
5162  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5163  if (ret)
5164  {
5166 
5167  ok(size >= sizeof(CERT_AUTHORITY_KEY_ID2_INFO), "Unexpected size %d\n",
5168  size);
5169  ok(info->KeyId.cbData == sizeof(keyId), "Unexpected key id len\n");
5170  ok(!memcmp(info->KeyId.pbData, keyId, sizeof(keyId)),
5171  "Unexpected key id\n");
5172  ok(info->AuthorityCertIssuer.cAltEntry == 0,
5173  "Expected no issuer name entries\n");
5174  ok(info->AuthorityCertSerialNumber.cbData == 0,
5175  "Expected no serial number\n");
5176  LocalFree(buf);
5177  }
5178  ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID2,
5181  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5182  if (ret)
5183  {
5185 
5186  ok(size >= sizeof(CERT_AUTHORITY_KEY_ID2_INFO), "Unexpected size %d\n",
5187  size);
5188  ok(info->KeyId.cbData == 0, "Expected no key id\n");
5189  ok(info->AuthorityCertIssuer.cAltEntry == 1,
5190  "Expected 1 issuer entry, got %d\n",
5191  info->AuthorityCertIssuer.cAltEntry);
5192  ok(info->AuthorityCertIssuer.rgAltEntry[0].dwAltNameChoice ==
5193  CERT_ALT_NAME_URL, "Expected CERT_ALT_NAME_URL, got %d\n",
5194  info->AuthorityCertIssuer.rgAltEntry[0].dwAltNameChoice);
5195  ok(!lstrcmpW(U(info->AuthorityCertIssuer.rgAltEntry[0]).pwszURL,
5196  url), "Unexpected URL\n");
5197  ok(info->AuthorityCertSerialNumber.cbData == 0,
5198  "Expected no serial number\n");
5199  LocalFree(buf);
5200  }
5201  ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID2,
5204  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5205  if (ret)
5206  {
5208 
5209  ok(size >= sizeof(CERT_AUTHORITY_KEY_ID2_INFO), "Unexpected size %d\n",
5210  size);
5211  ok(info->KeyId.cbData == 0, "Expected no key id\n");
5212  ok(info->AuthorityCertIssuer.cAltEntry == 0,
5213  "Expected no issuer name entries\n");
5214  ok(info->AuthorityCertSerialNumber.cbData == sizeof(serialNum),
5215  "Unexpected serial number len\n");
5216  ok(!memcmp(info->AuthorityCertSerialNumber.pbData, serialNum,
5217  sizeof(serialNum)), "Unexpected serial number\n");
5218  LocalFree(buf);
5219  }
5220 }
static const BYTE authorityKeyIdWithSerial[]
Definition: encode.c:4926
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static BYTE keyId[]
Definition: encode.c:4920
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static const BYTE authorityKeyIdWithIssuerUrl[]
Definition: encode.c:5063
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define CERT_ALT_NAME_URL
Definition: wincrypt.h:351
#define U(x)
Definition: wordpad.c:44
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static const BYTE emptySequence[]
Definition: encode.c:676
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
GLsizeiptr size
Definition: glext.h:5919
static const WCHAR url[]
Definition: encode.c:1432
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
static const BYTE serialNum[]
Definition: encode.c:3049
#define X509_AUTHORITY_KEY_ID2
Definition: wincrypt.h:3398
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
static const BYTE authorityKeyIdWithId[]
Definition: encode.c:4921

Referenced by START_TEST().

◆ test_decodeBasicConstraints()

static void test_decodeBasicConstraints ( DWORD  dwEncoding)
static

Definition at line 2304 of file encode.c.

2305 {
2306  static const BYTE inverted[] = { 0x30, 0x06, 0x02, 0x01, 0x01, 0x01, 0x01,
2307  0xff };
2308  static const struct Constraints2 badBool = { { TRUE, TRUE, 1 }, bin63 };
2309  DWORD i;
2310  BOOL ret;
2311  BYTE *buf = NULL;
2312  DWORD bufSize = 0;
2313 
2314  /* First test with simpler info2 */
2315  for (i = 0; i < ARRAY_SIZE(constraints2); i++)
2316  {
2317  ret = pCryptDecodeObjectEx(dwEncoding, X509_BASIC_CONSTRAINTS2,
2320  ok(ret, "CryptDecodeObjectEx failed for item %d: %08x\n", i,
2321  GetLastError());
2322  if (ret)
2323  {
2326 
2327  ok(!memcmp(info, &constraints2[i].info, sizeof(*info)),
2328  "Unexpected value for item %d\n", i);
2329  LocalFree(buf);
2330  }
2331  }
2332  /* Check with the order of encoded elements inverted */
2333  buf = (PBYTE)1;
2334  ret = pCryptDecodeObjectEx(dwEncoding, X509_BASIC_CONSTRAINTS2,
2335  inverted, inverted[1] + 2, CRYPT_DECODE_ALLOC_FLAG, NULL, &buf,
2336  &bufSize);
2338  GetLastError() == OSS_DATA_ERROR /* Win9x */),
2339  "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n",
2340  GetLastError());
2341  ok(!buf, "Expected buf to be set to NULL\n");
2342  /* Check with a non-DER bool */
2343  ret = pCryptDecodeObjectEx(dwEncoding, X509_BASIC_CONSTRAINTS2,
2344  badBool.encoded, badBool.encoded[1] + 2, CRYPT_DECODE_ALLOC_FLAG, NULL,
2345  &buf, &bufSize);
2346  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2347  if (ret)
2348  {
2351 
2352  ok(!memcmp(info, &badBool.info, sizeof(*info)), "Unexpected value\n");
2353  LocalFree(buf);
2354  }
2355  /* Check with a non-basic constraints value */
2356  ret = pCryptDecodeObjectEx(dwEncoding, X509_BASIC_CONSTRAINTS2,
2360  GetLastError() == OSS_DATA_ERROR /* Win9x */),
2361  "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n",
2362  GetLastError());
2363  /* Now check with the more complex CERT_BASIC_CONSTRAINTS_INFO */
2364  ret = pCryptDecodeObjectEx(dwEncoding, X509_BASIC_CONSTRAINTS,
2366  &buf, &bufSize);
2367  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2368  if (ret)
2369  {
2371 
2372  ok(info->SubjectType.cbData == 0, "Expected no subject type\n");
2373  ok(!info->fPathLenConstraint, "Expected no path length constraint\n");
2374  ok(info->cSubtreesConstraint == 0, "Expected no subtree constraints\n");
2375  LocalFree(buf);
2376  }
2377  ret = pCryptDecodeObjectEx(dwEncoding, X509_BASIC_CONSTRAINTS,
2380  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2381  if (ret)
2382  {
2384 
2385  ok(info->SubjectType.cbData == 0, "Expected no subject type\n");
2386  ok(!info->fPathLenConstraint, "Expected no path length constraint\n");
2387  ok(info->cSubtreesConstraint == 1, "Expected a subtree constraint\n");
2388  if (info->cSubtreesConstraint && info->rgSubtreesConstraint)
2389  {
2390  ok(info->rgSubtreesConstraint[0].cbData ==
2391  sizeof(encodedDomainName), "Wrong size %d\n",
2392  info->rgSubtreesConstraint[0].cbData);
2393  ok(!memcmp(info->rgSubtreesConstraint[0].pbData, encodedDomainName,
2394  sizeof(encodedDomainName)), "Unexpected value\n");
2395  }
2396  LocalFree(buf);
2397  }
2398 }
#define CRYPT_E_ASN1_CORRUPT
Definition: winerror.h:3087
static const BYTE emptyConstraint[]
Definition: encode.c:2231
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static const BYTE encodedDomainName[]
Definition: encode.c:2232
static const unsigned char bin63[]
Definition: encode.c:2302
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static const struct Constraints2 constraints2[]
Definition: encode.c:2218
GLuint GLsizei bufSize
Definition: glext.h:6040
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 X509_BASIC_CONSTRAINTS2
Definition: wincrypt.h:3380
smooth NULL
Definition: ftsmooth.c:416
static const BYTE constraintWithDomainName[]
Definition: encode.c:2236
#define ok(value,...)
Definition: CComObject.cpp:34
CERT_BASIC_CONSTRAINTS2_INFO info
Definition: encode.c:2210
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define OSS_DATA_ERROR
Definition: winerror.h:3042
unsigned char BYTE
Definition: mem.h:68
const BYTE * encoded
Definition: encode.c:2211
#define X509_BASIC_CONSTRAINTS
Definition: wincrypt.h:3378
#define ARRAY_SIZE(a)
Definition: main.h:24
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
static const unsigned char encodedCommonName[]
Definition: encode.c:1445
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
BYTE * PBYTE
Definition: pedump.c:66

Referenced by START_TEST().

◆ test_decodeBits()

static void test_decodeBits ( DWORD  dwEncoding)
static

Definition at line 2155 of file encode.c.

2156 {
2157  static const BYTE ber[] = "\x03\x02\x01\xff";
2158  static const BYTE berDecoded = 0xfe;
2159  DWORD i;
2160  BOOL ret;
2161  BYTE *buf = NULL;
2162  DWORD bufSize = 0;
2163 
2164  /* normal cases */
2165  for (i = 0; i < ARRAY_SIZE(bits); i++)
2166  {
2167  ret = pCryptDecodeObjectEx(dwEncoding, X509_BITS, bits[i].encoded,
2169  &bufSize);
2170  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2171  if (ret)
2172  {
2174 
2175  ok(bufSize >= sizeof(CRYPT_BIT_BLOB) + bits[i].cbDecoded,
2176  "Got unexpected size %d\n", bufSize);
2177  blob = (CRYPT_BIT_BLOB *)buf;
2178  ok(blob->cbData == bits[i].cbDecoded,
2179  "Got unexpected length %d, expected %d\n", blob->cbData,
2180  bits[i].cbDecoded);
2181  if (blob->cbData && bits[i].cbDecoded)
2182  ok(!memcmp(blob->pbData, bits[i].decoded, bits[i].cbDecoded),
2183  "Unexpected value\n");
2184  LocalFree(buf);
2185  }
2186  }
2187  /* special case: check that something that's valid in BER but not in DER
2188  * decodes successfully
2189  */
2190  ret = pCryptDecodeObjectEx(dwEncoding, X509_BITS, ber, ber[1] + 2,
2192  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2193  if (ret)
2194  {
2196 
2197  ok(bufSize >= sizeof(CRYPT_BIT_BLOB) + sizeof(berDecoded),
2198  "Got unexpected size %d\n", bufSize);
2199  blob = (CRYPT_BIT_BLOB *)buf;
2200  ok(blob->cbData == sizeof(berDecoded),
2201  "Got unexpected length %d\n", blob->cbData);
2202  if (blob->cbData)
2203  ok(*blob->pbData == berDecoded, "Unexpected value\n");
2204  LocalFree(buf);
2205  }
2206 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: image.c:133
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
GLuint GLsizei bufSize
Definition: glext.h:6040
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 ok(value,...)
Definition: CComObject.cpp:34
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
unsigned char BYTE
Definition: mem.h:68
const BYTE * encoded
Definition: encode.c:2211
#define ARRAY_SIZE(a)
Definition: main.h:24
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define X509_BITS
Definition: wincrypt.h:3392

Referenced by START_TEST().

◆ test_decodeCert()

static void test_decodeCert ( DWORD  dwEncoding)
static

Definition at line 3463 of file encode.c.

3464 {
3465  BOOL ret;
3466  BYTE *buf = NULL;
3467  DWORD size = 0;
3468 
3469  ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT, signedBigCert,
3471  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3472  if (ret)
3473  {
3475 
3476  ok(info->ToBeSigned.cbData == sizeof(bigCert),
3477  "Wrong cert size %d\n", info->ToBeSigned.cbData);
3478  ok(!memcmp(info->ToBeSigned.pbData, bigCert, info->ToBeSigned.cbData),
3479  "Unexpected cert\n");
3480  ok(info->Signature.cbData == sizeof(hash),
3481  "Wrong signature size %d\n", info->Signature.cbData);
3482  ok(!memcmp(info->Signature.pbData, hash, info->Signature.cbData),
3483  "Unexpected signature\n");
3484  LocalFree(buf);
3485  }
3486  /* A signed cert decodes as a CERT_INFO too */
3487  ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, signedBigCert,
3489  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3490  if (ret)
3491  {
3492  CERT_INFO *info = (CERT_INFO *)buf;
3493 
3494  ok(size >= sizeof(CERT_INFO), "Wrong size %d\n", size);
3495  ok(info->SerialNumber.cbData == 1,
3496  "Expected serial number size 1, got %d\n", info->SerialNumber.cbData);
3497  ok(*info->SerialNumber.pbData == *serialNum,
3498  "Expected serial number %d, got %d\n", *serialNum,
3499  *info->SerialNumber.pbData);
3500  ok(info->Issuer.cbData == sizeof(encodedCommonName),
3501  "Wrong size %d\n", info->Issuer.cbData);
3502  ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
3503  "Unexpected issuer\n");
3504  ok(info->Subject.cbData == sizeof(encodedCommonName),
3505  "Wrong size %d\n", info->Subject.cbData);
3506  ok(!memcmp(info->Subject.pbData, encodedCommonName,
3507  info->Subject.cbData), "Unexpected subject\n");
3508  LocalFree(buf);
3509  }
3510  ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, signedBigCertWithIndefiniteSeq,
3512  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3513  if (ret)
3514  {
3515  CERT_INFO *info = (CERT_INFO *)buf;
3516 
3517  ok(size >= sizeof(CERT_INFO), "Wrong size %d\n", size);
3518  ok(info->SerialNumber.cbData == 1,
3519  "Expected serial number size 1, got %d\n", info->SerialNumber.cbData);
3520  ok(*info->SerialNumber.pbData == *serialNum,
3521  "Expected serial number %d, got %d\n", *serialNum,
3522  *info->SerialNumber.pbData);
3523  ok(info->Issuer.cbData == sizeof(encodedCommonName),
3524  "Wrong size %d\n", info->Issuer.cbData);
3525  ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
3526  "Unexpected issuer\n");
3527  ok(info->Subject.cbData == sizeof(encodedCommonName),
3528  "Wrong size %d\n", info->Subject.cbData);
3529  ok(!memcmp(info->Subject.pbData, encodedCommonName,
3530  info->Subject.cbData), "Unexpected subject\n");
3531  LocalFree(buf);
3532  }
3533 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static const BYTE signedBigCert[]
Definition: encode.c:3368
static const BYTE bigCert[]
Definition: encode.c:2976
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
#define X509_CERT_TO_BE_SIGNED
Definition: wincrypt.h:3366
int ret
unsigned char BYTE
Definition: mem.h:68
static const BYTE signedBigCertWithIndefiniteSeq[]
Definition: encode.c:3403
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
static const BYTE serialNum[]
Definition: encode.c:3049
#define X509_CERT
Definition: wincrypt.h:3365
static const unsigned char encodedCommonName[]
Definition: encode.c:1445
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
Definition: _hash_fun.h:40

Referenced by START_TEST().

◆ test_decodeCertPolicies()

static void test_decodeCertPolicies ( DWORD  dwEncoding)
static

Definition at line 7650 of file encode.c.

7651 {
7652  BOOL ret;
7654  DWORD size;
7655 
7656  ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_POLICIES,
7658  &info, &size);
7659  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7660  if (ret)
7661  {
7662  ok(info->cPolicyInfo == 0, "unexpected policy info %d\n",
7663  info->cPolicyInfo);
7664  LocalFree(info);
7665  }
7666  ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_POLICIES,
7669  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7670  if (ret)
7671  {
7672  ok(info->cPolicyInfo == 1, "unexpected policy info %d\n",
7673  info->cPolicyInfo);
7674  ok(!strcmp(info->rgPolicyInfo[0].pszPolicyIdentifier, oid_any_policy),
7675  "unexpected policy id %s\n",
7676  info->rgPolicyInfo[0].pszPolicyIdentifier);
7677  ok(info->rgPolicyInfo[0].cPolicyQualifier == 0,
7678  "unexpected policy qualifier count %d\n",
7679  info->rgPolicyInfo[0].cPolicyQualifier);
7680  LocalFree(info);
7681  }
7682  ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_POLICIES,
7683  twoPolicies, sizeof(twoPolicies),
7685  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7686  if (ret)
7687  {
7688  ok(info->cPolicyInfo == 2, "unexpected policy info %d\n",
7689  info->cPolicyInfo);
7690  ok(!strcmp(info->rgPolicyInfo[0].pszPolicyIdentifier, oid_any_policy),
7691  "unexpected policy id %s\n",
7692  info->rgPolicyInfo[0].pszPolicyIdentifier);
7693  ok(info->rgPolicyInfo[0].cPolicyQualifier == 0,
7694  "unexpected policy qualifier count %d\n",
7695  info->rgPolicyInfo[0].cPolicyQualifier);
7696  ok(!strcmp(info->rgPolicyInfo[1].pszPolicyIdentifier, oid1),
7697  "unexpected policy id %s\n",
7698  info->rgPolicyInfo[1].pszPolicyIdentifier);
7699  ok(info->rgPolicyInfo[1].cPolicyQualifier == 1,
7700  "unexpected policy qualifier count %d\n",
7701  info->rgPolicyInfo[1].cPolicyQualifier);
7702  ok(!strcmp(
7703  info->rgPolicyInfo[1].rgPolicyQualifier[0].pszPolicyQualifierId,
7704  oid_user_notice), "unexpected policy qualifier id %s\n",
7705  info->rgPolicyInfo[1].rgPolicyQualifier[0].pszPolicyQualifierId);
7706  ok(info->rgPolicyInfo[1].rgPolicyQualifier[0].Qualifier.cbData ==
7707  sizeof(noticeWithReference), "unexpected qualifier size %d\n",
7708  info->rgPolicyInfo[1].rgPolicyQualifier[0].Qualifier.cbData);
7709  ok(!memcmp(
7710  info->rgPolicyInfo[1].rgPolicyQualifier[0].Qualifier.pbData,
7712  "unexpected qualifier value\n");
7713  LocalFree(info);
7714  }
7715  ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_POLICIES,
7716  twoPolicies, sizeof(twoPolicies), 0, NULL, NULL, &size);
7717  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7719  if (info)
7720  {
7721  ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_POLICIES,
7722  twoPolicies, sizeof(twoPolicies), 0, NULL, info, &size);
7723  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7724  HeapFree(GetProcessHeap(), 0, info);
7725  }
7726 }
static char oid_any_policy[]
Definition: encode.c:7579
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static const BYTE policiesWithAnyPolicy[]
Definition: encode.c:7580
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static const BYTE emptySequence[]
Definition: encode.c:676
struct _test_info info[]
Definition: SetCursorPos.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
#define X509_CERT_POLICIES
Definition: wincrypt.h:3381
smooth NULL
Definition: ftsmooth.c:416
static BYTE noticeWithReference[]
Definition: encode.c:7458
#define ok(value,...)
Definition: CComObject.cpp:34
static char oid_user_notice[]
Definition: encode.c:7584
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
static const BYTE twoPolicies[]
Definition: encode.c:7585
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define HeapFree(x, y, z)
Definition: compat.h:394
static char oid1[]
Definition: encode.c:7583

Referenced by START_TEST().

◆ test_decodeCertPolicyConstraints()

static void test_decodeCertPolicyConstraints ( DWORD  dwEncoding)
static

Definition at line 7965 of file encode.c.

7966 {
7968  DWORD size;
7969  BOOL ret;
7970 
7971  /* Again, even though CAs must not issue such constraints, they can be
7972  * decoded.
7973  */
7974  ret = pCryptDecodeObjectEx(dwEncoding, X509_POLICY_CONSTRAINTS,
7976  &info, &size);
7978  "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7979  if (!ret && GetLastError() == ERROR_FILE_NOT_FOUND)
7980  {
7981  win_skip("no policy mappings support\n");
7982  return;
7983  }
7984  if (ret)
7985  {
7986  ok(!info->fRequireExplicitPolicy,
7987  "expected require explicit = FALSE\n");
7988  ok(!info->fInhibitPolicyMapping,
7989  "expected implicit mapping = FALSE\n");
7990  LocalFree(info);
7991  }
7992  ret = pCryptDecodeObjectEx(dwEncoding, X509_POLICY_CONSTRAINTS,
7995  NULL, &info, &size);
7996  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7997  if (ret)
7998  {
7999  ok(info->fRequireExplicitPolicy,
8000  "expected require explicit = TRUE\n");
8001  ok(info->dwRequireExplicitPolicySkipCerts == 0, "expected 0, got %d\n",
8002  info->dwRequireExplicitPolicySkipCerts);
8003  ok(!info->fInhibitPolicyMapping,
8004  "expected implicit mapping = FALSE\n");
8005  LocalFree(info);
8006  }
8007  ret = pCryptDecodeObjectEx(dwEncoding, X509_POLICY_CONSTRAINTS,
8010  NULL, &info, &size);
8011  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
8012  if (ret)
8013  {
8014  ok(!info->fRequireExplicitPolicy,
8015  "expected require explicit = FALSE\n");
8016  ok(info->fInhibitPolicyMapping,
8017  "expected implicit mapping = TRUE\n");
8018  ok(info->dwInhibitPolicyMappingSkipCerts == 1, "expected 1, got %d\n",
8019  info->dwInhibitPolicyMappingSkipCerts);
8020  LocalFree(info);
8021  }
8022  ret = pCryptDecodeObjectEx(dwEncoding, X509_POLICY_CONSTRAINTS,
8025  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
8026  if (ret)
8027  {
8028  ok(info->fRequireExplicitPolicy,
8029  "expected require explicit = TRUE\n");
8030  ok(info->dwRequireExplicitPolicySkipCerts == 1, "expected 1, got %d\n",
8031  info->dwRequireExplicitPolicySkipCerts);
8032  ok(info->fInhibitPolicyMapping,
8033  "expected implicit mapping = TRUE\n");
8034  ok(info->dwInhibitPolicyMappingSkipCerts == 1, "expected 1, got %d\n",
8035  info->dwInhibitPolicyMappingSkipCerts);
8036  LocalFree(info);
8037  }
8038 }
#define X509_POLICY_CONSTRAINTS
Definition: wincrypt.h:3427
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static const BYTE emptySequence[]
Definition: encode.c:676
struct _test_info info[]
Definition: SetCursorPos.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static const BYTE policyConstraintsWithInhibitMapping[]
Definition: encode.c:7887
static const BYTE policyConstraintsWithBoth[]
Definition: encode.c:7889
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define ok(value,...)
Definition: CComObject.cpp:34
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
static const BYTE policyConstraintsWithRequireExplicit[]
Definition: encode.c:7885
int ret
#define broken(x)
Definition: _sntprintf.h:21
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_decodeCertPolicyMappings()

static void test_decodeCertPolicyMappings ( DWORD  dwEncoding)
static

Definition at line 7806 of file encode.c.

7807 {
7808  DWORD size, i;
7810  BOOL ret;
7811 
7812  /* Each of the mapping OIDs is equivalent, so check with all of them */
7813  for (i = 0; i < ARRAY_SIZE(mappingOids); i++)
7814  {
7815  ret = pCryptDecodeObjectEx(dwEncoding, mappingOids[i],
7817  &info, &size);
7819  "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7820  if (!ret && GetLastError() == ERROR_FILE_NOT_FOUND)
7821  {
7822  win_skip("no policy mappings support\n");
7823  return;
7824  }
7825  if (ret)
7826  {
7827  ok(info->cPolicyMapping == 0,
7828  "expected 0 policy mappings, got %d\n", info->cPolicyMapping);
7829  LocalFree(info);
7830  }
7831  ret = pCryptDecodeObjectEx(dwEncoding, mappingOids[i],
7834  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7835  if (ret)
7836  {
7837  ok(info->cPolicyMapping == 1,
7838  "expected 1 policy mappings, got %d\n", info->cPolicyMapping);
7839  ok(!strcmp(info->rgPolicyMapping[0].pszIssuerDomainPolicy, "1.2.3"),
7840  "unexpected issuer policy %s\n",
7841  info->rgPolicyMapping[0].pszIssuerDomainPolicy);
7842  ok(!strcmp(info->rgPolicyMapping[0].pszSubjectDomainPolicy,
7843  "2.3.4"), "unexpected subject policy %s\n",
7844  info->rgPolicyMapping[0].pszSubjectDomainPolicy);
7845  LocalFree(info);
7846  }
7847  ret = pCryptDecodeObjectEx(dwEncoding, mappingOids[i],
7850  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7851  if (ret)
7852  {
7853  ok(info->cPolicyMapping == 2,
7854  "expected 2 policy mappings, got %d\n", info->cPolicyMapping);
7855  ok(!strcmp(info->rgPolicyMapping[0].pszIssuerDomainPolicy, "1.2.3"),
7856  "unexpected issuer policy %s\n",
7857  info->rgPolicyMapping[0].pszIssuerDomainPolicy);
7858  ok(!strcmp(info->rgPolicyMapping[0].pszSubjectDomainPolicy,
7859  "2.3.4"), "unexpected subject policy %s\n",
7860  info->rgPolicyMapping[0].pszSubjectDomainPolicy);
7861  ok(!strcmp(info->rgPolicyMapping[1].pszIssuerDomainPolicy, "1.3.4"),
7862  "unexpected issuer policy %s\n",
7863  info->rgPolicyMapping[1].pszIssuerDomainPolicy);
7864  ok(!strcmp(info->rgPolicyMapping[1].pszSubjectDomainPolicy,
7865  "2.5.6"), "unexpected subject policy %s\n",
7866  info->rgPolicyMapping[1].pszSubjectDomainPolicy);
7867  LocalFree(info);
7868  }
7869  ret = pCryptDecodeObjectEx(dwEncoding, mappingOids[i],
7871  NULL, NULL, &size);
7872  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7874  if (info)
7875  {
7876  ret = pCryptDecodeObjectEx(dwEncoding, mappingOids[i],
7878  NULL, info, &size);
7879  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7880  HeapFree(GetProcessHeap(), 0, info);
7881  }
7882  }
7883 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static const BYTE emptySequence[]
Definition: encode.c:676
struct _test_info info[]
Definition: SetCursorPos.c:19
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 const BYTE policyMappingWithTwoMappings[]
Definition: encode.c:7730
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define ok(value,...)
Definition: CComObject.cpp:34
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static const LPCSTR mappingOids[]
Definition: encode.c:7733
#define broken(x)
Definition: _sntprintf.h:21
#define ARRAY_SIZE(a)
Definition: main.h:24
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static const BYTE policyMappingWithOneMapping[]
Definition: encode.c:7728
#define win_skip
Definition: test.h:141
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by START_TEST().

◆ test_decodeCertToBeSigned()

static void test_decodeCertToBeSigned ( DWORD  dwEncoding)
static

Definition at line 3235 of file encode.c.

3236 {
3237  static const BYTE *corruptCerts[] = { v1Cert, v2Cert, v3Cert, v4Cert,
3239  BOOL ret;
3240  BYTE *buf = NULL;
3241  DWORD size = 0, i;
3242 
3243  /* Test with NULL pbEncoded */
3244  ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, NULL, 0,
3246  ok(!ret && (GetLastError() == CRYPT_E_ASN1_EOD ||
3247  GetLastError() == OSS_BAD_ARG /* Win9x */),
3248  "Expected CRYPT_E_ASN1_EOD or OSS_BAD_ARG, got %08x\n", GetLastError());
3249  if (0)
3250  {
3251  /* Crashes on win9x */
3252  ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, NULL, 1,
3255  "Expected STATUS_ACCESS_VIOLATION, got %08x\n", GetLastError());
3256  }
3257  /* The following certs all fail with CRYPT_E_ASN1_CORRUPT or
3258  * CRYPT_E_ASN1_BADTAG, because at a minimum a cert must have a non-zero
3259  * serial number, an issuer, a subject, and a public key.
3260  */
3261  for (i = 0; i < ARRAY_SIZE(corruptCerts); i++)
3262  {
3263  ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED,
3264  corruptCerts[i], corruptCerts[i][1] + 2, CRYPT_DECODE_ALLOC_FLAG, NULL,
3265  &buf, &size);
3266  ok(!ret, "Expected failure\n");
3267  }
3268  /* The following succeeds, even though v1 certs are not allowed to have
3269  * extensions.
3270  */
3271  ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED,
3274  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3275  if (ret)
3276  {
3277  CERT_INFO *info = (CERT_INFO *)buf;
3278 
3279  ok(size >= sizeof(CERT_INFO), "Wrong size %d\n", size);
3280  ok(info->dwVersion == CERT_V1, "expected CERT_V1, got %d\n",
3281  info->dwVersion);
3282  ok(info->cExtension == 1, "expected 1 extension, got %d\n",
3283  info->cExtension);
3284  LocalFree(buf);
3285  }
3286  /* The following also succeeds, even though V1 certs are not allowed to
3287  * have issuer unique ids.
3288  */
3289  ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED,
3293  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3294  if (ret)
3295  {
3296  CERT_INFO *info = (CERT_INFO *)buf;
3297 
3298  ok(size >= sizeof(CERT_INFO), "Wrong size %d\n", size);
3299  ok(info->dwVersion == CERT_V1, "expected CERT_V1, got %d\n",
3300  info->dwVersion);
3301  ok(info->IssuerUniqueId.cbData == sizeof(serialNum),
3302  "unexpected issuer unique id size %d\n", info->IssuerUniqueId.cbData);
3303  ok(!memcmp(info->IssuerUniqueId.pbData, serialNum, sizeof(serialNum)),
3304  "unexpected issuer unique id value\n");
3305  LocalFree(buf);
3306  }
3307  /* Now check with serial number, subject and issuer specified */
3308  ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, bigCert,
3309  sizeof(bigCert), CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
3310  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3311  if (ret)
3312  {
3313  CERT_INFO *info = (CERT_INFO *)buf;
3314 
3315  ok(size >= sizeof(CERT_INFO), "Wrong size %d\n", size);
3316  ok(info->SerialNumber.cbData == 1,
3317  "Expected serial number size 1, got %d\n", info->SerialNumber.cbData);
3318  ok(*info->SerialNumber.pbData == *serialNum,
3319  "Expected serial number %d, got %d\n", *serialNum,
3320  *info->SerialNumber.pbData);
3321  ok(info->Issuer.cbData == sizeof(encodedCommonName),
3322  "Wrong size %d\n", info->Issuer.cbData);
3323  ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
3324  "Unexpected issuer\n");
3325  ok(info->Subject.cbData == sizeof(encodedCommonName),
3326  "Wrong size %d\n", info->Subject.cbData);
3327  ok(!memcmp(info->Subject.pbData, encodedCommonName,
3328  info->Subject.cbData), "Unexpected subject\n");
3329  LocalFree(buf);
3330  }
3331  /* Check again with pub key specified */
3332  ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED,
3334  &buf, &size);
3335  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3336  if (ret)
3337  {
3338  CERT_INFO *info = (CERT_INFO *)buf;
3339 
3340  ok(size >= sizeof(CERT_INFO), "Wrong size %d\n", size);
3341  ok(info->SerialNumber.cbData == 1,
3342  "Expected serial number size 1, got %d\n", info->SerialNumber.cbData);
3343  ok(*info->SerialNumber.pbData == *serialNum,
3344  "Expected serial number %d, got %d\n", *serialNum,
3345  *info->SerialNumber.pbData);
3346  ok(info->Issuer.cbData == sizeof(encodedCommonName),
3347  "Wrong size %d\n", info->Issuer.cbData);
3348  ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
3349  "Unexpected issuer\n");
3350  ok(info->Subject.cbData == sizeof(encodedCommonName),
3351  "Wrong size %d\n", info->Subject.cbData);
3352  ok(!memcmp(info->Subject.pbData, encodedCommonName,
3353  info->Subject.cbData), "Unexpected subject\n");
3354  ok(!strcmp(info->SubjectPublicKeyInfo.Algorithm.pszObjId,
3355  szOID_RSA_RSA), "Expected szOID_RSA_RSA, got %s\n",
3356  info->SubjectPublicKeyInfo.Algorithm.pszObjId);
3357  ok(info->SubjectPublicKeyInfo.PublicKey.cbData == sizeof(aKey),
3358  "Wrong size %d\n", info->SubjectPublicKeyInfo.PublicKey.cbData);
3359  ok(!memcmp(info->SubjectPublicKeyInfo.PublicKey.pbData, aKey,
3360  sizeof(aKey)), "Unexpected public key\n");
3361  LocalFree(buf);
3362  }
3363 }
static const BYTE v1CertWithSerial[]
Definition: encode.c:2969
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define CERT_V1
Definition: wincrypt.h:2656
static const BYTE bigCert[]
Definition: encode.c:2976
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static const BYTE v4Cert[]
Definition: encode.c:2957
static const BYTE v1Cert[]
Definition: encode.c:2942
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static const BYTE v1CertWithConstraints[]
Definition: encode.c:2962
#define OSS_BAD_ARG
Definition: winerror.h:3043
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 const BYTE v1CertWithSubjectKeyId[]
Definition: encode.c:3009
#define ok(value,...)
Definition: CComObject.cpp:34
GLsizeiptr size
Definition: glext.h:5919
#define CRYPT_E_ASN1_EOD
Definition: winerror.h:3086
static const BYTE v1CertWithIssuerUniqueId[]
Definition: encode.c:3019
unsigned long DWORD
Definition: ntddk_ex.h:95
#define X509_CERT_TO_BE_SIGNED
Definition: wincrypt.h:3366
int ret
unsigned char BYTE
Definition: mem.h:68
static const BYTE v1CertWithSubjectIssuerSerialAndIssuerUniqueId[]
Definition: encode.c:3024
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define ARRAY_SIZE(a)
Definition: main.h:24
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
static const BYTE v1CertWithPubKey[]
Definition: encode.c:2986
static const BYTE serialNum[]
Definition: encode.c:3049
static const BYTE v2Cert[]
Definition: encode.c:2947
static const BYTE aKey[]
Definition: encode.c:2797
static const unsigned char encodedCommonName[]
Definition: encode.c:1445
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define szOID_RSA_RSA
Definition: wincrypt.h:3015
static const BYTE v3Cert[]
Definition: encode.c:2952

Referenced by START_TEST().

◆ test_decodeCMSSignerInfo()

static void test_decodeCMSSignerInfo ( DWORD  dwEncoding)
static

Definition at line 7061 of file encode.c.

7062 {
7063  BOOL ret;
7064  LPBYTE buf = NULL;
7065  DWORD size = 0;
7067  static const char oid1[] = "1.2.3", oid2[] = "1.5.6";
7068 
7069  /* A CMS signer can't be decoded without a serial number. */
7070  SetLastError(0xdeadbeef);
7071  ret = pCryptDecodeObjectEx(dwEncoding, CMS_SIGNER_INFO,
7074  ok(!ret, "expected failure\n");
7075  if (!ret && GetLastError() == ERROR_FILE_NOT_FOUND)
7076  {
7077  skip("no CMS_SIGNER_INFO decode support\n");
7078  return;
7079  }