From f976f07653c64d338a27d27dac5d83cc3cc43398 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Tue, 17 Nov 2015 21:12:00 +0000 Subject: [PATCH] [CRYPT32] Sync with Wine Staging 1.7.55. CORE-10536 svn path=/trunk/; revision=69929 --- reactos/dll/win32/crypt32/CMakeLists.txt | 5 ++- reactos/dll/win32/crypt32/cert.c | 1 + reactos/dll/win32/crypt32/crypt32.spec | 2 ++ reactos/dll/win32/crypt32/decode.c | 40 +++++++++++++----------- reactos/dll/win32/crypt32/main.c | 13 ++++++++ reactos/dll/win32/crypt32/regstore.c | 6 ++-- reactos/media/doc/README.WINE | 2 +- 7 files changed, 45 insertions(+), 24 deletions(-) diff --git a/reactos/dll/win32/crypt32/CMakeLists.txt b/reactos/dll/win32/crypt32/CMakeLists.txt index b10d63891ab..535b061fa71 100644 --- a/reactos/dll/win32/crypt32/CMakeLists.txt +++ b/reactos/dll/win32/crypt32/CMakeLists.txt @@ -1,4 +1,7 @@ +remove_definitions(-D_WIN32_WINNT=0x502 -DWINVER=0x502) +add_definitions(-D_WIN32_WINNT=0x600 -DWINVER=0x600) + add_definitions( -D__WINESRC__ -D_WINE @@ -42,7 +45,7 @@ add_library(crypt32 SHARED set_module_type(crypt32 win32dll) target_link_libraries(crypt32 wine ${PSEH_LIB} oldnames) -add_importlibs(crypt32 user32 advapi32 shlwapi msvcrt kernel32 ntdll) +add_importlibs(crypt32 user32 advapi32 advapi32_vista msvcrt kernel32 ntdll) add_delay_importlibs(crypt32 cryptnet) add_pch(crypt32 crypt32_private.h SOURCE) add_cd_file(TARGET crypt32 DESTINATION reactos/system32 FOR all) diff --git a/reactos/dll/win32/crypt32/cert.c b/reactos/dll/win32/crypt32/cert.c index f3ee89f9e39..0cf885b20b2 100644 --- a/reactos/dll/win32/crypt32/cert.c +++ b/reactos/dll/win32/crypt32/cert.c @@ -685,6 +685,7 @@ static BOOL CertContext_SetProperty(cert_t *cert, DWORD dwPropId, case CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID: case CERT_ENROLLMENT_PROP_ID: case CERT_CROSS_CERT_DIST_POINTS_PROP_ID: + case CERT_OCSP_RESPONSE_PROP_ID: case CERT_RENEWAL_PROP_ID: { if (pvData) diff --git a/reactos/dll/win32/crypt32/crypt32.spec b/reactos/dll/win32/crypt32/crypt32.spec index 66d831b2e77..e639d7c5590 100644 --- a/reactos/dll/win32/crypt32/crypt32.spec +++ b/reactos/dll/win32/crypt32/crypt32.spec @@ -163,6 +163,7 @@ @ stub CryptMsgVerifyCountersignatureEncoded @ stdcall CryptMsgVerifyCountersignatureEncodedEx(ptr long ptr long ptr long long ptr long ptr) @ stdcall CryptProtectData(ptr wstr ptr ptr ptr long ptr) +@ stdcall CryptProtectMemory(ptr long long) @ stdcall CryptQueryObject(long ptr long long long ptr ptr ptr ptr ptr ptr) @ stdcall CryptRegisterDefaultOIDFunction(long str long wstr) @ stdcall CryptRegisterOIDFunction(long str str wstr str) @@ -186,6 +187,7 @@ @ stdcall CryptSignMessage(ptr long long ptr ptr ptr ptr) @ stub CryptSignMessageWithKey @ stdcall CryptUnprotectData(ptr ptr ptr ptr ptr long ptr) +@ stdcall CryptUnprotectMemory(ptr long long) @ stdcall CryptUnregisterDefaultOIDFunction(long str wstr) @ stdcall CryptUnregisterOIDFunction(long str str) @ stub CryptUnregisterOIDInfo diff --git a/reactos/dll/win32/crypt32/decode.c b/reactos/dll/win32/crypt32/decode.c index 07a68e6f83d..5d91e3027ce 100644 --- a/reactos/dll/win32/crypt32/decode.c +++ b/reactos/dll/win32/crypt32/decode.c @@ -3985,18 +3985,19 @@ static BOOL WINAPI CRYPT_AsnDecodeRsaPrivKey(DWORD dwCertEncodingType, &size, NULL, NULL); if (ret) { - halflen = decodedKey->modulus.cbData / 2; - if ((decodedKey->modulus.cbData != halflen * 2) || - (decodedKey->prime1.cbData != halflen) || - (decodedKey->prime2.cbData != halflen) || - (decodedKey->exponent1.cbData != halflen) || - (decodedKey->exponent2.cbData != halflen) || - (decodedKey->coefficient.cbData != halflen) || - (decodedKey->privexp.cbData != halflen * 2)) - { - ret = FALSE; - SetLastError(CRYPT_E_BAD_ENCODE); - } + halflen = decodedKey->prime1.cbData; + if (halflen < decodedKey->prime2.cbData) + halflen = decodedKey->prime2.cbData; + if (halflen < decodedKey->exponent1.cbData) + halflen = decodedKey->exponent1.cbData; + if (halflen < decodedKey->exponent2.cbData) + halflen = decodedKey->exponent2.cbData; + if (halflen < decodedKey->coefficient.cbData) + halflen = decodedKey->coefficient.cbData; + if (halflen * 2 < decodedKey->modulus.cbData) + halflen = decodedKey->modulus.cbData / 2 + decodedKey->modulus.cbData % 2; + if (halflen * 2 < decodedKey->privexp.cbData) + halflen = decodedKey->privexp.cbData / 2 + decodedKey->privexp.cbData % 2; if (ret) { @@ -4031,20 +4032,21 @@ static BOOL WINAPI CRYPT_AsnDecodeRsaPrivKey(DWORD dwCertEncodingType, rsaPubKey->bitlen = halflen * 16; vardata = (BYTE*)(rsaPubKey + 1); + memset(vardata, 0, halflen * 9); memcpy(vardata, - decodedKey->modulus.pbData, halflen * 2); + decodedKey->modulus.pbData, decodedKey->modulus.cbData); memcpy(vardata + halflen * 2, - decodedKey->prime1.pbData, halflen); + decodedKey->prime1.pbData, decodedKey->prime1.cbData); memcpy(vardata + halflen * 3, - decodedKey->prime2.pbData, halflen); + decodedKey->prime2.pbData, decodedKey->prime2.cbData); memcpy(vardata + halflen * 4, - decodedKey->exponent1.pbData, halflen); + decodedKey->exponent1.pbData, decodedKey->exponent1.cbData); memcpy(vardata + halflen * 5, - decodedKey->exponent2.pbData, halflen); + decodedKey->exponent2.pbData, decodedKey->exponent2.cbData); memcpy(vardata + halflen * 6, - decodedKey->coefficient.pbData, halflen); + decodedKey->coefficient.pbData, decodedKey->coefficient.cbData); memcpy(vardata + halflen * 7, - decodedKey->privexp.pbData, halflen * 2); + decodedKey->privexp.pbData, decodedKey->privexp.cbData); } } diff --git a/reactos/dll/win32/crypt32/main.c b/reactos/dll/win32/crypt32/main.c index 776396e802d..66d2b89bf47 100644 --- a/reactos/dll/win32/crypt32/main.c +++ b/reactos/dll/win32/crypt32/main.c @@ -241,3 +241,16 @@ ASN1encoding_t WINAPI I_CryptGetAsn1Encoder(HCRYPTASN1MODULE x) FIXME("(%08x): stub\n", x); return NULL; } + +BOOL WINAPI CryptProtectMemory(void *data, DWORD len, DWORD flags) +{ + FIXME("(%p %u %08x): stub\n", data, len, flags); + return TRUE; +} + +BOOL WINAPI CryptUnprotectMemory(void *data, DWORD len, DWORD flags) +{ + static int fixme_once; + if (!fixme_once++) FIXME("(%p %u %08x): stub\n", data, len, flags); + return TRUE; +} diff --git a/reactos/dll/win32/crypt32/regstore.c b/reactos/dll/win32/crypt32/regstore.c index 364ad0d4a67..783149c1105 100644 --- a/reactos/dll/win32/crypt32/regstore.c +++ b/reactos/dll/win32/crypt32/regstore.c @@ -509,12 +509,12 @@ WINECRYPT_CERTSTORE *CRYPT_RegOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, if (dwFlags & CERT_STORE_DELETE_FLAG) { - DWORD rc = SHDeleteKeyW((HKEY)pvPara, CertsW); + DWORD rc = RegDeleteTreeW((HKEY)pvPara, CertsW); if (rc == ERROR_SUCCESS || rc == ERROR_NO_MORE_ITEMS) - rc = SHDeleteKeyW((HKEY)pvPara, CRLsW); + rc = RegDeleteTreeW((HKEY)pvPara, CRLsW); if (rc == ERROR_SUCCESS || rc == ERROR_NO_MORE_ITEMS) - rc = SHDeleteKeyW((HKEY)pvPara, CTLsW); + rc = RegDeleteTreeW((HKEY)pvPara, CTLsW); if (rc == ERROR_NO_MORE_ITEMS) rc = ERROR_SUCCESS; SetLastError(rc); diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index fab7ce38f54..521d49bc019 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -58,7 +58,7 @@ reactos/dll/win32/comctl32 # Synced to WineStaging-1.7.47 reactos/dll/win32/comdlg32 # Synced to WineStaging-1.7.47 reactos/dll/win32/compstui # Synced to WineStaging-1.7.47 reactos/dll/win32/credui # Synced to WineStaging-1.7.47 -reactos/dll/win32/crypt32 # Synced to WineStaging-1.7.47 +reactos/dll/win32/crypt32 # Synced to WineStaging-1.7.55 reactos/dll/win32/cryptdlg # Synced to WineStaging-1.7.47 reactos/dll/win32/cryptdll # Synced to WineStaging-1.7.47 reactos/dll/win32/cryptnet # Synced to WineStaging-1.7.47