2019-10-01 13:30:07 +02:00
|
|
|
diff --git base/BUILD.gn base/BUILD.gn
|
2022-10-17 19:27:40 +02:00
|
|
|
index a56c5fc803675..e5018871ad80a 100644
|
2019-10-01 13:30:07 +02:00
|
|
|
--- base/BUILD.gn
|
|
|
|
+++ base/BUILD.gn
|
2022-10-17 19:27:40 +02:00
|
|
|
@@ -38,6 +38,7 @@ import("//build/nocompile.gni")
|
2022-01-25 21:26:51 +01:00
|
|
|
import("//build/rust/mixed_component.gni")
|
2019-10-01 13:30:07 +02:00
|
|
|
import("//build/timestamp.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
|
|
|
|
2022-10-17 19:27:40 +02:00
|
|
|
@@ -1973,7 +1974,11 @@ mixed_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",
|
2022-10-17 19:27:40 +02:00
|
|
|
@@ -2114,6 +2119,12 @@ mixed_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",
|
|
|
|
"powrprof.lib",
|
2022-08-23 03:37:40 +02:00
|
|
|
diff --git base/allocator/dispatcher/dispatcher.cc base/allocator/dispatcher/dispatcher.cc
|
2022-09-26 21:30:45 +02:00
|
|
|
index 4a1bf8191ba2c..1fed45b2ac0d9 100644
|
2022-08-23 03:37:40 +02:00
|
|
|
--- base/allocator/dispatcher/dispatcher.cc
|
|
|
|
+++ base/allocator/dispatcher/dispatcher.cc
|
|
|
|
@@ -13,6 +13,7 @@
|
|
|
|
#include "base/dcheck_is_on.h"
|
|
|
|
#include "base/no_destructor.h"
|
|
|
|
#include "base/sampling_heap_profiler/poisson_allocation_sampler.h"
|
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
|
|
|
|
#if DCHECK_IS_ON()
|
|
|
|
#include <atomic>
|
|
|
|
@@ -260,7 +261,7 @@ struct Dispatcher::Impl {
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2022-09-26 21:30:45 +02:00
|
|
|
index aa889f350e8f7..50acac8a69225 100644
|
2019-10-01 13:30:07 +02:00
|
|
|
--- base/hash/md5.h
|
|
|
|
+++ base/hash/md5.h
|
|
|
|
@@ -10,8 +10,9 @@
|
|
|
|
#include "base/base_export.h"
|
|
|
|
#include "base/strings/string_piece.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)
|
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
|
2022-09-26 21:30:45 +02:00
|
|
|
index 29626e5853c6e..2fb1c61504c5d 100644
|
2021-04-21 00:52:34 +02:00
|
|
|
--- base/hash/sha1.h
|
|
|
|
+++ base/hash/sha1.h
|
|
|
|
@@ -14,7 +14,9 @@
|
|
|
|
#include "base/containers/span.h"
|
|
|
|
#include "base/strings/string_piece.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
|
|
|
|
index 04024537ee698..59864cb084559 100644
|
|
|
|
--- base/rand_util.h
|
|
|
|
+++ base/rand_util.h
|
|
|
|
@@ -15,8 +15,9 @@
|
|
|
|
#include "base/compiler_specific.h"
|
|
|
|
#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
|
|
|
|
|
|
|
|
@@ -93,7 +94,7 @@ class RandomBitGenerator {
|
|
|
|
~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
|
2022-10-17 19:27:40 +02:00
|
|
|
index 099fe2912be23..758fa0c4296af 100644
|
2022-09-26 21:30:45 +02:00
|
|
|
--- base/rand_util_win.cc
|
|
|
|
+++ base/rand_util_win.cc
|
|
|
|
@@ -20,14 +20,19 @@
|
|
|
|
#include <limits>
|
|
|
|
|
|
|
|
#include "base/check.h"
|
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
+
|
|
|
|
+#if !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
|
|
|
#include "base/feature_list.h"
|
|
|
|
#include "third_party/boringssl/src/include/openssl/crypto.h"
|
|
|
|
#include "third_party/boringssl/src/include/openssl/rand.h"
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
namespace base {
|
|
|
|
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
+#if !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
// The BoringSSl helpers are duplicated in rand_util_fuchsia.cc and
|
2022-10-17 19:27:40 +02:00
|
|
|
@@ -49,11 +54,16 @@ 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 {
|
|
|
|
|
|
|
|
void RandBytes(void* output, size_t output_length, 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();
|
2022-10-17 19:27:40 +02:00
|
|
|
@@ -61,6 +71,7 @@ void RandBytes(void* output, size_t output_length, bool avoid_allocation) {
|
2022-09-26 21:30:45 +02:00
|
|
|
(void)RAND_bytes(static_cast<uint8_t*>(output), output_length);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
+#endif // !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
|
|
|
|
|
|
|
char* output_ptr = static_cast<char*>(output);
|
|
|
|
while (output_length > 0) {
|
2021-08-20 01:40:49 +02:00
|
|
|
diff --git base/unguessable_token.cc base/unguessable_token.cc
|
2022-09-26 21:30:45 +02:00
|
|
|
index dcef8fbda4493..c8034ebc44b23 100644
|
2021-08-20 01:40:49 +02:00
|
|
|
--- base/unguessable_token.cc
|
|
|
|
+++ base/unguessable_token.cc
|
|
|
|
@@ -9,8 +9,9 @@
|
|
|
|
#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
|
|
|
|
|
|
|
|
@@ -41,7 +42,7 @@ UnguessableToken UnguessableToken::Deserialize(uint64_t high, uint64_t low) {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UnguessableToken::operator==(const UnguessableToken& other) const {
|
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.
|
|
|
|
return token_ == other.token_;
|
|
|
|
#else
|