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

Side by Side Diff: chrome/common/net/x509_certificate_model_nss.cc

Issue 7972024: Update SHA1_LENGTH -> kSHA1Length to match previous change to SHA256_LENGTH. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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) 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 "chrome/common/net/x509_certificate_model.h" 5 #include "chrome/common/net/x509_certificate_model.h"
6 6
7 #include <cert.h> 7 #include <cert.h>
8 #include <cms.h> 8 #include <cms.h>
9 #include <hasht.h> 9 #include <hasht.h>
10 #include <keyhi.h> // SECKEY_DestroyPrivateKey 10 #include <keyhi.h> // SECKEY_DestroyPrivateKey
11 #include <keythi.h> // SECKEYPrivateKey 11 #include <keythi.h> // SECKEYPrivateKey
12 #include <pk11pub.h> // PK11_FindKeyByAnyCert 12 #include <pk11pub.h> // PK11_FindKeyByAnyCert
13 #include <seccomon.h> // SECItem 13 #include <seccomon.h> // SECItem
14 #include <sechash.h> 14 #include <sechash.h>
15 15
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/sha1.h"
17 #include "base/string_number_conversions.h" 18 #include "base/string_number_conversions.h"
18 #include "crypto/nss_util.h" 19 #include "crypto/nss_util.h"
20 #include "crypto/sha2.h"
wtc 2011/09/24 01:39:41 BUG: Please undo all the changes in this file. Th
Peter Kasting 2011/09/25 20:52:01 Right. I meant to be clearer about this in my cha
wtc 2011/09/26 18:06:22 The rule is that a file that uses the NSS hash fun
Peter Kasting 2011/09/26 20:08:18 OK. I reverted the four files you mentioned needi
19 #include "net/base/x509_certificate.h" 21 #include "net/base/x509_certificate.h"
20 #include "chrome/third_party/mozilla_security_manager/nsNSSCertHelper.h" 22 #include "chrome/third_party/mozilla_security_manager/nsNSSCertHelper.h"
21 #include "chrome/third_party/mozilla_security_manager/nsNSSCertificate.h" 23 #include "chrome/third_party/mozilla_security_manager/nsNSSCertificate.h"
22 #include "chrome/third_party/mozilla_security_manager/nsUsageArrayHelper.h" 24 #include "chrome/third_party/mozilla_security_manager/nsUsageArrayHelper.h"
23 25
24 namespace psm = mozilla_security_manager; 26 namespace psm = mozilla_security_manager;
25 27
26 namespace { 28 namespace {
27 29
28 // Convert a char* return value from NSS into a std::string and free the NSS 30 // Convert a char* return value from NSS into a std::string and free the NSS
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 Extension extension; 292 Extension extension;
291 extension.name = psm::GetOIDText(&cert_handle->extensions[i]->id); 293 extension.name = psm::GetOIDText(&cert_handle->extensions[i]->id);
292 extension.value = ProcessExtension( 294 extension.value = ProcessExtension(
293 critical_label, non_critical_label, cert_handle->extensions[i]); 295 critical_label, non_critical_label, cert_handle->extensions[i]);
294 extensions->push_back(extension); 296 extensions->push_back(extension);
295 } 297 }
296 } 298 }
297 } 299 }
298 300
299 string HashCertSHA256(X509Certificate::OSCertHandle cert_handle) { 301 string HashCertSHA256(X509Certificate::OSCertHandle cert_handle) {
300 return HashCert(cert_handle, HASH_AlgSHA256, SHA256_LENGTH); 302 return HashCert(cert_handle, HASH_AlgSHA256, kSHA256Length);
301 } 303 }
302 304
303 string HashCertSHA1(X509Certificate::OSCertHandle cert_handle) { 305 string HashCertSHA1(X509Certificate::OSCertHandle cert_handle) {
304 return HashCert(cert_handle, HASH_AlgSHA1, SHA1_LENGTH); 306 return HashCert(cert_handle, HASH_AlgSHA1, kSHA1Length);
305 } 307 }
306 308
307 void GetCertChainFromCert(X509Certificate::OSCertHandle cert_handle, 309 void GetCertChainFromCert(X509Certificate::OSCertHandle cert_handle,
308 X509Certificate::OSCertHandles* cert_handles) { 310 X509Certificate::OSCertHandles* cert_handles) {
309 CERTCertList* cert_list = 311 CERTCertList* cert_list =
310 CERT_GetCertChainFromCert(cert_handle, PR_Now(), certUsageSSLServer); 312 CERT_GetCertChainFromCert(cert_handle, PR_Now(), certUsageSSLServer);
311 CERTCertListNode* node; 313 CERTCertListNode* node;
312 for (node = CERT_LIST_HEAD(cert_list); 314 for (node = CERT_LIST_HEAD(cert_list);
313 !CERT_LIST_END(node, cert_list); 315 !CERT_LIST_END(node, cert_list);
314 node = CERT_LIST_NEXT(node)) { 316 node = CERT_LIST_NEXT(node)) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 string ProcessRawBitsSignatureWrap(X509Certificate::OSCertHandle cert_handle) { 405 string ProcessRawBitsSignatureWrap(X509Certificate::OSCertHandle cert_handle) {
404 return ProcessRawBits(cert_handle->signatureWrap.signature.data, 406 return ProcessRawBits(cert_handle->signatureWrap.signature.data,
405 cert_handle->signatureWrap.signature.len); 407 cert_handle->signatureWrap.signature.len);
406 } 408 }
407 409
408 void RegisterDynamicOids() { 410 void RegisterDynamicOids() {
409 psm::RegisterDynamicOids(); 411 psm::RegisterDynamicOids();
410 } 412 }
411 413
412 } // namespace x509_certificate_model 414 } // namespace x509_certificate_model
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698