rsaenh/tests: Simplify broken NT4 tests.
Based on Dmitry Timoshkov idea.
This commit is contained in:
parent
3dbcadc278
commit
3a7b89e4c0
|
@ -414,7 +414,7 @@ static void test_hashes(void)
|
||||||
BYTE pbHashValue[36];
|
BYTE pbHashValue[36];
|
||||||
BYTE pbSigValue[128];
|
BYTE pbSigValue[128];
|
||||||
HCRYPTKEY hKeyExchangeKey;
|
HCRYPTKEY hKeyExchangeKey;
|
||||||
DWORD hashlen, len, error;
|
DWORD hashlen, len, error, cryptflags;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i<2048; i++) pbData[i] = (unsigned char)i;
|
for (i=0; i<2048; i++) pbData[i] = (unsigned char)i;
|
||||||
|
@ -449,9 +449,11 @@ static void test_hashes(void)
|
||||||
result = CryptHashData(hHash, pbData, sizeof(pbData), ~0);
|
result = CryptHashData(hHash, pbData, sizeof(pbData), ~0);
|
||||||
ok(!result && GetLastError() == NTE_BAD_FLAGS, "%08x\n", GetLastError());
|
ok(!result && GetLastError() == NTE_BAD_FLAGS, "%08x\n", GetLastError());
|
||||||
|
|
||||||
result = CryptHashData(hHash, pbData, sizeof(pbData), CRYPT_USERDATA);
|
cryptflags = CRYPT_USERDATA;
|
||||||
|
result = CryptHashData(hHash, pbData, sizeof(pbData), cryptflags);
|
||||||
if (!result && GetLastError() == NTE_BAD_FLAGS) /* <= NT4 */
|
if (!result && GetLastError() == NTE_BAD_FLAGS) /* <= NT4 */
|
||||||
{
|
{
|
||||||
|
cryptflags &= ~CRYPT_USERDATA;
|
||||||
ok(broken(1), "Failed to support CRYPT_USERDATA flag\n");
|
ok(broken(1), "Failed to support CRYPT_USERDATA flag\n");
|
||||||
result = CryptHashData(hHash, pbData, sizeof(pbData), 0);
|
result = CryptHashData(hHash, pbData, sizeof(pbData), 0);
|
||||||
}
|
}
|
||||||
|
@ -481,12 +483,7 @@ static void test_hashes(void)
|
||||||
result = CryptHashData(hHash, pbData, sizeof(pbData), ~0);
|
result = CryptHashData(hHash, pbData, sizeof(pbData), ~0);
|
||||||
ok(!result && GetLastError() == NTE_BAD_FLAGS, "%08x\n", GetLastError());
|
ok(!result && GetLastError() == NTE_BAD_FLAGS, "%08x\n", GetLastError());
|
||||||
|
|
||||||
result = CryptHashData(hHash, pbData, sizeof(pbData), CRYPT_USERDATA);
|
result = CryptHashData(hHash, pbData, sizeof(pbData), cryptflags);
|
||||||
if (!result && GetLastError() == NTE_BAD_FLAGS) /* <= NT4 */
|
|
||||||
{
|
|
||||||
ok(broken(1), "Failed to support CRYPT_USERDATA flag\n");
|
|
||||||
result = CryptHashData(hHash, pbData, sizeof(pbData), 0);
|
|
||||||
}
|
|
||||||
ok(result, "%08x\n", GetLastError());
|
ok(result, "%08x\n", GetLastError());
|
||||||
|
|
||||||
len = 16;
|
len = 16;
|
||||||
|
@ -535,12 +532,7 @@ static void test_hashes(void)
|
||||||
result = CryptCreateHash(hProv, CALG_SHA, 0, 0, &hHash);
|
result = CryptCreateHash(hProv, CALG_SHA, 0, 0, &hHash);
|
||||||
ok(result, "%08x\n", GetLastError());
|
ok(result, "%08x\n", GetLastError());
|
||||||
|
|
||||||
result = CryptHashData(hHash, pbData, 5, CRYPT_USERDATA);
|
result = CryptHashData(hHash, pbData, 5, cryptflags);
|
||||||
if (!result && GetLastError() == NTE_BAD_FLAGS) /* <= NT4 */
|
|
||||||
{
|
|
||||||
ok(broken(1), "Failed to support CRYPT_USERDATA flag\n");
|
|
||||||
result = CryptHashData(hHash, pbData, 5, 0);
|
|
||||||
}
|
|
||||||
ok(result, "%08x\n", GetLastError());
|
ok(result, "%08x\n", GetLastError());
|
||||||
|
|
||||||
if(pCryptDuplicateHash) {
|
if(pCryptDuplicateHash) {
|
||||||
|
|
Loading…
Reference in New Issue