Commit febb06ce authored by Alexandre Julliard's avatar Alexandre Julliard

crypt32: Use nameless union/structs.

parent 420a7d06
......@@ -20,7 +20,6 @@
#include <assert.h>
#include <stdarg.h>
#define NONAMELESSUNION
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
......@@ -1403,9 +1402,9 @@ DWORD WINAPI CertGetPublicKeyLength(DWORD dwCertEncodingType,
{
HCRYPTKEY key;
TRACE("public key algid %#x (%s)\n", info->u.Algid, debugstr_a(pPublicKey->Algorithm.pszObjId));
TRACE("public key algid %#x (%s)\n", info->Algid, debugstr_a(pPublicKey->Algorithm.pszObjId));
ret = CryptImportPublicKeyInfo(I_CryptGetDefaultCryptProv(info->u.Algid), dwCertEncodingType, pPublicKey, &key);
ret = CryptImportPublicKeyInfo(I_CryptGetDefaultCryptProv(info->Algid), dwCertEncodingType, pPublicKey, &key);
if (ret)
{
size = sizeof(len);
......@@ -1538,14 +1537,14 @@ static BOOL compare_cert_by_cert_id(PCCERT_CONTEXT pCertContext, DWORD dwType,
{
case CERT_ID_ISSUER_SERIAL_NUMBER:
ret = CertCompareCertificateName(pCertContext->dwCertEncodingType,
&pCertContext->pCertInfo->Issuer, &id->u.IssuerSerialNumber.Issuer);
&pCertContext->pCertInfo->Issuer, &id->IssuerSerialNumber.Issuer);
if (ret)
ret = CertCompareIntegerBlob(&pCertContext->pCertInfo->SerialNumber,
&id->u.IssuerSerialNumber.SerialNumber);
&id->IssuerSerialNumber.SerialNumber);
break;
case CERT_ID_SHA1_HASH:
ret = compare_cert_by_sha1_hash(pCertContext, dwType, dwFlags,
&id->u.HashId);
&id->HashId);
break;
case CERT_ID_KEY_IDENTIFIER:
{
......@@ -1553,7 +1552,7 @@ static BOOL compare_cert_by_cert_id(PCCERT_CONTEXT pCertContext, DWORD dwType,
ret = CertGetCertificateContextProperty(pCertContext,
CERT_KEY_IDENTIFIER_PROP_ID, NULL, &size);
if (ret && size == id->u.KeyId.cbData)
if (ret && size == id->KeyId.cbData)
{
LPBYTE buf = CryptMemAlloc(size);
......@@ -1561,7 +1560,7 @@ static BOOL compare_cert_by_cert_id(PCCERT_CONTEXT pCertContext, DWORD dwType,
{
CertGetCertificateContextProperty(pCertContext,
CERT_KEY_IDENTIFIER_PROP_ID, buf, &size);
ret = !memcmp(buf, id->u.KeyId.pbData, size);
ret = !memcmp(buf, id->KeyId.pbData, size);
CryptMemFree(buf);
}
else
......@@ -1663,15 +1662,15 @@ static PCCERT_CONTEXT find_cert_by_issuer(HCERTSTORE store, DWORD dwType,
if (info->CertIssuer.cbData && info->CertSerialNumber.cbData)
{
id.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
memcpy(&id.u.IssuerSerialNumber.Issuer, &info->CertIssuer,
memcpy(&id.IssuerSerialNumber.Issuer, &info->CertIssuer,
sizeof(CERT_NAME_BLOB));
memcpy(&id.u.IssuerSerialNumber.SerialNumber,
memcpy(&id.IssuerSerialNumber.SerialNumber,
&info->CertSerialNumber, sizeof(CRYPT_INTEGER_BLOB));
}
else if (info->KeyId.cbData)
{
id.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
memcpy(&id.u.KeyId, &info->KeyId, sizeof(CRYPT_HASH_BLOB));
memcpy(&id.KeyId, &info->KeyId, sizeof(CRYPT_HASH_BLOB));
}
else
ret = FALSE;
......@@ -1709,9 +1708,9 @@ static PCCERT_CONTEXT find_cert_by_issuer(HCERTSTORE store, DWORD dwType,
if (directoryName)
{
id.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
memcpy(&id.u.IssuerSerialNumber.Issuer,
&directoryName->u.DirectoryName, sizeof(CERT_NAME_BLOB));
memcpy(&id.u.IssuerSerialNumber.SerialNumber,
memcpy(&id.IssuerSerialNumber.Issuer,
&directoryName->DirectoryName, sizeof(CERT_NAME_BLOB));
memcpy(&id.IssuerSerialNumber.SerialNumber,
&info->AuthorityCertSerialNumber,
sizeof(CRYPT_INTEGER_BLOB));
}
......@@ -1724,7 +1723,7 @@ static PCCERT_CONTEXT find_cert_by_issuer(HCERTSTORE store, DWORD dwType,
else if (info->KeyId.cbData)
{
id.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
memcpy(&id.u.KeyId, &info->KeyId, sizeof(CRYPT_HASH_BLOB));
memcpy(&id.KeyId, &info->KeyId, sizeof(CRYPT_HASH_BLOB));
}
else
ret = FALSE;
......@@ -1863,7 +1862,7 @@ PCCERT_CONTEXT WINAPI CertFindCertificateInStore(HCERTSTORE hCertStore,
break;
case CERT_COMPARE_KEY_IDENTIFIER:
cert_id.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
cert_id.u.KeyId = *(const CRYPT_HASH_BLOB *)pvPara;
cert_id.KeyId = *(const CRYPT_HASH_BLOB *)pvPara;
pvPara = &cert_id;
/* fall through */
case CERT_COMPARE_CERT_ID:
......@@ -2406,7 +2405,7 @@ BOOL WINAPI CryptHashToBeSigned(HCRYPTPROV_LEGACY hCryptProv,
}
else
{
ret = CryptCreateHash(hCryptProv, oidInfo->u.Algid, 0, 0, &hHash);
ret = CryptCreateHash(hCryptProv, oidInfo->Algid, 0, 0, &hHash);
if (ret)
{
ret = CryptHashData(hHash, info->ToBeSigned.pbData,
......@@ -2446,7 +2445,7 @@ BOOL WINAPI CryptSignCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProv,
{
if (!hCryptProv)
hCryptProv = I_CryptGetDefaultCryptProv(0);
ret = CryptCreateHash(hCryptProv, info->u.Algid, 0, 0, &hHash);
ret = CryptCreateHash(hCryptProv, info->Algid, 0, 0, &hHash);
if (ret)
{
ret = CryptHashData(hHash, pbEncodedToBeSigned,
......@@ -2466,7 +2465,7 @@ BOOL WINAPI CryptSignCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProv,
}
else
{
ret = CryptCreateHash(hCryptProv, info->u.Algid, 0, 0, &hHash);
ret = CryptCreateHash(hCryptProv, info->Algid, 0, 0, &hHash);
if (ret)
{
ret = CryptHashData(hHash, pbEncodedToBeSigned,
......@@ -2562,7 +2561,7 @@ static BOOL CRYPT_VerifySignature(HCRYPTPROV_LEGACY hCryptProv, DWORD dwCertEnco
HCRYPTKEY key;
ALG_ID pubKeyID, hashID;
hashID = info->u.Algid;
hashID = info->Algid;
if (info->ExtraInfo.cbData >= sizeof(ALG_ID))
pubKeyID = *(ALG_ID *)info->ExtraInfo.pbData;
else
......@@ -2896,7 +2895,7 @@ static BOOL CRYPT_VerifyCertSignatureFromPublicKeyInfo(HCRYPTPROV_LEGACY hCryptP
return FALSE;
}
if (info->u.Algid == CALG_OID_INFO_CNG_ONLY)
if (info->Algid == CALG_OID_INFO_CNG_ONLY)
return CNG_VerifySignature(hCryptProv, dwCertEncodingType, pubKeyInfo, signedCert, info);
else
return CRYPT_VerifySignature(hCryptProv, dwCertEncodingType, pubKeyInfo, signedCert, info);
......
......@@ -19,7 +19,7 @@
#include <assert.h>
#include <stdarg.h>
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "wincrypt.h"
......@@ -299,7 +299,7 @@ static BOOL compare_crl_issued_by(PCCRL_CONTEXT pCrlContext, DWORD dwType,
ret = CertCompareCertificateName(
issuer->dwCertEncodingType,
&issuer->pCertInfo->Subject,
&directoryName->u.DirectoryName);
&directoryName->DirectoryName);
if (ret)
ret = CertCompareIntegerBlob(
&issuer->pCertInfo->SerialNumber,
......@@ -692,31 +692,31 @@ static BOOL compare_dist_point_name(const CRL_DIST_POINT_NAME *name1,
match = TRUE;
if (name1->dwDistPointNameChoice == CRL_DIST_POINT_FULL_NAME)
{
if (name1->u.FullName.cAltEntry == name2->u.FullName.cAltEntry)
if (name1->FullName.cAltEntry == name2->FullName.cAltEntry)
{
DWORD i;
for (i = 0; match && i < name1->u.FullName.cAltEntry; i++)
for (i = 0; match && i < name1->FullName.cAltEntry; i++)
{
const CERT_ALT_NAME_ENTRY *entry1 =
&name1->u.FullName.rgAltEntry[i];
&name1->FullName.rgAltEntry[i];
const CERT_ALT_NAME_ENTRY *entry2 =
&name2->u.FullName.rgAltEntry[i];
&name2->FullName.rgAltEntry[i];
if (entry1->dwAltNameChoice == entry2->dwAltNameChoice)
{
switch (entry1->dwAltNameChoice)
{
case CERT_ALT_NAME_URL:
match = !wcsicmp(entry1->u.pwszURL,
entry2->u.pwszURL);
match = !wcsicmp(entry1->pwszURL,
entry2->pwszURL);
break;
case CERT_ALT_NAME_DIRECTORY_NAME:
match = (entry1->u.DirectoryName.cbData ==
entry2->u.DirectoryName.cbData) &&
!memcmp(entry1->u.DirectoryName.pbData,
entry2->u.DirectoryName.pbData,
entry1->u.DirectoryName.cbData);
match = (entry1->DirectoryName.cbData ==
entry2->DirectoryName.cbData) &&
!memcmp(entry1->DirectoryName.pbData,
entry2->DirectoryName.pbData,
entry1->DirectoryName.cbData);
break;
default:
FIXME("unimplemented for type %ld\n",
......
......@@ -35,8 +35,6 @@
#include <stdio.h>
#include <stdlib.h>
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "wincrypt.h"
......@@ -2407,15 +2405,15 @@ static BOOL WINAPI CRYPT_AsnEncodeAltNameEntry(DWORD dwCertEncodingType,
case CERT_ALT_NAME_DNS_NAME:
case CERT_ALT_NAME_URL:
tag = ASN_CONTEXT | (entry->dwAltNameChoice - 1);
if (entry->u.pwszURL)
if (entry->pwszURL)
{
DWORD i;
/* Not + 1: don't encode the NULL-terminator */
dataLen = lstrlenW(entry->u.pwszURL);
dataLen = lstrlenW(entry->pwszURL);
for (i = 0; ret && i < dataLen; i++)
{
if (entry->u.pwszURL[i] > 0x7f)
if (entry->pwszURL[i] > 0x7f)
{
SetLastError(CRYPT_E_INVALID_IA5_STRING);
ret = FALSE;
......@@ -2428,16 +2426,16 @@ static BOOL WINAPI CRYPT_AsnEncodeAltNameEntry(DWORD dwCertEncodingType,
break;
case CERT_ALT_NAME_DIRECTORY_NAME:
tag = ASN_CONTEXT | ASN_CONSTRUCTOR | (entry->dwAltNameChoice - 1);
dataLen = entry->u.DirectoryName.cbData;
dataLen = entry->DirectoryName.cbData;
break;
case CERT_ALT_NAME_IP_ADDRESS:
tag = ASN_CONTEXT | (entry->dwAltNameChoice - 1);
dataLen = entry->u.IPAddress.cbData;
dataLen = entry->IPAddress.cbData;
break;
case CERT_ALT_NAME_REGISTERED_ID:
{
struct AsnEncodeTagSwappedItem swapped =
{ ASN_CONTEXT | (entry->dwAltNameChoice - 1), entry->u.pszRegisteredID,
{ ASN_CONTEXT | (entry->dwAltNameChoice - 1), entry->pszRegisteredID,
CRYPT_AsnEncodeOid };
return CRYPT_AsnEncodeSwapTag(0, NULL, &swapped, 0, NULL, pbEncoded,
......@@ -2478,14 +2476,14 @@ static BOOL WINAPI CRYPT_AsnEncodeAltNameEntry(DWORD dwCertEncodingType,
DWORD i;
for (i = 0; i < dataLen; i++)
*pbEncoded++ = (BYTE)entry->u.pwszURL[i];
*pbEncoded++ = (BYTE)entry->pwszURL[i];
break;
}
case CERT_ALT_NAME_DIRECTORY_NAME:
memcpy(pbEncoded, entry->u.DirectoryName.pbData, dataLen);
memcpy(pbEncoded, entry->DirectoryName.pbData, dataLen);
break;
case CERT_ALT_NAME_IP_ADDRESS:
memcpy(pbEncoded, entry->u.IPAddress.pbData, dataLen);
memcpy(pbEncoded, entry->IPAddress.pbData, dataLen);
break;
}
if (ret)
......@@ -3757,7 +3755,7 @@ static BOOL CRYPT_AsnEncodeDistPoint(const CRL_DIST_POINT *distPoint,
break;
case CRL_DIST_POINT_FULL_NAME:
swapped[cSwapped].tag = ASN_CONTEXT | ASN_CONSTRUCTOR | 0;
swapped[cSwapped].pvStructInfo = &distPoint->DistPointName.u.FullName;
swapped[cSwapped].pvStructInfo = &distPoint->DistPointName.FullName;
swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeAltName;
constructed.tag = 0;
constructed.pvStructInfo = &swapped[cSwapped];
......@@ -3972,7 +3970,7 @@ static BOOL WINAPI CRYPT_AsnEncodeIssuingDistPoint(DWORD dwCertEncodingType,
break;
case CRL_DIST_POINT_FULL_NAME:
swapped[cSwapped].tag = ASN_CONTEXT | ASN_CONSTRUCTOR | 0;
swapped[cSwapped].pvStructInfo = &point->DistPointName.u.FullName;
swapped[cSwapped].pvStructInfo = &point->DistPointName.FullName;
swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeAltName;
constructed.tag = 0;
constructed.pvStructInfo = &swapped[cSwapped];
......@@ -4275,7 +4273,7 @@ static BOOL WINAPI CRYPT_AsnEncodeCMSSignerInfo(DWORD dwCertEncodingType,
info->SignerId.dwIdChoice != CERT_ID_KEY_IDENTIFIER)
SetLastError(E_INVALIDARG);
else if (info->SignerId.dwIdChoice == CERT_ID_ISSUER_SERIAL_NUMBER &&
!info->SignerId.u.IssuerSerialNumber.Issuer.cbData)
!info->SignerId.IssuerSerialNumber.Issuer.cbData)
SetLastError(E_INVALIDARG);
else
{
......@@ -4288,7 +4286,7 @@ static BOOL WINAPI CRYPT_AsnEncodeCMSSignerInfo(DWORD dwCertEncodingType,
if (info->SignerId.dwIdChoice == CERT_ID_ISSUER_SERIAL_NUMBER)
{
items[cItem].pvStructInfo =
&info->SignerId.u.IssuerSerialNumber.Issuer;
&info->SignerId.IssuerSerialNumber.Issuer;
items[cItem].encodeFunc =
CRYPT_AsnEncodeIssuerSerialNumber;
cItem++;
......@@ -4296,7 +4294,7 @@ static BOOL WINAPI CRYPT_AsnEncodeCMSSignerInfo(DWORD dwCertEncodingType,
else
{
swapped[cSwapped].tag = ASN_CONTEXT | 0;
swapped[cSwapped].pvStructInfo = &info->SignerId.u.KeyId;
swapped[cSwapped].pvStructInfo = &info->SignerId.KeyId;
swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeOctets;
items[cItem].pvStructInfo = &swapped[cSwapped];
items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
......@@ -4426,7 +4424,7 @@ static BOOL WINAPI CRYPT_AsnEncodeRecipientInfo(DWORD dwCertEncodingType,
const CMSG_KEY_TRANS_RECIPIENT_INFO *info = pvStructInfo;
struct AsnEncodeSequenceItem items[] = {
{ &info->dwVersion, CRYPT_AsnEncodeInt, 0 },
{ &info->RecipientId.u.IssuerSerialNumber,
{ &info->RecipientId.IssuerSerialNumber,
CRYPT_AsnEncodeIssuerSerialNumber, 0 },
{ &info->KeyEncryptionAlgorithm,
CRYPT_AsnEncodeAlgorithmIdWithNullParams, 0 },
......
......@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "wincrypt.h"
......@@ -1248,12 +1248,12 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
{
case CERT_ALT_NAME_RFC822_NAME:
LoadStringW(hInstance, IDS_ALT_NAME_RFC822_NAME, buf, ARRAY_SIZE(buf));
bytesNeeded += lstrlenW(entry->u.pwszRfc822Name) * sizeof(WCHAR);
bytesNeeded += lstrlenW(entry->pwszRfc822Name) * sizeof(WCHAR);
ret = TRUE;
break;
case CERT_ALT_NAME_DNS_NAME:
LoadStringW(hInstance, IDS_ALT_NAME_DNS_NAME, buf, ARRAY_SIZE(buf));
bytesNeeded += lstrlenW(entry->u.pwszDNSName) * sizeof(WCHAR);
bytesNeeded += lstrlenW(entry->pwszDNSName) * sizeof(WCHAR);
ret = TRUE;
break;
case CERT_ALT_NAME_DIRECTORY_NAME:
......@@ -1263,7 +1263,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
strType |= CERT_NAME_STR_CRLF_FLAG;
directoryNameLen = cert_name_to_str_with_indent(X509_ASN_ENCODING,
indentLevel + 1, &entry->u.DirectoryName, strType, NULL, 0);
indentLevel + 1, &entry->DirectoryName, strType, NULL, 0);
LoadStringW(hInstance, IDS_ALT_NAME_DIRECTORY_NAME, buf, ARRAY_SIZE(buf));
bytesNeeded += (directoryNameLen - 1) * sizeof(WCHAR);
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
......@@ -1275,45 +1275,45 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
}
case CERT_ALT_NAME_URL:
LoadStringW(hInstance, IDS_ALT_NAME_URL, buf, ARRAY_SIZE(buf));
bytesNeeded += lstrlenW(entry->u.pwszURL) * sizeof(WCHAR);
bytesNeeded += lstrlenW(entry->pwszURL) * sizeof(WCHAR);
ret = TRUE;
break;
case CERT_ALT_NAME_IP_ADDRESS:
{
LoadStringW(hInstance, IDS_ALT_NAME_IP_ADDRESS, buf, ARRAY_SIZE(buf));
if (entry->u.IPAddress.cbData == 8)
if (entry->IPAddress.cbData == 8)
{
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{
LoadStringW(hInstance, IDS_ALT_NAME_MASK, mask, ARRAY_SIZE(mask));
bytesNeeded += lstrlenW(mask) * sizeof(WCHAR);
swprintf(ipAddrBuf, ARRAY_SIZE(ipAddrBuf), L"%d.%d.%d.%d",
entry->u.IPAddress.pbData[0],
entry->u.IPAddress.pbData[1],
entry->u.IPAddress.pbData[2],
entry->u.IPAddress.pbData[3]);
entry->IPAddress.pbData[0],
entry->IPAddress.pbData[1],
entry->IPAddress.pbData[2],
entry->IPAddress.pbData[3]);
bytesNeeded += lstrlenW(ipAddrBuf) * sizeof(WCHAR);
/* indent again, for the mask line */
bytesNeeded += indentLevel * lstrlenW(indent) * sizeof(WCHAR);
swprintf(maskBuf, ARRAY_SIZE(maskBuf), L"%d.%d.%d.%d",
entry->u.IPAddress.pbData[4],
entry->u.IPAddress.pbData[5],
entry->u.IPAddress.pbData[6],
entry->u.IPAddress.pbData[7]);
entry->IPAddress.pbData[4],
entry->IPAddress.pbData[5],
entry->IPAddress.pbData[6],
entry->IPAddress.pbData[7]);
bytesNeeded += lstrlenW(maskBuf) * sizeof(WCHAR);
bytesNeeded += lstrlenW(crlf) * sizeof(WCHAR);
}
else
{
swprintf(ipAddrBuf, ARRAY_SIZE(ipAddrBuf), L"%d.%d.%d.%d/%d.%d.%d.%d",
entry->u.IPAddress.pbData[0],
entry->u.IPAddress.pbData[1],
entry->u.IPAddress.pbData[2],
entry->u.IPAddress.pbData[3],
entry->u.IPAddress.pbData[4],
entry->u.IPAddress.pbData[5],
entry->u.IPAddress.pbData[6],
entry->u.IPAddress.pbData[7]);
entry->IPAddress.pbData[0],
entry->IPAddress.pbData[1],
entry->IPAddress.pbData[2],
entry->IPAddress.pbData[3],
entry->IPAddress.pbData[4],
entry->IPAddress.pbData[5],
entry->IPAddress.pbData[6],
entry->IPAddress.pbData[7]);
bytesNeeded += (lstrlenW(ipAddrBuf) + 1) * sizeof(WCHAR);
}
ret = TRUE;
......@@ -1321,7 +1321,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
else
{
FIXME("unknown IP address format (%ld bytes)\n",
entry->u.IPAddress.cbData);
entry->IPAddress.cbData);
ret = FALSE;
}
break;
......@@ -1361,7 +1361,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
case CERT_ALT_NAME_RFC822_NAME:
case CERT_ALT_NAME_DNS_NAME:
case CERT_ALT_NAME_URL:
lstrcpyW(str, entry->u.pwszURL);
lstrcpyW(str, entry->pwszURL);
break;
case CERT_ALT_NAME_DIRECTORY_NAME:
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
......@@ -1372,7 +1372,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
else
*str++ = '=';
cert_name_to_str_with_indent(X509_ASN_ENCODING,
indentLevel + 1, &entry->u.DirectoryName, strType, str,
indentLevel + 1, &entry->DirectoryName, strType, str,
bytesNeeded / sizeof(WCHAR));
break;
case CERT_ALT_NAME_IP_ADDRESS:
......@@ -2039,7 +2039,7 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
* RDN.)
*/
ret = CRYPT_FormatAltNameInfo(dwFormatStrType, 3,
&distPoint->DistPointName.u.FullName, NULL, &size);
&distPoint->DistPointName.FullName, NULL, &size);
if (ret)
bytesNeeded += size - sizeof(WCHAR);
haveAnEntry = TRUE;
......@@ -2158,7 +2158,7 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
lstrcpyW(str, nameSep);
str += lstrlenW(nameSep);
ret = CRYPT_FormatAltNameInfo(dwFormatStrType, 3,
&distPoint->DistPointName.u.FullName, str,
&distPoint->DistPointName.FullName, str,
&altNameSize);
if (ret)
str += altNameSize / sizeof(WCHAR) - 1;
......
......@@ -21,7 +21,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#define CRYPT_OID_INFO_HAS_EXTRA_FIELDS
......@@ -778,9 +778,9 @@ BOOL WINAPI CryptRegisterOIDInfo(PCCRYPT_OID_INFO info, DWORD flags)
if (err != ERROR_SUCCESS) goto done;
}
if (info->u.Algid)
if (info->Algid)
{
err = RegSetValueExW(key, L"Algid", 0, REG_DWORD, (const BYTE *)&info->u.Algid, sizeof(info->u.Algid));
err = RegSetValueExW(key, L"Algid", 0, REG_DWORD, (const BYTE *)&info->Algid, sizeof(info->Algid));
if (err != ERROR_SUCCESS) goto done;
}
......@@ -1532,8 +1532,8 @@ static struct OIDInfo *read_oid_info(HKEY root, char *key_name, DWORD *flags)
info->info.dwGroupId = group_id;
len = sizeof(info->info.u.Algid);
RegQueryValueExW(key, L"Algid", NULL, NULL, (BYTE *)&info->info.u.Algid, &len);
len = sizeof(info->info.Algid);
RegQueryValueExW(key, L"Algid", NULL, NULL, (BYTE *)&info->info.Algid, &len);
if (extra_len)
{
......@@ -1588,7 +1588,7 @@ static void init_registered_oid_info(void)
{
TRACE("adding oid %s, name %s, groupid %lu, algid %u, extra %lu, CNG algid %s, CNG extra %s\n",
debugstr_a(info->info.pszOID), debugstr_w(info->info.pwszName),
info->info.dwGroupId, info->info.u.Algid, info->info.ExtraInfo.cbData,
info->info.dwGroupId, info->info.Algid, info->info.ExtraInfo.cbData,
debugstr_w(info->info.pwszCNGAlgid), debugstr_w(info->info.pwszCNGExtraAlgid));
if (flags & CRYPT_INSTALL_OID_INFO_BEFORE_FLAG)
......@@ -1622,7 +1622,7 @@ static void init_oid_info(void)
info->info.pszOID = oidInfoConstructors[i].pszOID;
info->info.pwszName = oidInfoConstructors[i].pwszName;
info->info.dwGroupId = oidInfoConstructors[i].dwGroupId;
info->info.u.Algid = oidInfoConstructors[i].Algid;
info->info.Algid = oidInfoConstructors[i].Algid;
if (oidInfoConstructors[i].blob)
{
info->info.ExtraInfo.cbData =
......@@ -1654,7 +1654,7 @@ static void init_oid_info(void)
info->info.pszOID = oidInfoConstructors[i].pszOID;
info->info.pwszName = (LPWSTR)(info + 1);
info->info.dwGroupId = oidInfoConstructors[i].dwGroupId;
info->info.u.Algid = oidInfoConstructors[i].Algid;
info->info.Algid = oidInfoConstructors[i].Algid;
memcpy(info + 1, stringresource, len*sizeof(WCHAR));
((LPWSTR)(info + 1))[len] = 0;
if (oidInfoConstructors[i].blob)
......@@ -1728,7 +1728,7 @@ PCCRYPT_OID_INFO WINAPI CryptFindOIDInfo(DWORD dwKeyType, void *pvKey,
EnterCriticalSection(&oidInfoCS);
LIST_FOR_EACH_ENTRY(info, &oidInfo, struct OIDInfo, entry)
{
if (info->info.u.Algid == *(DWORD *)pvKey &&
if (info->info.Algid == *(DWORD *)pvKey &&
(!dwGroupId || info->info.dwGroupId == dwGroupId))
{
ret = &info->info;
......@@ -1783,7 +1783,7 @@ PCCRYPT_OID_INFO WINAPI CryptFindOIDInfo(DWORD dwKeyType, void *pvKey,
EnterCriticalSection(&oidInfoCS);
LIST_FOR_EACH_ENTRY(info, &oidInfo, struct OIDInfo, entry)
{
if (info->info.u.Algid == *(DWORD *)pvKey &&
if (info->info.Algid == *(DWORD *)pvKey &&
info->info.ExtraInfo.cbData >= sizeof(DWORD) &&
*(DWORD *)info->info.ExtraInfo.pbData ==
*(DWORD *)((LPBYTE)pvKey + sizeof(DWORD)) &&
......@@ -1820,7 +1820,7 @@ DWORD WINAPI CertOIDToAlgId(LPCSTR pszObjId)
(void *)pszObjId, 0);
if (info)
ret = info->u.Algid;
ret = info->Algid;
else
ret = 0;
return ret;
......
......@@ -17,8 +17,6 @@
*/
#include <stdarg.h>
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
......@@ -1036,7 +1034,7 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT cert, DWORD type, DWORD flags, vo
if (entry)
{
ret = copy_output_str(name_string, entry->u.pwszRfc822Name, name_len);
ret = copy_output_str(name_string, entry->pwszRfc822Name, name_len);
break;
}
ret = cert_get_name_from_rdn_attr(cert->dwCertEncodingType, name, szOID_RSA_emailAddr,
......@@ -1056,7 +1054,7 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT cert, DWORD type, DWORD flags, vo
entry = cert_find_alt_name_entry(cert, alt_name_issuer, CERT_ALT_NAME_DIRECTORY_NAME, &info);
if (entry)
ret = CertNameToStrW(cert->dwCertEncodingType, &entry->u.DirectoryName,
ret = CertNameToStrW(cert->dwCertEncodingType, &entry->DirectoryName,
param, name_string, name_len);
}
break;
......@@ -1069,7 +1067,7 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT cert, DWORD type, DWORD flags, vo
entry = cert_find_alt_name_entry(cert, alt_name_issuer, CERT_ALT_NAME_DIRECTORY_NAME, &info);
if (entry)
ret = cert_name_to_str_with_indent(X509_ASN_ENCODING, 0, &entry->u.DirectoryName,
ret = cert_name_to_str_with_indent(X509_ASN_ENCODING, 0, &entry->DirectoryName,
0, name_string, name_len);
break;
case CERT_NAME_SIMPLE_DISPLAY_TYPE:
......@@ -1097,7 +1095,7 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT cert, DWORD type, DWORD flags, vo
if (!info) break;
if (!entry && info->cAltEntry)
entry = &info->rgAltEntry[0];
if (entry) ret = copy_output_str(name_string, entry->u.pwszRfc822Name, name_len);
if (entry) ret = copy_output_str(name_string, entry->pwszRfc822Name, name_len);
break;
}
case CERT_NAME_FRIENDLY_DISPLAY_TYPE:
......@@ -1123,7 +1121,7 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT cert, DWORD type, DWORD flags, vo
do
{
if (name_string && name_len == 1) break;
ret += len = copy_output_str(name_string, entry->u.pwszDNSName, name_len ? name_len - 1 : 0);
ret += len = copy_output_str(name_string, entry->pwszDNSName, name_len ? name_len - 1 : 0);
if (name_string && name_len)
{
name_string += len;
......@@ -1132,7 +1130,7 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT cert, DWORD type, DWORD flags, vo
}
while ((entry = cert_find_next_alt_name_entry(info, CERT_ALT_NAME_DNS_NAME, &index)));
}
else ret = copy_output_str(name_string, entry->u.pwszDNSName, name_len);
else ret = copy_output_str(name_string, entry->pwszDNSName, name_len);
}
else
{
......@@ -1155,7 +1153,7 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT cert, DWORD type, DWORD flags, vo
case CERT_NAME_URL_TYPE:
{
if ((entry = cert_find_alt_name_entry(cert, alt_name_issuer, CERT_ALT_NAME_URL, &info)))
ret = copy_output_str(name_string, entry->u.pwszURL, name_len);
ret = copy_output_str(name_string, entry->pwszURL, name_len);
break;
}
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment