diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-09-03 13:32:17 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-10-01 14:31:55 +0200 |
commit | 21ba0c5d4bf8fba15dddd97cd693bad2358b77fd (patch) | |
tree | 91be119f694044dfc1ff9fdc054459e925de9df0 /chromium/components/webcrypto | |
parent | 03c549e0392f92c02536d3f86d5e1d8dfa3435ac (diff) | |
download | qtwebengine-chromium-21ba0c5d4bf8fba15dddd97cd693bad2358b77fd.tar.gz |
BASELINE: Update Chromium to 92.0.4515.166
Change-Id: I42a050486714e9e54fc271f2a8939223a02ae364
Diffstat (limited to 'chromium/components/webcrypto')
6 files changed, 20 insertions, 19 deletions
diff --git a/chromium/components/webcrypto/algorithms/asymmetric_key_util.h b/chromium/components/webcrypto/algorithms/asymmetric_key_util.h index 8964ec1b898..2355bd3cdf9 100644 --- a/chromium/components/webcrypto/algorithms/asymmetric_key_util.h +++ b/chromium/components/webcrypto/algorithms/asymmetric_key_util.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_WEBCRYPTO_ALGORITHMS_ASYMMETRIC_KEY_UTIL_ -#define COMPONENTS_WEBCRYPTO_ALGORITHMS_ASYMMETRIC_KEY_UTIL_ +#ifndef COMPONENTS_WEBCRYPTO_ALGORITHMS_ASYMMETRIC_KEY_UTIL_H_ +#define COMPONENTS_WEBCRYPTO_ALGORITHMS_ASYMMETRIC_KEY_UTIL_H_ #include "third_party/blink/public/platform/web_crypto_algorithm.h" #include "third_party/blink/public/platform/web_crypto_key.h" @@ -60,4 +60,4 @@ Status GetUsagesForGenerateAsymmetricKey( } // namespace webcrypto -#endif // COMPONENTS_WEBCRYPTO_ALGORITHMS_ASYMMETRIC_KEY_UTIL_ +#endif // COMPONENTS_WEBCRYPTO_ALGORITHMS_ASYMMETRIC_KEY_UTIL_H_ diff --git a/chromium/components/webcrypto/algorithms/secret_key_util.h b/chromium/components/webcrypto/algorithms/secret_key_util.h index 2da1798c7aa..f0404f60bda 100644 --- a/chromium/components/webcrypto/algorithms/secret_key_util.h +++ b/chromium/components/webcrypto/algorithms/secret_key_util.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_WEBCRYPTO_ALGORITHMS_SECRET_KEY_UTIL_ -#define COMPONENTS_WEBCRYPTO_ALGORITHMS_SECRET_KEY_UTIL_ +#ifndef COMPONENTS_WEBCRYPTO_ALGORITHMS_SECRET_KEY_UTIL_H_ +#define COMPONENTS_WEBCRYPTO_ALGORITHMS_SECRET_KEY_UTIL_H_ #include <stdint.h> @@ -67,4 +67,4 @@ Status ReadSecretKeyNoExpectedAlgJwk( } // namespace webcrypto -#endif // COMPONENTS_WEBCRYPTO_ALGORITHMS_SECRET_KEY_UTIL_ +#endif // COMPONENTS_WEBCRYPTO_ALGORITHMS_SECRET_KEY_UTIL_H_ diff --git a/chromium/components/webcrypto/algorithms/test_helpers.cc b/chromium/components/webcrypto/algorithms/test_helpers.cc index c981141eeea..d9afec15057 100644 --- a/chromium/components/webcrypto/algorithms/test_helpers.cc +++ b/chromium/components/webcrypto/algorithms/test_helpers.cc @@ -161,7 +161,7 @@ std::vector<uint8_t> MakeJsonVector(const base::DictionaryValue& dict) { re2::RE2::GlobalReplace(&file_contents, re2::RE2("\\s*//.*"), ""); // Parse the JSON to a dictionary. - base::Optional<base::Value> read_value = + absl::optional<base::Value> read_value = base::JSONReader::Read(file_contents); if (!read_value.has_value()) { return ::testing::AssertionFailure() @@ -381,17 +381,17 @@ Status ImportKeyJwkFromDict(const base::DictionaryValue& dict, usages, key); } -base::Optional<base::DictionaryValue> GetJwkDictionary( +absl::optional<base::DictionaryValue> GetJwkDictionary( const std::vector<uint8_t>& json) { base::StringPiece json_string(reinterpret_cast<const char*>(json.data()), json.size()); - base::Optional<base::Value> value = base::JSONReader::Read(json_string); + absl::optional<base::Value> value = base::JSONReader::Read(json_string); EXPECT_TRUE(value.has_value()); EXPECT_TRUE(value.value().is_dict()); base::DictionaryValue* dict_value = nullptr; if (!value.value().GetAsDictionary(&dict_value)) - return base::nullopt; + return absl::nullopt; return std::move(*dict_value); } @@ -451,8 +451,8 @@ base::Optional<base::DictionaryValue> GetJwkDictionary( const std::string& alg_expected, const std::string& k_expected_hex, blink::WebCryptoKeyUsageMask use_mask_expected) { - base::Optional<base::DictionaryValue> dict = GetJwkDictionary(json); - if (!dict.has_value() || dict.value().empty()) + absl::optional<base::DictionaryValue> dict = GetJwkDictionary(json); + if (!dict.has_value() || dict.value().DictEmpty()) return ::testing::AssertionFailure() << "JSON parsing failed"; // ---- k @@ -478,8 +478,8 @@ base::Optional<base::DictionaryValue> GetJwkDictionary( const std::string& n_expected_hex, const std::string& e_expected_hex, blink::WebCryptoKeyUsageMask use_mask_expected) { - base::Optional<base::DictionaryValue> dict = GetJwkDictionary(json); - if (!dict.has_value() || dict.value().empty()) + absl::optional<base::DictionaryValue> dict = GetJwkDictionary(json); + if (!dict.has_value() || dict.value().DictEmpty()) return ::testing::AssertionFailure() << "JSON parsing failed"; // ---- n diff --git a/chromium/components/webcrypto/algorithms/test_helpers.h b/chromium/components/webcrypto/algorithms/test_helpers.h index cf031b494fb..40296348bc9 100644 --- a/chromium/components/webcrypto/algorithms/test_helpers.h +++ b/chromium/components/webcrypto/algorithms/test_helpers.h @@ -12,8 +12,8 @@ #include <string> #include <vector> -#include "base/optional.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/platform/web_crypto_algorithm.h" #include "third_party/blink/public/platform/web_crypto_key.h" @@ -147,7 +147,7 @@ Status ImportKeyJwkFromDict(const base::DictionaryValue& dict, blink::WebCryptoKey* key); // Parses a vector of JSON into a dictionary. -base::Optional<base::DictionaryValue> GetJwkDictionary( +absl::optional<base::DictionaryValue> GetJwkDictionary( const std::vector<uint8_t>& json); // Verifies the input dictionary contains the expected values. Exact matches are diff --git a/chromium/components/webcrypto/jwk.cc b/chromium/components/webcrypto/jwk.cc index a7700982622..08d5d0b53dd 100644 --- a/chromium/components/webcrypto/jwk.cc +++ b/chromium/components/webcrypto/jwk.cc @@ -207,7 +207,7 @@ Status JwkReader::Init(const CryptoData& bytes, { // Limit the visibility for |value| as it is moved to |dict_| (via // |dict_value|) once it has been loaded successfully. - base::Optional<base::Value> value = base::JSONReader::Read(json_string); + absl::optional<base::Value> value = base::JSONReader::Read(json_string); base::DictionaryValue* dict_value = nullptr; if (!value.has_value() || !value.value().GetAsDictionary(&dict_value)) @@ -331,9 +331,10 @@ Status JwkReader::GetOptionalBool(const std::string& member_name, if (!dict_.Get(member_name, &value)) return Status::Success(); - if (!value->GetAsBoolean(result)) + if (!value->is_bool()) return Status::ErrorJwkMemberWrongType(member_name, "boolean"); + *result = value->GetBool(); *member_exists = true; return Status::Success(); } diff --git a/chromium/components/webcrypto/webcrypto_impl.cc b/chromium/components/webcrypto/webcrypto_impl.cc index 42573f7f89f..7418b4897b8 100644 --- a/chromium/components/webcrypto/webcrypto_impl.cc +++ b/chromium/components/webcrypto/webcrypto_impl.cc @@ -76,7 +76,7 @@ class CryptoThreadPool { CryptoThreadPool() : worker_thread_("WebCrypto") { base::Thread::Options options; options.joinable = false; - worker_thread_.StartWithOptions(options); + worker_thread_.StartWithOptions(std::move(options)); } static bool PostTask(const base::Location& from_here, base::OnceClosure task); |