-
Notifications
You must be signed in to change notification settings - Fork 879
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gives crashpad an option to use TLS 1.1 and 1.2 on Windows 7 and 8.0
in addition to TLS 1.0 used by WinHttp by default. Fixes brave/brave-browser#1188
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
chromium_src/third_party/crashpad/crashpad/util/net/http_transport_win.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include <windows.h> | ||
#include <versionhelpers.h> | ||
#include <winhttp.h> | ||
|
||
#include "base/logging.h" | ||
|
||
// Forward declaration. | ||
namespace crashpad { | ||
namespace { | ||
std::string WinHttpMessage(const char* extra); | ||
} | ||
} | ||
|
||
namespace { | ||
|
||
void BraveSetSessionOptions(HINTERNET hSession) { | ||
// Windows 8.1+ already have TLS 1.1 and 1.2 available by default. | ||
if (IsWindows8Point1OrGreater()) | ||
return; | ||
|
||
// Use TLS 1.0, 1.1, or 1.2. | ||
unsigned long secure_protocols = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 | | ||
WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 | | ||
WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2; | ||
|
||
// Set protocols and log an error if we can't. Bailing out on the session due | ||
// to an error here is not necessary since if TLS 1.1 or 1.2 is required to | ||
// connect then the connection will fail anyway. | ||
if (!WinHttpSetOption(hSession, WINHTTP_OPTION_SECURE_PROTOCOLS, | ||
&secure_protocols, sizeof(secure_protocols))) { | ||
LOG(ERROR) << crashpad::WinHttpMessage("WinHttpSetOption"); | ||
} | ||
} | ||
|
||
} // namespace | ||
|
||
// The original file is patched to call the above function. | ||
#include "../../../../../../../third_party/crashpad/crashpad/util/net/http_transport_win.cc" | ||
|
13 changes: 13 additions & 0 deletions
13
patches/third_party-crashpad-crashpad-util-net-http_transport_win.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/third_party/crashpad/crashpad/util/net/http_transport_win.cc b/third_party/crashpad/crashpad/util/net/http_transport_win.cc | ||
index 2919bc11d0ba4bf84a11e146bf2961b830db35fe..56811eb3e2879e76404c836e6791f8c0ed317595 100644 | ||
--- a/third_party/crashpad/crashpad/util/net/http_transport_win.cc | ||
+++ b/third_party/crashpad/crashpad/util/net/http_transport_win.cc | ||
@@ -153,6 +153,8 @@ bool HTTPTransportWin::ExecuteSynchronously(std::string* response_body) { | ||
return false; | ||
} | ||
|
||
+ BraveSetSessionOptions(session.get()); | ||
+ | ||
int timeout_in_ms = static_cast<int>(timeout() * 1000); | ||
if (!WinHttpSetTimeouts(session.get(), | ||
timeout_in_ms, |