mirror of
https://github.com/reactos/reactos.git
synced 2025-04-19 04:07:16 +00:00
sync crypt32_winetest with wine 1.1.14
svn path=/trunk/; revision=39237
This commit is contained in:
parent
e09c7694fd
commit
66e2845732
6 changed files with 65 additions and 49 deletions
|
@ -662,6 +662,10 @@ static void testDupCert(void)
|
||||||
CertFreeCertificateContext(context);
|
CertFreeCertificateContext(context);
|
||||||
}
|
}
|
||||||
CertCloseStore(store, 0);
|
CertCloseStore(store, 0);
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
context = CertDuplicateCertificateContext(NULL);
|
||||||
|
ok(context == NULL, "Expected context to be NULL\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static BYTE subjectName3[] = { 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06,
|
static BYTE subjectName3[] = { 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06,
|
||||||
|
|
|
@ -808,7 +808,7 @@ static void test_encodeName(DWORD dwEncoding)
|
||||||
attrs[0].pszObjId = "bogus";
|
attrs[0].pszObjId = "bogus";
|
||||||
attrs[0].dwValueType = CERT_RDN_PRINTABLE_STRING;
|
attrs[0].dwValueType = CERT_RDN_PRINTABLE_STRING;
|
||||||
attrs[0].Value.cbData = sizeof(commonName);
|
attrs[0].Value.cbData = sizeof(commonName);
|
||||||
attrs[0].Value.pbData = (BYTE *)commonName;
|
attrs[0].Value.pbData = commonName;
|
||||||
rdn.cRDNAttr = 1;
|
rdn.cRDNAttr = 1;
|
||||||
rdn.rgRDNAttr = attrs;
|
rdn.rgRDNAttr = attrs;
|
||||||
ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
|
ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
|
||||||
|
@ -861,7 +861,7 @@ static void test_encodeName(DWORD dwEncoding)
|
||||||
"Expected E_INVALIDARG, got %08x\n", GetLastError());
|
"Expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||||
/* Test a more complex name */
|
/* Test a more complex name */
|
||||||
rdn.cRDNAttr = sizeof(rdnAttrs) / sizeof(rdnAttrs[0]);
|
rdn.cRDNAttr = sizeof(rdnAttrs) / sizeof(rdnAttrs[0]);
|
||||||
rdn.rgRDNAttr = (PCERT_RDN_ATTR)rdnAttrs;
|
rdn.rgRDNAttr = rdnAttrs;
|
||||||
info.cRDN = 1;
|
info.cRDN = 1;
|
||||||
info.rgRDN = &rdn;
|
info.rgRDN = &rdn;
|
||||||
buf = NULL;
|
buf = NULL;
|
||||||
|
@ -993,6 +993,13 @@ static void test_encodeUnicodeName(DWORD dwEncoding)
|
||||||
static void compareNameValues(const CERT_NAME_VALUE *expected,
|
static void compareNameValues(const CERT_NAME_VALUE *expected,
|
||||||
const CERT_NAME_VALUE *got)
|
const CERT_NAME_VALUE *got)
|
||||||
{
|
{
|
||||||
|
if (expected->dwValueType == CERT_RDN_UTF8_STRING &&
|
||||||
|
got->dwValueType == CERT_RDN_ENCODED_BLOB)
|
||||||
|
{
|
||||||
|
win_skip("Can't handle CERT_RDN_UTF8_STRING\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ok(got->dwValueType == expected->dwValueType,
|
ok(got->dwValueType == expected->dwValueType,
|
||||||
"Expected string type %d, got %d\n", expected->dwValueType,
|
"Expected string type %d, got %d\n", expected->dwValueType,
|
||||||
got->dwValueType);
|
got->dwValueType);
|
||||||
|
@ -1149,7 +1156,7 @@ static void test_decodeName(DWORD dwEncoding)
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
rdn.cRDNAttr = sizeof(decodedRdnAttrs) / sizeof(decodedRdnAttrs[0]);
|
rdn.cRDNAttr = sizeof(decodedRdnAttrs) / sizeof(decodedRdnAttrs[0]);
|
||||||
rdn.rgRDNAttr = (PCERT_RDN_ATTR)decodedRdnAttrs;
|
rdn.rgRDNAttr = decodedRdnAttrs;
|
||||||
compareNames(&info, (CERT_NAME_INFO *)buf);
|
compareNames(&info, (CERT_NAME_INFO *)buf);
|
||||||
LocalFree(buf);
|
LocalFree(buf);
|
||||||
}
|
}
|
||||||
|
@ -1977,10 +1984,10 @@ static void test_encodeBits(DWORD dwEncoding)
|
||||||
if (buf)
|
if (buf)
|
||||||
{
|
{
|
||||||
ok(bufSize == bits[i].encoded[1] + 2,
|
ok(bufSize == bits[i].encoded[1] + 2,
|
||||||
"Got unexpected size %d, expected %d\n", bufSize,
|
"%d: Got unexpected size %d, expected %d\n", i, bufSize,
|
||||||
bits[i].encoded[1] + 2);
|
bits[i].encoded[1] + 2);
|
||||||
ok(!memcmp(buf, bits[i].encoded, bits[i].encoded[1] + 2),
|
ok(!memcmp(buf, bits[i].encoded, bits[i].encoded[1] + 2),
|
||||||
"Unexpected value\n");
|
"%d: Unexpected value\n", i);
|
||||||
LocalFree(buf);
|
LocalFree(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2962,7 +2969,7 @@ static void test_encodeCertToBeSigned(DWORD dwEncoding)
|
||||||
ext.pszObjId = oid_subject_key_identifier;
|
ext.pszObjId = oid_subject_key_identifier;
|
||||||
ext.fCritical = FALSE;
|
ext.fCritical = FALSE;
|
||||||
ext.Value.cbData = sizeof(octetCommonNameValue);
|
ext.Value.cbData = sizeof(octetCommonNameValue);
|
||||||
ext.Value.pbData = (BYTE *)octetCommonNameValue;
|
ext.Value.pbData = octetCommonNameValue;
|
||||||
info.cExtension = 1;
|
info.cExtension = 1;
|
||||||
info.rgExtension = &ext;
|
info.rgExtension = &ext;
|
||||||
ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, &info,
|
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);
|
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, NULL, &size);
|
||||||
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
|
ok(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
|
||||||
size = sizeof(value);
|
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(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
|
||||||
/* For this (empty) message, the type isn't set */
|
/* For this (empty) message, the type isn't set */
|
||||||
ok(value == 0, "Expected type 0, got %d\n", value);
|
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());
|
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
|
||||||
/* For explicitly typed messages, the type is known. */
|
/* For explicitly typed messages, the type is known. */
|
||||||
size = sizeof(value);
|
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(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
|
||||||
ok(value == CMSG_DATA, "Expected CMSG_DATA, got %d\n", value);
|
ok(value == CMSG_DATA, "Expected CMSG_DATA, got %d\n", value);
|
||||||
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
|
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
|
||||||
|
@ -208,7 +208,7 @@ static void test_msg_get_param(void)
|
||||||
NULL);
|
NULL);
|
||||||
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
|
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
|
||||||
size = sizeof(value);
|
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(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
|
||||||
ok(value == CMSG_ENVELOPED, "Expected CMSG_ENVELOPED, got %d\n", value);
|
ok(value == CMSG_ENVELOPED, "Expected CMSG_ENVELOPED, got %d\n", value);
|
||||||
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
|
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
|
||||||
|
@ -223,7 +223,7 @@ static void test_msg_get_param(void)
|
||||||
NULL);
|
NULL);
|
||||||
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
|
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
|
||||||
size = sizeof(value);
|
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(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
|
||||||
ok(value == CMSG_HASHED, "Expected CMSG_HASHED, got %d\n", value);
|
ok(value == CMSG_HASHED, "Expected CMSG_HASHED, got %d\n", value);
|
||||||
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
|
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
|
||||||
|
@ -238,7 +238,7 @@ static void test_msg_get_param(void)
|
||||||
NULL);
|
NULL);
|
||||||
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
|
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
|
||||||
size = sizeof(value);
|
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(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
|
||||||
ok(value == CMSG_SIGNED, "Expected CMSG_SIGNED, got %d\n", value);
|
ok(value == CMSG_SIGNED, "Expected CMSG_SIGNED, got %d\n", value);
|
||||||
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
|
for (i = CMSG_CONTENT_PARAM; i <= CMSG_CMS_SIGNER_INFO_PARAM; i++)
|
||||||
|
@ -254,7 +254,7 @@ static void test_msg_get_param(void)
|
||||||
NULL);
|
NULL);
|
||||||
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
|
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
|
||||||
size = sizeof(value);
|
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(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
|
||||||
ok(value == CMSG_ENCRYPTED, "Expected CMSG_ENCRYPTED, got %d\n", value);
|
ok(value == CMSG_ENCRYPTED, "Expected CMSG_ENCRYPTED, got %d\n", value);
|
||||||
CryptMsgClose(msg);
|
CryptMsgClose(msg);
|
||||||
|
@ -262,7 +262,7 @@ static void test_msg_get_param(void)
|
||||||
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 1000, 0, NULL, NULL);
|
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 1000, 0, NULL, NULL);
|
||||||
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
|
ok(msg != NULL, "CryptMsgOpenToDecode failed: %x\n", GetLastError());
|
||||||
size = sizeof(value);
|
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(ret, "CryptMsgGetParam failed: %x\n", GetLastError());
|
||||||
ok(value == 1000, "Expected 1000, got %d\n", value);
|
ok(value == 1000, "Expected 1000, got %d\n", value);
|
||||||
CryptMsgClose(msg);
|
CryptMsgClose(msg);
|
||||||
|
@ -830,7 +830,7 @@ static void test_hash_msg_get_param(void)
|
||||||
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, NULL, &size);
|
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, NULL, &size);
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
||||||
size = sizeof(value);
|
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(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
||||||
ok(value == 0, "Expected version 0, got %d\n", value);
|
ok(value == 0, "Expected version 0, got %d\n", value);
|
||||||
/* As usual, the type isn't available. */
|
/* 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;
|
signer.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
|
||||||
U(signer.SignerId).IssuerSerialNumber.Issuer.cbData =
|
U(signer.SignerId).IssuerSerialNumber.Issuer.cbData =
|
||||||
sizeof(encodedCommonName);
|
sizeof(encodedCommonName);
|
||||||
U(signer.SignerId).IssuerSerialNumber.Issuer.pbData =
|
U(signer.SignerId).IssuerSerialNumber.Issuer.pbData = encodedCommonName;
|
||||||
(BYTE *)encodedCommonName;
|
|
||||||
U(signer.SignerId).IssuerSerialNumber.SerialNumber.cbData =
|
U(signer.SignerId).IssuerSerialNumber.SerialNumber.cbData =
|
||||||
sizeof(serialNum);
|
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,
|
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_SIGNED, &signInfo,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError());
|
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 ||
|
ok(!ret && (GetLastError() == NTE_BAD_KEYSET ||
|
||||||
GetLastError() == NTE_NO_KEY),
|
GetLastError() == NTE_NO_KEY),
|
||||||
"Expected NTE_BAD_KEYSET or NTE_NO_KEY, got %x\n", GetLastError());
|
"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);
|
0, 0, &key);
|
||||||
ok(ret, "CryptImportKey failed: %08x\n", GetLastError());
|
ok(ret, "CryptImportKey failed: %08x\n", GetLastError());
|
||||||
/* The final update should be able to succeed now that a key exists, but
|
/* 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = CryptImportKey(signer.hCryptProv, (LPBYTE)privKey, sizeof(privKey),
|
ret = CryptImportKey(signer.hCryptProv, privKey, sizeof(privKey),
|
||||||
0, 0, &key);
|
0, 0, &key);
|
||||||
ok(ret, "CryptImportKey failed: %08x\n", GetLastError());
|
ok(ret, "CryptImportKey failed: %08x\n", GetLastError());
|
||||||
|
|
||||||
|
@ -1664,7 +1663,7 @@ static void test_signed_msg_encoding(void)
|
||||||
certInfo.Issuer.cbData = 0;
|
certInfo.Issuer.cbData = 0;
|
||||||
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
|
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
|
||||||
U(signer.SignerId).KeyId.cbData = sizeof(serialNum);
|
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,
|
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_SIGNED, &signInfo,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError());
|
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);
|
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, NULL, &size);
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
||||||
size = sizeof(value);
|
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(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
||||||
ok(value == CMSG_SIGNED_DATA_V1, "Expected version 1, got %d\n", value);
|
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
|
/* 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;
|
signer.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
|
||||||
U(signer.SignerId).IssuerSerialNumber.Issuer.cbData =
|
U(signer.SignerId).IssuerSerialNumber.Issuer.cbData =
|
||||||
sizeof(encodedCommonName);
|
sizeof(encodedCommonName);
|
||||||
U(signer.SignerId).IssuerSerialNumber.Issuer.pbData =
|
U(signer.SignerId).IssuerSerialNumber.Issuer.pbData = encodedCommonName;
|
||||||
(BYTE *)encodedCommonName;
|
|
||||||
U(signer.SignerId).IssuerSerialNumber.SerialNumber.cbData =
|
U(signer.SignerId).IssuerSerialNumber.SerialNumber.cbData =
|
||||||
sizeof(serialNum);
|
sizeof(serialNum);
|
||||||
U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = (BYTE *)serialNum;
|
U(signer.SignerId).IssuerSerialNumber.SerialNumber.pbData = serialNum;
|
||||||
ret = pCryptAcquireContextA(&signer.hCryptProv, cspNameA, NULL,
|
ret = pCryptAcquireContextA(&signer.hCryptProv, cspNameA, NULL,
|
||||||
PROV_RSA_FULL, CRYPT_NEWKEYSET);
|
PROV_RSA_FULL, CRYPT_NEWKEYSET);
|
||||||
if (!ret && GetLastError() == NTE_EXISTS)
|
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.
|
* are used and no additional CMS fields are used.
|
||||||
*/
|
*/
|
||||||
size = sizeof(value);
|
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(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
||||||
ok(value == CMSG_SIGNED_DATA_V1, "expected version 1, got %d\n", value);
|
ok(value == CMSG_SIGNED_DATA_V1, "expected version 1, got %d\n", value);
|
||||||
/* Apparently the encoded signer can be retrieved.. */
|
/* 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;
|
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
|
||||||
U(signer.SignerId).KeyId.cbData = sizeof(serialNum);
|
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,
|
ret = pCryptAcquireContextA(&signer.hCryptProv, cspNameA, NULL,
|
||||||
PROV_RSA_FULL, CRYPT_NEWKEYSET);
|
PROV_RSA_FULL, CRYPT_NEWKEYSET);
|
||||||
if (!ret && GetLastError() == NTE_EXISTS)
|
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);
|
CMSG_CRYPT_RELEASE_CONTEXT_FLAG, CMSG_SIGNED, &signInfo, NULL, NULL);
|
||||||
ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError());
|
ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError());
|
||||||
size = sizeof(value);
|
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);
|
ok(value == CMSG_SIGNED_DATA_V3, "expected version 3, got %d\n", value);
|
||||||
/* Even for a CMS message, the signer can be retrieved.. */
|
/* Even for a CMS message, the signer can be retrieved.. */
|
||||||
ret = CryptMsgGetParam(msg, CMSG_ENCODED_SIGNER, 0, NULL, &size);
|
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.dwVersion = CMSG_SIGNED_DATA_V3;
|
||||||
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
|
signer.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
|
||||||
U(signer.SignerId).KeyId.cbData = sizeof(serialNum);
|
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;
|
signer.HashAlgorithm.pszObjId = oid_rsa_md5;
|
||||||
CryptMsgGetParam(msg, CMSG_CMS_SIGNER_INFO_PARAM, 0, buf, &size);
|
CryptMsgGetParam(msg, CMSG_CMS_SIGNER_INFO_PARAM, 0, buf, &size);
|
||||||
compare_cms_signer_info((CMSG_CMS_SIGNER_INFO *)buf, &signer);
|
compare_cms_signer_info((CMSG_CMS_SIGNER_INFO *)buf, &signer);
|
||||||
|
|
|
@ -69,11 +69,16 @@ static void test_cryptprotectdata(void)
|
||||||
/* without entropy */
|
/* without entropy */
|
||||||
SetLastError(0xDEADBEEF);
|
SetLastError(0xDEADBEEF);
|
||||||
protected = pCryptProtectData(&plain,desc,NULL,NULL,NULL,0,&cipher);
|
protected = pCryptProtectData(&plain,desc,NULL,NULL,NULL,0,&cipher);
|
||||||
ok(protected, "Encrypting without entropy.\n");
|
ok(protected ||
|
||||||
r = GetLastError();
|
broken(!protected), /* Win9x/NT4 */
|
||||||
ok(r == ERROR_SUCCESS ||
|
"Encrypting without entropy.\n");
|
||||||
r == ERROR_IO_PENDING, /* win2k */
|
if (protected)
|
||||||
"Expected ERROR_SUCCESS or ERROR_IO_PENDING, got %d\n",r);
|
{
|
||||||
|
r = GetLastError();
|
||||||
|
ok(r == ERROR_SUCCESS ||
|
||||||
|
r == ERROR_IO_PENDING, /* win2k */
|
||||||
|
"Expected ERROR_SUCCESS or ERROR_IO_PENDING, got %d\n",r);
|
||||||
|
}
|
||||||
|
|
||||||
cipher_entropy.pbData=NULL;
|
cipher_entropy.pbData=NULL;
|
||||||
cipher_entropy.cbData=0;
|
cipher_entropy.cbData=0;
|
||||||
|
@ -81,7 +86,9 @@ static void test_cryptprotectdata(void)
|
||||||
/* with entropy */
|
/* with entropy */
|
||||||
SetLastError(0xDEADBEEF);
|
SetLastError(0xDEADBEEF);
|
||||||
protected = pCryptProtectData(&plain,desc,&entropy,NULL,NULL,0,&cipher_entropy);
|
protected = pCryptProtectData(&plain,desc,&entropy,NULL,NULL,0,&cipher_entropy);
|
||||||
ok(protected, "Encrypting with entropy.\n");
|
ok(protected ||
|
||||||
|
broken(!protected), /* Win9x/NT4 */
|
||||||
|
"Encrypting with entropy.\n");
|
||||||
|
|
||||||
cipher_no_desc.pbData=NULL;
|
cipher_no_desc.pbData=NULL;
|
||||||
cipher_no_desc.cbData=0;
|
cipher_no_desc.cbData=0;
|
||||||
|
|
|
@ -1701,7 +1701,7 @@ struct EnumSystemStoreInfo
|
||||||
static BOOL CALLBACK enumSystemStoreCB(const void *systemStore, DWORD dwFlags,
|
static BOOL CALLBACK enumSystemStoreCB(const void *systemStore, DWORD dwFlags,
|
||||||
PCERT_SYSTEM_STORE_INFO pStoreInfo, void *pvReserved, void *pvArg)
|
PCERT_SYSTEM_STORE_INFO pStoreInfo, void *pvReserved, void *pvArg)
|
||||||
{
|
{
|
||||||
struct EnumSystemStoreInfo *info = (struct EnumSystemStoreInfo *)pvArg;
|
struct EnumSystemStoreInfo *info = pvArg;
|
||||||
|
|
||||||
info->storeCount++;
|
info->storeCount++;
|
||||||
return info->goOn;
|
return info->goOn;
|
||||||
|
|
|
@ -204,19 +204,19 @@ static void test_CertRDNValueToStrA(void)
|
||||||
{
|
{
|
||||||
CertRDNAttrEncoding attrs[] = {
|
CertRDNAttrEncoding attrs[] = {
|
||||||
{ "2.5.4.6", CERT_RDN_PRINTABLE_STRING,
|
{ "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,
|
{ "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,
|
{ "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,
|
{ "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,
|
{ "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,
|
{ "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,
|
{ "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;
|
DWORD i, ret;
|
||||||
char buffer[2000];
|
char buffer[2000];
|
||||||
|
@ -261,19 +261,19 @@ static void test_CertRDNValueToStrW(void)
|
||||||
'a','v','e','r','s','.','c','o','m',0 };
|
'a','v','e','r','s','.','c','o','m',0 };
|
||||||
CertRDNAttrEncodingW attrs[] = {
|
CertRDNAttrEncodingW attrs[] = {
|
||||||
{ "2.5.4.6", CERT_RDN_PRINTABLE_STRING,
|
{ "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,
|
{ "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,
|
{ "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,
|
{ "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,
|
{ "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,
|
{ "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,
|
{ "1.2.840.113549.1.9.1", CERT_RDN_IA5_STRING,
|
||||||
{ sizeof(bin7), (PBYTE)bin7 }, aricW },
|
{ sizeof(bin7), bin7 }, aricW },
|
||||||
};
|
};
|
||||||
DWORD i, ret;
|
DWORD i, ret;
|
||||||
WCHAR buffer[2000];
|
WCHAR buffer[2000];
|
||||||
|
|
Loading…
Reference in a new issue