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

Side by Side Diff: crypto/encryptor_unittest.cc

Issue 1539353003: Switch to standard integer types in crypto/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years 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 | « crypto/encryptor_openssl.cc ('k') | crypto/ghash.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "crypto/encryptor.h" 5 #include "crypto/encryptor.h"
6 6
7 #include <stddef.h>
8
7 #include <string> 9 #include <string>
8 10
11 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
11 #include "crypto/symmetric_key.h" 14 #include "crypto/symmetric_key.h"
12 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
13 16
14 TEST(EncryptorTest, EncryptDecrypt) { 17 TEST(EncryptorTest, EncryptDecrypt) {
15 scoped_ptr<crypto::SymmetricKey> key( 18 scoped_ptr<crypto::SymmetricKey> key(
16 crypto::SymmetricKey::DeriveKeyFromPassword( 19 crypto::SymmetricKey::DeriveKeyFromPassword(
17 crypto::SymmetricKey::AES, "password", "saltiest", 1000, 256)); 20 crypto::SymmetricKey::AES, "password", "saltiest", 1000, 256));
18 EXPECT_TRUE(key.get()); 21 EXPECT_TRUE(key.get());
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 // 525 //
523 // Otherwise when using std::string as the other tests do, accesses several 526 // Otherwise when using std::string as the other tests do, accesses several
524 // bytes off the end of the buffer may fall inside the reservation of 527 // bytes off the end of the buffer may fall inside the reservation of
525 // the string and not be detected. 528 // the string and not be detected.
526 scoped_ptr<char[]> ciphertext(new char[1]); 529 scoped_ptr<char[]> ciphertext(new char[1]);
527 530
528 std::string plaintext; 531 std::string plaintext;
529 EXPECT_FALSE( 532 EXPECT_FALSE(
530 encryptor.Decrypt(base::StringPiece(ciphertext.get(), 1), &plaintext)); 533 encryptor.Decrypt(base::StringPiece(ciphertext.get(), 1), &plaintext));
531 } 534 }
OLDNEW
« no previous file with comments | « crypto/encryptor_openssl.cc ('k') | crypto/ghash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698