Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: components/webcrypto/algorithms/aes_cbc_unittest.cc

Issue 2160943003: Transfer WebCrypto databuffers across the Blink API using blink::WebVector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/webcrypto/algorithms/aes_ctr_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <limits.h> 5 #include <limits.h>
6 #include <stddef.h> 6 #include <stddef.h>
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "components/webcrypto/algorithm_dispatch.h" 11 #include "components/webcrypto/algorithm_dispatch.h"
12 #include "components/webcrypto/algorithms/test_helpers.h" 12 #include "components/webcrypto/algorithms/test_helpers.h"
13 #include "components/webcrypto/crypto_data.h" 13 #include "components/webcrypto/crypto_data.h"
14 #include "components/webcrypto/status.h" 14 #include "components/webcrypto/status.h"
15 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" 15 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h"
16 #include "third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h" 16 #include "third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h"
17 17
18 namespace webcrypto { 18 namespace webcrypto {
19 19
20 namespace { 20 namespace {
21 21
22 // Creates an AES-CBC algorithm. 22 // Creates an AES-CBC algorithm.
23 blink::WebCryptoAlgorithm CreateAesCbcAlgorithm( 23 blink::WebCryptoAlgorithm CreateAesCbcAlgorithm(
24 const std::vector<uint8_t>& iv) { 24 const std::vector<uint8_t>& iv) {
25 return blink::WebCryptoAlgorithm::adoptParamsAndCreate( 25 return blink::WebCryptoAlgorithm::adoptParamsAndCreate(
26 blink::WebCryptoAlgorithmIdAesCbc, 26 blink::WebCryptoAlgorithmIdAesCbc, new blink::WebCryptoAesCbcParams(iv));
27 new blink::WebCryptoAesCbcParams(iv.data(),
28 static_cast<unsigned int>(iv.size())));
29 } 27 }
30 28
31 blink::WebCryptoAlgorithm CreateAesCbcKeyGenAlgorithm( 29 blink::WebCryptoAlgorithm CreateAesCbcKeyGenAlgorithm(
32 unsigned short key_length_bits) { 30 unsigned short key_length_bits) {
33 return CreateAesKeyGenAlgorithm(blink::WebCryptoAlgorithmIdAesCbc, 31 return CreateAesKeyGenAlgorithm(blink::WebCryptoAlgorithmIdAesCbc,
34 key_length_bits); 32 key_length_bits);
35 } 33 }
36 34
37 blink::WebCryptoKey GetTestAesCbcKey() { 35 blink::WebCryptoKey GetTestAesCbcKey() {
38 const std::string key_hex = "2b7e151628aed2a6abf7158809cf4f3c"; 36 const std::string key_hex = "2b7e151628aed2a6abf7158809cf4f3c";
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 EXPECT_EQ(public_key_spki, unwrapped_public_key_spki); 561 EXPECT_EQ(public_key_spki, unwrapped_public_key_spki);
564 EXPECT_EQ(private_key_pkcs8, unwrapped_private_key_pkcs8); 562 EXPECT_EQ(private_key_pkcs8, unwrapped_private_key_pkcs8);
565 563
566 EXPECT_NE(public_key_spki, wrapped_public_key); 564 EXPECT_NE(public_key_spki, wrapped_public_key);
567 EXPECT_NE(private_key_pkcs8, wrapped_private_key); 565 EXPECT_NE(private_key_pkcs8, wrapped_private_key);
568 } 566 }
569 567
570 } // namespace 568 } // namespace
571 569
572 } // namespace webcrypto 570 } // namespace webcrypto
OLDNEW
« no previous file with comments | « no previous file | components/webcrypto/algorithms/aes_ctr_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698