⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 271170 in webkit


Ignore:
Timestamp:
Jan 5, 2021, 12:33:21 PM (6 years ago)
Author:
Fujii Hironori
Message:

[WinCairo][curl] Enable CURLSSLOPT_NATIVE_CA flag to use system's CA certs instead of cacert.pem
https://bugs.webkit.org/show_bug.cgi?id=220258

Reviewed by Don Olmstead.

.:

Libcurl 7.71 added a new flag CURLSSLOPT_NATIVE_CA to use the
operating system's native CA store only for Windows. Use the flag
for WinCairo port.

  • Source/cmake/OptionsWinCairo.cmake: Bumped the minimum Curl version.

Source/WebCore:

  • PlatformFTW.cmake: Removed the code copying pem file.
  • PlatformWin.cmake: Ditto.
  • platform/network/curl/CurlContext.cpp:

(WebCore::CurlHandle::enableSSLForHost):
(WebCore::CurlHandle::enableHttp): Set CURLOPT_SSL_OPTIONS with CURLSSLOPT_NATIVE_CA.

  • platform/network/win/CurlSSLHandleWin.cpp:

(WebCore::CurlSSLHandle::platformInitialize):
(WebCore::getCACertPathEnv): Deleted.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r271138 r271170  
     12021-01-05  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [WinCairo][curl] Enable CURLSSLOPT_NATIVE_CA flag to use system's CA certs instead of cacert.pem
     4        https://bugs.webkit.org/show_bug.cgi?id=220258
     5
     6        Reviewed by Don Olmstead.
     7
     8        Libcurl 7.71 added a new flag CURLSSLOPT_NATIVE_CA to use the
     9        operating system's native CA store only for Windows. Use the flag
     10        for WinCairo port.
     11
     12        * Source/cmake/OptionsWinCairo.cmake: Bumped the minimum Curl version.
     13
    1142021-01-04  Lauro Moura  <lmoura@igalia.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r271167 r271170  
     12021-01-05  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [WinCairo][curl] Enable CURLSSLOPT_NATIVE_CA flag to use system's CA certs instead of cacert.pem
     4        https://bugs.webkit.org/show_bug.cgi?id=220258
     5
     6        Reviewed by Don Olmstead.
     7
     8        * PlatformFTW.cmake: Removed the code copying pem file.
     9        * PlatformWin.cmake: Ditto.
     10        * platform/network/curl/CurlContext.cpp:
     11        (WebCore::CurlHandle::enableSSLForHost):
     12        (WebCore::CurlHandle::enableHttp): Set CURLOPT_SSL_OPTIONS with CURLSSLOPT_NATIVE_CA.
     13        * platform/network/win/CurlSSLHandleWin.cpp:
     14        (WebCore::CurlSSLHandle::platformInitialize):
     15        (WebCore::getCACertPathEnv): Deleted.
     16
    1172021-01-05  Ryan Haddad  <ryanhaddad@apple.com>
    218
  • trunk/Source/WebCore/PlatformFTW.cmake

    r270940 r271170  
    258258)
    259259
    260 if (EXISTS ${WEBKIT_LIBRARIES_DIR}/etc/ssl/cert.pem)
    261     make_directory(${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit.resources/certificates)
    262     file(COPY
    263         ${WEBKIT_LIBRARIES_DIR}/etc/ssl/cert.pem
    264         DESTINATION
    265         ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit.resources/certificates
    266     )
    267     file(RENAME
    268         ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit.resources/certificates/cert.pem
    269         ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit.resources/certificates/cacert.pem
    270     )
    271 endif ()
    272 
    273260set(WebCore_OUTPUT_NAME WebCore${DEBUG_SUFFIX})
  • trunk/Source/WebCore/PlatformWin.cmake

    r270940 r271170  
    217217    ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit.resources
    218218)
    219 if (WTF_PLATFORM_WIN_CAIRO AND EXISTS ${WEBKIT_LIBRARIES_DIR}/etc/ssl/cert.pem)
    220     make_directory(${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit.resources/certificates)
    221     file(COPY
    222         ${WEBKIT_LIBRARIES_DIR}/etc/ssl/cert.pem
    223         DESTINATION
    224         ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit.resources/certificates
    225     )
    226     file(RENAME
    227         ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit.resources/certificates/cert.pem
    228         ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit.resources/certificates/cacert.pem
    229     )
    230 endif ()
    231219
    232220set(WebCore_OUTPUT_NAME WebCore${DEBUG_SUFFIX})
  • trunk/Source/WebCore/platform/network/curl/CurlContext.cpp

    r257656 r271170  
    333333    setSslCtxCallbackFunction(willSetupSslCtxCallback, this);
    334334
     335#if !OS(WINDOWS)
    335336    if (auto* path = WTF::get_if<String>(sslHandle.getCACertInfo()))
    336337        setCACertPath(path->utf8().data());
     338#endif
    337339}
    338340
     
    460462        curl_easy_setopt(m_handle, CURLOPT_SSL_ENABLE_ALPN, 1L);
    461463        curl_easy_setopt(m_handle, CURLOPT_SSL_ENABLE_NPN, 0L);
     464#if OS(WINDOWS)
     465        curl_easy_setopt(m_handle, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
     466#endif
    462467    } else
    463468        curl_easy_setopt(m_handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  • trunk/Source/WebCore/platform/network/win/CurlSSLHandleWin.cpp

    r241654 r271170  
    2727#include "CurlSSLHandle.h"
    2828
    29 #if USE(CF)
    30 #if OS(WINDOWS)
    31 #include "WebCoreBundleWin.h"
    32 #endif
    33 
    34 #include <wtf/RetainPtr.h>
    35 #endif
    36 
    3729namespace WebCore {
    38 
    39 static String getCACertPathEnv()
    40 {
    41     char* envPath = getenv("CURL_CA_BUNDLE_PATH");
    42     if (envPath)
    43         return String(envPath);
    44 
    45 #if USE(CF)
    46     CFBundleRef webKitBundleRef = webKitBundle();
    47     if (webKitBundleRef) {
    48         RetainPtr<CFURLRef> certURLRef = adoptCF(CFBundleCopyResourceURL(webKitBundleRef, CFSTR("cacert"), CFSTR("pem"), CFSTR("certificates")));
    49         if (certURLRef) {
    50             char path[MAX_PATH];
    51             if (CFURLGetFileSystemRepresentation(certURLRef.get(), false, reinterpret_cast<UInt8*>(path), MAX_PATH) && *path)
    52                 return String(path);
    53         }
    54     }
    55 #endif
    56 
    57     return String();
    58 }
    5930
    6031void CurlSSLHandle::platformInitialize()
    6132{
    62     auto caCertPath = getCACertPathEnv();
    63     if (!caCertPath.isEmpty())
    64         setCACertPath(WTFMove(caCertPath));
    6533}
    6634
  • trunk/Source/cmake/OptionsWinCairo.cmake

    r270899 r271170  
    77
    88find_package(Cairo 1.15.12 REQUIRED)
    9 find_package(CURL 7.60.0 REQUIRED)
     9find_package(CURL 7.71.0 REQUIRED)
    1010find_package(ICU 60.2 REQUIRED COMPONENTS data i18n uc)
    1111find_package(JPEG 1.5.2 REQUIRED)
Note: See TracChangeset for help on using the changeset viewer.