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

Side by Side Diff: crypto/signature_verifier_mac.cc

Issue 6880166: Improving logging in /app, /base, /crypto and /ipc. Updating plain DCHECK() usages for DCHECK_EQ/LE/ (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Static casting to DWORD to fix type mismatch 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
« no previous file with comments | « crypto/signature_creator_mac.cc ('k') | crypto/signature_verifier_nss.cc » ('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) 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 "crypto/signature_verifier.h" 5 #include "crypto/signature_verifier.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "crypto/cssm_init.h" 10 #include "crypto/cssm_init.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 return true; 68 return true;
69 } 69 }
70 70
71 void SignatureVerifier::VerifyUpdate(const uint8* data_part, 71 void SignatureVerifier::VerifyUpdate(const uint8* data_part,
72 int data_part_len) { 72 int data_part_len) {
73 CSSM_DATA data; 73 CSSM_DATA data;
74 data.Data = const_cast<uint8*>(data_part); 74 data.Data = const_cast<uint8*>(data_part);
75 data.Length = data_part_len; 75 data.Length = data_part_len;
76 CSSM_RETURN crtn = CSSM_VerifyDataUpdate(sig_handle_, &data, 1); 76 CSSM_RETURN crtn = CSSM_VerifyDataUpdate(sig_handle_, &data, 1);
77 DCHECK(crtn == CSSM_OK); 77 DCHECK_EQ(CSSM_OK, crtn);
78 } 78 }
79 79
80 bool SignatureVerifier::VerifyFinal() { 80 bool SignatureVerifier::VerifyFinal() {
81 CSSM_DATA sig; 81 CSSM_DATA sig;
82 sig.Data = const_cast<uint8*>(&signature_[0]); 82 sig.Data = const_cast<uint8*>(&signature_[0]);
83 sig.Length = signature_.size(); 83 sig.Length = signature_.size();
84 CSSM_RETURN crtn = CSSM_VerifyDataFinal(sig_handle_, &sig); 84 CSSM_RETURN crtn = CSSM_VerifyDataFinal(sig_handle_, &sig);
85 Reset(); 85 Reset();
86 86
87 // crtn is CSSMERR_CSP_VERIFY_FAILED if signature verification fails. 87 // crtn is CSSMERR_CSP_VERIFY_FAILED if signature verification fails.
88 return (crtn == CSSM_OK); 88 return (crtn == CSSM_OK);
89 } 89 }
90 90
91 void SignatureVerifier::Reset() { 91 void SignatureVerifier::Reset() {
92 CSSM_RETURN crtn; 92 CSSM_RETURN crtn;
93 if (sig_handle_) { 93 if (sig_handle_) {
94 crtn = CSSM_DeleteContext(sig_handle_); 94 crtn = CSSM_DeleteContext(sig_handle_);
95 DCHECK(crtn == CSSM_OK); 95 DCHECK_EQ(CSSM_OK, crtn);
96 sig_handle_ = 0; 96 sig_handle_ = 0;
97 } 97 }
98 signature_.clear(); 98 signature_.clear();
99 99
100 // Can't call CSSM_FreeKey on public_key_ because we constructed 100 // Can't call CSSM_FreeKey on public_key_ because we constructed
101 // public_key_ manually. 101 // public_key_ manually.
102 } 102 }
103 103
104 } // namespace crypto 104 } // namespace crypto
105 105
OLDNEW
« no previous file with comments | « crypto/signature_creator_mac.cc ('k') | crypto/signature_verifier_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698