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

Side by Side Diff: crypto/signature_verifier_win.cc

Issue 6805019: Move crypto files out of base, to a top level directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 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 "base/crypto/signature_verifier.h" 5 #include "crypto/signature_verifier.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 #pragma comment(lib, "crypt32.lib") 9 #pragma comment(lib, "crypt32.lib")
10 10
11 namespace { 11 namespace {
12 12
13 // Wrappers of malloc and free for CRYPT_DECODE_PARA, which requires the 13 // Wrappers of malloc and free for CRYPT_DECODE_PARA, which requires the
14 // WINAPI calling convention. 14 // WINAPI calling convention.
15 void* WINAPI MyCryptAlloc(size_t size) { 15 void* WINAPI MyCryptAlloc(size_t size) {
16 return malloc(size); 16 return malloc(size);
17 } 17 }
18 18
19 void WINAPI MyCryptFree(void* p) { 19 void WINAPI MyCryptFree(void* p) {
20 free(p); 20 free(p);
21 } 21 }
22 22
23 } // namespace 23 } // namespace
24 24
25 namespace base { 25 namespace crypto {
26 26
27 SignatureVerifier::SignatureVerifier() : hash_object_(0), public_key_(0) { 27 SignatureVerifier::SignatureVerifier() : hash_object_(0), public_key_(0) {
28 if (!CryptAcquireContext(provider_.receive(), NULL, NULL, 28 if (!CryptAcquireContext(provider_.receive(), NULL, NULL,
29 PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) 29 PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
30 provider_.reset(); 30 provider_.reset();
31 } 31 }
32 32
33 SignatureVerifier::~SignatureVerifier() { 33 SignatureVerifier::~SignatureVerifier() {
34 } 34 }
35 35
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 return false; 123 return false;
124 return true; 124 return true;
125 } 125 }
126 126
127 void SignatureVerifier::Reset() { 127 void SignatureVerifier::Reset() {
128 hash_object_.reset(); 128 hash_object_.reset();
129 public_key_.reset(); 129 public_key_.reset();
130 signature_.clear(); 130 signature_.clear();
131 } 131 }
132 132
133 } // namespace base 133 } // namespace crypto
134 134
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698