| 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 /* | 5 /* |
| 6 * Moved from secpkcs7.c | 6 * Moved from secpkcs7.c |
| 7 * | 7 * |
| 8 * $Id$ | 8 * $Id$ |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1688 added to the cache and the refcount got bumped, or not, and | 1688 added to the cache and the refcount got bumped, or not, and |
| 1689 thus we need to free its RAM */ | 1689 thus we need to free its RAM */ |
| 1690 } | 1690 } |
| 1691 } | 1691 } |
| 1692 PORT_FreeArena(head.arena, PR_FALSE); /* destroy CRL list */ | 1692 PORT_FreeArena(head.arena, PR_FALSE); /* destroy CRL list */ |
| 1693 } | 1693 } |
| 1694 | 1694 |
| 1695 return rv; | 1695 return rv; |
| 1696 } | 1696 } |
| 1697 | 1697 |
| 1698 static SECStatus CachedCrl_GetEntry(CachedCrl* crl, SECItem* sn, | 1698 static SECStatus CachedCrl_GetEntry(CachedCrl* crl, const SECItem* sn, |
| 1699 CERTCrlEntry** returned) | 1699 CERTCrlEntry** returned) |
| 1700 { | 1700 { |
| 1701 CERTCrlEntry* acrlEntry; | 1701 CERTCrlEntry* acrlEntry; |
| 1702 | 1702 |
| 1703 PORT_Assert(crl); | 1703 PORT_Assert(crl); |
| 1704 PORT_Assert(crl->entries); | 1704 PORT_Assert(crl->entries); |
| 1705 PORT_Assert(sn); | 1705 PORT_Assert(sn); |
| 1706 PORT_Assert(returned); | 1706 PORT_Assert(returned); |
| 1707 if (!crl || !sn || !returned || !crl->entries) | 1707 if (!crl || !sn || !returned || !crl->entries) |
| 1708 { | 1708 { |
| 1709 PORT_SetError(SEC_ERROR_INVALID_ARGS); | 1709 PORT_SetError(SEC_ERROR_INVALID_ARGS); |
| 1710 return SECFailure; | 1710 return SECFailure; |
| 1711 } | 1711 } |
| 1712 acrlEntry = PL_HashTableLookup(crl->entries, (void*)sn); | 1712 acrlEntry = PL_HashTableLookup(crl->entries, (void*)sn); |
| 1713 if (acrlEntry) | 1713 if (acrlEntry) |
| 1714 { | 1714 { |
| 1715 *returned = acrlEntry; | 1715 *returned = acrlEntry; |
| 1716 } | 1716 } |
| 1717 else | 1717 else |
| 1718 { | 1718 { |
| 1719 *returned = NULL; | 1719 *returned = NULL; |
| 1720 } | 1720 } |
| 1721 return SECSuccess; | 1721 return SECSuccess; |
| 1722 } | 1722 } |
| 1723 | 1723 |
| 1724 /* check if a particular SN is in the CRL cache and return its entry */ | 1724 /* check if a particular SN is in the CRL cache and return its entry */ |
| 1725 dpcacheStatus DPCache_Lookup(CRLDPCache* cache, SECItem* sn, | 1725 dpcacheStatus DPCache_Lookup(CRLDPCache* cache, const SECItem* sn, |
| 1726 CERTCrlEntry** returned) | 1726 CERTCrlEntry** returned) |
| 1727 { | 1727 { |
| 1728 SECStatus rv; | 1728 SECStatus rv; |
| 1729 if (!cache || !sn || !returned) | 1729 if (!cache || !sn || !returned) |
| 1730 { | 1730 { |
| 1731 PORT_SetError(SEC_ERROR_INVALID_ARGS); | 1731 PORT_SetError(SEC_ERROR_INVALID_ARGS); |
| 1732 /* no cache or SN to look up, or no way to return entry */ | 1732 /* no cache or SN to look up, or no way to return entry */ |
| 1733 return dpcacheCallerError; | 1733 return dpcacheCallerError; |
| 1734 } | 1734 } |
| 1735 *returned = NULL; | 1735 *returned = NULL; |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2624 | 2624 |
| 2625 if (revStatus) | 2625 if (revStatus) |
| 2626 { | 2626 { |
| 2627 *revStatus = status; | 2627 *revStatus = status; |
| 2628 } | 2628 } |
| 2629 if (revReason) | 2629 if (revReason) |
| 2630 { | 2630 { |
| 2631 *revReason = reason; | 2631 *revReason = reason; |
| 2632 } | 2632 } |
| 2633 | 2633 |
| 2634 if (t && SECSuccess != CERT_CheckCertValidTimes(issuer, t, PR_FALSE)) | 2634 if (t && secCertTimeValid != CERT_CheckCertValidTimes(issuer, t, PR_FALSE)) |
| 2635 { | 2635 { |
| 2636 /* we won't be able to check the CRL's signature if the issuer cert | 2636 /* we won't be able to check the CRL's signature if the issuer cert |
| 2637 is expired as of the time we are verifying. This may cause a valid | 2637 is expired as of the time we are verifying. This may cause a valid |
| 2638 CRL to be cached as bad. short-circuit to avoid this case. */ | 2638 CRL to be cached as bad. short-circuit to avoid this case. */ |
| 2639 PORT_SetError(SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE); | 2639 PORT_SetError(SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE); |
| 2640 return SECFailure; | 2640 return SECFailure; |
| 2641 } | 2641 } |
| 2642 | 2642 |
| 2643 rv = AcquireDPCache(issuer, &issuer->derSubject, dp, t, wincx, &dpcache, | 2643 rv = AcquireDPCache(issuer, &issuer->derSubject, dp, t, wincx, &dpcache, |
| 2644 &lockedwrite); | 2644 &lockedwrite); |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3364 to CERT_CacheCRL previously. That API takes a SECItem*, thus, we | 3364 to CERT_CacheCRL previously. That API takes a SECItem*, thus, we |
| 3365 just do a pointer comparison here. | 3365 just do a pointer comparison here. |
| 3366 */ | 3366 */ |
| 3367 if (b->crl->derCrl == a->crl->derCrl) | 3367 if (b->crl->derCrl == a->crl->derCrl) |
| 3368 { | 3368 { |
| 3369 *isDupe = PR_TRUE; | 3369 *isDupe = PR_TRUE; |
| 3370 } | 3370 } |
| 3371 } | 3371 } |
| 3372 return SECSuccess; | 3372 return SECSuccess; |
| 3373 } | 3373 } |
| OLD | NEW |