| OLD | NEW |
| 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 /* | 4 /* |
| 5 * pkix_validate.c | 5 * pkix_validate.c |
| 6 * | 6 * |
| 7 * Top level validateChain function | 7 * Top level validateChain function |
| 8 * | 8 * |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 &certCheckedIndex, | 1106 &certCheckedIndex, |
| 1107 &checkerIndex, | 1107 &checkerIndex, |
| 1108 &revChecking, | 1108 &revChecking, |
| 1109 &reasonCode, | 1109 &reasonCode, |
| 1110 &nbioContext, | 1110 &nbioContext, |
| 1111 &finalPubKey, | 1111 &finalPubKey, |
| 1112 &validPolicyTree, | 1112 &validPolicyTree, |
| 1113 pVerifyTree, | 1113 pVerifyTree, |
| 1114 plContext); | 1114 plContext); |
| 1115 | 1115 |
| 1116 if (chainFailed || (reasonCode != 0)) { | 1116 if (chainFailed) { |
| 1117 | 1117 |
| 1118 /* cert chain failed to validate */ | 1118 /* cert chain failed to validate */ |
| 1119 | 1119 |
| 1120 PKIX_DECREF(chainFailed); | 1120 PKIX_DECREF(chainFailed); |
| 1121 PKIX_DECREF(anchor); | 1121 PKIX_DECREF(anchor); |
| 1122 PKIX_DECREF(checkers); | 1122 PKIX_DECREF(checkers); |
| 1123 PKIX_DECREF(validPolicyTree); | 1123 PKIX_DECREF(validPolicyTree); |
| 1124 | 1124 |
| 1125 /* if last anchor, we fail; else, we try next anchor */ | 1125 /* if last anchor, we fail; else, we try next anchor */ |
| 1126 if (i == (numAnchors - 1)) { /* last anchor */ | 1126 if (i == (numAnchors - 1)) { /* last anchor */ |
| 1127 PKIX_ERROR(PKIX_VALIDATECHAINFAILED); | 1127 PKIX_ERROR(PKIX_VALIDATECHAINFAILED); |
| 1128 } | 1128 } |
| 1129 | 1129 |
| 1130 } else { | 1130 } else { |
| 1131 | 1131 |
| 1132 /* XXX Remove this assertion after 2014-12-31. |
| 1133 * See bug 946984. */ |
| 1134 PORT_Assert(reasonCode == 0); |
| 1135 |
| 1132 /* cert chain successfully validated! */ | 1136 /* cert chain successfully validated! */ |
| 1133 PKIX_CHECK(pkix_ValidateResult_Create | 1137 PKIX_CHECK(pkix_ValidateResult_Create |
| 1134 (finalPubKey, | 1138 (finalPubKey, |
| 1135 anchor, | 1139 anchor, |
| 1136 validPolicyTree, | 1140 validPolicyTree, |
| 1137 &valResult, | 1141 &valResult, |
| 1138 plContext), | 1142 plContext), |
| 1139 PKIX_VALIDATERESULTCREATEFAILED); | 1143 PKIX_VALIDATERESULTCREATEFAILED); |
| 1140 | 1144 |
| 1141 *pResult = valResult; | 1145 *pResult = valResult; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1386 *pCertIndex = certIndex; | 1390 *pCertIndex = certIndex; |
| 1387 *pAnchorIndex = anchorIndex; | 1391 *pAnchorIndex = anchorIndex; |
| 1388 *pCheckerIndex = checkerIndex; | 1392 *pCheckerIndex = checkerIndex; |
| 1389 *pRevChecking = revChecking; | 1393 *pRevChecking = revChecking; |
| 1390 PKIX_INCREF(checkers); | 1394 PKIX_INCREF(checkers); |
| 1391 *pCheckers = checkers; | 1395 *pCheckers = checkers; |
| 1392 *pNBIOContext = nbioContext; | 1396 *pNBIOContext = nbioContext; |
| 1393 goto cleanup; | 1397 goto cleanup; |
| 1394 } | 1398 } |
| 1395 | 1399 |
| 1396 if (chainFailed || (reasonCode != 0)) { | 1400 if (chainFailed) { |
| 1397 | 1401 |
| 1398 /* cert chain failed to validate */ | 1402 /* cert chain failed to validate */ |
| 1399 | 1403 |
| 1400 PKIX_DECREF(chainFailed); | 1404 PKIX_DECREF(chainFailed); |
| 1401 PKIX_DECREF(anchor); | 1405 PKIX_DECREF(anchor); |
| 1402 PKIX_DECREF(checkers); | 1406 PKIX_DECREF(checkers); |
| 1403 PKIX_DECREF(validPolicyTree); | 1407 PKIX_DECREF(validPolicyTree); |
| 1404 | 1408 |
| 1405 /* if last anchor, we fail; else, we try next anchor */ | 1409 /* if last anchor, we fail; else, we try next anchor */ |
| 1406 if (i == (numAnchors - 1)) { /* last anchor */ | 1410 if (i == (numAnchors - 1)) { /* last anchor */ |
| 1407 PKIX_ERROR(PKIX_VALIDATECHAINFAILED); | 1411 PKIX_ERROR(PKIX_VALIDATECHAINFAILED); |
| 1408 } | 1412 } |
| 1409 | 1413 |
| 1410 } else { | 1414 } else { |
| 1411 | 1415 |
| 1416 /* XXX Remove this assertion after 2014-12-31. |
| 1417 * See bug 946984. */ |
| 1418 PORT_Assert(reasonCode == 0); |
| 1419 |
| 1412 /* cert chain successfully validated! */ | 1420 /* cert chain successfully validated! */ |
| 1413 PKIX_CHECK(pkix_ValidateResult_Create | 1421 PKIX_CHECK(pkix_ValidateResult_Create |
| 1414 (finalPubKey, | 1422 (finalPubKey, |
| 1415 anchor, | 1423 anchor, |
| 1416 validPolicyTree, | 1424 validPolicyTree, |
| 1417 &valResult, | 1425 &valResult, |
| 1418 plContext), | 1426 plContext), |
| 1419 PKIX_VALIDATERESULTCREATEFAILED); | 1427 PKIX_VALIDATERESULTCREATEFAILED); |
| 1420 | 1428 |
| 1421 *pResult = valResult; | 1429 *pResult = valResult; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1434 PKIX_DECREF(checkers); | 1442 PKIX_DECREF(checkers); |
| 1435 PKIX_DECREF(revChecker); | 1443 PKIX_DECREF(revChecker); |
| 1436 PKIX_DECREF(validPolicyTree); | 1444 PKIX_DECREF(validPolicyTree); |
| 1437 PKIX_DECREF(chainFailed); | 1445 PKIX_DECREF(chainFailed); |
| 1438 PKIX_DECREF(procParams); | 1446 PKIX_DECREF(procParams); |
| 1439 PKIX_DECREF(userCheckers); | 1447 PKIX_DECREF(userCheckers); |
| 1440 PKIX_DECREF(validateCheckedCritExtOIDsList); | 1448 PKIX_DECREF(validateCheckedCritExtOIDsList); |
| 1441 | 1449 |
| 1442 PKIX_RETURN(VALIDATE); | 1450 PKIX_RETURN(VALIDATE); |
| 1443 } | 1451 } |
| OLD | NEW |