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 2009
----- 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
3 participants
1207 discussions
Start a n
N
ew thread
Hans Leidekker : msi: Avoid accessing uninitialized memory.
by Alexandre Julliard
21 Oct '09
21 Oct '09
Module: wine Branch: master Commit: a15e6cbb1afcc3a7094720572456caa6dbc80714 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a15e6cbb1afcc3a7094720572…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Oct 21 13:20:04 2009 +0200 msi: Avoid accessing uninitialized memory. Found by valgrind. --- dlls/msi/action.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/msi/action.c b/dlls/msi/action.c index b9b8199..a6af7cc 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -5037,7 +5037,7 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param ) goto done; } - size = (lstrlenW(value) + 1 + size) * sizeof(WCHAR); + size += (lstrlenW(value) + 1) * sizeof(WCHAR); newval = msi_alloc(size); ptr = newval; if (!newval)
1
0
0
0
Hans Leidekker : winhttp: Fix two memory leaks.
by Alexandre Julliard
21 Oct '09
21 Oct '09
Module: wine Branch: master Commit: ec0a0b372ef7e30b2a52ec09754c7d238ae90de7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ec0a0b372ef7e30b2a52ec097…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Oct 21 13:19:42 2009 +0200 winhttp: Fix two memory leaks. Found by valgrind. --- dlls/winhttp/cookie.c | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-) diff --git a/dlls/winhttp/cookie.c b/dlls/winhttp/cookie.c index 6c0f8b4..af881ea 100644 --- a/dlls/winhttp/cookie.c +++ b/dlls/winhttp/cookie.c @@ -39,7 +39,7 @@ static domain_t *add_domain( session_t *session, WCHAR *name ) list_init( &domain->entry ); list_init( &domain->cookies ); - domain->name = name; + domain->name = strdupW( name ); list_add_tail( &session->cookie_cache, &domain->entry ); TRACE("%s\n", debugstr_w(domain->name)); @@ -120,7 +120,7 @@ static BOOL add_cookie( session_t *session, cookie_t *cookie, WCHAR *domain_name } else if ((old_cookie = find_cookie( domain, path, cookie->name ))) delete_cookie( old_cookie ); - cookie->path = path; + cookie->path = strdupW( path ); list_add_tail( &domain->cookies, &cookie->entry ); TRACE("domain %s path %s <- %s=%s\n", debugstr_w(domain_name), debugstr_w(cookie->path), @@ -230,12 +230,9 @@ BOOL set_cookies( request_t *request, const WCHAR *cookies ) ret = add_cookie( session, cookie, cookie_domain, cookie_path ); end: - if (!ret) - { - free_cookie( cookie ); - heap_free( cookie_domain ); - heap_free( cookie_path ); - } + if (!ret) free_cookie( cookie ); + heap_free( cookie_domain ); + heap_free( cookie_path ); heap_free( buffer ); return ret; }
1
0
0
0
Hans Leidekker : winhttp/tests: Free the certificate context after use.
by Alexandre Julliard
21 Oct '09
21 Oct '09
Module: wine Branch: master Commit: 45b6cf835513930cc60278b6c7236092d7774caa URL:
http://source.winehq.org/git/wine.git/?a=commit;h=45b6cf835513930cc60278b6c…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Oct 21 13:19:15 2009 +0200 winhttp/tests: Free the certificate context after use. Found by valgrind. --- dlls/winhttp/tests/Makefile.in | 2 +- dlls/winhttp/tests/winhttp.c | 1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/dlls/winhttp/tests/Makefile.in b/dlls/winhttp/tests/Makefile.in index 670ee1a..72d3435 100644 --- a/dlls/winhttp/tests/Makefile.in +++ b/dlls/winhttp/tests/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../../.. SRCDIR = @srcdir@ VPATH = @srcdir@ TESTDLL = winhttp.dll -IMPORTS = winhttp advapi32 kernel32 +IMPORTS = winhttp crypt32 advapi32 kernel32 CTESTS = \ notification.c \ diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index fc0d8ff..24bdbb8 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -763,6 +763,7 @@ static void test_secure_connection(void) size = sizeof(cert); ret = WinHttpQueryOption(req, WINHTTP_OPTION_SERVER_CERT_CONTEXT, &cert, &size ); ok(ret, "failed to retrieve certificate context %u\n", GetLastError()); + CertFreeCertificateContext(cert); size = sizeof(bitness); ret = WinHttpQueryOption(req, WINHTTP_OPTION_SECURITY_KEY_BITNESS, &bitness, &size );
1
0
0
0
Hans Leidekker : winhttp: Correct SSL lock size and make sure we free as many as we allocated.
by Alexandre Julliard
21 Oct '09
21 Oct '09
Module: wine Branch: master Commit: 6732d5dfd71bb615467b92f29659e172bef81c52 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6732d5dfd71bb615467b92f29…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Oct 21 13:18:43 2009 +0200 winhttp: Correct SSL lock size and make sure we free as many as we allocated. Found by valgrind. --- dlls/winhttp/net.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c index 6e54348..28b3972 100644 --- a/dlls/winhttp/net.c +++ b/dlls/winhttp/net.c @@ -120,6 +120,7 @@ MAKE_FUNCPTR( i2d_X509 ); #undef MAKE_FUNCPTR static CRITICAL_SECTION *ssl_locks; +static unsigned int num_ssl_locks; static unsigned long ssl_thread_id(void) { @@ -290,16 +291,15 @@ BOOL netconn_init( netconn_t *conn, BOOL secure ) } pCRYPTO_set_id_callback(ssl_thread_id); - ssl_locks = HeapAlloc(GetProcessHeap(), 0, - pCRYPTO_num_locks() * sizeof(HANDLE)); + num_ssl_locks = pCRYPTO_num_locks(); + ssl_locks = HeapAlloc(GetProcessHeap(), 0, num_ssl_locks * sizeof(CRITICAL_SECTION)); if (!ssl_locks) { set_last_error( ERROR_OUTOFMEMORY ); LeaveCriticalSection( &init_ssl_cs ); return FALSE; } - for (i = 0; i < pCRYPTO_num_locks(); i++) - InitializeCriticalSection( &ssl_locks[i] ); + for (i = 0; i < num_ssl_locks; i++) InitializeCriticalSection( &ssl_locks[i] ); pCRYPTO_set_locking_callback(ssl_lock_callback); LeaveCriticalSection( &init_ssl_cs ); @@ -320,8 +320,7 @@ void netconn_unload( void ) { int i; - for (i = 0; i < pCRYPTO_num_locks(); i++) - DeleteCriticalSection( &ssl_locks[i] ); + for (i = 0; i < num_ssl_locks; i++) DeleteCriticalSection( &ssl_locks[i] ); HeapFree( GetProcessHeap(), 0, ssl_locks ); } wine_dlclose( libcrypto_handle, NULL, 0 );
1
0
0
0
Hans Leidekker : winhttp: Fix a memory leak.
by Alexandre Julliard
21 Oct '09
21 Oct '09
Module: wine Branch: master Commit: 7c59b46890cf8f01af8f5b3899b4778ee4aa7b9f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7c59b46890cf8f01af8f5b389…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Oct 21 13:18:18 2009 +0200 winhttp: Fix a memory leak. Found by valgrind. --- dlls/winhttp/session.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index d5649ed..448603f 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -368,6 +368,7 @@ BOOL set_server_for_hostname( connect_t *connect, LPCWSTR server, INTERNET_PORT } else if (server) { + heap_free( connect->servername ); if (!(connect->servername = strdupW( server ))) { ret = FALSE;
1
0
0
0
Hans Leidekker : hnetcfg: Improve the stub for INetFwServices::Item.
by Alexandre Julliard
21 Oct '09
21 Oct '09
Module: wine Branch: master Commit: f80ca42e4bb0fe003b88a28d96571e06adffb6a2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f80ca42e4bb0fe003b88a28d9…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Oct 21 13:17:53 2009 +0200 hnetcfg: Improve the stub for INetFwServices::Item. --- dlls/hnetcfg/service.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/hnetcfg/service.c b/dlls/hnetcfg/service.c index be30d8a..ecfc00c 100644 --- a/dlls/hnetcfg/service.c +++ b/dlls/hnetcfg/service.c @@ -286,7 +286,7 @@ static const struct INetFwServiceVtbl fw_service_vtbl = fw_service_get_GloballyOpenPorts }; -HRESULT NetFwService_create( IUnknown *pUnkOuter, LPVOID *ppObj ) +static HRESULT NetFwService_create( IUnknown *pUnkOuter, LPVOID *ppObj ) { fw_service *fp; @@ -433,7 +433,7 @@ static HRESULT WINAPI fw_services_Item( fw_services *This = impl_from_INetFwServices( iface ); FIXME("%p, %u, %p\n", This, svcType, service); - return E_NOTIMPL; + return NetFwService_create( NULL, (void **)service ); } static HRESULT WINAPI fw_services_get__NewEnum(
1
0
0
0
Hans Leidekker : mscms/tests: Avoid accessing uninitialized memory.
by Alexandre Julliard
21 Oct '09
21 Oct '09
Module: wine Branch: master Commit: 7c05c62419d33d5eaf339a67e8aa15262e26d049 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7c05c62419d33d5eaf339a67e…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Oct 21 13:17:24 2009 +0200 mscms/tests: Avoid accessing uninitialized memory. Found by valgrind. --- dlls/mscms/tests/profile.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/mscms/tests/profile.c b/dlls/mscms/tests/profile.c index 470e10e..91ae97a 100644 --- a/dlls/mscms/tests/profile.c +++ b/dlls/mscms/tests/profile.c @@ -593,10 +593,13 @@ static void test_GetStandardColorSpaceProfileW(void) SetLastError(0xfaceabee); /* maybe 2nd param. */ ret = pGetStandardColorSpaceProfileW(NULL, 0, newprofile, &sizeP); - WideCharToMultiByte(CP_ACP, 0, newprofile, -1, newprofileA, sizeof(newprofileA), NULL, NULL); if (!ret) ok( GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileW() returns %d (GLE=%d)\n", ret, GetLastError() ); - else ok( !lstrcmpiA( newprofileA, empty ) && GetLastError() == 0xfaceabee, + else + { + WideCharToMultiByte(CP_ACP, 0, newprofile, -1, newprofileA, sizeof(newprofileA), NULL, NULL); + ok( !lstrcmpiA( newprofileA, empty ) && GetLastError() == 0xfaceabee, "GetStandardColorSpaceProfileW() returns %d (GLE=%d)\n", ret, GetLastError() ); + } /* Functional checks */
1
0
0
0
Dmitriy Anisimkov : ws2_32: Ignore EINTR poll result code in WS_select.
by Alexandre Julliard
21 Oct '09
21 Oct '09
Module: wine Branch: master Commit: f951deec6f48e815281f152a750f8ddbb604587a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f951deec6f48e815281f152a7…
Author: Dmitriy Anisimkov <anisimkov(a)ada-ru.org> Date: Tue Oct 20 23:35:00 2009 +0700 ws2_32: Ignore EINTR poll result code in WS_select. --- dlls/ws2_32/socket.c | 29 +++++++++++++++++++++++++++-- 1 files changed, 27 insertions(+), 2 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 35f7b07..7cf4b96 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -2883,6 +2883,8 @@ int WINAPI WS_select(int nfds, WS_fd_set *ws_readfds, const struct WS_timeval* ws_timeout) { struct pollfd *pollfds; + struct timeval tv1, tv2; + int torig = 0; int count, ret, timeout = -1; TRACE("read %p, write %p, excp %p timeout %p\n", @@ -2894,9 +2896,32 @@ int WINAPI WS_select(int nfds, WS_fd_set *ws_readfds, return SOCKET_ERROR; } - if (ws_timeout) timeout = (ws_timeout->tv_sec * 1000) + (ws_timeout->tv_usec + 999) / 1000; + if (ws_timeout) + { + torig = (ws_timeout->tv_sec * 1000) + (ws_timeout->tv_usec + 999) / 1000; + timeout = torig; + gettimeofday( &tv1, 0 ); + } + + while ((ret = poll( pollfds, count, timeout )) < 0) + { + if (errno == EINTR) + { + if (!ws_timeout) continue; + gettimeofday( &tv2, 0 ); - ret = poll( pollfds, count, timeout ); + tv2.tv_sec -= tv1.tv_sec; + tv2.tv_usec -= tv1.tv_usec; + if (tv2.tv_usec < 0) + { + tv2.tv_usec += 1000000; + tv2.tv_sec -= 1; + } + + timeout = torig - (tv2.tv_sec * 1000) - (tv2.tv_usec + 999) / 1000; + if (timeout <= 0) break; + } else break; + } release_poll_fds( ws_readfds, ws_writefds, ws_exceptfds, pollfds ); if (ret == -1) SetLastError(wsaErrno());
1
0
0
0
Juan Lang : crypt32: Check key usage during chain validation.
by Alexandre Julliard
21 Oct '09
21 Oct '09
Module: wine Branch: master Commit: 7fa618aa8e4351ff9e284fa8cf8ac6cc869b7f29 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7fa618aa8e4351ff9e284fa8c…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Oct 20 18:25:06 2009 -0700 crypt32: Check key usage during chain validation. --- dlls/crypt32/chain.c | 125 +++++++++++++++++++++++++++++++++++++++----- dlls/crypt32/tests/chain.c | 6 +- 2 files changed, 114 insertions(+), 17 deletions(-) diff --git a/dlls/crypt32/chain.c b/dlls/crypt32/chain.c index 1dc7a74..0490723 100644 --- a/dlls/crypt32/chain.c +++ b/dlls/crypt32/chain.c @@ -815,6 +815,106 @@ static void dump_element(PCCERT_CONTEXT cert) dump_extension(&cert->pCertInfo->rgExtension[i]); } +static void trace_usage(const CRYPT_BIT_BLOB *usage) +{ +#define trace_usage_bit(bits, bit) \ + if ((bits) & (bit)) TRACE_(chain)("%s\n", #bit) + if (usage->cbData) + { + trace_usage_bit(usage->pbData[0], CERT_DIGITAL_SIGNATURE_KEY_USAGE); + trace_usage_bit(usage->pbData[0], CERT_NON_REPUDIATION_KEY_USAGE); + trace_usage_bit(usage->pbData[0], CERT_KEY_ENCIPHERMENT_KEY_USAGE); + trace_usage_bit(usage->pbData[0], CERT_DATA_ENCIPHERMENT_KEY_USAGE); + trace_usage_bit(usage->pbData[0], CERT_KEY_AGREEMENT_KEY_USAGE); + trace_usage_bit(usage->pbData[0], CERT_KEY_CERT_SIGN_KEY_USAGE); + trace_usage_bit(usage->pbData[0], CERT_CRL_SIGN_KEY_USAGE); + trace_usage_bit(usage->pbData[0], CERT_ENCIPHER_ONLY_KEY_USAGE); + } +#undef trace_usage_bit + if (usage->cbData > 1 && usage->pbData[1] & CERT_DECIPHER_ONLY_KEY_USAGE) + TRACE_(chain)("CERT_DECIPHER_ONLY_KEY_USAGE\n"); +} + +static BOOL CRYPT_KeyUsageValid(PCCERT_CONTEXT cert, BOOL isRoot, BOOL isCA, + DWORD index) +{ + PCERT_EXTENSION ext; + BOOL ret; + BYTE usageBits = 0; + + ext = CertFindExtension(szOID_KEY_USAGE, cert->pCertInfo->cExtension, + cert->pCertInfo->rgExtension); + if (ext) + { + CRYPT_BIT_BLOB usage; + DWORD size = sizeof(usage); + + ret = CryptDecodeObjectEx(cert->dwCertEncodingType, X509_BITS, + ext->Value.pbData, ext->Value.cbData, CRYPT_DECODE_NOCOPY_FLAG, NULL, + &usage, &size); + if (!ret) + return FALSE; + else if (usage.cbData > 2) + { + /* The key usage extension only defines 9 bits => no more than 2 + * bytes are needed to encode all known usages. + */ + return FALSE; + } + else + { + /* The only bit relevant to chain validation is the keyCertSign + * bit, which is always in the least significant byte of the + * key usage bits. + */ + usageBits = usage.pbData[usage.cbData - 1]; + if (TRACE_ON(chain)) + trace_usage(&usage); + } + } + if (isCA) + { + if (!ext) + { + /* MS appears to violate RFC 3280, section 4.2.1.3 (Key Usage) + * here. Quoting the RFC: + * "This [key usage] extension MUST appear in certificates that + * contain public keys that are used to validate digital signatures + * on other public key certificates or CRLs." + * Most of the test chains' certs do not contain key usage + * extensions, yet are allowed to be CA certs. This appears to + * be common usage too: the root CA in a chain often does not have + * the key usage extension. We are a little more restrictive: + * root certs, which commonly do not have any extensions, are + * allowed to sign certificates without the key usage extension. + */ + WARN_(chain)("no key usage extension on a CA cert\n"); + ret = isRoot; + } + else + { + if (!(usageBits & CERT_KEY_CERT_SIGN_KEY_USAGE)) + { + WARN_(chain)("keyCertSign not asserted on a CA cert\n"); + ret = FALSE; + } + else + ret = TRUE; + } + } + else + { + if (ext && (usageBits & CERT_KEY_CERT_SIGN_KEY_USAGE)) + { + WARN_(chain)("keyCertSign asserted on a non-CA cert\n"); + ret = FALSE; + } + else + ret = TRUE; + } + return ret; +} + static BOOL CRYPT_CriticalExtensionsSupported(PCCERT_CONTEXT cert) { BOOL ret = TRUE; @@ -833,13 +933,7 @@ static BOOL CRYPT_CriticalExtensionsSupported(PCCERT_CONTEXT cert) else if (!strcmp(oid, szOID_NAME_CONSTRAINTS)) ret = TRUE; else if (!strcmp(oid, szOID_KEY_USAGE)) - { - static int warned; - - if (!warned++) - FIXME("key usage extension unsupported, ignoring\n"); ret = TRUE; - } else if (!strcmp(oid, szOID_SUBJECT_ALT_NAME)) ret = TRUE; else @@ -865,21 +959,21 @@ static void CRYPT_CheckSimpleChain(PCertificateChainEngine engine, chain->cElement, debugstr_w(filetime_to_str(time))); for (i = chain->cElement - 1; i >= 0; i--) { + BOOL isRoot; + if (TRACE_ON(chain)) dump_element(chain->rgpElement[i]->pCertContext); if (CertVerifyTimeValidity(time, chain->rgpElement[i]->pCertContext->pCertInfo) != 0) chain->rgpElement[i]->TrustStatus.dwErrorStatus |= CERT_TRUST_IS_NOT_TIME_VALID; + if (i == chain->cElement - 1) + isRoot = CRYPT_IsCertificateSelfSigned( + chain->rgpElement[i]->pCertContext); + else + isRoot = FALSE; if (i != 0) { - BOOL isRoot; - - if (i == chain->cElement - 1) - isRoot = CRYPT_IsCertificateSelfSigned( - chain->rgpElement[i]->pCertContext); - else - isRoot = FALSE; /* Check the signature of the cert this issued */ if (!CryptVerifyCertificateSignatureEx(0, X509_ASN_ENCODING, CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT, @@ -914,6 +1008,10 @@ static void CRYPT_CheckSimpleChain(PCertificateChainEngine engine, chain->rgpElement[i]->TrustStatus.dwErrorStatus |= CERT_TRUST_INVALID_BASIC_CONSTRAINTS; } + if (!CRYPT_KeyUsageValid(chain->rgpElement[i]->pCertContext, isRoot, + constraints.fCA, i)) + chain->rgpElement[i]->TrustStatus.dwErrorStatus |= + CERT_TRUST_IS_NOT_VALID_FOR_USAGE; if (CRYPT_IsSimpleChainCyclic(chain)) { /* If the chain is cyclic, then the path length constraints @@ -924,7 +1022,6 @@ static void CRYPT_CheckSimpleChain(PCertificateChainEngine engine, CERT_TRUST_IS_PARTIAL_CHAIN | CERT_TRUST_INVALID_BASIC_CONSTRAINTS; } - /* FIXME: check valid usages */ /* Check whether every critical extension is supported */ if (!CRYPT_CriticalExtensionsSupported( chain->rgpElement[i]->pCertContext)) diff --git a/dlls/crypt32/tests/chain.c b/dlls/crypt32/tests/chain.c index 44fcacb..d29c86a 100644 --- a/dlls/crypt32/tests/chain.c +++ b/dlls/crypt32/tests/chain.c @@ -1782,7 +1782,7 @@ static ChainCheck chainCheck[] = { { { CERT_TRUST_IS_NOT_TIME_NESTED, CERT_TRUST_HAS_PREFERRED_ISSUER }, { CERT_TRUST_IS_UNTRUSTED_ROOT | CERT_TRUST_IS_NOT_VALID_FOR_USAGE, 0 }, 1, simpleStatus15 }, - TODO_ERROR }, + 0 }, /* Windows XP incorrectly does not complain that the end cert's key usage is * invalid, so ignore that error. */ @@ -1791,7 +1791,7 @@ static ChainCheck chainCheck[] = { CERT_TRUST_HAS_PREFERRED_ISSUER }, { CERT_TRUST_IS_UNTRUSTED_ROOT | CERT_TRUST_IS_NOT_VALID_FOR_USAGE, 0 }, 1, simpleStatus16 }, - TODO_ERROR }, + 0 }, { { sizeof(chain17) / sizeof(chain17[0]), chain17 }, { { CERT_TRUST_IS_NOT_TIME_NESTED, CERT_TRUST_HAS_PREFERRED_ISSUER }, { CERT_TRUST_IS_UNTRUSTED_ROOT, 0 }, 1, simpleStatus17 }, @@ -1800,7 +1800,7 @@ static ChainCheck chainCheck[] = { { { CERT_TRUST_IS_NOT_TIME_NESTED, CERT_TRUST_HAS_PREFERRED_ISSUER }, { CERT_TRUST_IS_UNTRUSTED_ROOT | CERT_TRUST_IS_NOT_VALID_FOR_USAGE, 0 }, 1, simpleStatus18 }, - TODO_ERROR }, + 0 }, { { sizeof(selfSignedChain) / sizeof(selfSignedChain[0]), selfSignedChain }, { { 0, CERT_TRUST_HAS_PREFERRED_ISSUER }, { CERT_TRUST_IS_NOT_TIME_VALID | CERT_TRUST_IS_UNTRUSTED_ROOT, 0 },
1
0
0
0
Juan Lang : crypt32: Add tests for key usage in the base policy.
by Alexandre Julliard
21 Oct '09
21 Oct '09
Module: wine Branch: master Commit: f2057592bf52c3891919891a7eb6a7e55991452c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f2057592bf52c3891919891a7…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Oct 20 18:05:08 2009 -0700 crypt32: Add tests for key usage in the base policy. --- dlls/crypt32/tests/chain.c | 349 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 349 insertions(+), 0 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=f2057592bf52c38919198…
1
0
0
0
← Newer
1
...
35
36
37
38
39
40
41
...
121
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
Results per page:
10
25
50
100
200