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

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

Issue 337014: Add a CERT_RDN_ENCODED_BLOB case to CertSubjectCommonNameHasNull... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Improve comment Created 11 years, 1 month 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 | « no previous file | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/base/x509_certificate.h" 5 #include "net/base/x509_certificate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/pickle.h" 8 #include "base/pickle.h"
9 #include "base/string_tokenizer.h" 9 #include "base/string_tokenizer.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // utf8String UTF8String (SIZE (1..ub-common-name)), 197 // utf8String UTF8String (SIZE (1..ub-common-name)),
198 // bmpString BMPString (SIZE (1..ub-common-name)) } 198 // bmpString BMPString (SIZE (1..ub-common-name)) }
199 // 199 //
200 // We also check IA5String and VisibleString. 200 // We also check IA5String and VisibleString.
201 for (DWORD i = 0; i < name_info->cRDN; ++i) { 201 for (DWORD i = 0; i < name_info->cRDN; ++i) {
202 PCERT_RDN rdn = &name_info->rgRDN[i]; 202 PCERT_RDN rdn = &name_info->rgRDN[i];
203 for (DWORD j = 0; j < rdn->cRDNAttr; ++j) { 203 for (DWORD j = 0; j < rdn->cRDNAttr; ++j) {
204 PCERT_RDN_ATTR rdn_attr = &rdn->rgRDNAttr[j]; 204 PCERT_RDN_ATTR rdn_attr = &rdn->rgRDNAttr[j];
205 if (strcmp(rdn_attr->pszObjId, szOID_COMMON_NAME) == 0) { 205 if (strcmp(rdn_attr->pszObjId, szOID_COMMON_NAME) == 0) {
206 switch (rdn_attr->dwValueType) { 206 switch (rdn_attr->dwValueType) {
207 // After the CryptoAPI ASN.1 security vulnerabilities described in
208 // http://www.microsoft.com/technet/security/Bulletin/MS09-056.mspx
209 // were patched, we get CERT_RDN_ENCODED_BLOB for a common name
210 // that contains a NULL character.
211 case CERT_RDN_ENCODED_BLOB:
212 break;
207 // Array of 8-bit characters. 213 // Array of 8-bit characters.
208 case CERT_RDN_PRINTABLE_STRING: 214 case CERT_RDN_PRINTABLE_STRING:
209 case CERT_RDN_TELETEX_STRING: 215 case CERT_RDN_TELETEX_STRING:
210 case CERT_RDN_IA5_STRING: 216 case CERT_RDN_IA5_STRING:
211 case CERT_RDN_VISIBLE_STRING: 217 case CERT_RDN_VISIBLE_STRING:
212 for (DWORD k = 0; k < rdn_attr->Value.cbData; ++k) { 218 for (DWORD k = 0; k < rdn_attr->Value.cbData; ++k) {
213 if (rdn_attr->Value.pbData[k] == '\0') 219 if (rdn_attr->Value.pbData[k] == '\0')
214 return true; 220 return true;
215 } 221 }
216 break; 222 break;
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 DWORD sha1_size = sizeof(sha1.data); 745 DWORD sha1_size = sizeof(sha1.data);
740 rv = CryptHashCertificate(NULL, CALG_SHA1, 0, cert->pbCertEncoded, 746 rv = CryptHashCertificate(NULL, CALG_SHA1, 0, cert->pbCertEncoded,
741 cert->cbCertEncoded, sha1.data, &sha1_size); 747 cert->cbCertEncoded, sha1.data, &sha1_size);
742 DCHECK(rv && sha1_size == sizeof(sha1.data)); 748 DCHECK(rv && sha1_size == sizeof(sha1.data));
743 if (!rv) 749 if (!rv)
744 memset(sha1.data, 0, sizeof(sha1.data)); 750 memset(sha1.data, 0, sizeof(sha1.data));
745 return sha1; 751 return sha1;
746 } 752 }
747 753
748 } // namespace net 754 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698