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

Unified Diff: crypto/encryptor_mac.cc

Issue 7230037: Use base::StringPiece for input parameters in Encryptor, rather than std::string (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac fix Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: crypto/encryptor_mac.cc
diff --git a/crypto/encryptor_mac.cc b/crypto/encryptor_mac.cc
index ff6e019be44fe2b4ba65640d612befcb504dcff3..1819bbc49dba3c28dcde972c66c9c177b3dbf792 100644
--- a/crypto/encryptor_mac.cc
+++ b/crypto/encryptor_mac.cc
@@ -20,7 +20,9 @@ Encryptor::Encryptor()
Encryptor::~Encryptor() {
}
-bool Encryptor::Init(SymmetricKey* key, Mode mode, const std::string& iv) {
+bool Encryptor::Init(SymmetricKey* key,
+ Mode mode,
+ const base::StringPiece& iv) {
DCHECK(key);
DCHECK_EQ(CBC, mode) << "Unsupported mode of operation";
CSSM_DATA raw_key = key->cssm_data();
@@ -33,12 +35,12 @@ bool Encryptor::Init(SymmetricKey* key, Mode mode, const std::string& iv) {
key_ = key;
mode_ = mode;
- iv_ = iv;
+ iv_ = iv.as_string();
wtc 2011/06/28 22:42:09 The as_string() method creates a temporary std::st
Ryan Sleevi 2011/06/28 22:56:12 You're right - I forgot about this convenience met
return true;
}
bool Encryptor::Crypt(int /*CCOperation*/ op,
- const std::string& input,
+ const base::StringPiece& input,
std::string* output) {
DCHECK(key_);
CSSM_DATA raw_key = key_->cssm_data();
@@ -65,11 +67,13 @@ bool Encryptor::Crypt(int /*CCOperation*/ op,
return true;
}
-bool Encryptor::Encrypt(const std::string& plaintext, std::string* ciphertext) {
+bool Encryptor::Encrypt(const base::StringPiece& plaintext,
+ std::string* ciphertext) {
return Crypt(kCCEncrypt, plaintext, ciphertext);
}
-bool Encryptor::Decrypt(const std::string& ciphertext, std::string* plaintext) {
+bool Encryptor::Decrypt(const base::StringPiece& ciphertext,
+ std::string* plaintext) {
return Crypt(kCCDecrypt, ciphertext, plaintext);
}
« crypto/encryptor.h ('K') | « crypto/encryptor.cc ('k') | crypto/encryptor_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698