Commit 1dc371c2 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

crypt32/tests: Remove superfluous pointer casts.

parent ae6231d0
......@@ -808,7 +808,7 @@ static void test_encodeName(DWORD dwEncoding)
attrs[0].pszObjId = "bogus";
attrs[0].dwValueType = CERT_RDN_PRINTABLE_STRING;
attrs[0].Value.cbData = sizeof(commonName);
attrs[0].Value.pbData = (BYTE *)commonName;
attrs[0].Value.pbData = commonName;
rdn.cRDNAttr = 1;
rdn.rgRDNAttr = attrs;
ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
......@@ -861,7 +861,7 @@ static void test_encodeName(DWORD dwEncoding)
"Expected E_INVALIDARG, got %08x\n", GetLastError());
/* Test a more complex name */
rdn.cRDNAttr = sizeof(rdnAttrs) / sizeof(rdnAttrs[0]);
rdn.rgRDNAttr = (PCERT_RDN_ATTR)rdnAttrs;
rdn.rgRDNAttr = rdnAttrs;
info.cRDN = 1;
info.rgRDN = &rdn;
buf = NULL;
......@@ -1156,7 +1156,7 @@ static void test_decodeName(DWORD dwEncoding)
if (ret)
{
rdn.cRDNAttr = sizeof(decodedRdnAttrs) / sizeof(decodedRdnAttrs[0]);
rdn.rgRDNAttr = (PCERT_RDN_ATTR)decodedRdnAttrs;
rdn.rgRDNAttr = decodedRdnAttrs;
compareNames(&info, (CERT_NAME_INFO *)buf);
LocalFree(buf);
}
......@@ -2969,7 +2969,7 @@ static void test_encodeCertToBeSigned(DWORD dwEncoding)
ext.pszObjId = oid_subject_key_identifier;
ext.fCritical = FALSE;
ext.Value.cbData = sizeof(octetCommonNameValue);
ext.Value.pbData = (BYTE *)octetCommonNameValue;
ext.Value.pbData = octetCommonNameValue;
info.cExtension = 1;
info.rgExtension = &ext;
ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, &info,
......
......@@ -182,7 +182,7 @@ static void test_msg_get_param(void)
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, NULL, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
size = sizeof(value);
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, (LPBYTE)&value, &size);
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
/* For this (empty) message, the type isn't set */
ok(value == 0, "Expected type 0, got %d\n", value);
......@@ -193,7 +193,7 @@ static void test_msg_get_param(void)
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
/* For explicitly typed messages, the type is known. */
size = sizeof(value);
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, (LPBYTE)&value, &size);
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
ok(value == CMSG_DATA, "Expected CMSG_DATA, got %d\n", value);
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
......@@ -208,7 +208,7 @@ static void test_msg_get_param(void)
NULL);
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
size = sizeof(value);
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, (LPBYTE)&value, &size);
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
ok(value == CMSG_ENVELOPED, "Expected CMSG_ENVELOPED, got %d\n", value);
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
......@@ -223,7 +223,7 @@ static void test_msg_get_param(void)
NULL);
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
size = sizeof(value);
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, (LPBYTE)&value, &size);
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
ok(value == CMSG_HASHED, "Expected CMSG_HASHED, got %d\n", value);
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
......@@ -238,7 +238,7 @@ static void test_msg_get_param(void)
NULL);
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
size = sizeof(value);
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, (LPBYTE)&value, &size);
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
ok(value == CMSG_SIGNED, "Expected CMSG_SIGNED, got %d\n", value);
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
......@@ -254,7 +254,7 @@ static void test_msg_get_param(void)
NULL);
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
size = sizeof(value);
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, (LPBYTE)&value, &size);
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
ok(value == CMSG_ENCRYPTED, "Expected CMSG_ENCRYPTED, got %d\n", value);
CryptMsgClose(msg);
......@@ -262,7 +262,7 @@ static void test_msg_get_param(void)
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 1000, 0, NULL, NULL);
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
size = sizeof(value);
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, (LPBYTE)&value, &size);
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
ok(value == 1000, "Expected 1000, got %d\n", value);
CryptMsgClose(msg);
......@@ -830,7 +830,7 @@ static void test_hash_msg_get_param(void)
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, NULL, &size);
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
size = sizeof(value);
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, (LPBYTE)&value, &size);
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
ok(value == 0, "Expected version 0, got %d\n", value);
/* As usual, the type isn't available. */
......@@ -1116,11 +1116,10 @@ static void test_signed_msg_open(void)
signer.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
U(signer.SignerId).IssuerSerialNumber.Issuer.cbData =
sizeof(encodedCommonName);
U(signer.SignerId).IssuerSerialNumber.Issuer.pbData =
(BYTE *)encodedCommonName;
U(signer.SignerId).IssuerSerialNumber.Issuer.pbData = encodedCommonName;
U(signer.SignerId).IssuerSerialNumber.SerialNumber.cbData =
sizeof(serialNum);
U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = (BYTE *)serialNum;
U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = serialNum;
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_SIGNED, &signInfo,
NULL, NULL);
ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError());
......@@ -1211,7 +1210,7 @@ static void test_signed_msg_update(void)
ok(!ret && (GetLastError() == NTE_BAD_KEYSET ||
GetLastError() == NTE_NO_KEY),
"Expected NTE_BAD_KEYSET or NTE_NO_KEY, got %x\n", GetLastError());
ret = CryptImportKey(signer.hCryptProv, (LPBYTE)privKey, sizeof(privKey),
ret = CryptImportKey(signer.hCryptProv, privKey, sizeof(privKey),
0, 0, &key);
ok(ret, "CryptImportKey failed: %08x\n", GetLastError());
/* The final update should be able to succeed now that a key exists, but
......@@ -1630,7 +1629,7 @@ static void test_signed_msg_encoding(void)
return;
}
ret = CryptImportKey(signer.hCryptProv, (LPBYTE)privKey, sizeof(privKey),
ret = CryptImportKey(signer.hCryptProv, privKey, sizeof(privKey),
0, 0, &key);
ok(ret, "CryptImportKey failed: %08x\n", GetLastError());
......@@ -1664,7 +1663,7 @@ static void test_signed_msg_encoding(void)
certInfo.Issuer.cbData = 0;
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
U(signer.SignerId).KeyId.cbData = sizeof(serialNum);
U(signer.SignerId).KeyId.pbData = (BYTE *)serialNum;
U(signer.SignerId).KeyId.pbData = serialNum;
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_SIGNED, &signInfo,
NULL, NULL);
ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError());
......@@ -1814,7 +1813,7 @@ static void test_signed_msg_get_param(void)
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, NULL, &size);
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
size = sizeof(value);
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, (LPBYTE)&value, &size);
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
ok(value == CMSG_SIGNED_DATA_V1, "Expected version 1, got %d\n", value);
/* But for this message, with no signers, the hash and signer aren't
......@@ -1892,11 +1891,10 @@ static void test_signed_msg_get_param(void)
signer.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
U(signer.SignerId).IssuerSerialNumber.Issuer.cbData =
sizeof(encodedCommonName);
U(signer.SignerId).IssuerSerialNumber.Issuer.pbData =
(BYTE *)encodedCommonName;
U(signer.SignerId).IssuerSerialNumber.Issuer.pbData = encodedCommonName;
U(signer.SignerId).IssuerSerialNumber.SerialNumber.cbData =
sizeof(serialNum);
U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = (BYTE *)serialNum;
U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = serialNum;
ret = pCryptAcquireContextA(&signer.hCryptProv, cspNameA, NULL,
PROV_RSA_FULL, CRYPT_NEWKEYSET);
if (!ret && GetLastError() == NTE_EXISTS)
......@@ -1910,7 +1908,7 @@ static void test_signed_msg_get_param(void)
* are used and no additional CMS fields are used.
*/
size = sizeof(value);
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, (LPBYTE)&value, &size);
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, &value, &size);
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
ok(value == CMSG_SIGNED_DATA_V1, "expected version 1, got %d\n", value);
/* Apparently the encoded signer can be retrieved.. */
......@@ -1936,7 +1934,7 @@ static void test_signed_msg_get_param(void)
*/
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
U(signer.SignerId).KeyId.cbData = sizeof(serialNum);
U(signer.SignerId).KeyId.pbData = (BYTE *)serialNum;
U(signer.SignerId).KeyId.pbData = serialNum;
ret = pCryptAcquireContextA(&signer.hCryptProv, cspNameA, NULL,
PROV_RSA_FULL, CRYPT_NEWKEYSET);
if (!ret && GetLastError() == NTE_EXISTS)
......@@ -1947,7 +1945,7 @@ static void test_signed_msg_get_param(void)
CMSG_CRYPT_RELEASE_CONTEXT_FLAG, CMSG_SIGNED, &signInfo, NULL, NULL);
ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError());
size = sizeof(value);
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, (LPBYTE)&value, &size);
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, &value, &size);
ok(value == CMSG_SIGNED_DATA_V3, "expected version 3, got %d\n", value);
/* Even for a CMS message, the signer can be retrieved.. */
ret = CryptMsgGetParam(msg, CMSG_ENCODED_SIGNER, 0, NULL, &size);
......@@ -2528,7 +2526,7 @@ 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 = (BYTE *)serialNum;
U(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);
......
......@@ -1701,7 +1701,7 @@ struct EnumSystemStoreInfo
static BOOL CALLBACK enumSystemStoreCB(const void *systemStore, DWORD dwFlags,
PCERT_SYSTEM_STORE_INFO pStoreInfo, void *pvReserved, void *pvArg)
{
struct EnumSystemStoreInfo *info = (struct EnumSystemStoreInfo *)pvArg;
struct EnumSystemStoreInfo *info = pvArg;
info->storeCount++;
return info->goOn;
......
......@@ -204,19 +204,19 @@ static void test_CertRDNValueToStrA(void)
{
CertRDNAttrEncoding attrs[] = {
{ "2.5.4.6", CERT_RDN_PRINTABLE_STRING,
{ sizeof(bin1), (PBYTE)bin1 }, "US" },
{ sizeof(bin1), bin1 }, "US" },
{ "2.5.4.8", CERT_RDN_PRINTABLE_STRING,
{ sizeof(bin2), (PBYTE)bin2 }, "Minnesota" },
{ sizeof(bin2), bin2 }, "Minnesota" },
{ "2.5.4.7", CERT_RDN_PRINTABLE_STRING,
{ sizeof(bin3), (PBYTE)bin3 }, "Minneapolis" },
{ sizeof(bin3), bin3 }, "Minneapolis" },
{ "2.5.4.10", CERT_RDN_PRINTABLE_STRING,
{ sizeof(bin4), (PBYTE)bin4 }, "CodeWeavers" },
{ sizeof(bin4), bin4 }, "CodeWeavers" },
{ "2.5.4.11", CERT_RDN_PRINTABLE_STRING,
{ sizeof(bin5), (PBYTE)bin5 }, "Wine Development" },
{ sizeof(bin5), bin5 }, "Wine Development" },
{ "2.5.4.3", CERT_RDN_PRINTABLE_STRING,
{ sizeof(bin6), (PBYTE)bin6 }, "localhost" },
{ sizeof(bin6), bin6 }, "localhost" },
{ "1.2.840.113549.1.9.1", CERT_RDN_IA5_STRING,
{ sizeof(bin7), (PBYTE)bin7 }, "aric@codeweavers.com" },
{ sizeof(bin7), bin7 }, "aric@codeweavers.com" },
};
DWORD i, ret;
char buffer[2000];
......@@ -261,19 +261,19 @@ static void test_CertRDNValueToStrW(void)
'a','v','e','r','s','.','c','o','m',0 };
CertRDNAttrEncodingW attrs[] = {
{ "2.5.4.6", CERT_RDN_PRINTABLE_STRING,
{ sizeof(bin1), (PBYTE)bin1 }, usW },
{ sizeof(bin1), bin1 }, usW },
{ "2.5.4.8", CERT_RDN_PRINTABLE_STRING,
{ sizeof(bin2), (PBYTE)bin2 }, minnesotaW },
{ sizeof(bin2), bin2 }, minnesotaW },
{ "2.5.4.7", CERT_RDN_PRINTABLE_STRING,
{ sizeof(bin3), (PBYTE)bin3 }, minneapolisW },
{ sizeof(bin3), bin3 }, minneapolisW },
{ "2.5.4.10", CERT_RDN_PRINTABLE_STRING,
{ sizeof(bin4), (PBYTE)bin4 }, codeweaversW },
{ sizeof(bin4), bin4 }, codeweaversW },
{ "2.5.4.11", CERT_RDN_PRINTABLE_STRING,
{ sizeof(bin5), (PBYTE)bin5 }, wineDevW },
{ sizeof(bin5), bin5 }, wineDevW },
{ "2.5.4.3", CERT_RDN_PRINTABLE_STRING,
{ sizeof(bin6), (PBYTE)bin6 }, localhostW },
{ sizeof(bin6), bin6 }, localhostW },
{ "1.2.840.113549.1.9.1", CERT_RDN_IA5_STRING,
{ sizeof(bin7), (PBYTE)bin7 }, aricW },
{ sizeof(bin7), bin7 }, aricW },
};
DWORD i, ret;
WCHAR buffer[2000];
......
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