winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
October 2007
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
4 participants
996 discussions
Start a n
N
ew thread
Juan Lang : crypt32: Don' t keep a pointer to the lower quality chains when choosing a higher quality one , otherwise they'll get double-freed.
by Alexandre Julliard
19 Oct '07
19 Oct '07
Module: wine Branch: master Commit: 5d6feab0e2aba6f71679df24f46c0251e63f2f7b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5d6feab0e2aba6f71679df24f…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Oct 18 20:44:18 2007 -0700 crypt32: Don't keep a pointer to the lower quality chains when choosing a higher quality one, otherwise they'll get double-freed. --- dlls/crypt32/chain.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/dlls/crypt32/chain.c b/dlls/crypt32/chain.c index ff555bb..9832f0e 100644 --- a/dlls/crypt32/chain.c +++ b/dlls/crypt32/chain.c @@ -1272,6 +1272,8 @@ static PCertificateChain CRYPT_ChooseHighestQualityChain( chain->context.rgpLowerQualityChainContext; alternate->context.rgpLowerQualityChainContext[i] = (PCCERT_CHAIN_CONTEXT)chain; + chain->context.cLowerQualityChainContext = 0; + chain->context.rgpLowerQualityChainContext = NULL; chain = alternate; } }
1
0
0
0
Juan Lang : crypt32: Use GetSystemTimeAsFileTime rather than GetSystemTime/ SystemTimeToFileTime.
by Alexandre Julliard
19 Oct '07
19 Oct '07
Module: wine Branch: master Commit: cf904c2bc4a314625d6dfb7a581d1e1de8e1bada URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cf904c2bc4a314625d6dfb7a5…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Oct 18 11:14:12 2007 -0700 crypt32: Use GetSystemTimeAsFileTime rather than GetSystemTime/SystemTimeToFileTime. --- dlls/crypt32/cert.c | 5 +---- dlls/crypt32/crl.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index dcad7fa..2451973 100644 --- a/dlls/crypt32/cert.c +++ b/dlls/crypt32/cert.c @@ -1305,10 +1305,7 @@ LONG WINAPI CertVerifyTimeValidity(LPFILETIME pTimeToVerify, if (!pTimeToVerify) { - SYSTEMTIME sysTime; - - GetSystemTime(&sysTime); - SystemTimeToFileTime(&sysTime, &fileTime); + GetSystemTimeAsFileTime(&fileTime); pTimeToVerify = &fileTime; } if ((ret = CompareFileTime(pTimeToVerify, &pCertInfo->NotBefore)) >= 0) diff --git a/dlls/crypt32/crl.c b/dlls/crypt32/crl.c index bc7f73e..ada06fc 100644 --- a/dlls/crypt32/crl.c +++ b/dlls/crypt32/crl.c @@ -519,10 +519,7 @@ LONG WINAPI CertVerifyCRLTimeValidity(LPFILETIME pTimeToVerify, if (!pTimeToVerify) { - SYSTEMTIME sysTime; - - GetSystemTime(&sysTime); - SystemTimeToFileTime(&sysTime, &fileTime); + GetSystemTimeAsFileTime(&fileTime); pTimeToVerify = &fileTime; } if ((ret = CompareFileTime(pTimeToVerify, &pCrlInfo->ThisUpdate)) >= 0)
1
0
0
0
Juan Lang : crypt32: Use I_CertUpdateStore in registry stores.
by Alexandre Julliard
19 Oct '07
19 Oct '07
Module: wine Branch: master Commit: abc2aec88c98fffbebfb94d797eb7ad30c26ebc9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=abc2aec88c98fffbebfb94d79…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Oct 18 11:13:20 2007 -0700 crypt32: Use I_CertUpdateStore in registry stores. --- dlls/crypt32/crypt32_private.h | 1 - dlls/crypt32/regstore.c | 10 ++++++++-- dlls/crypt32/store.c | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index 63d7c2d..8975522 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -233,7 +233,6 @@ typedef struct WINE_CRYPTCERTSTORE void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, DWORD dwFlags, CertStoreType type); void CRYPT_FreeStore(PWINECRYPT_CERTSTORE store); -void CRYPT_EmptyStore(HCERTSTORE store); BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0, DWORD unk1); diff --git a/dlls/crypt32/regstore.c b/dlls/crypt32/regstore.c index 3754011..35928b8 100644 --- a/dlls/crypt32/regstore.c +++ b/dlls/crypt32/regstore.c @@ -442,11 +442,17 @@ static BOOL WINAPI CRYPT_RegControl(HCERTSTORE hCertStore, DWORD dwFlags, switch (dwCtrlType) { case CERT_STORE_CTRL_RESYNC: + { + HCERTSTORE memStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, + CERT_STORE_CREATE_NEW_FLAG, NULL); + CRYPT_RegFlushStore(store, FALSE); - CRYPT_EmptyStore(store->memStore); - CRYPT_RegReadFromReg(store->key, store->memStore); + CRYPT_RegReadFromReg(store->key, memStore); + I_CertUpdateStore(store->memStore, memStore, 0, 0); + CertCloseStore(memStore, 0); ret = TRUE; break; + } case CERT_STORE_CTRL_COMMIT: ret = CRYPT_RegFlushStore(store, dwFlags & CERT_STORE_CTRL_COMMIT_FORCE_FLAG); diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 28c37d2..57a2bd8 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -199,7 +199,7 @@ static BOOL CRYPT_MemDeleteCrl(PWINECRYPT_CERTSTORE store, void *pCrlContext) return TRUE; } -void CRYPT_EmptyStore(HCERTSTORE store) +static void CRYPT_EmptyStore(HCERTSTORE store) { PCCERT_CONTEXT cert; PCCRL_CONTEXT crl;
1
0
0
0
Juan Lang : crypt32: Pass reg store' s key and memory store to CRYPT_RegReadFromReg, rather than passing a private type.
by Alexandre Julliard
19 Oct '07
19 Oct '07
Module: wine Branch: master Commit: 4d203fe9028c8e17ab60a794ca9bef0ee04513fb URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4d203fe9028c8e17ab60a794c…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Oct 18 11:12:32 2007 -0700 crypt32: Pass reg store's key and memory store to CRYPT_RegReadFromReg, rather than passing a private type. --- dlls/crypt32/regstore.c | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dlls/crypt32/regstore.c b/dlls/crypt32/regstore.c index e7de5fd..3754011 100644 --- a/dlls/crypt32/regstore.c +++ b/dlls/crypt32/regstore.c @@ -63,8 +63,8 @@ static const WCHAR CRLsW[] = { 'C','R','L','s',0 }; static const WCHAR CTLsW[] = { 'C','T','L','s',0 }; static const WCHAR BlobW[] = { 'B','l','o','b',0 }; -static void CRYPT_RegReadSerializedFromReg(const WINE_REGSTOREINFO *store, HKEY key, - DWORD contextType) +static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType, + HCERTSTORE store) { LONG rc; DWORD index = 0; @@ -136,7 +136,7 @@ static void CRYPT_RegReadSerializedFromReg(const WINE_REGSTOREINFO *store, HKEY { TRACE("hash matches, adding\n"); contextInterface->addContextToStore( - store->memStore, context, + store, context, CERT_STORE_ADD_REPLACE_EXISTING, NULL); } else @@ -156,7 +156,7 @@ static void CRYPT_RegReadSerializedFromReg(const WINE_REGSTOREINFO *store, HKEY } while (!rc); } -static void CRYPT_RegReadFromReg(const WINE_REGSTOREINFO *store) +static void CRYPT_RegReadFromReg(HKEY key, HCERTSTORE store) { static const WCHAR * const subKeys[] = { CertsW, CRLsW, CTLsW }; static const DWORD contextFlags[] = { CERT_STORE_CERTIFICATE_CONTEXT_FLAG, @@ -165,15 +165,15 @@ static void CRYPT_RegReadFromReg(const WINE_REGSTOREINFO *store) for (i = 0; i < sizeof(subKeys) / sizeof(subKeys[0]); i++) { - HKEY key; + HKEY hKey; LONG rc; - rc = RegCreateKeyExW(store->key, subKeys[i], 0, NULL, 0, KEY_READ, NULL, - &key, NULL); + rc = RegCreateKeyExW(key, subKeys[i], 0, NULL, 0, KEY_READ, NULL, + &hKey, NULL); if (!rc) { - CRYPT_RegReadSerializedFromReg(store, key, contextFlags[i]); - RegCloseKey(key); + CRYPT_RegReadSerializedFromReg(hKey, contextFlags[i], store); + RegCloseKey(hKey); } } } @@ -444,7 +444,7 @@ static BOOL WINAPI CRYPT_RegControl(HCERTSTORE hCertStore, DWORD dwFlags, case CERT_STORE_CTRL_RESYNC: CRYPT_RegFlushStore(store, FALSE); CRYPT_EmptyStore(store->memStore); - CRYPT_RegReadFromReg(store); + CRYPT_RegReadFromReg(store->key, store->memStore); ret = TRUE; break; case CERT_STORE_CTRL_COMMIT: @@ -523,7 +523,7 @@ PWINECRYPT_CERTSTORE CRYPT_RegOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, regInfo->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": PWINE_REGSTOREINFO->cs"); list_init(®Info->certsToDelete); list_init(®Info->crlsToDelete); - CRYPT_RegReadFromReg(regInfo); + CRYPT_RegReadFromReg(regInfo->key, regInfo->memStore); regInfo->dirty = FALSE; provInfo.cbSize = sizeof(provInfo); provInfo.cStoreProvFunc = sizeof(regProvFuncs) /
1
0
0
0
Juan Lang : crypt32: Use I_CertUpdateStore in file stores.
by Alexandre Julliard
19 Oct '07
19 Oct '07
Module: wine Branch: master Commit: 889449630dcba07351a58b07cb874974ed34f68f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=889449630dcba07351a58b07c…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Oct 18 11:11:54 2007 -0700 crypt32: Use I_CertUpdateStore in file stores. --- dlls/crypt32/crypt32_private.h | 2 ++ dlls/crypt32/filestore.c | 35 ++++++++++++++--------------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index c0246d0..63d7c2d 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -234,6 +234,8 @@ void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, DWORD dwFlags, CertStoreType type); void CRYPT_FreeStore(PWINECRYPT_CERTSTORE store); void CRYPT_EmptyStore(HCERTSTORE store); +BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0, + DWORD unk1); PWINECRYPT_CERTSTORE CRYPT_CollectionOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara); diff --git a/dlls/crypt32/filestore.c b/dlls/crypt32/filestore.c index 8294e82..4c8c4a1 100644 --- a/dlls/crypt32/filestore.c +++ b/dlls/crypt32/filestore.c @@ -118,11 +118,20 @@ static BOOL WINAPI CRYPT_FileControl(HCERTSTORE hCertStore, DWORD dwFlags, switch (dwCtrlType) { case CERT_STORE_CTRL_RESYNC: - CRYPT_EmptyStore(store->memStore); store->dirty = FALSE; if (store->type == CERT_STORE_SAVE_AS_STORE) - ret = CRYPT_ReadSerializedStoreFromFile(store->file, - store->memStore); + { + HCERTSTORE memStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, + CERT_STORE_CREATE_NEW_FLAG, NULL); + + /* FIXME: if I could translate a handle to a path, I could use + * CryptQueryObject instead, but there's no API to do so yet. + */ + ret = CRYPT_ReadSerializedStoreFromFile(store->file, memStore); + if (ret) + I_CertUpdateStore(store->memStore, memStore, 0, 0); + CertCloseStore(memStore, 0); + } else if (store->type == CERT_STORE_SAVE_AS_PKCS7) { CERT_BLOB blob = { 0, NULL }; @@ -136,24 +145,8 @@ static BOOL WINAPI CRYPT_FileControl(HCERTSTORE hCertStore, DWORD dwFlags, CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED, CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, NULL, NULL, &messageStore, NULL, NULL); - if (ret) - { - PCCERT_CONTEXT cert = NULL; - PCCRL_CONTEXT crl = NULL; - - do { - cert = CertEnumCertificatesInStore(messageStore, cert); - if (cert) - CertAddCertificateContextToStore(store->memStore, - cert, CERT_STORE_ADD_ALWAYS, NULL); - } while (cert); - do { - crl = CertEnumCRLsInStore(messageStore, crl); - if (crl) - CertAddCRLContextToStore(store->memStore, crl, - CERT_STORE_ADD_ALWAYS, NULL); - } while (crl); - } + I_CertUpdateStore(store->memStore, messageStore, 0, 0); + CertCloseStore(messageStore, 0); CryptMemFree(blob.pbData); } }
1
0
0
0
Juan Lang : crypt32: Implement I_CertUpdateStore.
by Alexandre Julliard
19 Oct '07
19 Oct '07
Module: wine Branch: master Commit: e857f383a428f07e7b0f1e0dbbec7ffa62d5e54b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e857f383a428f07e7b0f1e0db…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Oct 18 11:10:55 2007 -0700 crypt32: Implement I_CertUpdateStore. --- dlls/crypt32/main.c | 10 ---------- dlls/crypt32/store.c | 32 ++++++++++++++++++++++++++++++++ dlls/crypt32/tests/store.c | 11 ----------- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/dlls/crypt32/main.c b/dlls/crypt32/main.c index fa8b782..12f2885 100644 --- a/dlls/crypt32/main.c +++ b/dlls/crypt32/main.c @@ -60,16 +60,6 @@ HCRYPTPROV CRYPT_GetDefaultProvider(void) return hDefProv; } -/* Appears to be called to update the contents of store1 with those in store2. - * The second two parameters are unknown. - */ -BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0, - DWORD unk1) -{ - FIXME("(%p, %p, %08x, %08x)\n", store1, store2, unk0, unk1); - return FALSE; -} - typedef void * HLRUCACHE; /* this function is called by Internet Explorer when it is about to verify a diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index c32ae62..28c37d2 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -216,6 +216,38 @@ void CRYPT_EmptyStore(HCERTSTORE store) } while (crl); } +BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0, + DWORD unk1) +{ + static BOOL warned = FALSE; + PCCERT_CONTEXT cert = NULL; + PCCRL_CONTEXT crl = NULL; + + TRACE("(%p, %p, %08x, %08x)\n", store1, store2, unk0, unk1); + if (!warned) + { + FIXME("semi-stub\n"); + warned = TRUE; + } + + /* Poor-man's resync: empty first store, then add everything from second + * store to it. + */ + CRYPT_EmptyStore(store1); + do { + cert = CertEnumCertificatesInStore(store2, cert); + if (cert) + CertAddCertificateContextToStore(store1, cert, + CERT_STORE_ADD_ALWAYS, NULL); + } while (cert); + do { + crl = CertEnumCRLsInStore(store2, crl); + if (crl) + CertAddCRLContextToStore(store1, crl, CERT_STORE_ADD_ALWAYS, NULL); + } while (crl); + return TRUE; +} + static void WINAPI CRYPT_MemCloseStore(HCERTSTORE hCertStore, DWORD dwFlags) { WINE_MEMSTORE *store = (WINE_MEMSTORE *)hCertStore; diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c index 99fac18..05ea5e0 100644 --- a/dlls/crypt32/tests/store.c +++ b/dlls/crypt32/tests/store.c @@ -1840,32 +1840,25 @@ static void test_I_UpdateStore(void) ret = pI_CertUpdatestore(NULL, store2, 0, 0); */ ret = pI_CertUpdatestore(store1, store2, 0, 0); - todo_wine ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); CertAddEncodedCertificateToStore(store2, X509_ASN_ENCODING, bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, &cert); /* I_CertUpdateStore adds the contexts from store2 to store1 */ ret = pI_CertUpdatestore(store1, store2, 0, 0); - todo_wine ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); certs = countCertsInStore(store1); - todo_wine ok(certs == 1, "Expected 1 cert, got %d\n", certs); /* Calling it a second time has no effect */ ret = pI_CertUpdatestore(store1, store2, 0, 0); - todo_wine ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); certs = countCertsInStore(store1); - todo_wine ok(certs == 1, "Expected 1 cert, got %d\n", certs); /* The last parameters to I_CertUpdateStore appear to be ignored */ ret = pI_CertUpdatestore(store1, store2, 1, 0); - todo_wine ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); ret = pI_CertUpdatestore(store1, store2, 0, 1); - todo_wine ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); CertAddEncodedCRLToStore(store2, X509_ASN_ENCODING, signedCRL, @@ -1873,13 +1866,10 @@ static void test_I_UpdateStore(void) /* I_CertUpdateStore also adds the CRLs from store2 to store1 */ ret = pI_CertUpdatestore(store1, store2, 0, 0); - todo_wine ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); certs = countCertsInStore(store1); - todo_wine ok(certs == 1, "Expected 1 cert, got %d\n", certs); certs = countCRLsInStore(store1); - todo_wine ok(certs == 1, "Expected 1 CRL, got %d\n", certs); CertDeleteCertificateFromStore(cert); @@ -1887,7 +1877,6 @@ static void test_I_UpdateStore(void) * from store1 */ ret = pI_CertUpdatestore(store1, store2, 0, 0); - todo_wine ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); certs = countCertsInStore(store1); ok(certs == 0, "Expected 0 certs, got %d\n", certs);
1
0
0
0
Juan Lang : crypt32: Add tests for I_CertUpdateStore.
by Alexandre Julliard
19 Oct '07
19 Oct '07
Module: wine Branch: master Commit: 542af8aeeb6d023f8b27b4b12e3cf9cddd2cfb41 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=542af8aeeb6d023f8b27b4b12…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Oct 18 11:10:23 2007 -0700 crypt32: Add tests for I_CertUpdateStore. --- dlls/crypt32/tests/store.c | 111 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 111 insertions(+), 0 deletions(-) diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c index b14dbc2..99fac18 100644 --- a/dlls/crypt32/tests/store.c +++ b/dlls/crypt32/tests/store.c @@ -1788,6 +1788,115 @@ static void testAddSerialized(void) CertCloseStore(store, 0); } +static DWORD countCertsInStore(HCERTSTORE store) +{ + PCCERT_CONTEXT cert = NULL; + DWORD certs = 0; + + do { + cert = CertEnumCertificatesInStore(store, cert); + if (cert) + certs++; + } while (cert); + return certs; +} + +static DWORD countCRLsInStore(HCERTSTORE store) +{ + PCCRL_CONTEXT crl = NULL; + DWORD crls = 0; + + do { + crl = CertEnumCRLsInStore(store, crl); + if (crl) + crls++; + } while (crl); + return crls; +} + +static void test_I_UpdateStore(void) +{ + HMODULE lib = GetModuleHandleA("crypt32"); + BOOL (WINAPI *pI_CertUpdatestore)(HCERTSTORE, HCERTSTORE, DWORD, DWORD) = + (void *)GetProcAddress(lib, "I_CertUpdateStore"); + BOOL ret; + HCERTSTORE store1, store2; + PCCERT_CONTEXT cert; + DWORD certs; + + if (!pI_CertUpdatestore) + { + skip("No I_CertUpdateStore\n"); + return; + } + store1 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, + CERT_STORE_CREATE_NEW_FLAG, NULL); + store2 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, + CERT_STORE_CREATE_NEW_FLAG, NULL); + + /* Crash + ret = pI_CertUpdatestore(NULL, NULL, 0, 0); + ret = pI_CertUpdatestore(store1, NULL, 0, 0); + ret = pI_CertUpdatestore(NULL, store2, 0, 0); + */ + ret = pI_CertUpdatestore(store1, store2, 0, 0); + todo_wine + ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); + + CertAddEncodedCertificateToStore(store2, X509_ASN_ENCODING, bigCert, + sizeof(bigCert), CERT_STORE_ADD_ALWAYS, &cert); + /* I_CertUpdateStore adds the contexts from store2 to store1 */ + ret = pI_CertUpdatestore(store1, store2, 0, 0); + todo_wine + ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); + certs = countCertsInStore(store1); + todo_wine + ok(certs == 1, "Expected 1 cert, got %d\n", certs); + /* Calling it a second time has no effect */ + ret = pI_CertUpdatestore(store1, store2, 0, 0); + todo_wine + ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); + certs = countCertsInStore(store1); + todo_wine + ok(certs == 1, "Expected 1 cert, got %d\n", certs); + + /* The last parameters to I_CertUpdateStore appear to be ignored */ + ret = pI_CertUpdatestore(store1, store2, 1, 0); + todo_wine + ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); + ret = pI_CertUpdatestore(store1, store2, 0, 1); + todo_wine + ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); + + CertAddEncodedCRLToStore(store2, X509_ASN_ENCODING, signedCRL, + sizeof(signedCRL), CERT_STORE_ADD_ALWAYS, NULL); + + /* I_CertUpdateStore also adds the CRLs from store2 to store1 */ + ret = pI_CertUpdatestore(store1, store2, 0, 0); + todo_wine + ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); + certs = countCertsInStore(store1); + todo_wine + ok(certs == 1, "Expected 1 cert, got %d\n", certs); + certs = countCRLsInStore(store1); + todo_wine + ok(certs == 1, "Expected 1 CRL, got %d\n", certs); + + CertDeleteCertificateFromStore(cert); + /* If a context is deleted from store2, I_CertUpdateStore delets it + * from store1 + */ + ret = pI_CertUpdatestore(store1, store2, 0, 0); + todo_wine + ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); + certs = countCertsInStore(store1); + ok(certs == 0, "Expected 0 certs, got %d\n", certs); + + CertFreeCertificateContext(cert); + CertCloseStore(store1, 0); + CertCloseStore(store2, 0); +} + START_TEST(store) { /* various combinations of CertOpenStore */ @@ -1805,4 +1914,6 @@ START_TEST(store) testStoreProperty(); testAddSerialized(); + + test_I_UpdateStore(); }
1
0
0
0
Juan Lang : crypt32: Add I_CertUpdateStore stub.
by Alexandre Julliard
19 Oct '07
19 Oct '07
Module: wine Branch: master Commit: b4eb9bf251b76df40626c030cb0373bba8952641 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b4eb9bf251b76df40626c030c…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Oct 18 11:09:22 2007 -0700 crypt32: Add I_CertUpdateStore stub. --- dlls/crypt32/crypt32.spec | 1 + dlls/crypt32/main.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/dlls/crypt32/crypt32.spec b/dlls/crypt32/crypt32.spec index 8542721..874d26d 100644 --- a/dlls/crypt32/crypt32.spec +++ b/dlls/crypt32/crypt32.spec @@ -190,6 +190,7 @@ @ stdcall CryptVerifyMessageSignature(ptr long ptr long ptr ptr ptr) @ stub CryptVerifyMessageSignatureWithKey @ stub CryptVerifySignatureU +@ stdcall I_CertUpdateStore(ptr ptr long long) @ stdcall I_CryptAllocTls() @ stdcall I_CryptCreateLruCache(ptr ptr) @ stdcall I_CryptCreateLruEntry(ptr long long) diff --git a/dlls/crypt32/main.c b/dlls/crypt32/main.c index 12f2885..fa8b782 100644 --- a/dlls/crypt32/main.c +++ b/dlls/crypt32/main.c @@ -60,6 +60,16 @@ HCRYPTPROV CRYPT_GetDefaultProvider(void) return hDefProv; } +/* Appears to be called to update the contents of store1 with those in store2. + * The second two parameters are unknown. + */ +BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0, + DWORD unk1) +{ + FIXME("(%p, %p, %08x, %08x)\n", store1, store2, unk0, unk1); + return FALSE; +} + typedef void * HLRUCACHE; /* this function is called by Internet Explorer when it is about to verify a
1
0
0
0
Juan Lang : crypt32: Add stubs for I_CryptFindLruEntry and I_CryptCreateLruEntry.
by Alexandre Julliard
19 Oct '07
19 Oct '07
Module: wine Branch: master Commit: 7b8cb034b223be10bf72e155fd40910679816b56 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7b8cb034b223be10bf72e155f…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Oct 18 10:36:28 2007 -0700 crypt32: Add stubs for I_CryptFindLruEntry and I_CryptCreateLruEntry. --- dlls/crypt32/crypt32.spec | 3 ++- dlls/crypt32/main.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletions(-) diff --git a/dlls/crypt32/crypt32.spec b/dlls/crypt32/crypt32.spec index cbadf22..8542721 100644 --- a/dlls/crypt32/crypt32.spec +++ b/dlls/crypt32/crypt32.spec @@ -192,8 +192,9 @@ @ stub CryptVerifySignatureU @ stdcall I_CryptAllocTls() @ stdcall I_CryptCreateLruCache(ptr ptr) -@ stub I_CryptCreateLruEntry +@ stdcall I_CryptCreateLruEntry(ptr long long) @ stdcall I_CryptDetachTls(long) +@ stdcall I_CryptFindLruEntry(long long) @ stdcall I_CryptFindLruEntryData(long long long) @ stdcall I_CryptFlushLruCache(ptr long long) @ stdcall I_CryptFreeLruCache(ptr long long) diff --git a/dlls/crypt32/main.c b/dlls/crypt32/main.c index f10a9c9..12f2885 100644 --- a/dlls/crypt32/main.c +++ b/dlls/crypt32/main.c @@ -75,12 +75,24 @@ BOOL WINAPI I_CryptCreateLruCache(void *unknown, HLRUCACHE *out) return TRUE; } +BOOL WINAPI I_CryptFindLruEntry(DWORD unk0, DWORD unk1) +{ + FIXME("(%08x, %08x): stub!\n", unk0, unk1); + return FALSE; +} + BOOL WINAPI I_CryptFindLruEntryData(DWORD unk0, DWORD unk1, DWORD unk2) { FIXME("(%08x, %08x, %08x): stub!\n", unk0, unk1, unk2); return FALSE; } +BOOL WINAPI I_CryptCreateLruEntry(HLRUCACHE h, DWORD unk0, DWORD unk1) +{ + FIXME("(%p, %08x, %08x): stub!\n", h, unk0, unk1); + return FALSE; +} + DWORD WINAPI I_CryptFlushLruCache(HLRUCACHE h, DWORD unk0, DWORD unk1) { FIXME("(%p, %08x, %08x): stub!\n", h, unk0, unk1);
1
0
0
0
Juan Lang : cryptnet: Partially implement CryptGetObjectUrl.
by Alexandre Julliard
19 Oct '07
19 Oct '07
Module: wine Branch: master Commit: 43bdf4e52d929d65aee05c9c23f6ea896902d07a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=43bdf4e52d929d65aee05c9c2…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Oct 18 10:29:34 2007 -0700 cryptnet: Partially implement CryptGetObjectUrl. --- dlls/cryptnet/cryptnet_main.c | 204 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 202 insertions(+), 2 deletions(-) diff --git a/dlls/cryptnet/cryptnet_main.c b/dlls/cryptnet/cryptnet_main.c index 67a1ebb..206ba24 100644 --- a/dlls/cryptnet/cryptnet_main.c +++ b/dlls/cryptnet/cryptnet_main.c @@ -18,10 +18,13 @@ */ #include "config.h" +#include "wine/port.h" +#include <stdio.h> #include "windef.h" #include "wine/debug.h" #include "winbase.h" #include "winnt.h" +#define NONAMELESSUNION #include "wincrypt.h" WINE_DEFAULT_DEBUG_CHANNEL(cryptnet); @@ -78,6 +81,169 @@ HRESULT WINAPI DllUnregisterServer(void) return S_OK; } +static const char *url_oid_to_str(LPCSTR oid) +{ + if (HIWORD(oid)) + return oid; + else + { + static char buf[10]; + + switch (LOWORD(oid)) + { +#define _x(oid) case LOWORD(oid): return #oid + _x(URL_OID_CERTIFICATE_ISSUER); + _x(URL_OID_CERTIFICATE_CRL_DIST_POINT); + _x(URL_OID_CTL_ISSUER); + _x(URL_OID_CTL_NEXT_UPDATE); + _x(URL_OID_CRL_ISSUER); + _x(URL_OID_CERTIFICATE_FRESHEST_CRL); + _x(URL_OID_CRL_FRESHEST_CRL); + _x(URL_OID_CROSS_CERT_DIST_POINT); +#undef _x + default: + snprintf(buf, sizeof(buf), "%d", LOWORD(oid)); + return buf; + } + } +} + +typedef BOOL (WINAPI *UrlDllGetObjectUrlFunc)(LPCSTR, LPVOID, DWORD, + PCRYPT_URL_ARRAY, DWORD *, PCRYPT_URL_INFO, DWORD *, LPVOID); + +static BOOL WINAPI CRYPT_GetUrlFromCertificateIssuer(LPCSTR pszUrlOid, + LPVOID pvPara, DWORD dwFlags, PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray, + PCRYPT_URL_INFO pUrlInfo, DWORD *pcbUrlInfo, LPVOID pvReserved) +{ + /* FIXME: This depends on the AIA (authority info access) extension being + * supported in crypt32. + */ + FIXME("\n"); + SetLastError(CRYPT_E_NOT_FOUND); + return FALSE; +} + +static BOOL WINAPI CRYPT_GetUrlFromCertificateCRLDistPoint(LPCSTR pszUrlOid, + LPVOID pvPara, DWORD dwFlags, PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray, + PCRYPT_URL_INFO pUrlInfo, DWORD *pcbUrlInfo, LPVOID pvReserved) +{ + PCCERT_CONTEXT cert = (PCCERT_CONTEXT)pvPara; + PCERT_EXTENSION ext; + BOOL ret = FALSE; + + /* The only applicable flag is CRYPT_GET_URL_FROM_EXTENSION */ + if (dwFlags && !(dwFlags & CRYPT_GET_URL_FROM_EXTENSION)) + { + SetLastError(CRYPT_E_NOT_FOUND); + return FALSE; + } + if ((ext = CertFindExtension(szOID_CRL_DIST_POINTS, + cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension))) + { + CRL_DIST_POINTS_INFO *info; + DWORD size; + + ret = CryptDecodeObjectEx(X509_ASN_ENCODING, X509_CRL_DIST_POINTS, + ext->Value.pbData, ext->Value.cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, + &info, &size); + if (ret) + { + DWORD i, cUrl, bytesNeeded = sizeof(CRYPT_URL_ARRAY); + + for (i = 0, cUrl = 0; i < info->cDistPoint; i++) + if (info->rgDistPoint[i].DistPointName.dwDistPointNameChoice + == CRL_DIST_POINT_FULL_NAME) + { + DWORD j; + CERT_ALT_NAME_INFO *name = + &info->rgDistPoint[i].DistPointName.FullName; + + for (j = 0; j < name->cAltEntry; j++) + if (name->rgAltEntry[j].dwAltNameChoice == + CERT_ALT_NAME_URL) + { + if (name->rgAltEntry[j].pwszURL) + { + cUrl++; + bytesNeeded += sizeof(LPWSTR) + + (lstrlenW(name->rgAltEntry[j].pwszURL) + 1) + * sizeof(WCHAR); + } + } + } + if (!pcbUrlArray) + SetLastError(E_INVALIDARG); + else if (!pUrlArray) + *pcbUrlArray = bytesNeeded; + else if (*pcbUrlArray < bytesNeeded) + { + SetLastError(ERROR_MORE_DATA); + *pcbUrlArray = bytesNeeded; + ret = FALSE; + } + else + { + LPWSTR nextUrl; + + *pcbUrlArray = bytesNeeded; + pUrlArray->cUrl = 0; + pUrlArray->rgwszUrl = + (LPWSTR *)((BYTE *)pUrlArray + sizeof(CRYPT_URL_ARRAY)); + nextUrl = (LPWSTR)((BYTE *)pUrlArray + sizeof(CRYPT_URL_ARRAY) + + cUrl * sizeof(LPWSTR)); + for (i = 0; i < info->cDistPoint; i++) + if (info->rgDistPoint[i].DistPointName.dwDistPointNameChoice + == CRL_DIST_POINT_FULL_NAME) + { + DWORD j; + CERT_ALT_NAME_INFO *name = + &info->rgDistPoint[i].DistPointName.FullName; + + for (j = 0; j < name->cAltEntry; j++) + if (name->rgAltEntry[j].dwAltNameChoice == + CERT_ALT_NAME_URL) + { + if (name->rgAltEntry[j].pwszURL) + { + lstrcpyW(nextUrl, + name->rgAltEntry[j].pwszURL); + pUrlArray->rgwszUrl[pUrlArray->cUrl++] = + nextUrl; + nextUrl += + (lstrlenW(name->rgAltEntry[j].pwszURL) + 1) + * sizeof(WCHAR); + } + } + } + } + if (ret) + { + if (pcbUrlInfo) + { + FIXME("url info: stub\n"); + if (!pUrlInfo) + *pcbUrlInfo = sizeof(CRYPT_URL_INFO); + else if (*pcbUrlInfo < sizeof(CRYPT_URL_INFO)) + { + *pcbUrlInfo = sizeof(CRYPT_URL_INFO); + SetLastError(ERROR_MORE_DATA); + ret = FALSE; + } + else + { + *pcbUrlInfo = sizeof(CRYPT_URL_INFO); + memset(pUrlInfo, 0, sizeof(CRYPT_URL_INFO)); + } + } + } + LocalFree(info); + } + } + else + SetLastError(CRYPT_E_NOT_FOUND); + return ret; +} + /*********************************************************************** * CryptGetObjectUrl (CRYPTNET.@) */ @@ -85,9 +251,43 @@ BOOL WINAPI CryptGetObjectUrl(LPCSTR pszUrlOid, LPVOID pvPara, DWORD dwFlags, PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray, PCRYPT_URL_INFO pUrlInfo, DWORD *pcbUrlInfo, LPVOID pvReserved) { - FIXME("(%s, %p, %08x, %p, %p, %p, %p, %p): stub\n", debugstr_a(pszUrlOid), + UrlDllGetObjectUrlFunc func = NULL; + HCRYPTOIDFUNCADDR hFunc = NULL; + BOOL ret = FALSE; + + TRACE("(%s, %p, %08x, %p, %p, %p, %p, %p)\n", debugstr_a(pszUrlOid), pvPara, dwFlags, pUrlArray, pcbUrlArray, pUrlInfo, pcbUrlInfo, pvReserved); - return FALSE; + + if (!HIWORD(pszUrlOid)) + { + switch (LOWORD(pszUrlOid)) + { + case LOWORD(URL_OID_CERTIFICATE_ISSUER): + func = CRYPT_GetUrlFromCertificateIssuer; + break; + case LOWORD(URL_OID_CERTIFICATE_CRL_DIST_POINT): + func = CRYPT_GetUrlFromCertificateCRLDistPoint; + break; + default: + FIXME("unimplemented for %s\n", url_oid_to_str(pszUrlOid)); + SetLastError(ERROR_FILE_NOT_FOUND); + } + } + else + { + static HCRYPTOIDFUNCSET set = NULL; + + if (!set) + set = CryptInitOIDFunctionSet(URL_OID_GET_OBJECT_URL_FUNC, 0); + CryptGetOIDFunctionAddress(set, X509_ASN_ENCODING, pszUrlOid, 0, + (void **)&func, &hFunc); + } + if (func) + ret = func(pszUrlOid, pvPara, dwFlags, pUrlArray, pcbUrlArray, + pUrlInfo, pcbUrlInfo, pvReserved); + if (hFunc) + CryptFreeOIDFunctionAddress(hFunc, 0); + return ret; } /***********************************************************************
1
0
0
0
← Newer
1
...
39
40
41
42
43
44
45
...
100
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Results per page:
10
25
50
100
200