OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/child/webcrypto/shared_crypto.h" | 5 #include "content/child/webcrypto/shared_crypto.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 std::string algorithm_name; | 257 std::string algorithm_name; |
258 if (!dict->GetString(property_name, &algorithm_name)) { | 258 if (!dict->GetString(property_name, &algorithm_name)) { |
259 EXPECT_TRUE(false) << "Couldn't get string property: " << property_name; | 259 EXPECT_TRUE(false) << "Couldn't get string property: " << property_name; |
260 return blink::WebCryptoAlgorithm::createNull(); | 260 return blink::WebCryptoAlgorithm::createNull(); |
261 } | 261 } |
262 | 262 |
263 struct { | 263 struct { |
264 const char* name; | 264 const char* name; |
265 blink::WebCryptoAlgorithmId id; | 265 blink::WebCryptoAlgorithmId id; |
266 } kDigestNameToId[] = {{"sha-1", blink::WebCryptoAlgorithmIdSha1}, | 266 } kDigestNameToId[] = {{"sha-1", blink::WebCryptoAlgorithmIdSha1}, |
267 {"sha-224", blink::WebCryptoAlgorithmIdSha224}, | |
268 {"sha-256", blink::WebCryptoAlgorithmIdSha256}, | 267 {"sha-256", blink::WebCryptoAlgorithmIdSha256}, |
269 {"sha-384", blink::WebCryptoAlgorithmIdSha384}, | 268 {"sha-384", blink::WebCryptoAlgorithmIdSha384}, |
270 {"sha-512", blink::WebCryptoAlgorithmIdSha512}, }; | 269 {"sha-512", blink::WebCryptoAlgorithmIdSha512}, }; |
271 | 270 |
272 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kDigestNameToId); ++i) { | 271 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kDigestNameToId); ++i) { |
273 if (kDigestNameToId[i].name == algorithm_name) | 272 if (kDigestNameToId[i].name == algorithm_name) |
274 return CreateAlgorithm(kDigestNameToId[i].id); | 273 return CreateAlgorithm(kDigestNameToId[i].id); |
275 } | 274 } |
276 | 275 |
277 return blink::WebCryptoAlgorithm::createNull(); | 276 return blink::WebCryptoAlgorithm::createNull(); |
(...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2308 test_cipher_text, | 2307 test_cipher_text, |
2309 test_authentication_tag, | 2308 test_authentication_tag, |
2310 &plain_text)); | 2309 &plain_text)); |
2311 } | 2310 } |
2312 } | 2311 } |
2313 } | 2312 } |
2314 | 2313 |
2315 } // namespace webcrypto | 2314 } // namespace webcrypto |
2316 | 2315 |
2317 } // namespace content | 2316 } // namespace content |
OLD | NEW |