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

Side by Side Diff: net/socket/dns_cert_provenance_checker.cc

Issue 8511050: Unify the error checking of crypto::Encryptor and add WARN_UNUSED_RESULT to prevent misuse. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
« crypto/encryptor_openssl.cc ('K') | « crypto/encryptor_win.cc ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "net/socket/dns_cert_provenance_checker.h" 5 #include "net/socket/dns_cert_provenance_checker.h"
6 6
7 #if !defined(USE_OPENSSL) 7 #if !defined(USE_OPENSSL)
8 8
9 #include <nspr.h> 9 #include <nspr.h>
10 10
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 scoped_ptr<crypto::SymmetricKey> symkey( 305 scoped_ptr<crypto::SymmetricKey> symkey(
306 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, raw_key)); 306 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, raw_key));
307 std::string iv(key_data + kKeySizeInBytes, kIVSizeInBytes); 307 std::string iv(key_data + kKeySizeInBytes, kIVSizeInBytes);
308 308
309 crypto::Encryptor encryptor; 309 crypto::Encryptor encryptor;
310 bool r = encryptor.Init(symkey.get(), crypto::Encryptor::CBC, iv); 310 bool r = encryptor.Init(symkey.get(), crypto::Encryptor::CBC, iv);
311 CHECK(r); 311 CHECK(r);
312 312
313 std::string plaintext(reinterpret_cast<const char*>(p.data()), p.size()); 313 std::string plaintext(reinterpret_cast<const char*>(p.data()), p.size());
314 std::string ciphertext; 314 std::string ciphertext;
315 encryptor.Encrypt(plaintext, &ciphertext); 315 r = encryptor.Encrypt(plaintext, &ciphertext);
316 CHECK(r);
316 317
317 // We use another Pickle object to serialise the 'outer' wrapping of the 318 // We use another Pickle object to serialise the 'outer' wrapping of the
318 // plaintext. 319 // plaintext.
319 Pickle outer; 320 Pickle outer;
320 outer.WriteInt(kVersion); 321 outer.WriteInt(kVersion);
321 322
322 SECItem* pub_key_serialized = SECKEY_EncodeDERSubjectPublicKeyInfo(pub_key); 323 SECItem* pub_key_serialized = SECKEY_EncodeDERSubjectPublicKeyInfo(pub_key);
323 outer.WriteString( 324 outer.WriteString(
324 std::string(reinterpret_cast<char*>(pub_key_serialized->data), 325 std::string(reinterpret_cast<char*>(pub_key_serialized->data),
325 pub_key_serialized->len)); 326 pub_key_serialized->len));
(...skipping 29 matching lines...) Expand all
355 356
356 std::string DnsCertProvenanceChecker::BuildEncryptedReport( 357 std::string DnsCertProvenanceChecker::BuildEncryptedReport(
357 const std::string& hostname, 358 const std::string& hostname,
358 const std::vector<std::string>& der_certs) { 359 const std::vector<std::string>& der_certs) {
359 return ""; 360 return "";
360 } 361 }
361 362
362 } // namespace net 363 } // namespace net
363 364
364 #endif // USE_OPENSSL 365 #endif // USE_OPENSSL
OLDNEW
« crypto/encryptor_openssl.cc ('K') | « crypto/encryptor_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698