From 9cafb9c1685ebb84da0b65f119f2e1027ff994a9 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Sat, 25 Oct 2008 00:11:47 +0200 Subject: [PATCH] rsaenh: Use 0 instead of casting NULL to a handle of integer type. --- dlls/rsaenh/rsaenh.c | 4 +-- dlls/rsaenh/tests/rsaenh.c | 74 +++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c index b935ee33b5c..6428ae1faf8 100644 --- a/dlls/rsaenh/rsaenh.c +++ b/dlls/rsaenh/rsaenh.c @@ -657,7 +657,7 @@ static inline void update_hash(CRYPTHASH *pCryptHash, CONST BYTE *pbData, DWORD pbTemp = HeapAlloc(GetProcessHeap(), 0, dwDataLen); if (!pbTemp) return; memcpy(pbTemp, pbData, dwDataLen); - RSAENH_CPEncrypt(pCryptHash->hProv, pCryptHash->hKey, (HCRYPTHASH)NULL, FALSE, 0, + RSAENH_CPEncrypt(pCryptHash->hProv, pCryptHash->hKey, 0, FALSE, 0, pbTemp, &dwDataLen, dwDataLen); HeapFree(GetProcessHeap(), 0, pbTemp); break; @@ -701,7 +701,7 @@ static inline void finalize_hash(CRYPTHASH *pCryptHash) { case CALG_MAC: dwDataLen = 0; - RSAENH_CPEncrypt(pCryptHash->hProv, pCryptHash->hKey, (HCRYPTHASH)NULL, TRUE, 0, + RSAENH_CPEncrypt(pCryptHash->hProv, pCryptHash->hKey, 0, TRUE, 0, pCryptHash->abHashValue, &dwDataLen, pCryptHash->dwHashSize); break; diff --git a/dlls/rsaenh/tests/rsaenh.c b/dlls/rsaenh/tests/rsaenh.c index 4f25831f217..37553230f29 100644 --- a/dlls/rsaenh/tests/rsaenh.c +++ b/dlls/rsaenh/tests/rsaenh.c @@ -248,7 +248,7 @@ static BOOL derive_key(ALG_ID aiAlgid, HCRYPTKEY *phKey, DWORD len) unsigned char pbData[2000]; int i; - *phKey = (HCRYPTKEY)NULL; + *phKey = 0; for (i=0; i<2000; i++) pbData[i] = (unsigned char)i; result = CryptCreateHash(hProv, CALG_MD2, 0, 0, &hHash); if (!result) { @@ -451,17 +451,17 @@ static void test_block_cipher_modes(void) ok(result, "%08x\n", GetLastError()); dwLen = 23; - result = CryptEncrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, NULL, &dwLen, 24); + result = CryptEncrypt(hKey, 0, TRUE, 0, NULL, &dwLen, 24); ok(result, "CryptEncrypt failed: %08x\n", GetLastError()); ok(dwLen == 24, "Unexpected length %d\n", dwLen); SetLastError(ERROR_SUCCESS); dwLen = 23; - result = CryptEncrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, abData, &dwLen, 24); + result = CryptEncrypt(hKey, 0, TRUE, 0, abData, &dwLen, 24); ok(result && dwLen == 24 && !memcmp(ecb, abData, sizeof(ecb)), "%08x, dwLen: %d\n", GetLastError(), dwLen); - result = CryptDecrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, abData, &dwLen); + result = CryptDecrypt(hKey, 0, TRUE, 0, abData, &dwLen); ok(result && dwLen == 23 && !memcmp(plain, abData, sizeof(plain)), "%08x, dwLen: %d\n", GetLastError(), dwLen); @@ -470,16 +470,16 @@ static void test_block_cipher_modes(void) ok(result, "%08x\n", GetLastError()); dwLen = 23; - result = CryptEncrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, NULL, &dwLen, 24); + result = CryptEncrypt(hKey, 0, TRUE, 0, NULL, &dwLen, 24); ok(result, "CryptEncrypt failed: %08x\n", GetLastError()); ok(dwLen == 24, "Unexpected length %d\n", dwLen); dwLen = 23; - result = CryptEncrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, abData, &dwLen, 24); + result = CryptEncrypt(hKey, 0, TRUE, 0, abData, &dwLen, 24); ok(result && dwLen == 24 && !memcmp(cbc, abData, sizeof(cbc)), "%08x, dwLen: %d\n", GetLastError(), dwLen); - result = CryptDecrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, abData, &dwLen); + result = CryptDecrypt(hKey, 0, TRUE, 0, abData, &dwLen); ok(result && dwLen == 23 && !memcmp(plain, abData, sizeof(plain)), "%08x, dwLen: %d\n", GetLastError(), dwLen); @@ -488,20 +488,20 @@ static void test_block_cipher_modes(void) ok(result, "%08x\n", GetLastError()); dwLen = 16; - result = CryptEncrypt(hKey, (HCRYPTHASH)NULL, FALSE, 0, abData, &dwLen, 24); + result = CryptEncrypt(hKey, 0, FALSE, 0, abData, &dwLen, 24); ok(result && dwLen == 16, "%08x, dwLen: %d\n", GetLastError(), dwLen); dwLen = 7; - result = CryptEncrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, abData+16, &dwLen, 8); + result = CryptEncrypt(hKey, 0, TRUE, 0, abData+16, &dwLen, 8); ok(result && dwLen == 8 && !memcmp(cfb, abData, sizeof(cfb)), "%08x, dwLen: %d\n", GetLastError(), dwLen); dwLen = 8; - result = CryptDecrypt(hKey, (HCRYPTHASH)NULL, FALSE, 0, abData, &dwLen); + result = CryptDecrypt(hKey, 0, FALSE, 0, abData, &dwLen); ok(result && dwLen == 8, "%08x, dwLen: %d\n", GetLastError(), dwLen); dwLen = 16; - result = CryptDecrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, abData+8, &dwLen); + result = CryptDecrypt(hKey, 0, TRUE, 0, abData+8, &dwLen); ok(result && dwLen == 15 && !memcmp(plain, abData, sizeof(plain)), "%08x, dwLen: %d\n", GetLastError(), dwLen); @@ -510,7 +510,7 @@ static void test_block_cipher_modes(void) ok(result, "%08x\n", GetLastError()); dwLen = 23; - result = CryptEncrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, abData, &dwLen, 24); + result = CryptEncrypt(hKey, 0, TRUE, 0, abData, &dwLen, 24); ok(!result && GetLastError() == NTE_BAD_ALGID, "%08x\n", GetLastError()); CryptDestroyKey(hKey); @@ -534,10 +534,10 @@ static void test_3des112(void) for (i=0; i