crypt32: Remove some superfluous pointer casts.

This commit is contained in:
Michael Stefaniuc 2009-01-19 10:23:15 +01:00 committed by Alexandre Julliard
parent 61808b1689
commit 14b136ca43
1 changed files with 68 additions and 74 deletions

View File

@ -537,7 +537,7 @@ static BOOL CRYPT_AsnDecodeSequence(struct AsnDecodeSequenceItem items[],
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
if (startingPointer)
nextData = (BYTE *)startingPointer;
nextData = startingPointer;
else
nextData = (BYTE *)pvStructInfo + structSize;
memset(pvStructInfo, 0, structSize);
@ -704,7 +704,7 @@ static BOOL CRYPT_AsnDecodeArray(const struct AsnArrayDescriptor *arrayDesc,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
array = (struct GenericArray *)pvStructInfo;
array = pvStructInfo;
array->cItems = cItems;
if (startingPointer)
array->rgItems = startingPointer;
@ -779,7 +779,7 @@ static BOOL CRYPT_AsnDecodeDerBlob(const BYTE *pbEncoded, DWORD cbEncoded,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
blob = (CRYPT_DER_BLOB *)pvStructInfo;
blob = pvStructInfo;
blob->cbData = 1 + lenBytes + dataLen;
if (blob->cbData)
{
@ -819,7 +819,7 @@ static BOOL CRYPT_AsnDecodeBitsSwapBytes(const BYTE *pbEncoded,
pcbDecoded);
if (ret && pvStructInfo)
{
CRYPT_BIT_BLOB *blob = (CRYPT_BIT_BLOB *)pvStructInfo;
CRYPT_BIT_BLOB *blob = pvStructInfo;
if (blob->cbData)
{
@ -985,7 +985,7 @@ static BOOL CRYPT_AsnDecodeCertInfo(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
info = *(CERT_INFO **)pvStructInfo;
else
info = (CERT_INFO *)pvStructInfo;
info = pvStructInfo;
if (!info->SerialNumber.cbData || !info->Issuer.cbData ||
!info->Subject.cbData)
{
@ -1021,7 +1021,7 @@ static BOOL WINAPI CRYPT_AsnDecodeCert(DWORD dwCertEncodingType,
ret = CRYPT_AsnDecodeCertSignedContent(dwCertEncodingType,
X509_CERT, pbEncoded, cbEncoded, CRYPT_DECODE_ALLOC_FLAG, NULL,
(BYTE *)&signedCert, &size);
&signedCert, &size);
if (ret)
{
size = 0;
@ -1065,7 +1065,7 @@ static BOOL CRYPT_AsnDecodeCRLEntry(const BYTE *pbEncoded, DWORD cbEncoded,
CRYPT_AsnDecodeExtensionsInternal, sizeof(CERT_EXTENSIONS), TRUE, TRUE,
offsetof(CRL_ENTRY, rgExtension), 0 },
};
PCRL_ENTRY entry = (PCRL_ENTRY)pvStructInfo;
PCRL_ENTRY entry = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags, entry,
*pcbStructInfo);
@ -1092,7 +1092,7 @@ static BOOL CRYPT_AsnDecodeCRLEntries(const BYTE *pbEncoded, DWORD cbEncoded,
struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
CRYPT_AsnDecodeCRLEntry, sizeof(CRL_ENTRY), TRUE,
offsetof(CRL_ENTRY, SerialNumber.pbData) };
struct GenericArray *entries = (struct GenericArray *)pvStructInfo;
struct GenericArray *entries = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo, pcbDecoded);
@ -1161,7 +1161,7 @@ static BOOL WINAPI CRYPT_AsnDecodeCRL(DWORD dwCertEncodingType,
ret = CRYPT_AsnDecodeCertSignedContent(dwCertEncodingType,
X509_CERT, pbEncoded, cbEncoded, CRYPT_DECODE_ALLOC_FLAG, NULL,
(BYTE *)&signedCrl, &size);
&signedCrl, &size);
if (ret)
{
size = 0;
@ -1331,7 +1331,7 @@ static BOOL CRYPT_AsnDecodeExtension(const BYTE *pbEncoded, DWORD cbEncoded,
offsetof(CERT_EXTENSION, Value.pbData) },
};
BOOL ret = TRUE;
PCERT_EXTENSION ext = (PCERT_EXTENSION)pvStructInfo;
PCERT_EXTENSION ext = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags, ext,
*pcbStructInfo);
@ -1356,7 +1356,7 @@ static BOOL CRYPT_AsnDecodeExtensionsInternal(const BYTE *pbEncoded,
struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
CRYPT_AsnDecodeExtension, sizeof(CERT_EXTENSION), TRUE,
offsetof(CERT_EXTENSION, pszObjId) };
PCERT_EXTENSIONS exts = (PCERT_EXTENSIONS)pvStructInfo;
PCERT_EXTENSIONS exts = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo, pcbDecoded);
@ -1387,7 +1387,7 @@ static BOOL WINAPI CRYPT_AsnDecodeExtensions(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
exts = (CERT_EXTENSIONS *)pvStructInfo;
exts = pvStructInfo;
exts->rgExtension = (CERT_EXTENSION *)((BYTE *)exts +
sizeof(CERT_EXTENSIONS));
ret = CRYPT_AsnDecodeExtensionsInternal(pbEncoded, cbEncoded,
@ -1415,7 +1415,7 @@ static BOOL CRYPT_AsnDecodeNameValueInternal(const BYTE *pbEncoded,
{
BOOL ret = TRUE;
DWORD dataLen;
CERT_NAME_VALUE *value = (CERT_NAME_VALUE *)pvStructInfo;
CERT_NAME_VALUE *value = pvStructInfo;
if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
{
@ -1579,7 +1579,7 @@ static BOOL WINAPI CRYPT_AsnDecodeNameValue(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
value = (CERT_NAME_VALUE *)pvStructInfo;
value = pvStructInfo;
value->Value.pbData = ((BYTE *)value + sizeof(CERT_NAME_VALUE));
ret = CRYPT_AsnDecodeNameValueInternal( pbEncoded, cbEncoded,
dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, pvStructInfo,
@ -1602,7 +1602,7 @@ static BOOL CRYPT_AsnDecodeUnicodeNameValueInternal(const BYTE *pbEncoded,
{
BOOL ret = TRUE;
DWORD dataLen;
CERT_NAME_VALUE *value = (CERT_NAME_VALUE *)pvStructInfo;
CERT_NAME_VALUE *value = pvStructInfo;
if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
{
@ -1761,7 +1761,7 @@ static BOOL WINAPI CRYPT_AsnDecodeUnicodeNameValue(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
value = (CERT_NAME_VALUE *)pvStructInfo;
value = pvStructInfo;
value->Value.pbData = ((BYTE *)value + sizeof(CERT_NAME_VALUE));
ret = CRYPT_AsnDecodeUnicodeNameValueInternal(pbEncoded,
cbEncoded, dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, pvStructInfo,
@ -1790,7 +1790,7 @@ static BOOL CRYPT_AsnDecodeRdnAttr(const BYTE *pbEncoded, DWORD cbEncoded,
CRYPT_AsnDecodeNameValueInternal, sizeof(CERT_NAME_VALUE),
FALSE, TRUE, offsetof(CERT_RDN_ATTR, Value.pbData), 0 },
};
CERT_RDN_ATTR *attr = (CERT_RDN_ATTR *)pvStructInfo;
CERT_RDN_ATTR *attr = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo);
@ -1817,7 +1817,7 @@ static BOOL CRYPT_AsnDecodeRdn(const BYTE *pbEncoded, DWORD cbEncoded,
struct AsnArrayDescriptor arrayDesc = { ASN_CONSTRUCTOR | ASN_SETOF,
CRYPT_AsnDecodeRdnAttr, sizeof(CERT_RDN_ATTR), TRUE,
offsetof(CERT_RDN_ATTR, pszObjId) };
PCERT_RDN rdn = (PCERT_RDN)pvStructInfo;
PCERT_RDN rdn = pvStructInfo;
ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded, dwFlags,
NULL, pvStructInfo, pcbStructInfo, pcbDecoded,
@ -1862,7 +1862,7 @@ static BOOL CRYPT_AsnDecodeUnicodeRdnAttr(const BYTE *pbEncoded,
CRYPT_AsnDecodeUnicodeNameValueInternal, sizeof(CERT_NAME_VALUE),
FALSE, TRUE, offsetof(CERT_RDN_ATTR, Value.pbData), 0 },
};
CERT_RDN_ATTR *attr = (CERT_RDN_ATTR *)pvStructInfo;
CERT_RDN_ATTR *attr = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo);
@ -1889,7 +1889,7 @@ static BOOL CRYPT_AsnDecodeUnicodeRdn(const BYTE *pbEncoded, DWORD cbEncoded,
struct AsnArrayDescriptor arrayDesc = { ASN_CONSTRUCTOR | ASN_SETOF,
CRYPT_AsnDecodeUnicodeRdnAttr, sizeof(CERT_RDN_ATTR), TRUE,
offsetof(CERT_RDN_ATTR, pszObjId) };
PCERT_RDN rdn = (PCERT_RDN)pvStructInfo;
PCERT_RDN rdn = pvStructInfo;
ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded, dwFlags,
NULL, pvStructInfo, pcbStructInfo, pcbDecoded,
@ -2001,7 +2001,7 @@ static BOOL CRYPT_AsnDecodeCopyBytes(const BYTE *pbEncoded,
}
else
{
PCRYPT_OBJID_BLOB blob = (PCRYPT_OBJID_BLOB)pvStructInfo;
PCRYPT_OBJID_BLOB blob = pvStructInfo;
*pcbStructInfo = bytesNeeded;
blob->cbData = encodedLen;
@ -2030,7 +2030,7 @@ static BOOL CRYPT_DecodeDERArray(const BYTE *pbEncoded, DWORD cbEncoded,
BOOL ret;
struct AsnArrayDescriptor arrayDesc = { 0, CRYPT_AsnDecodeCopyBytes,
sizeof(CRYPT_DER_BLOB), TRUE, offsetof(CRYPT_DER_BLOB, pbData) };
struct GenericArray *array = (struct GenericArray *)pvStructInfo;
struct GenericArray *array = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo, pcbDecoded);
@ -2047,7 +2047,7 @@ static BOOL CRYPT_AsnDecodeCTLUsage(const BYTE *pbEncoded, DWORD cbEncoded,
BOOL ret;
struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
CRYPT_AsnDecodeOidInternal, sizeof(LPSTR), TRUE, 0 };
CTL_USAGE *usage = (CTL_USAGE *)pvStructInfo;
CTL_USAGE *usage = pvStructInfo;
ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded, dwFlags,
NULL, pvStructInfo, pcbStructInfo, pcbDecoded,
@ -2067,7 +2067,7 @@ static BOOL CRYPT_AsnDecodeCTLEntry(const BYTE *pbEncoded, DWORD cbEncoded,
TRUE, offsetof(CTL_ENTRY, rgAttribute), 0 },
};
BOOL ret = TRUE;
CTL_ENTRY *entry = (CTL_ENTRY *)pvStructInfo;
CTL_ENTRY *entry = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags, entry,
*pcbStructInfo);
@ -2085,7 +2085,7 @@ static BOOL CRYPT_AsnDecodeCTLEntries(const BYTE *pbEncoded, DWORD cbEncoded,
struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
CRYPT_AsnDecodeCTLEntry, sizeof(CTL_ENTRY), TRUE,
offsetof(CTL_ENTRY, SubjectIdentifier.pbData) };
struct GenericArray *entries = (struct GenericArray *)pvStructInfo;
struct GenericArray *entries = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo, pcbDecoded);
@ -2164,7 +2164,7 @@ static BOOL CRYPT_AsnDecodeSMIMECapability(const BYTE *pbEncoded,
CRYPT_AsnDecodeCopyBytes, sizeof(CRYPT_OBJID_BLOB), TRUE, TRUE,
offsetof(CRYPT_SMIME_CAPABILITY, Parameters.pbData), 0 },
};
PCRYPT_SMIME_CAPABILITY capability = (PCRYPT_SMIME_CAPABILITY)pvStructInfo;
PCRYPT_SMIME_CAPABILITY capability = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo);
@ -2183,8 +2183,7 @@ static BOOL CRYPT_AsnDecodeSMIMECapabilitiesInternal(const BYTE *pbEncoded,
struct AsnArrayDescriptor arrayDesc = { 0,
CRYPT_AsnDecodeSMIMECapability, sizeof(CRYPT_SMIME_CAPABILITY), TRUE,
offsetof(CRYPT_SMIME_CAPABILITY, pszObjId) };
PCRYPT_SMIME_CAPABILITIES capabilities =
(PCRYPT_SMIME_CAPABILITIES)pvStructInfo;
PCRYPT_SMIME_CAPABILITIES capabilities = pvStructInfo;
BOOL ret;
ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded, dwFlags,
@ -2223,7 +2222,7 @@ static BOOL WINAPI CRYPT_AsnDecodeSMIMECapabilities(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
capabilities = (PCRYPT_SMIME_CAPABILITIES)pvStructInfo;
capabilities = pvStructInfo;
capabilities->rgCapability =
(PCRYPT_SMIME_CAPABILITY)((BYTE *)pvStructInfo +
sizeof(CRYPT_SMIME_CAPABILITIES));
@ -2591,7 +2590,7 @@ static BOOL CRYPT_AsnDecodePKCSAttributeInternal(const BYTE *pbEncoded,
CRYPT_DecodeDERArray, sizeof(struct GenericArray), FALSE, TRUE,
offsetof(CRYPT_ATTRIBUTE, rgValue), 0 },
};
PCRYPT_ATTRIBUTE attr = (PCRYPT_ATTRIBUTE)pvStructInfo;
PCRYPT_ATTRIBUTE attr = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo);
@ -2629,7 +2628,7 @@ static BOOL WINAPI CRYPT_AsnDecodePKCSAttribute(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
attr = (PCRYPT_ATTRIBUTE)pvStructInfo;
attr = pvStructInfo;
attr->pszObjId = (LPSTR)((BYTE *)pvStructInfo +
sizeof(CRYPT_ATTRIBUTE));
ret = CRYPT_AsnDecodePKCSAttributeInternal(pbEncoded, cbEncoded,
@ -2654,7 +2653,7 @@ static BOOL CRYPT_AsnDecodePKCSAttributesInternal(const BYTE *pbEncoded,
struct AsnArrayDescriptor arrayDesc = { 0,
CRYPT_AsnDecodePKCSAttributeInternal, sizeof(CRYPT_ATTRIBUTE), TRUE,
offsetof(CRYPT_ATTRIBUTE, pszObjId) };
PCRYPT_ATTRIBUTES attrs = (PCRYPT_ATTRIBUTES)pvStructInfo;
PCRYPT_ATTRIBUTES attrs = pvStructInfo;
BOOL ret;
ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded, dwFlags,
@ -2693,7 +2692,7 @@ static BOOL WINAPI CRYPT_AsnDecodePKCSAttributes(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
attrs = (PCRYPT_ATTRIBUTES)pvStructInfo;
attrs = pvStructInfo;
attrs->rgAttr = (PCRYPT_ATTRIBUTE)((BYTE *)pvStructInfo +
sizeof(CRYPT_ATTRIBUTES));
ret = CRYPT_AsnDecodePKCSAttributesInternal(pbEncoded,
@ -2714,8 +2713,7 @@ static BOOL WINAPI CRYPT_AsnDecodePKCSAttributes(DWORD dwCertEncodingType,
static BOOL CRYPT_AsnDecodeAlgorithmId(const BYTE *pbEncoded, DWORD cbEncoded,
DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
{
CRYPT_ALGORITHM_IDENTIFIER *algo =
(CRYPT_ALGORITHM_IDENTIFIER *)pvStructInfo;
CRYPT_ALGORITHM_IDENTIFIER *algo = pvStructInfo;
BOOL ret = TRUE;
struct AsnDecodeSequenceItem items[] = {
{ ASN_OBJECTIDENTIFIER, offsetof(CRYPT_ALGORITHM_IDENTIFIER, pszObjId),
@ -2754,7 +2752,7 @@ static BOOL CRYPT_AsnDecodePubKeyInfoInternal(const BYTE *pbEncoded,
CRYPT_AsnDecodeBitsInternal, sizeof(CRYPT_BIT_BLOB), FALSE, TRUE,
offsetof(CERT_PUBLIC_KEY_INFO, PublicKey.pbData) },
};
PCERT_PUBLIC_KEY_INFO info = (PCERT_PUBLIC_KEY_INFO)pvStructInfo;
PCERT_PUBLIC_KEY_INFO info = pvStructInfo;
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
@ -2784,7 +2782,7 @@ static BOOL WINAPI CRYPT_AsnDecodePubKeyInfo(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
info = (PCERT_PUBLIC_KEY_INFO)pvStructInfo;
info = pvStructInfo;
info->Algorithm.Parameters.pbData = (BYTE *)pvStructInfo +
sizeof(CERT_PUBLIC_KEY_INFO);
ret = CRYPT_AsnDecodePubKeyInfoInternal(pbEncoded, cbEncoded,
@ -2848,7 +2846,7 @@ static BOOL CRYPT_AsnDecodeBool(const BYTE *pbEncoded, DWORD cbEncoded,
static BOOL CRYPT_AsnDecodeAltNameEntry(const BYTE *pbEncoded, DWORD cbEncoded,
DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
{
PCERT_ALT_NAME_ENTRY entry = (PCERT_ALT_NAME_ENTRY)pvStructInfo;
PCERT_ALT_NAME_ENTRY entry = pvStructInfo;
DWORD dataLen, lenBytes, bytesNeeded = sizeof(CERT_ALT_NAME_ENTRY);
BOOL ret;
@ -2971,7 +2969,7 @@ static BOOL CRYPT_AsnDecodeAltNameInternal(const BYTE *pbEncoded,
struct AsnArrayDescriptor arrayDesc = { 0,
CRYPT_AsnDecodeAltNameEntry, sizeof(CERT_ALT_NAME_ENTRY), TRUE,
offsetof(CERT_ALT_NAME_ENTRY, u.pwszURL) };
PCERT_ALT_NAME_INFO info = (PCERT_ALT_NAME_INFO)pvStructInfo;
PCERT_ALT_NAME_INFO info = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo, pcbDecoded);
@ -3002,7 +3000,7 @@ static BOOL CRYPT_AsnDecodeIntegerSwapBytes(const BYTE *pbEncoded,
pcbDecoded);
if (ret && pvStructInfo)
{
CRYPT_DATA_BLOB *blob = (CRYPT_DATA_BLOB *)pvStructInfo;
CRYPT_DATA_BLOB *blob = pvStructInfo;
if (blob->cbData)
{
@ -3105,7 +3103,7 @@ static BOOL CRYPT_AsnDecodeAccessDescription(const BYTE *pbEncoded,
CRYPT_AsnDecodeAltNameEntry, sizeof(CERT_ALT_NAME_ENTRY), FALSE,
TRUE, offsetof(CERT_ACCESS_DESCRIPTION, AccessLocation.u.pwszURL), 0 },
};
CERT_ACCESS_DESCRIPTION *descr = (CERT_ACCESS_DESCRIPTION *)pvStructInfo;
CERT_ACCESS_DESCRIPTION *descr = pvStructInfo;
return CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
@ -3195,7 +3193,7 @@ static BOOL CRYPT_AsnDecodePKCSContentInfoInternal(const BYTE *pbEncoded,
DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo,
DWORD *pcbDecoded)
{
CRYPT_CONTENT_INFO *info = (CRYPT_CONTENT_INFO *)pvStructInfo;
CRYPT_CONTENT_INFO *info = pvStructInfo;
struct AsnDecodeSequenceItem items[] = {
{ ASN_OBJECTIDENTIFIER, offsetof(CRYPT_CONTENT_INFO, pszObjId),
CRYPT_AsnDecodeOidIgnoreTag, sizeof(LPSTR), FALSE, TRUE,
@ -3239,7 +3237,7 @@ static BOOL WINAPI CRYPT_AsnDecodePKCSContentInfo(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
info = (CRYPT_CONTENT_INFO *)pvStructInfo;
info = pvStructInfo;
info->pszObjId = (LPSTR)((BYTE *)info +
sizeof(CRYPT_CONTENT_INFO));
ret = CRYPT_AsnDecodePKCSContentInfoInternal(pbEncoded,
@ -3308,7 +3306,7 @@ static BOOL WINAPI CRYPT_AsnDecodeAltName(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
name = (CERT_ALT_NAME_INFO *)pvStructInfo;
name = pvStructInfo;
name->rgAltEntry = (PCERT_ALT_NAME_ENTRY)
((BYTE *)pvStructInfo + sizeof(CERT_ALT_NAME_INFO));
ret = CRYPT_AsnDecodeAltNameInternal(pbEncoded, cbEncoded,
@ -3356,8 +3354,7 @@ static BOOL CRYPT_AsnDecodePathLenConstraint(const BYTE *pbEncoded,
}
else
{
struct PATH_LEN_CONSTRAINT *constraint =
(struct PATH_LEN_CONSTRAINT *)pvStructInfo;
struct PATH_LEN_CONSTRAINT *constraint = pvStructInfo;
*pcbStructInfo = bytesNeeded;
size = sizeof(constraint->dwPathLenConstraint);
@ -3380,7 +3377,7 @@ static BOOL CRYPT_AsnDecodeSubtreeConstraints(const BYTE *pbEncoded,
struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
CRYPT_AsnDecodeCopyBytes, sizeof(CERT_NAME_BLOB), TRUE,
offsetof(CERT_NAME_BLOB, pbData) };
struct GenericArray *entries = (struct GenericArray *)pvStructInfo;
struct GenericArray *entries = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo, pcbDecoded);
@ -3597,7 +3594,7 @@ static BOOL WINAPI CRYPT_AsnDecodeRsaPubKey(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
hdr = (BLOBHEADER *)pvStructInfo;
hdr = pvStructInfo;
hdr->bType = PUBLICKEYBLOB;
hdr->bVersion = CUR_BLOB_VERSION;
hdr->reserved = 0;
@ -3656,7 +3653,7 @@ static BOOL CRYPT_AsnDecodeOctetsInternal(const BYTE *pbEncoded,
CRYPT_DATA_BLOB *blob;
*pcbStructInfo = bytesNeeded;
blob = (CRYPT_DATA_BLOB *)pvStructInfo;
blob = pvStructInfo;
blob->cbData = dataLen;
if (dwFlags & CRYPT_DECODE_NOCOPY_FLAG)
blob->pbData = (BYTE *)pbEncoded + 1 + lenBytes;
@ -3707,7 +3704,7 @@ static BOOL WINAPI CRYPT_AsnDecodeOctets(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
blob = (CRYPT_DATA_BLOB *)pvStructInfo;
blob = pvStructInfo;
blob->pbData = (BYTE *)pvStructInfo + sizeof(CRYPT_DATA_BLOB);
ret = CRYPT_AsnDecodeOctetsInternal(pbEncoded, cbEncoded,
dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, pvStructInfo,
@ -3755,7 +3752,7 @@ static BOOL CRYPT_AsnDecodeBitsInternal(const BYTE *pbEncoded, DWORD cbEncoded,
CRYPT_BIT_BLOB *blob;
*pcbStructInfo = bytesNeeded;
blob = (CRYPT_BIT_BLOB *)pvStructInfo;
blob = pvStructInfo;
blob->cbData = dataLen - 1;
blob->cUnusedBits = *(pbEncoded + 1 + lenBytes);
if (dwFlags & CRYPT_DECODE_NOCOPY_FLAG)
@ -3814,7 +3811,7 @@ static BOOL WINAPI CRYPT_AsnDecodeBits(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
blob = (CRYPT_BIT_BLOB *)pvStructInfo;
blob = pvStructInfo;
blob->pbData = (BYTE *)pvStructInfo + sizeof(CRYPT_BIT_BLOB);
ret = CRYPT_AsnDecodeBitsInternal(pbEncoded, cbEncoded,
dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, pvStructInfo,
@ -3943,7 +3940,7 @@ static BOOL CRYPT_AsnDecodeIntegerInternal(const BYTE *pbEncoded,
}
else
{
CRYPT_INTEGER_BLOB *blob = (CRYPT_INTEGER_BLOB *)pvStructInfo;
CRYPT_INTEGER_BLOB *blob = pvStructInfo;
*pcbStructInfo = bytesNeeded;
blob->cbData = dataLen;
@ -3992,7 +3989,7 @@ static BOOL WINAPI CRYPT_AsnDecodeInteger(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
blob = (CRYPT_INTEGER_BLOB *)pvStructInfo;
blob = pvStructInfo;
blob->pbData = (BYTE *)pvStructInfo +
sizeof(CRYPT_INTEGER_BLOB);
ret = CRYPT_AsnDecodeIntegerInternal(pbEncoded, cbEncoded,
@ -4037,7 +4034,7 @@ static BOOL CRYPT_AsnDecodeUnsignedIntegerInternal(const BYTE *pbEncoded,
}
else
{
CRYPT_INTEGER_BLOB *blob = (CRYPT_INTEGER_BLOB *)pvStructInfo;
CRYPT_INTEGER_BLOB *blob = pvStructInfo;
*pcbStructInfo = bytesNeeded;
blob->cbData = dataLen;
@ -4091,7 +4088,7 @@ static BOOL WINAPI CRYPT_AsnDecodeUnsignedInteger(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
blob = (CRYPT_INTEGER_BLOB *)pvStructInfo;
blob = pvStructInfo;
blob->pbData = (BYTE *)pvStructInfo +
sizeof(CRYPT_INTEGER_BLOB);
ret = CRYPT_AsnDecodeUnsignedIntegerInternal(pbEncoded,
@ -4313,8 +4310,7 @@ static BOOL CRYPT_AsnDecodeUtcTimeInternal(const BYTE *pbEncoded,
*pcbStructInfo = sizeof(FILETIME);
else if ((ret = CRYPT_DecodeCheckSpace(pcbStructInfo,
sizeof(FILETIME))))
ret = SystemTimeToFileTime(&sysTime,
(FILETIME *)pvStructInfo);
ret = SystemTimeToFileTime(&sysTime, pvStructInfo);
}
}
}
@ -4421,8 +4417,7 @@ static BOOL CRYPT_AsnDecodeGeneralizedTime(const BYTE *pbEncoded,
*pcbStructInfo = sizeof(FILETIME);
else if ((ret = CRYPT_DecodeCheckSpace(pcbStructInfo,
sizeof(FILETIME))))
ret = SystemTimeToFileTime(&sysTime,
(FILETIME *)pvStructInfo);
ret = SystemTimeToFileTime(&sysTime, pvStructInfo);
}
}
}
@ -4542,7 +4537,7 @@ static BOOL WINAPI CRYPT_AsnDecodeSequenceOfAny(DWORD dwCertEncodingType,
{
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
seq = (CRYPT_SEQUENCE_OF_ANY *)pvStructInfo;
seq = pvStructInfo;
seq->cValue = cValue;
seq->rgValue = (CRYPT_DER_BLOB *)((BYTE *)seq +
sizeof(*seq));
@ -4640,7 +4635,7 @@ static BOOL CRYPT_AsnDecodeDistPointName(const BYTE *pbEncoded,
}
else
{
CRL_DIST_POINT_NAME *name = (CRL_DIST_POINT_NAME *)pvStructInfo;
CRL_DIST_POINT_NAME *name = pvStructInfo;
*pcbStructInfo = bytesNeeded;
if (dataLen)
@ -4679,7 +4674,7 @@ static BOOL CRYPT_AsnDecodeDistPoint(const BYTE *pbEncoded, DWORD cbEncoded,
CRYPT_AsnDecodeAltNameInternal, sizeof(CERT_ALT_NAME_INFO), TRUE, TRUE,
offsetof(CRL_DIST_POINT, CRLIssuer.rgAltEntry), 0 },
};
CRL_DIST_POINT *point = (CRL_DIST_POINT *)pvStructInfo;
CRL_DIST_POINT *point = pvStructInfo;
BOOL ret;
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
@ -4829,14 +4824,14 @@ static BOOL CRYPT_AsnDecodeSubtree(const BYTE *pbEncoded,
CRYPT_AsnDecodeMaximum, sizeof(BOOL) + sizeof(DWORD), TRUE, FALSE, 0,
0 },
};
CERT_GENERAL_SUBTREE *subtree = (CERT_GENERAL_SUBTREE *)pvStructInfo;
CERT_GENERAL_SUBTREE *subtree = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo, pcbDecoded);
ret = CRYPT_AsnDecodeSequence(items, sizeof(items) / sizeof(items[0]),
pbEncoded, cbEncoded, dwFlags, NULL, pvStructInfo, pcbStructInfo,
pcbDecoded, subtree ? (BYTE *)subtree->Base.u.pwszURL : NULL);
pcbDecoded, subtree ? subtree->Base.u.pwszURL : NULL);
if (pcbDecoded)
{
TRACE("%d\n", *pcbDecoded);
@ -4856,7 +4851,7 @@ static BOOL CRYPT_AsnDecodeSubtreeArray(const BYTE *pbEncoded,
struct AsnArrayDescriptor arrayDesc = { 0,
CRYPT_AsnDecodeSubtree, sizeof(CERT_GENERAL_SUBTREE), TRUE,
offsetof(CERT_GENERAL_SUBTREE, Base.u.pwszURL) };
struct GenericArray *array = (struct GenericArray *)pvStructInfo;
struct GenericArray *array = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo, pcbDecoded);
@ -4915,8 +4910,7 @@ static BOOL CRYPT_AsnDecodeIssuerSerialNumber(const BYTE *pbEncoded,
CRYPT_AsnDecodeIntegerInternal, sizeof(CRYPT_INTEGER_BLOB), FALSE,
TRUE, offsetof(CERT_ISSUER_SERIAL_NUMBER, SerialNumber.pbData), 0 },
};
CERT_ISSUER_SERIAL_NUMBER *issuerSerial =
(CERT_ISSUER_SERIAL_NUMBER *)pvStructInfo;
CERT_ISSUER_SERIAL_NUMBER *issuerSerial = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo, pcbDecoded);
@ -4937,7 +4931,7 @@ static BOOL CRYPT_AsnDecodePKCSSignerInfoInternal(const BYTE *pbEncoded,
DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo,
DWORD *pcbDecoded)
{
CMSG_SIGNER_INFO *info = (CMSG_SIGNER_INFO *)pvStructInfo;
CMSG_SIGNER_INFO *info = pvStructInfo;
struct AsnDecodeSequenceItem items[] = {
{ ASN_INTEGER, offsetof(CMSG_SIGNER_INFO, dwVersion),
CRYPT_AsnDecodeIntInternal, sizeof(DWORD), FALSE, FALSE, 0, 0 },
@ -4997,7 +4991,7 @@ static BOOL WINAPI CRYPT_AsnDecodePKCSSignerInfo(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
info = (CMSG_SIGNER_INFO *)pvStructInfo;
info = pvStructInfo;
info->Issuer.pbData = ((BYTE *)info +
sizeof(CMSG_SIGNER_INFO));
ret = CRYPT_AsnDecodePKCSSignerInfoInternal(pbEncoded,
@ -5019,7 +5013,7 @@ static BOOL CRYPT_AsnDecodeCMSSignerId(const BYTE *pbEncoded,
DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo,
DWORD *pcbDecoded)
{
CERT_ID *id = (CERT_ID *)pvStructInfo;
CERT_ID *id = pvStructInfo;
BOOL ret = FALSE;
if (*pbEncoded == ASN_SEQUENCEOF)
@ -5061,7 +5055,7 @@ static BOOL CRYPT_AsnDecodeCMSSignerInfoInternal(const BYTE *pbEncoded,
DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo,
DWORD *pcbDecoded)
{
CMSG_CMS_SIGNER_INFO *info = (CMSG_CMS_SIGNER_INFO *)pvStructInfo;
CMSG_CMS_SIGNER_INFO *info = pvStructInfo;
struct AsnDecodeSequenceItem items[] = {
{ ASN_INTEGER, offsetof(CMSG_CMS_SIGNER_INFO, dwVersion),
CRYPT_AsnDecodeIntInternal, sizeof(DWORD), FALSE, FALSE, 0, 0 },
@ -5121,7 +5115,7 @@ static BOOL WINAPI CRYPT_AsnDecodeCMSSignerInfo(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
info = (CMSG_CMS_SIGNER_INFO *)pvStructInfo;
info = pvStructInfo;
info->SignerId.u.KeyId.pbData = ((BYTE *)info +
sizeof(CMSG_CMS_SIGNER_INFO));
ret = CRYPT_AsnDecodeCMSSignerInfoInternal(pbEncoded,
@ -5146,7 +5140,7 @@ static BOOL CRYPT_DecodeSignerArray(const BYTE *pbEncoded, DWORD cbEncoded,
struct AsnArrayDescriptor arrayDesc = { ASN_CONSTRUCTOR | ASN_SETOF,
CRYPT_AsnDecodeCMSSignerInfoInternal, sizeof(CMSG_CMS_SIGNER_INFO), TRUE,
offsetof(CMSG_CMS_SIGNER_INFO, SignerId.u.KeyId.pbData) };
struct GenericArray *array = (struct GenericArray *)pvStructInfo;
struct GenericArray *array = pvStructInfo;
TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo, pcbDecoded);