Commit 6bd4bf66 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

crypt32: Fix compilation on systems that don't support nameless unions.

parent 360c164e
......@@ -1112,13 +1112,13 @@ static void test_signed_msg_open(void)
certInfo.Issuer.cbData = 0;
certInfo.SerialNumber.cbData = 0;
signer.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
signer.SignerId.IssuerSerialNumber.Issuer.cbData =
U(signer.SignerId).IssuerSerialNumber.Issuer.cbData =
sizeof(encodedCommonName);
signer.SignerId.IssuerSerialNumber.Issuer.pbData =
U(signer.SignerId).IssuerSerialNumber.Issuer.pbData =
(BYTE *)encodedCommonName;
signer.SignerId.IssuerSerialNumber.SerialNumber.cbData =
U(signer.SignerId).IssuerSerialNumber.SerialNumber.cbData =
sizeof(serialNum);
signer.SignerId.IssuerSerialNumber.SerialNumber.pbData = (BYTE *)serialNum;
U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = (BYTE *)serialNum;
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_SIGNED, &signInfo,
NULL, NULL);
ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError());
......@@ -1661,8 +1661,8 @@ static void test_signed_msg_encoding(void)
certInfo.SerialNumber.cbData = 0;
certInfo.Issuer.cbData = 0;
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
signer.SignerId.KeyId.cbData = sizeof(serialNum);
signer.SignerId.KeyId.pbData = (BYTE *)serialNum;
U(signer.SignerId).KeyId.cbData = sizeof(serialNum);
U(signer.SignerId).KeyId.pbData = (BYTE *)serialNum;
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_SIGNED, &signInfo,
NULL, NULL);
ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError());
......@@ -1888,13 +1888,13 @@ static void test_signed_msg_get_param(void)
certInfo.SerialNumber.cbData = 0;
certInfo.Issuer.cbData = 0;
signer.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
signer.SignerId.IssuerSerialNumber.Issuer.cbData =
U(signer.SignerId).IssuerSerialNumber.Issuer.cbData =
sizeof(encodedCommonName);
signer.SignerId.IssuerSerialNumber.Issuer.pbData =
U(signer.SignerId).IssuerSerialNumber.Issuer.pbData =
(BYTE *)encodedCommonName;
signer.SignerId.IssuerSerialNumber.SerialNumber.cbData =
U(signer.SignerId).IssuerSerialNumber.SerialNumber.cbData =
sizeof(serialNum);
signer.SignerId.IssuerSerialNumber.SerialNumber.pbData = (BYTE *)serialNum;
U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = (BYTE *)serialNum;
ret = pCryptAcquireContextA(&signer.hCryptProv, cspNameA, NULL,
PROV_RSA_FULL, CRYPT_NEWKEYSET);
if (!ret && GetLastError() == NTE_EXISTS)
......@@ -1933,8 +1933,8 @@ static void test_signed_msg_get_param(void)
* the CMS version.
*/
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
signer.SignerId.KeyId.cbData = sizeof(serialNum);
signer.SignerId.KeyId.pbData = (BYTE *)serialNum;
U(signer.SignerId).KeyId.cbData = sizeof(serialNum);
U(signer.SignerId).KeyId.pbData = (BYTE *)serialNum;
ret = pCryptAcquireContextA(&signer.hCryptProv, cspNameA, NULL,
PROV_RSA_FULL, CRYPT_NEWKEYSET);
if (!ret && GetLastError() == NTE_EXISTS)
......@@ -2291,32 +2291,32 @@ static void compare_cms_signer_info(const CMSG_CMS_SIGNER_INFO *got,
{
if (got->SignerId.dwIdChoice == CERT_ID_ISSUER_SERIAL_NUMBER)
{
ok(got->SignerId.IssuerSerialNumber.Issuer.cbData ==
expected->SignerId.IssuerSerialNumber.Issuer.cbData,
ok(U(got->SignerId).IssuerSerialNumber.Issuer.cbData ==
U(expected->SignerId).IssuerSerialNumber.Issuer.cbData,
"Expected issuer size %d, got %d\n",
expected->SignerId.IssuerSerialNumber.Issuer.cbData,
got->SignerId.IssuerSerialNumber.Issuer.cbData);
ok(!memcmp(got->SignerId.IssuerSerialNumber.Issuer.pbData,
expected->SignerId.IssuerSerialNumber.Issuer.pbData,
got->SignerId.IssuerSerialNumber.Issuer.cbData),
U(expected->SignerId).IssuerSerialNumber.Issuer.cbData,
U(got->SignerId).IssuerSerialNumber.Issuer.cbData);
ok(!memcmp(U(got->SignerId).IssuerSerialNumber.Issuer.pbData,
U(expected->SignerId).IssuerSerialNumber.Issuer.pbData,
U(got->SignerId).IssuerSerialNumber.Issuer.cbData),
"Unexpected issuer\n");
ok(got->SignerId.IssuerSerialNumber.SerialNumber.cbData ==
expected->SignerId.IssuerSerialNumber.SerialNumber.cbData,
ok(U(got->SignerId).IssuerSerialNumber.SerialNumber.cbData ==
U(expected->SignerId).IssuerSerialNumber.SerialNumber.cbData,
"Expected serial number size %d, got %d\n",
expected->SignerId.IssuerSerialNumber.SerialNumber.cbData,
got->SignerId.IssuerSerialNumber.SerialNumber.cbData);
ok(!memcmp(got->SignerId.IssuerSerialNumber.SerialNumber.pbData,
expected->SignerId.IssuerSerialNumber.SerialNumber.pbData,
got->SignerId.IssuerSerialNumber.SerialNumber.cbData),
U(expected->SignerId).IssuerSerialNumber.SerialNumber.cbData,
U(got->SignerId).IssuerSerialNumber.SerialNumber.cbData);
ok(!memcmp(U(got->SignerId).IssuerSerialNumber.SerialNumber.pbData,
U(expected->SignerId).IssuerSerialNumber.SerialNumber.pbData,
U(got->SignerId).IssuerSerialNumber.SerialNumber.cbData),
"Unexpected serial number\n");
}
else
{
ok(got->SignerId.KeyId.cbData == expected->SignerId.KeyId.cbData,
ok(U(got->SignerId).KeyId.cbData == U(expected->SignerId).KeyId.cbData,
"expected key id size %d, got %d\n",
expected->SignerId.KeyId.cbData, got->SignerId.KeyId.cbData);
ok(!memcmp(expected->SignerId.KeyId.pbData,
got->SignerId.KeyId.pbData, got->SignerId.KeyId.cbData),
U(expected->SignerId).KeyId.cbData, U(got->SignerId).KeyId.cbData);
ok(!memcmp(U(expected->SignerId).KeyId.pbData,
U(got->SignerId).KeyId.pbData, U(got->SignerId).KeyId.cbData),
"unexpected key id\n");
}
}
......@@ -2429,12 +2429,12 @@ static void test_decode_msg_get_param(void)
signer.dwVersion = 1;
signer.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
signer.SignerId.IssuerSerialNumber.Issuer.cbData =
U(signer.SignerId).IssuerSerialNumber.Issuer.cbData =
sizeof(encodedCommonName);
signer.SignerId.IssuerSerialNumber.Issuer.pbData = encodedCommonName;
signer.SignerId.IssuerSerialNumber.SerialNumber.cbData =
U(signer.SignerId).IssuerSerialNumber.Issuer.pbData = encodedCommonName;
U(signer.SignerId).IssuerSerialNumber.SerialNumber.cbData =
sizeof(serialNum);
signer.SignerId.IssuerSerialNumber.SerialNumber.pbData = serialNum;
U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = serialNum;
signer.HashAlgorithm.pszObjId = oid_rsa_md5;
CryptMsgGetParam(msg, CMSG_CMS_SIGNER_INFO_PARAM, 0, buf, &size);
compare_cms_signer_info((CMSG_CMS_SIGNER_INFO *)buf, &signer);
......@@ -2521,8 +2521,8 @@ static void test_decode_msg_get_param(void)
signer.dwVersion = CMSG_SIGNED_DATA_V3;
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
signer.SignerId.KeyId.cbData = sizeof(serialNum);
signer.SignerId.KeyId.pbData = (BYTE *)serialNum;
U(signer.SignerId).KeyId.cbData = sizeof(serialNum);
U(signer.SignerId).KeyId.pbData = (BYTE *)serialNum;
signer.HashAlgorithm.pszObjId = oid_rsa_md5;
CryptMsgGetParam(msg, CMSG_CMS_SIGNER_INFO_PARAM, 0, buf, &size);
compare_cms_signer_info((CMSG_CMS_SIGNER_INFO *)buf, &signer);
......
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