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

Side by Side Diff: net/cert/x509_certificate_win.cc

Issue 169193002: Convert scoped_ptr_malloc -> scoped_ptr, part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 10 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 | « net/cert/x509_cert_types_win.cc ('k') | net/cert/x509_util_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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/cert/x509_certificate.h" 5 #include "net/cert/x509_certificate.h"
6 6
7 #include <blapi.h> // Implement CalculateChainFingerprint() with NSS. 7 #include <blapi.h> // Implement CalculateChainFingerprint() with NSS.
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 27 matching lines...) Expand all
38 system_time->wHour = exploded.hour; 38 system_time->wHour = exploded.hour;
39 system_time->wMinute = exploded.minute; 39 system_time->wMinute = exploded.minute;
40 system_time->wSecond = exploded.second; 40 system_time->wSecond = exploded.second;
41 system_time->wMilliseconds = exploded.millisecond; 41 system_time->wMilliseconds = exploded.millisecond;
42 } 42 }
43 43
44 //----------------------------------------------------------------------------- 44 //-----------------------------------------------------------------------------
45 45
46 // Decodes the cert's subjectAltName extension into a CERT_ALT_NAME_INFO 46 // Decodes the cert's subjectAltName extension into a CERT_ALT_NAME_INFO
47 // structure and stores it in *output. 47 // structure and stores it in *output.
48 void GetCertSubjectAltName(PCCERT_CONTEXT cert, 48 void GetCertSubjectAltName(
49 scoped_ptr_malloc<CERT_ALT_NAME_INFO>* output) { 49 PCCERT_CONTEXT cert,
50 scoped_ptr<CERT_ALT_NAME_INFO, base::FreeDeleter>* output) {
50 PCERT_EXTENSION extension = CertFindExtension(szOID_SUBJECT_ALT_NAME2, 51 PCERT_EXTENSION extension = CertFindExtension(szOID_SUBJECT_ALT_NAME2,
51 cert->pCertInfo->cExtension, 52 cert->pCertInfo->cExtension,
52 cert->pCertInfo->rgExtension); 53 cert->pCertInfo->rgExtension);
53 if (!extension) 54 if (!extension)
54 return; 55 return;
55 56
56 CRYPT_DECODE_PARA decode_para; 57 CRYPT_DECODE_PARA decode_para;
57 decode_para.cbSize = sizeof(decode_para); 58 decode_para.cbSize = sizeof(decode_para);
58 decode_para.pfnAlloc = crypto::CryptAlloc; 59 decode_para.pfnAlloc = crypto::CryptAlloc;
59 decode_para.pfnFree = crypto::CryptFree; 60 decode_para.pfnFree = crypto::CryptFree;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 std::vector<std::string>* dns_names, 169 std::vector<std::string>* dns_names,
169 std::vector<std::string>* ip_addrs) const { 170 std::vector<std::string>* ip_addrs) const {
170 if (dns_names) 171 if (dns_names)
171 dns_names->clear(); 172 dns_names->clear();
172 if (ip_addrs) 173 if (ip_addrs)
173 ip_addrs->clear(); 174 ip_addrs->clear();
174 175
175 if (!cert_handle_) 176 if (!cert_handle_)
176 return; 177 return;
177 178
178 scoped_ptr_malloc<CERT_ALT_NAME_INFO> alt_name_info; 179 scoped_ptr<CERT_ALT_NAME_INFO, base::FreeDeleter> alt_name_info;
179 GetCertSubjectAltName(cert_handle_, &alt_name_info); 180 GetCertSubjectAltName(cert_handle_, &alt_name_info);
180 CERT_ALT_NAME_INFO* alt_name = alt_name_info.get(); 181 CERT_ALT_NAME_INFO* alt_name = alt_name_info.get();
181 if (alt_name) { 182 if (alt_name) {
182 int num_entries = alt_name->cAltEntry; 183 int num_entries = alt_name->cAltEntry;
183 for (int i = 0; i < num_entries; i++) { 184 for (int i = 0; i < num_entries; i++) {
184 // dNSName is an ASN.1 IA5String representing a string of ASCII 185 // dNSName is an ASN.1 IA5String representing a string of ASCII
185 // characters, so we can use WideToASCII here. 186 // characters, so we can use WideToASCII here.
186 const CERT_ALT_NAME_ENTRY& entry = alt_name->rgAltEntry[i]; 187 const CERT_ALT_NAME_ENTRY& entry = alt_name->rgAltEntry[i];
187 188
188 if (dns_names && entry.dwAltNameChoice == CERT_ALT_NAME_DNS_NAME) { 189 if (dns_names && entry.dwAltNameChoice == CERT_ALT_NAME_DNS_NAME) {
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 if (IsCertNameBlobInIssuerList(&(*it)->pCertInfo->Issuer, 445 if (IsCertNameBlobInIssuerList(&(*it)->pCertInfo->Issuer,
445 valid_issuers)) { 446 valid_issuers)) {
446 return true; 447 return true;
447 } 448 }
448 } 449 }
449 450
450 return false; 451 return false;
451 } 452 }
452 453
453 } // namespace net 454 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/x509_cert_types_win.cc ('k') | net/cert/x509_util_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698