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

Unified Diff: base/crypto/signature_verifier_win.cc

Issue 1528021: Implement PBKDF2-based key derivation, random key generation,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Make albertb's suggested changes. Created 10 years, 8 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
« no previous file with comments | « base/crypto/signature_verifier.h ('k') | base/crypto/symmetric_key.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/crypto/signature_verifier_win.cc
===================================================================
--- base/crypto/signature_verifier_win.cc (revision 43766)
+++ base/crypto/signature_verifier_win.cc (working copy)
@@ -25,17 +25,12 @@
namespace base {
SignatureVerifier::SignatureVerifier() : hash_object_(0), public_key_(0) {
- if (!CryptAcquireContext(&provider_, NULL, NULL,
+ if (!CryptAcquireContext(provider_.receive(), NULL, NULL,
PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
- provider_ = 0;
+ provider_.reset();
}
SignatureVerifier::~SignatureVerifier() {
- Reset();
- if (provider_) {
- BOOL ok = CryptReleaseContext(provider_, 0);
- DCHECK(ok);
- }
}
bool SignatureVerifier::VerifyInit(const uint8* signature_algorithm,
@@ -70,7 +65,7 @@
ok = CryptImportPublicKeyInfo(provider_,
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
- cert_public_key_info, &public_key_);
+ cert_public_key_info, public_key_.receive());
free(cert_public_key_info);
if (!ok)
return false;
@@ -108,7 +103,7 @@
return false;
}
- ok = CryptCreateHash(provider_, hash_alg_id, 0, 0, &hash_object_);
+ ok = CryptCreateHash(provider_, hash_alg_id, 0, 0, hash_object_.receive());
if (!ok)
return false;
return true;
@@ -130,17 +125,8 @@
}
void SignatureVerifier::Reset() {
- BOOL ok;
- if (hash_object_) {
- ok = CryptDestroyHash(hash_object_);
- DCHECK(ok);
- hash_object_ = 0;
- }
- if (public_key_) {
- ok = CryptDestroyKey(public_key_);
- DCHECK(ok);
- public_key_ = 0;
- }
+ hash_object_.reset();
+ public_key_.reset();
signature_.clear();
}
« no previous file with comments | « base/crypto/signature_verifier.h ('k') | base/crypto/symmetric_key.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698