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

Side by Side Diff: nss/lib/certhigh/certvfy.c

Issue 170823003: Update to NSS 3.15.5 and NSPR 4.10.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: 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 | « nss/lib/certdb/certt.h ('k') | nss/lib/certhigh/ocsp.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* This Source Code Form is subject to the terms of the Mozilla Public 1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 #include "nspr.h" 4 #include "nspr.h"
5 #include "secerr.h" 5 #include "secerr.h"
6 #include "secport.h" 6 #include "secport.h"
7 #include "seccomon.h" 7 #include "seccomon.h"
8 #include "secoid.h" 8 #include "secoid.h"
9 #include "sslerr.h" 9 #include "sslerr.h"
10 #include "genname.h" 10 #include "genname.h"
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 certUsage, t, wincx, log, 1236 certUsage, t, wincx, log,
1237 &revoked); 1237 &revoked);
1238 1238
1239 if (rv != SECSuccess) { 1239 if (rv != SECSuccess) {
1240 /* EXIT_IF_NOT_LOGGING(log); XXX ???? */ 1240 /* EXIT_IF_NOT_LOGGING(log); XXX ???? */
1241 INVALID_USAGE(); 1241 INVALID_USAGE();
1242 } 1242 }
1243 1243
1244 /* 1244 /*
1245 * Check OCSP revocation status, but only if the cert we are checking 1245 * Check OCSP revocation status, but only if the cert we are checking
1246 * is not a status reponder itself. We only do this in the case 1246 * is not a status responder itself. We only do this in the case
1247 * where we checked the cert chain (above); explicit trust "wins" 1247 * where we checked the cert chain (above); explicit trust "wins"
1248 * (avoids status checking, just as it avoids CRL checking) by 1248 * (avoids status checking, just as it avoids CRL checking) by
1249 * bypassing this code. 1249 * bypassing this code.
1250 */ 1250 */
1251 1251
1252 if (PR_FALSE == checkedOCSP) { 1252 if (PR_FALSE == checkedOCSP) {
1253 checkedOCSP = PR_TRUE; /* only check OCSP once */ 1253 checkedOCSP = PR_TRUE; /* only check OCSP once */
1254 statusConfig = CERT_GetStatusConfig(handle); 1254 statusConfig = CERT_GetStatusConfig(handle);
1255 if (requiredUsages != certificateUsageStatusResponder && 1255 if (requiredUsages != certificateUsageStatusResponder &&
1256 statusConfig != NULL) { 1256 statusConfig != NULL) {
(...skipping 14 matching lines...) Expand all
1271 1271
1272 loser: 1272 loser:
1273 return(valid); 1273 return(valid);
1274 } 1274 }
1275 1275
1276 SECStatus 1276 SECStatus
1277 CERT_VerifyCert(CERTCertDBHandle *handle, CERTCertificate *cert, 1277 CERT_VerifyCert(CERTCertDBHandle *handle, CERTCertificate *cert,
1278 PRBool checkSig, SECCertUsage certUsage, PRTime t, 1278 PRBool checkSig, SECCertUsage certUsage, PRTime t,
1279 void *wincx, CERTVerifyLog *log) 1279 void *wincx, CERTVerifyLog *log)
1280 { 1280 {
1281 return cert_VerifyCertWithFlags(handle, cert, checkSig, certUsage, t,
1282 CERT_VERIFYCERT_USE_DEFAULTS, wincx, log);
1283 }
1284
1285 SECStatus
1286 cert_VerifyCertWithFlags(CERTCertDBHandle *handle, CERTCertificate *cert,
1287 PRBool checkSig, SECCertUsage certUsage, PRTime t,
1288 PRUint32 flags, void *wincx, CERTVerifyLog *log)
1289 {
1281 SECStatus rv; 1290 SECStatus rv;
1282 unsigned int requiredKeyUsage; 1291 unsigned int requiredKeyUsage;
1283 unsigned int requiredCertType; 1292 unsigned int requiredCertType;
1284 unsigned int flags; 1293 unsigned int failedFlags;
1285 unsigned int certType; 1294 unsigned int certType;
1286 PRBool trusted; 1295 PRBool trusted;
1287 PRBool allowOverride; 1296 PRBool allowOverride;
1288 SECCertTimeValidity validity; 1297 SECCertTimeValidity validity;
1289 CERTStatusConfig *statusConfig; 1298 CERTStatusConfig *statusConfig;
1290 1299
1291 #ifdef notdef 1300 #ifdef notdef
1292 /* check if this cert is in the Evil list */ 1301 /* check if this cert is in the Evil list */
1293 rv = CERT_CheckForEvilCert(cert); 1302 rv = CERT_CheckForEvilCert(cert);
1294 if ( rv != SECSuccess ) { 1303 if ( rv != SECSuccess ) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 } 1352 }
1344 if ( CERT_CheckKeyUsage(cert, requiredKeyUsage) != SECSuccess ) { 1353 if ( CERT_CheckKeyUsage(cert, requiredKeyUsage) != SECSuccess ) {
1345 PORT_SetError(SEC_ERROR_INADEQUATE_KEY_USAGE); 1354 PORT_SetError(SEC_ERROR_INADEQUATE_KEY_USAGE);
1346 LOG_ERROR_OR_EXIT(log,cert,0,requiredKeyUsage); 1355 LOG_ERROR_OR_EXIT(log,cert,0,requiredKeyUsage);
1347 } 1356 }
1348 if ( !( certType & requiredCertType ) ) { 1357 if ( !( certType & requiredCertType ) ) {
1349 PORT_SetError(SEC_ERROR_INADEQUATE_CERT_TYPE); 1358 PORT_SetError(SEC_ERROR_INADEQUATE_CERT_TYPE);
1350 LOG_ERROR_OR_EXIT(log,cert,0,requiredCertType); 1359 LOG_ERROR_OR_EXIT(log,cert,0,requiredCertType);
1351 } 1360 }
1352 1361
1353 rv = cert_CheckLeafTrust(cert,certUsage, &flags, &trusted); 1362 rv = cert_CheckLeafTrust(cert, certUsage, &failedFlags, &trusted);
1354 if (rv == SECFailure) { 1363 if (rv == SECFailure) {
1355 PORT_SetError(SEC_ERROR_UNTRUSTED_CERT); 1364 PORT_SetError(SEC_ERROR_UNTRUSTED_CERT);
1356 » LOG_ERROR_OR_EXIT(log,cert,0,flags); 1365 » LOG_ERROR_OR_EXIT(log, cert, 0, failedFlags);
1357 } else if (trusted) { 1366 } else if (trusted) {
1358 goto done; 1367 goto done;
1359 } 1368 }
1360 1369
1361 1370
1362 rv = CERT_VerifyCertChain(handle, cert, checkSig, certUsage, 1371 rv = CERT_VerifyCertChain(handle, cert, checkSig, certUsage,
1363 t, wincx, log); 1372 t, wincx, log);
1364 if (rv != SECSuccess) { 1373 if (rv != SECSuccess) {
1365 EXIT_IF_NOT_LOGGING(log); 1374 EXIT_IF_NOT_LOGGING(log);
1366 } 1375 }
1367 1376
1368 /* 1377 /*
1369 * Check revocation status, but only if the cert we are checking 1378 * Check revocation status, but only if the cert we are checking is not a
1370 * is not a status reponder itself. We only do this in the case 1379 * status responder itself and the caller did not ask us to skip the check.
1371 * where we checked the cert chain (above); explicit trust "wins" 1380 * We only do this in the case where we checked the cert chain (above);
1372 * (avoids status checking, just as it avoids CRL checking, which 1381 * explicit trust "wins" (avoids status checking, just as it avoids CRL
1373 * is all done inside VerifyCertChain) by bypassing this code. 1382 * checking, which is all done inside VerifyCertChain) by bypassing this
1383 * code.
1374 */ 1384 */
1375 statusConfig = CERT_GetStatusConfig(handle); 1385 if (!(flags & CERT_VERIFYCERT_SKIP_OCSP) &&
1376 if (certUsage != certUsageStatusResponder && statusConfig != NULL) { 1386 » certUsage != certUsageStatusResponder) {
1377 » if (statusConfig->statusChecker != NULL) { 1387 » statusConfig = CERT_GetStatusConfig(handle);
1388 » if (statusConfig && statusConfig->statusChecker) {
1378 rv = (* statusConfig->statusChecker)(handle, cert, 1389 rv = (* statusConfig->statusChecker)(handle, cert,
1379 t, wincx); 1390 t, wincx);
1380 if (rv != SECSuccess) { 1391 if (rv != SECSuccess) {
1381 LOG_ERROR_OR_EXIT(log,cert,0,0); 1392 LOG_ERROR_OR_EXIT(log,cert,0,0);
1382 } 1393 }
1383 } 1394 }
1384 } 1395 }
1385 1396
1386 done: 1397 done:
1387 if (log && log->head) { 1398 if (log && log->head) {
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 return chain; 1877 return chain;
1867 } 1878 }
1868 1879
1869 cert = CERT_FindCertIssuer(cert, time, usage); 1880 cert = CERT_FindCertIssuer(cert, time, usage);
1870 } 1881 }
1871 1882
1872 /* return partial chain */ 1883 /* return partial chain */
1873 PORT_SetError(SEC_ERROR_UNKNOWN_ISSUER); 1884 PORT_SetError(SEC_ERROR_UNKNOWN_ISSUER);
1874 return chain; 1885 return chain;
1875 } 1886 }
OLDNEW
« no previous file with comments | « nss/lib/certdb/certt.h ('k') | nss/lib/certhigh/ocsp.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698