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

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

Issue 1461703009: Switch //components from vector_as_array to vector::data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: eroman comment Created 5 years, 1 month 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
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 "base/stl_util.h"
6 #include "base/values.h" 5 #include "base/values.h"
7 #include "components/webcrypto/algorithm_dispatch.h" 6 #include "components/webcrypto/algorithm_dispatch.h"
8 #include "components/webcrypto/algorithms/test_helpers.h" 7 #include "components/webcrypto/algorithms/test_helpers.h"
9 #include "components/webcrypto/crypto_data.h" 8 #include "components/webcrypto/crypto_data.h"
10 #include "components/webcrypto/status.h" 9 #include "components/webcrypto/status.h"
11 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" 11 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h"
13 #include "third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h" 12 #include "third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h"
14 13
15 namespace webcrypto { 14 namespace webcrypto {
16 15
17 namespace { 16 namespace {
18 17
19 // Creates an AES-GCM algorithm. 18 // Creates an AES-GCM algorithm.
20 blink::WebCryptoAlgorithm CreateAesGcmAlgorithm( 19 blink::WebCryptoAlgorithm CreateAesGcmAlgorithm(
21 const std::vector<uint8_t>& iv, 20 const std::vector<uint8_t>& iv,
22 const std::vector<uint8_t>& additional_data, 21 const std::vector<uint8_t>& additional_data,
23 unsigned int tag_length_bits) { 22 unsigned int tag_length_bits) {
24 return blink::WebCryptoAlgorithm::adoptParamsAndCreate( 23 return blink::WebCryptoAlgorithm::adoptParamsAndCreate(
25 blink::WebCryptoAlgorithmIdAesGcm, 24 blink::WebCryptoAlgorithmIdAesGcm,
26 new blink::WebCryptoAesGcmParams( 25 new blink::WebCryptoAesGcmParams(
27 vector_as_array(&iv), static_cast<unsigned int>(iv.size()), true, 26 iv.data(), static_cast<unsigned int>(iv.size()), true,
28 vector_as_array(&additional_data), 27 additional_data.data(),
29 static_cast<unsigned int>(additional_data.size()), true, 28 static_cast<unsigned int>(additional_data.size()), true,
30 tag_length_bits)); 29 tag_length_bits));
31 } 30 }
32 31
33 blink::WebCryptoAlgorithm CreateAesGcmKeyGenAlgorithm( 32 blink::WebCryptoAlgorithm CreateAesGcmKeyGenAlgorithm(
34 unsigned short key_length_bits) { 33 unsigned short key_length_bits) {
35 return CreateAesKeyGenAlgorithm(blink::WebCryptoAlgorithmIdAesGcm, 34 return CreateAesKeyGenAlgorithm(blink::WebCryptoAlgorithmIdAesGcm,
36 key_length_bits); 35 key_length_bits);
37 } 36 }
38 37
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 AesGcmDecrypt(key, test_iv, test_additional_data, 212 AesGcmDecrypt(key, test_iv, test_additional_data,
214 wrong_tag_size_bits, test_cipher_text, 213 wrong_tag_size_bits, test_cipher_text,
215 test_authentication_tag, &plain_text)); 214 test_authentication_tag, &plain_text));
216 } 215 }
217 } 216 }
218 } 217 }
219 218
220 } // namespace 219 } // namespace
221 220
222 } // namespace webcrypto 221 } // namespace webcrypto
OLDNEW
« no previous file with comments | « components/webcrypto/algorithms/aes_ctr_unittest.cc ('k') | components/webcrypto/algorithms/ec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698