2019-10-01 13:30:07 +02:00
|
|
|
diff --git base/BUILD.gn base/BUILD.gn
|
2024-05-23 03:52:35 +02:00
|
|
|
index 575149b2f3246..74719a39cf4e4 100644
|
2019-10-01 13:30:07 +02:00
|
|
|
--- base/BUILD.gn
|
|
|
|
+++ base/BUILD.gn
|
2024-01-26 03:12:43 +01:00
|
|
|
@@ -41,6 +41,7 @@ import("//build/nocompile.gni")
|
2019-10-01 13:30:07 +02:00
|
|
|
import("//build/timestamp.gni")
|
2024-01-26 03:12:43 +01:00
|
|
|
import("//build/util/process_version.gni")
|
2020-07-08 19:23:29 +02:00
|
|
|
import("//build_overrides/build.gni")
|
2019-10-01 13:30:07 +02:00
|
|
|
+import("//cef/libcef/features/features.gni")
|
|
|
|
import("//testing/libfuzzer/fuzzer_test.gni")
|
|
|
|
import("//testing/test.gni")
|
2022-04-21 20:58:48 +02:00
|
|
|
|
2024-04-23 22:06:00 +02:00
|
|
|
@@ -1525,7 +1526,11 @@ component("base") {
|
2019-10-01 13:30:07 +02:00
|
|
|
"hash/md5_constexpr_internal.h",
|
|
|
|
"hash/sha1.h",
|
|
|
|
]
|
|
|
|
- if (is_nacl) {
|
|
|
|
+ deps += [ "//cef/libcef/features" ]
|
|
|
|
+ if (enable_cef) {
|
|
|
|
+ configs += [ "//cef/libcef/features:config" ]
|
|
|
|
+ }
|
|
|
|
+ if (is_nacl || is_cef_sandbox_build) {
|
|
|
|
sources += [
|
|
|
|
"hash/md5_nacl.cc",
|
|
|
|
"hash/md5_nacl.h",
|
2024-04-23 22:06:00 +02:00
|
|
|
@@ -1954,6 +1959,12 @@ component("base") {
|
2020-10-08 21:54:42 +02:00
|
|
|
defines += [ "COM_INIT_CHECK_HOOK_DISABLED" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (!use_custom_libcxx) {
|
|
|
|
+ # Enable the VS 2015 Update 2 fix when building with the MSVC standard
|
|
|
|
+ # library.
|
|
|
|
+ defines += [ "_ENABLE_ATOMIC_ALIGNMENT_FIX" ]
|
|
|
|
+ }
|
|
|
|
+
|
2021-08-20 01:40:49 +02:00
|
|
|
libs += [
|
|
|
|
"cfgmgr32.lib",
|
2023-02-27 19:52:38 +01:00
|
|
|
"ntdll.lib",
|
2022-08-23 03:37:40 +02:00
|
|
|
diff --git base/allocator/dispatcher/dispatcher.cc base/allocator/dispatcher/dispatcher.cc
|
2024-05-23 03:52:35 +02:00
|
|
|
index 2c5dfc7870ce8..7ed12711289b4 100644
|
2022-08-23 03:37:40 +02:00
|
|
|
--- base/allocator/dispatcher/dispatcher.cc
|
|
|
|
+++ base/allocator/dispatcher/dispatcher.cc
|
2024-03-19 22:11:42 +01:00
|
|
|
@@ -8,6 +8,7 @@
|
2023-04-26 21:55:59 +02:00
|
|
|
#include "base/check.h"
|
2022-08-23 03:37:40 +02:00
|
|
|
#include "base/dcheck_is_on.h"
|
|
|
|
#include "base/no_destructor.h"
|
|
|
|
+#include "cef/libcef/features/features.h"
|
2024-03-19 22:11:42 +01:00
|
|
|
#include "partition_alloc/partition_alloc_buildflags.h"
|
|
|
|
#include "partition_alloc/shim/allocator_shim.h"
|
2022-08-23 03:37:40 +02:00
|
|
|
|
2023-08-09 23:17:17 +02:00
|
|
|
@@ -33,7 +34,7 @@ struct Dispatcher::Impl {
|
2022-08-23 03:37:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Reset() {
|
|
|
|
-#if DCHECK_IS_ON()
|
|
|
|
+#if DCHECK_IS_ON() && !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
|
|
|
DCHECK([&]() {
|
2022-09-26 21:30:45 +02:00
|
|
|
auto const was_set = is_initialized_check_flag_.test_and_set();
|
2022-08-23 03:37:40 +02:00
|
|
|
is_initialized_check_flag_.clear();
|
2019-10-01 13:30:07 +02:00
|
|
|
diff --git base/hash/md5.h base/hash/md5.h
|
2024-03-19 22:11:42 +01:00
|
|
|
index 215d636fec275..922e88f31b999 100644
|
2019-10-01 13:30:07 +02:00
|
|
|
--- base/hash/md5.h
|
|
|
|
+++ base/hash/md5.h
|
2024-02-22 19:36:15 +01:00
|
|
|
@@ -11,8 +11,9 @@
|
2019-10-01 13:30:07 +02:00
|
|
|
#include "base/base_export.h"
|
2024-02-22 19:36:15 +01:00
|
|
|
#include "base/containers/span.h"
|
2019-10-01 13:30:07 +02:00
|
|
|
#include "build/build_config.h"
|
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
|
2022-01-25 21:26:51 +01:00
|
|
|
-#if BUILDFLAG(IS_NACL)
|
|
|
|
+#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
2019-10-01 13:30:07 +02:00
|
|
|
#include "base/hash/md5_nacl.h"
|
|
|
|
#else
|
|
|
|
#include "base/hash/md5_boringssl.h"
|
2021-04-21 00:52:34 +02:00
|
|
|
diff --git base/hash/sha1.h base/hash/sha1.h
|
2024-02-22 19:36:15 +01:00
|
|
|
index 1891e95fa387d..fc190dc39ae7d 100644
|
2021-04-21 00:52:34 +02:00
|
|
|
--- base/hash/sha1.h
|
|
|
|
+++ base/hash/sha1.h
|
|
|
|
@@ -14,7 +14,9 @@
|
2024-02-22 19:36:15 +01:00
|
|
|
#include "base/base_export.h"
|
2021-04-21 00:52:34 +02:00
|
|
|
#include "base/containers/span.h"
|
|
|
|
#include "build/build_config.h"
|
2022-01-25 21:26:51 +01:00
|
|
|
-#if BUILDFLAG(IS_NACL)
|
2021-04-21 00:52:34 +02:00
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
+
|
2022-01-25 21:26:51 +01:00
|
|
|
+#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
2021-04-21 00:52:34 +02:00
|
|
|
#include "base/hash/sha1_nacl.h"
|
|
|
|
#else
|
|
|
|
#include "base/hash/sha1_boringssl.h"
|
2022-10-17 19:27:40 +02:00
|
|
|
diff --git base/rand_util.h base/rand_util.h
|
2024-05-23 03:52:35 +02:00
|
|
|
index 746166bf75df7..7192a939e4fec 100644
|
2022-10-17 19:27:40 +02:00
|
|
|
--- base/rand_util.h
|
|
|
|
+++ base/rand_util.h
|
2024-01-26 03:12:43 +01:00
|
|
|
@@ -17,8 +17,9 @@
|
|
|
|
#include "base/containers/span.h"
|
2022-10-17 19:27:40 +02:00
|
|
|
#include "base/gtest_prod_util.h"
|
|
|
|
#include "build/build_config.h"
|
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
|
|
|
|
-#if !BUILDFLAG(IS_NACL)
|
|
|
|
+#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
|
|
|
#include "third_party/boringssl/src/include/openssl/rand.h"
|
|
|
|
#endif
|
|
|
|
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -123,7 +124,7 @@ class RandomBitGenerator {
|
2022-10-17 19:27:40 +02:00
|
|
|
~RandomBitGenerator() = default;
|
|
|
|
};
|
|
|
|
|
|
|
|
-#if !BUILDFLAG(IS_NACL)
|
|
|
|
+#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
|
|
|
class NonAllocatingRandomBitGenerator {
|
|
|
|
public:
|
|
|
|
using result_type = uint64_t;
|
2022-09-26 21:30:45 +02:00
|
|
|
diff --git base/rand_util_win.cc base/rand_util_win.cc
|
2024-05-23 03:52:35 +02:00
|
|
|
index 6961e0ef8153c..8863f4ed65ee8 100644
|
2022-09-26 21:30:45 +02:00
|
|
|
--- base/rand_util_win.cc
|
|
|
|
+++ base/rand_util_win.cc
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -20,8 +20,12 @@
|
2022-09-26 21:30:45 +02:00
|
|
|
|
|
|
|
#include "base/check.h"
|
2023-07-21 00:11:34 +02:00
|
|
|
#include "base/feature_list.h"
|
2022-09-26 21:30:45 +02:00
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
+
|
|
|
|
+#if !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
|
|
|
#include "third_party/boringssl/src/include/openssl/crypto.h"
|
|
|
|
#include "third_party/boringssl/src/include/openssl/rand.h"
|
|
|
|
+#endif
|
|
|
|
|
2023-07-21 00:11:34 +02:00
|
|
|
// Prototype for ProcessPrng.
|
|
|
|
// See: https://learn.microsoft.com/en-us/windows/win32/seccng/processprng
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -33,6 +37,7 @@ namespace base {
|
2022-09-26 21:30:45 +02:00
|
|
|
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
+#if !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
// The BoringSSl helpers are duplicated in rand_util_fuchsia.cc and
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -54,6 +59,10 @@ bool UseBoringSSLForRandBytes() {
|
2022-09-26 21:30:45 +02:00
|
|
|
return g_use_boringssl.load(std::memory_order_relaxed);
|
|
|
|
}
|
|
|
|
|
|
|
|
+#else // !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
|
|
|
+void ConfigureBoringSSLBackedRandBytesFieldTrial() {}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
} // namespace internal
|
|
|
|
|
2022-10-17 19:27:40 +02:00
|
|
|
namespace {
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -71,6 +80,7 @@ decltype(&ProcessPrng) GetProcessPrng() {
|
2023-07-21 00:11:34 +02:00
|
|
|
}
|
2022-10-17 19:27:40 +02:00
|
|
|
|
2024-05-23 03:52:35 +02:00
|
|
|
void RandBytesInternal(span<uint8_t> output, bool avoid_allocation) {
|
2022-09-26 21:30:45 +02:00
|
|
|
+#if !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
2022-10-17 19:27:40 +02:00
|
|
|
if (!avoid_allocation && internal::UseBoringSSLForRandBytes()) {
|
2022-09-26 21:30:45 +02:00
|
|
|
// Ensure BoringSSL is initialized so it can use things like RDRAND.
|
|
|
|
CRYPTO_library_init();
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -78,6 +88,7 @@ void RandBytesInternal(span<uint8_t> output, bool avoid_allocation) {
|
2024-01-26 03:12:43 +01:00
|
|
|
(void)RAND_bytes(output.data(), output.size());
|
2022-09-26 21:30:45 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
+#endif // !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
|
|
|
|
2023-07-21 00:11:34 +02:00
|
|
|
static decltype(&ProcessPrng) process_prng_fn = GetProcessPrng();
|
2024-01-26 03:12:43 +01:00
|
|
|
BOOL success =
|
2021-08-20 01:40:49 +02:00
|
|
|
diff --git base/unguessable_token.cc base/unguessable_token.cc
|
2024-03-19 22:11:42 +01:00
|
|
|
index 1f91a938caf55..e7b383ebe3986 100644
|
2021-08-20 01:40:49 +02:00
|
|
|
--- base/unguessable_token.cc
|
|
|
|
+++ base/unguessable_token.cc
|
2023-01-03 00:34:43 +01:00
|
|
|
@@ -10,8 +10,9 @@
|
2021-08-20 01:40:49 +02:00
|
|
|
#include "base/format_macros.h"
|
|
|
|
#include "base/rand_util.h"
|
|
|
|
#include "build/build_config.h"
|
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
|
2022-01-25 21:26:51 +01:00
|
|
|
-#if !BUILDFLAG(IS_NACL)
|
|
|
|
+#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
2021-08-20 01:40:49 +02:00
|
|
|
#include "third_party/boringssl/src/include/openssl/mem.h"
|
|
|
|
#endif
|
|
|
|
|
2024-03-19 22:11:42 +01:00
|
|
|
@@ -57,7 +58,7 @@ std::optional<UnguessableToken> UnguessableToken::DeserializeFromString(
|
2021-08-20 01:40:49 +02:00
|
|
|
}
|
|
|
|
|
2023-12-06 21:16:15 +01:00
|
|
|
bool operator==(const UnguessableToken& lhs, const UnguessableToken& rhs) {
|
2022-01-25 21:26:51 +01:00
|
|
|
-#if BUILDFLAG(IS_NACL)
|
|
|
|
+#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
2021-08-20 01:40:49 +02:00
|
|
|
// BoringSSL is unavailable for NaCl builds so it remains timing dependent.
|
2023-12-06 21:16:15 +01:00
|
|
|
return lhs.token_ == rhs.token_;
|
2021-08-20 01:40:49 +02:00
|
|
|
#else
|
2023-01-03 00:34:43 +01:00
|
|
|
diff --git base/win/sid.cc base/win/sid.cc
|
2024-05-23 03:52:35 +02:00
|
|
|
index dd063382d97e1..6f8d6a0be91b1 100644
|
2023-01-03 00:34:43 +01:00
|
|
|
--- base/win/sid.cc
|
|
|
|
+++ base/win/sid.cc
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -22,6 +22,7 @@
|
2023-01-03 00:34:43 +01:00
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
#include "base/check.h"
|
|
|
|
+#include "base/notreached.h"
|
|
|
|
#include "base/no_destructor.h"
|
|
|
|
#include "base/rand_util.h"
|
2023-04-04 20:00:13 +02:00
|
|
|
#include "base/ranges/algorithm.h"
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -29,8 +30,12 @@
|
2023-01-03 00:34:43 +01:00
|
|
|
#include "base/win/scoped_handle.h"
|
|
|
|
#include "base/win/scoped_localalloc.h"
|
|
|
|
#include "base/win/windows_version.h"
|
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
+
|
|
|
|
+#if !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
|
|
|
#include "third_party/boringssl/src/include/openssl/crypto.h"
|
|
|
|
#include "third_party/boringssl/src/include/openssl/sha.h"
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
namespace base::win {
|
|
|
|
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -131,6 +136,7 @@ Sid Sid::FromNamedCapability(const std::wstring& capability_name) {
|
2023-01-03 00:34:43 +01:00
|
|
|
if (known_cap != known_capabilities->end()) {
|
|
|
|
return FromKnownCapability(known_cap->second);
|
|
|
|
}
|
|
|
|
+#if !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
|
|
|
CRYPTO_library_init();
|
|
|
|
static_assert((SHA256_DIGEST_LENGTH / sizeof(DWORD)) ==
|
|
|
|
SECURITY_APP_PACKAGE_RID_COUNT);
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -143,6 +149,10 @@ Sid Sid::FromNamedCapability(const std::wstring& capability_name) {
|
2023-01-03 00:34:43 +01:00
|
|
|
reinterpret_cast<uint8_t*>(&rids[2]));
|
|
|
|
return FromSubAuthorities(SECURITY_APP_PACKAGE_AUTHORITY, std::size(rids),
|
|
|
|
rids);
|
|
|
|
+#else
|
|
|
|
+ NOTREACHED();
|
|
|
|
+ return Sid(WellKnownSid::kNull);
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Sid Sid::FromKnownSid(WellKnownSid type) {
|