summaryrefslogtreecommitdiff
path: root/chromium/components/webcrypto
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-10-26 13:57:00 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-11-02 11:31:01 +0000
commit1943b3c2a1dcee36c233724fc4ee7613d71b9cf6 (patch)
tree8c1b5f12357025c197da5427ae02cfdc2f3570d6 /chromium/components/webcrypto
parent21ba0c5d4bf8fba15dddd97cd693bad2358b77fd (diff)
downloadqtwebengine-chromium-1943b3c2a1dcee36c233724fc4ee7613d71b9cf6.tar.gz
BASELINE: Update Chromium to 94.0.4606.111
Change-Id: I924781584def20fc800bedf6ff41fdb96c438193 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/components/webcrypto')
-rw-r--r--chromium/components/webcrypto/algorithms/aes_cbc_unittest.cc24
-rw-r--r--chromium/components/webcrypto/algorithms/aes_ctr_unittest.cc2
-rw-r--r--chromium/components/webcrypto/algorithms/aes_gcm.cc1
-rw-r--r--chromium/components/webcrypto/algorithms/aes_gcm_unittest.cc2
-rw-r--r--chromium/components/webcrypto/algorithms/aes_kw_unittest.cc10
-rw-r--r--chromium/components/webcrypto/algorithms/ec.cc2
-rw-r--r--chromium/components/webcrypto/algorithms/ecdh_unittest.cc1
-rw-r--r--chromium/components/webcrypto/algorithms/ecdsa_unittest.cc3
-rw-r--r--chromium/components/webcrypto/algorithms/hmac_unittest.cc20
-rw-r--r--chromium/components/webcrypto/algorithms/pbkdf2.cc1
-rw-r--r--chromium/components/webcrypto/algorithms/rsa_oaep_unittest.cc2
-rw-r--r--chromium/components/webcrypto/algorithms/rsa_pss_unittest.cc1
-rw-r--r--chromium/components/webcrypto/algorithms/rsa_ssa_unittest.cc6
-rw-r--r--chromium/components/webcrypto/algorithms/test_helpers.cc2
-rw-r--r--chromium/components/webcrypto/jwk.cc11
-rw-r--r--chromium/components/webcrypto/status_unittest.cc1
16 files changed, 43 insertions, 46 deletions
diff --git a/chromium/components/webcrypto/algorithms/aes_cbc_unittest.cc b/chromium/components/webcrypto/algorithms/aes_cbc_unittest.cc
index fc9982d53f2..9b0a91db18b 100644
--- a/chromium/components/webcrypto/algorithms/aes_cbc_unittest.cc
+++ b/chromium/components/webcrypto/algorithms/aes_cbc_unittest.cc
@@ -9,7 +9,7 @@
#include <memory>
#include <utility>
-#include "base/stl_util.h"
+#include "base/cxx17_backports.h"
#include "base/values.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
@@ -222,7 +222,7 @@ TEST_F(WebCryptoAesCbcTest, ImportKeyJwkEmptyKeyOps) {
dict.SetString("kty", "oct");
dict.SetBoolean("ext", false);
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg");
- dict.Set("key_ops", std::make_unique<base::ListValue>());
+ dict.SetKey("key_ops", base::ListValue());
// The JWK does not contain encrypt usages.
EXPECT_EQ(Status::ErrorJwkKeyopsInconsistent(),
@@ -263,10 +263,10 @@ TEST_F(WebCryptoAesCbcTest, ImportKeyJwkKeyOpsEncryptDecrypt) {
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg");
- base::ListValue* key_ops =
- dict.SetList("key_ops", std::make_unique<base::ListValue>());
+ base::Value* key_ops =
+ dict.SetKey("key_ops", base::Value(base::Value::Type::LIST));
- key_ops->AppendString("encrypt");
+ key_ops->Append("encrypt");
EXPECT_EQ(Status::Success(),
ImportKeyJwkFromDict(
@@ -275,7 +275,7 @@ TEST_F(WebCryptoAesCbcTest, ImportKeyJwkKeyOpsEncryptDecrypt) {
EXPECT_EQ(blink::kWebCryptoKeyUsageEncrypt, key.Usages());
- key_ops->AppendString("decrypt");
+ key_ops->Append("decrypt");
EXPECT_EQ(Status::Success(),
ImportKeyJwkFromDict(
@@ -301,9 +301,9 @@ TEST_F(WebCryptoAesCbcTest, ImportKeyJwkKeyOpsNotSuperset) {
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg");
- auto key_ops = std::make_unique<base::ListValue>();
- key_ops->AppendString("encrypt");
- dict.Set("key_ops", std::move(key_ops));
+ base::ListValue key_ops;
+ key_ops.AppendString("encrypt");
+ dict.SetKey("key_ops", std::move(key_ops));
EXPECT_EQ(
Status::ErrorJwkKeyopsInconsistent(),
@@ -366,9 +366,9 @@ TEST_F(WebCryptoAesCbcTest, ImportJwkKeyOpsLacksUsages) {
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg");
- auto key_ops = std::make_unique<base::ListValue>();
- key_ops->AppendString("foo");
- dict.Set("key_ops", std::move(key_ops));
+ base::ListValue key_ops;
+ key_ops.AppendString("foo");
+ dict.SetKey("key_ops", std::move(key_ops));
EXPECT_EQ(Status::ErrorJwkKeyopsInconsistent(),
ImportKeyJwkFromDict(
dict, CreateAlgorithm(blink::kWebCryptoAlgorithmIdAesCbc),
diff --git a/chromium/components/webcrypto/algorithms/aes_ctr_unittest.cc b/chromium/components/webcrypto/algorithms/aes_ctr_unittest.cc
index ac0a2a916e2..01eeddcb6fd 100644
--- a/chromium/components/webcrypto/algorithms/aes_ctr_unittest.cc
+++ b/chromium/components/webcrypto/algorithms/aes_ctr_unittest.cc
@@ -5,7 +5,7 @@
#include <stddef.h>
#include <stdint.h>
-#include "base/stl_util.h"
+#include "base/cxx17_backports.h"
#include "base/values.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
diff --git a/chromium/components/webcrypto/algorithms/aes_gcm.cc b/chromium/components/webcrypto/algorithms/aes_gcm.cc
index f75c461bb46..0f3f70c80a0 100644
--- a/chromium/components/webcrypto/algorithms/aes_gcm.cc
+++ b/chromium/components/webcrypto/algorithms/aes_gcm.cc
@@ -8,7 +8,6 @@
#include <memory>
#include <vector>
-#include "base/stl_util.h"
#include "components/webcrypto/algorithms/aes.h"
#include "components/webcrypto/algorithms/util.h"
#include "components/webcrypto/blink_key_handle.h"
diff --git a/chromium/components/webcrypto/algorithms/aes_gcm_unittest.cc b/chromium/components/webcrypto/algorithms/aes_gcm_unittest.cc
index e409ba0f64b..c94c3620e00 100644
--- a/chromium/components/webcrypto/algorithms/aes_gcm_unittest.cc
+++ b/chromium/components/webcrypto/algorithms/aes_gcm_unittest.cc
@@ -5,7 +5,7 @@
#include <stddef.h>
#include <stdint.h>
-#include "base/stl_util.h"
+#include "base/cxx17_backports.h"
#include "base/values.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
diff --git a/chromium/components/webcrypto/algorithms/aes_kw_unittest.cc b/chromium/components/webcrypto/algorithms/aes_kw_unittest.cc
index 645c9d258ee..b620490f949 100644
--- a/chromium/components/webcrypto/algorithms/aes_kw_unittest.cc
+++ b/chromium/components/webcrypto/algorithms/aes_kw_unittest.cc
@@ -7,7 +7,7 @@
#include <memory>
-#include "base/stl_util.h"
+#include "base/cxx17_backports.h"
#include "base/values.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
@@ -58,10 +58,10 @@ TEST_F(WebCryptoAesKwTest, ImportKeyJwkKeyOpsWrapUnwrap) {
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg");
- base::ListValue* key_ops =
- dict.SetList("key_ops", std::make_unique<base::ListValue>());
+ base::Value* key_ops =
+ dict.SetKey("key_ops", base::Value(base::Value::Type::LIST));
- key_ops->AppendString("wrapKey");
+ key_ops->Append("wrapKey");
EXPECT_EQ(Status::Success(),
ImportKeyJwkFromDict(
@@ -70,7 +70,7 @@ TEST_F(WebCryptoAesKwTest, ImportKeyJwkKeyOpsWrapUnwrap) {
EXPECT_EQ(blink::kWebCryptoKeyUsageWrapKey, key.Usages());
- key_ops->AppendString("unwrapKey");
+ key_ops->Append("unwrapKey");
EXPECT_EQ(Status::Success(),
ImportKeyJwkFromDict(
diff --git a/chromium/components/webcrypto/algorithms/ec.cc b/chromium/components/webcrypto/algorithms/ec.cc
index f0be1d3af3b..13774c8c3ec 100644
--- a/chromium/components/webcrypto/algorithms/ec.cc
+++ b/chromium/components/webcrypto/algorithms/ec.cc
@@ -7,7 +7,7 @@
#include <stddef.h>
#include <utility>
-#include "base/stl_util.h"
+#include "base/cxx17_backports.h"
#include "components/webcrypto/algorithms/asymmetric_key_util.h"
#include "components/webcrypto/algorithms/util.h"
#include "components/webcrypto/blink_key_handle.h"
diff --git a/chromium/components/webcrypto/algorithms/ecdh_unittest.cc b/chromium/components/webcrypto/algorithms/ecdh_unittest.cc
index 1a5b92b94ac..693efcedc5e 100644
--- a/chromium/components/webcrypto/algorithms/ecdh_unittest.cc
+++ b/chromium/components/webcrypto/algorithms/ecdh_unittest.cc
@@ -5,7 +5,6 @@
#include <stddef.h>
#include <stdint.h>
-#include "base/stl_util.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/ec.h"
#include "components/webcrypto/algorithms/test_helpers.h"
diff --git a/chromium/components/webcrypto/algorithms/ecdsa_unittest.cc b/chromium/components/webcrypto/algorithms/ecdsa_unittest.cc
index 1f56bf0e6a5..ba484e521e1 100644
--- a/chromium/components/webcrypto/algorithms/ecdsa_unittest.cc
+++ b/chromium/components/webcrypto/algorithms/ecdsa_unittest.cc
@@ -5,7 +5,6 @@
#include <stddef.h>
#include <stdint.h>
-#include "base/stl_util.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
#include "components/webcrypto/crypto_data.h"
@@ -115,7 +114,7 @@ TEST_F(WebCryptoEcdsaTest, SignatureIsRandom) {
// public key (WebCrypto doesn't provide a mechanism for importing a public
// key given a private key).
std::unique_ptr<base::DictionaryValue> key_jwk_copy(key_jwk->DeepCopy());
- key_jwk_copy->Remove("d", nullptr);
+ key_jwk_copy->RemoveKey("d");
blink::WebCryptoKey public_key;
ASSERT_EQ(
Status::Success(),
diff --git a/chromium/components/webcrypto/algorithms/hmac_unittest.cc b/chromium/components/webcrypto/algorithms/hmac_unittest.cc
index b61e506c91d..b6dd6904b12 100644
--- a/chromium/components/webcrypto/algorithms/hmac_unittest.cc
+++ b/chromium/components/webcrypto/algorithms/hmac_unittest.cc
@@ -231,10 +231,10 @@ TEST_F(WebCryptoHmacTest, ImportKeyJwkKeyOpsSignVerify) {
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg");
- base::ListValue* key_ops =
- dict.SetList("key_ops", std::make_unique<base::ListValue>());
+ base::Value* key_ops =
+ dict.SetKey("key_ops", base::Value(base::Value::Type::LIST));
- key_ops->AppendString("sign");
+ key_ops->Append("sign");
EXPECT_EQ(Status::Success(),
ImportKeyJwkFromDict(dict,
@@ -244,7 +244,7 @@ TEST_F(WebCryptoHmacTest, ImportKeyJwkKeyOpsSignVerify) {
EXPECT_EQ(blink::kWebCryptoKeyUsageSign, key.Usages());
- key_ops->AppendString("verify");
+ key_ops->Append("verify");
EXPECT_EQ(Status::Success(),
ImportKeyJwkFromDict(dict,
@@ -264,11 +264,11 @@ TEST_F(WebCryptoHmacTest, ImportKeyJwkUseInconsisteWithKeyOps) {
dict.SetString("alg", "HS256");
dict.SetString("use", "sig");
- auto key_ops = std::make_unique<base::ListValue>();
- key_ops->AppendString("sign");
- key_ops->AppendString("verify");
- key_ops->AppendString("encrypt");
- dict.Set("key_ops", std::move(key_ops));
+ base::ListValue key_ops;
+ key_ops.AppendString("sign");
+ key_ops.AppendString("verify");
+ key_ops.AppendString("encrypt");
+ dict.SetKey("key_ops", std::move(key_ops));
EXPECT_EQ(
Status::ErrorJwkUseAndKeyopsInconsistent(),
ImportKeyJwkFromDict(
@@ -387,7 +387,7 @@ TEST_F(WebCryptoHmacTest, ImportJwkInputConsistency) {
extractable, usages, &key));
// Pass: JWK alg missing but input algorithm specified: use input value
- dict.Remove("alg", nullptr);
+ dict.RemoveKey("alg");
EXPECT_EQ(Status::Success(),
ImportKeyJwkFromDict(dict,
CreateHmacImportAlgorithmNoLength(
diff --git a/chromium/components/webcrypto/algorithms/pbkdf2.cc b/chromium/components/webcrypto/algorithms/pbkdf2.cc
index 3c731731aa6..41f5d889af5 100644
--- a/chromium/components/webcrypto/algorithms/pbkdf2.cc
+++ b/chromium/components/webcrypto/algorithms/pbkdf2.cc
@@ -6,7 +6,6 @@
#include <memory>
-#include "base/stl_util.h"
#include "components/webcrypto/algorithm_implementation.h"
#include "components/webcrypto/algorithms/secret_key_util.h"
#include "components/webcrypto/algorithms/util.h"
diff --git a/chromium/components/webcrypto/algorithms/rsa_oaep_unittest.cc b/chromium/components/webcrypto/algorithms/rsa_oaep_unittest.cc
index cd3be745bf0..0ebb1701677 100644
--- a/chromium/components/webcrypto/algorithms/rsa_oaep_unittest.cc
+++ b/chromium/components/webcrypto/algorithms/rsa_oaep_unittest.cc
@@ -6,7 +6,7 @@
#include <stdint.h>
#include "base/base64url.h"
-#include "base/stl_util.h"
+#include "base/cxx17_backports.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
#include "components/webcrypto/crypto_data.h"
diff --git a/chromium/components/webcrypto/algorithms/rsa_pss_unittest.cc b/chromium/components/webcrypto/algorithms/rsa_pss_unittest.cc
index 5f917e274a3..8e313bc5a73 100644
--- a/chromium/components/webcrypto/algorithms/rsa_pss_unittest.cc
+++ b/chromium/components/webcrypto/algorithms/rsa_pss_unittest.cc
@@ -5,7 +5,6 @@
#include <stddef.h>
#include <stdint.h>
-#include "base/stl_util.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
#include "components/webcrypto/crypto_data.h"
diff --git a/chromium/components/webcrypto/algorithms/rsa_ssa_unittest.cc b/chromium/components/webcrypto/algorithms/rsa_ssa_unittest.cc
index d9009c3cb5e..f2d8329d7c6 100644
--- a/chromium/components/webcrypto/algorithms/rsa_ssa_unittest.cc
+++ b/chromium/components/webcrypto/algorithms/rsa_ssa_unittest.cc
@@ -6,7 +6,7 @@
#include <stdint.h>
#include "base/check_op.h"
-#include "base/stl_util.h"
+#include "base/cxx17_backports.h"
#include "base/values.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
@@ -716,7 +716,7 @@ TEST_F(WebCryptoRsaSsaTest, ImportRsaSsaPublicKeyBadUsage_JWK) {
base::DictionaryValue dict;
RestoreJwkRsaDictionary(&dict);
- dict.Remove("use", nullptr);
+ dict.RemoveKey("use");
dict.SetString("alg", "RS256");
for (size_t i = 0; i < base::size(bad_usages); ++i) {
@@ -946,7 +946,7 @@ TEST_F(WebCryptoRsaSsaTest, ImportJwkRsaFailures) {
const std::string kKtyParmName[] = {"n", "e"};
for (size_t idx = 0; idx < base::size(kKtyParmName); ++idx) {
// Fail on missing parameter.
- dict.Remove(kKtyParmName[idx], nullptr);
+ dict.RemoveKey(kKtyParmName[idx]);
EXPECT_NE(Status::Success(),
ImportKeyJwkFromDict(dict, algorithm, false, usages, &key));
RestoreJwkRsaDictionary(&dict);
diff --git a/chromium/components/webcrypto/algorithms/test_helpers.cc b/chromium/components/webcrypto/algorithms/test_helpers.cc
index d9afec15057..cbb815b3987 100644
--- a/chromium/components/webcrypto/algorithms/test_helpers.cc
+++ b/chromium/components/webcrypto/algorithms/test_helpers.cc
@@ -10,11 +10,11 @@
#include "base/base64url.h"
#include "base/check.h"
+#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/path_service.h"
-#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/values.h"
diff --git a/chromium/components/webcrypto/jwk.cc b/chromium/components/webcrypto/jwk.cc
index 08d5d0b53dd..e8af65eaf90 100644
--- a/chromium/components/webcrypto/jwk.cc
+++ b/chromium/components/webcrypto/jwk.cc
@@ -9,9 +9,9 @@
#include <set>
#include "base/base64url.h"
+#include "base/cxx17_backports.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
-#include "base/stl_util.h"
#include "base/strings/string_piece.h"
#include "base/strings/stringprintf.h"
#include "components/webcrypto/algorithms/util.h"
@@ -252,8 +252,9 @@ Status JwkReader::GetString(const std::string& member_name,
const base::Value* value = nullptr;
if (!dict_.Get(member_name, &value))
return Status::ErrorJwkMemberMissing(member_name);
- if (!value->GetAsString(result))
+ if (!value->is_string())
return Status::ErrorJwkMemberWrongType(member_name, "string");
+ *result = value->GetString();
return Status::Success();
}
@@ -265,9 +266,10 @@ Status JwkReader::GetOptionalString(const std::string& member_name,
if (!dict_.Get(member_name, &value))
return Status::Success();
- if (!value->GetAsString(result))
+ if (!value->is_string())
return Status::ErrorJwkMemberWrongType(member_name, "string");
+ *result = value->GetString();
*member_exists = true;
return Status::Success();
}
@@ -362,7 +364,8 @@ JwkWriter::JwkWriter(const std::string& algorithm,
const std::string& kty) {
if (!algorithm.empty())
dict_.SetString("alg", algorithm);
- dict_.Set("key_ops", CreateJwkKeyOpsFromWebCryptoUsages(usages));
+ dict_.SetKey("key_ops", base::Value::FromUniquePtrValue(
+ CreateJwkKeyOpsFromWebCryptoUsages(usages)));
dict_.SetBoolean("ext", extractable);
dict_.SetString("kty", kty);
}
diff --git a/chromium/components/webcrypto/status_unittest.cc b/chromium/components/webcrypto/status_unittest.cc
index ad128208175..27dd89d198d 100644
--- a/chromium/components/webcrypto/status_unittest.cc
+++ b/chromium/components/webcrypto/status_unittest.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "components/webcrypto/status.h"
-#include "base/stl_util.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
#include "components/webcrypto/crypto_data.h"