Commit 7bcfc123 authored by Alexandre Julliard's avatar Alexandre Julliard

crypt32/tests: Use nameless unions/structs.

parent a0b9b4ee
......@@ -5154,7 +5154,7 @@ static void check_ssl_policy(void)
/* And again authenticating a client, but specify the size of the policy
* parameter.
*/
U(sslPolicyPara).cbSize = sizeof(sslPolicyCheck);
sslPolicyPara.cbSize = sizeof(sslPolicyCheck);
sslPolicyPara.dwAuthType = AUTHTYPE_CLIENT;
CHECK_CHAIN_POLICY_STATUS_ARRAY(CERT_CHAIN_POLICY_SSL, NULL, sslPolicyCheck,
&oct2007, &policyPara);
......
......@@ -1105,12 +1105,10 @@ static void test_signed_msg_open(void)
certInfo.Issuer.cbData = 0;
certInfo.SerialNumber.cbData = 0;
signer.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
U(signer.SignerId).IssuerSerialNumber.Issuer.cbData =
sizeof(encodedCommonName);
U(signer.SignerId).IssuerSerialNumber.Issuer.pbData = encodedCommonName;
U(signer.SignerId).IssuerSerialNumber.SerialNumber.cbData =
sizeof(serialNum);
U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = serialNum;
signer.SignerId.IssuerSerialNumber.Issuer.cbData = sizeof(encodedCommonName);
signer.SignerId.IssuerSerialNumber.Issuer.pbData = encodedCommonName;
signer.SignerId.IssuerSerialNumber.SerialNumber.cbData = sizeof(serialNum);
signer.SignerId.IssuerSerialNumber.SerialNumber.pbData = serialNum;
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_SIGNED, &signInfo,
NULL, NULL);
ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
......@@ -1642,8 +1640,8 @@ static void test_signed_msg_encoding(void)
certInfo.SerialNumber.cbData = 0;
certInfo.Issuer.cbData = 0;
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
U(signer.SignerId).KeyId.cbData = sizeof(serialNum);
U(signer.SignerId).KeyId.pbData = serialNum;
signer.SignerId.KeyId.cbData = sizeof(serialNum);
signer.SignerId.KeyId.pbData = serialNum;
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_SIGNED, &signInfo,
NULL, NULL);
ok(msg != NULL, "CryptMsgOpenToEncode failed: %lx\n", GetLastError());
......@@ -1866,12 +1864,10 @@ static void test_signed_msg_get_param(void)
certInfo.SerialNumber.cbData = 0;
certInfo.Issuer.cbData = 0;
signer.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
U(signer.SignerId).IssuerSerialNumber.Issuer.cbData =
sizeof(encodedCommonName);
U(signer.SignerId).IssuerSerialNumber.Issuer.pbData = encodedCommonName;
U(signer.SignerId).IssuerSerialNumber.SerialNumber.cbData =
sizeof(serialNum);
U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = serialNum;
signer.SignerId.IssuerSerialNumber.Issuer.cbData = sizeof(encodedCommonName);
signer.SignerId.IssuerSerialNumber.Issuer.pbData = encodedCommonName;
signer.SignerId.IssuerSerialNumber.SerialNumber.cbData = sizeof(serialNum);
signer.SignerId.IssuerSerialNumber.SerialNumber.pbData = serialNum;
ret = CryptAcquireContextA(&signer.hCryptProv, cspNameA, NULL,
PROV_RSA_FULL, CRYPT_NEWKEYSET);
if (!ret && GetLastError() == NTE_EXISTS)
......@@ -1911,8 +1907,8 @@ static void test_signed_msg_get_param(void)
* the CMS version.
*/
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
U(signer.SignerId).KeyId.cbData = sizeof(serialNum);
U(signer.SignerId).KeyId.pbData = serialNum;
signer.SignerId.KeyId.cbData = sizeof(serialNum);
signer.SignerId.KeyId.pbData = serialNum;
ret = CryptAcquireContextA(&signer.hCryptProv, cspNameA, NULL,
PROV_RSA_FULL, CRYPT_NEWKEYSET);
if (!ret && GetLastError() == NTE_EXISTS)
......@@ -2520,32 +2516,32 @@ static void compare_cms_signer_info(const CMSG_CMS_SIGNER_INFO *got,
{
if (got->SignerId.dwIdChoice == CERT_ID_ISSUER_SERIAL_NUMBER)
{
ok(U(got->SignerId).IssuerSerialNumber.Issuer.cbData ==
U(expected->SignerId).IssuerSerialNumber.Issuer.cbData,
ok(got->SignerId.IssuerSerialNumber.Issuer.cbData ==
expected->SignerId.IssuerSerialNumber.Issuer.cbData,
"Expected issuer size %ld, got %ld\n",
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),
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),
"Unexpected issuer\n");
ok(U(got->SignerId).IssuerSerialNumber.SerialNumber.cbData ==
U(expected->SignerId).IssuerSerialNumber.SerialNumber.cbData,
ok(got->SignerId.IssuerSerialNumber.SerialNumber.cbData ==
expected->SignerId.IssuerSerialNumber.SerialNumber.cbData,
"Expected serial number size %ld, got %ld\n",
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),
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),
"Unexpected serial number\n");
}
else
{
ok(U(got->SignerId).KeyId.cbData == U(expected->SignerId).KeyId.cbData,
ok(got->SignerId.KeyId.cbData == expected->SignerId.KeyId.cbData,
"expected key id size %ld, got %ld\n",
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),
expected->SignerId.KeyId.cbData, got->SignerId.KeyId.cbData);
ok(!memcmp(expected->SignerId.KeyId.pbData,
got->SignerId.KeyId.pbData, got->SignerId.KeyId.cbData),
"unexpected key id\n");
}
}
......@@ -2785,12 +2781,10 @@ static void test_decode_msg_get_param(void)
signer.dwVersion = 1;
signer.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
U(signer.SignerId).IssuerSerialNumber.Issuer.cbData =
sizeof(encodedCommonName);
U(signer.SignerId).IssuerSerialNumber.Issuer.pbData = encodedCommonName;
U(signer.SignerId).IssuerSerialNumber.SerialNumber.cbData =
sizeof(serialNum);
U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = serialNum;
signer.SignerId.IssuerSerialNumber.Issuer.cbData = sizeof(encodedCommonName);
signer.SignerId.IssuerSerialNumber.Issuer.pbData = encodedCommonName;
signer.SignerId.IssuerSerialNumber.SerialNumber.cbData = sizeof(serialNum);
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);
......@@ -2871,8 +2865,8 @@ static void test_decode_msg_get_param(void)
signer.dwVersion = CMSG_SIGNED_DATA_V3;
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
U(signer.SignerId).KeyId.cbData = sizeof(serialNum);
U(signer.SignerId).KeyId.pbData = serialNum;
signer.SignerId.KeyId.cbData = sizeof(serialNum);
signer.SignerId.KeyId.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);
......
......@@ -543,8 +543,8 @@ static void test_findOIDInfo(void)
if (info)
{
ok(!strcmp(info->pszOID, test->oid), "Unexpected OID %s, expected %s\n", info->pszOID, test->oid);
ok(U(*info).Algid == test->algid || broken(U(*info).Algid == test->broken_algid),
"Unexpected Algid %d, expected %d\n", U(*info).Algid, test->algid);
ok(info->Algid == test->algid || broken(info->Algid == test->broken_algid),
"Unexpected Algid %d, expected %d\n", info->Algid, test->algid);
}
}
......@@ -559,8 +559,8 @@ static void test_findOIDInfo(void)
wine_dbgstr_w(L"sha256ECDSA"), wine_dbgstr_w(info->pwszName));
ok(info->dwGroupId == CRYPT_SIGN_ALG_OID_GROUP_ID,
"Expected CRYPT_SIGN_ALG_OID_GROUP_ID, got %lu\n", info->dwGroupId);
ok(U(*info).Algid == CALG_OID_INFO_CNG_ONLY,
"Expected CALG_OID_INFO_CNG_ONLY, got %d\n", U(*info).Algid);
ok(info->Algid == CALG_OID_INFO_CNG_ONLY,
"Expected CALG_OID_INFO_CNG_ONLY, got %d\n", info->Algid);
data = (DWORD *)info->ExtraInfo.pbData;
ok(info->ExtraInfo.cbData == 8, "Expected 8, got %ld\n", info->ExtraInfo.cbData);
......@@ -581,7 +581,7 @@ static void test_findOIDInfo(void)
ok(!strcmp(info->pszOID, oid_ecc_public_key), "got %s.\n", info->pszOID);
ok(!wcscmp(info->pwszName, L"ECC"), "got %s.\n", wine_dbgstr_w(info->pwszName));
ok(info->dwGroupId == CRYPT_PUBKEY_ALG_OID_GROUP_ID, "got %lu.\n", info->dwGroupId);
ok(U(*info).Algid == CALG_OID_INFO_PARAMETERS, "got %d.\n", U(*info).Algid);
ok(info->Algid == CALG_OID_INFO_PARAMETERS, "got %d.\n", info->Algid);
ok(!info->ExtraInfo.cbData, "got %ld.\n", info->ExtraInfo.cbData);
ok(!wcscmp(info->pwszCNGAlgid, CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM), "got %s.\n", wine_dbgstr_w(info->pwszCNGAlgid));
ok(info->pwszCNGExtraAlgid && !wcscmp(info->pwszCNGExtraAlgid, L""), "got %s.\n",
......
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