| 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 #ifndef PKIM_H | 5 #ifndef PKIM_H |
| 6 #include "pkim.h" | 6 #include "pkim.h" |
| 7 #endif /* PKIM_H */ | 7 #endif /* PKIM_H */ |
| 8 | 8 |
| 9 #ifndef PKIT_H | 9 #ifndef PKIT_H |
| 10 #include "pkit.h" | 10 #include "pkit.h" |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 NSSCertificate **cp, **cached = NULL; | 461 NSSCertificate **cp, **cached = NULL; |
| 462 nssList *certList; | 462 nssList *certList; |
| 463 PRUint32 count; | 463 PRUint32 count; |
| 464 certList = nssList_Create(NULL, PR_FALSE); | 464 certList = nssList_Create(NULL, PR_FALSE); |
| 465 if (!certList) return PR_FAILURE; | 465 if (!certList) return PR_FAILURE; |
| 466 (void)nssTrustDomain_GetCertsFromCache(td, certList); | 466 (void)nssTrustDomain_GetCertsFromCache(td, certList); |
| 467 count = nssList_Count(certList); | 467 count = nssList_Count(certList); |
| 468 if (count > 0) { | 468 if (count > 0) { |
| 469 cached = nss_ZNEWARRAY(NULL, NSSCertificate *, count + 1); | 469 cached = nss_ZNEWARRAY(NULL, NSSCertificate *, count + 1); |
| 470 if (!cached) { | 470 if (!cached) { |
| 471 nssList_Destroy(certList); |
| 471 return PR_FAILURE; | 472 return PR_FAILURE; |
| 472 } | 473 } |
| 473 nssList_GetArray(certList, (void **)cached, count); | 474 nssList_GetArray(certList, (void **)cached, count); |
| 474 nssList_Destroy(certList); | |
| 475 for (cp = cached; *cp; cp++) { | 475 for (cp = cached; *cp; cp++) { |
| 476 nssCryptokiObject *instance; | 476 nssCryptokiObject *instance; |
| 477 NSSCertificate *c = *cp; | 477 NSSCertificate *c = *cp; |
| 478 nssTokenSearchType tokenOnly = nssTokenSearchType_TokenOnly; | 478 nssTokenSearchType tokenOnly = nssTokenSearchType_TokenOnly; |
| 479 instance = nssToken_FindCertificateByIssuerAndSerialNumber( | 479 instance = nssToken_FindCertificateByIssuerAndSerialNumber( |
| 480 token, | 480 token, |
| 481 NULL, | 481 NULL, |
| 482 &c->issuer, | 482 &c->issuer, |
| 483 &c->serial, | 483 &c->serial, |
| 484 tokenOnly, | 484 tokenOnly, |
| 485 NULL); | 485 NULL); |
| 486 if (instance) { | 486 if (instance) { |
| 487 nssPKIObject_AddInstance(&c->object, instance); | 487 nssPKIObject_AddInstance(&c->object, instance); |
| 488 STAN_ForceCERTCertificateUpdate(c); | 488 STAN_ForceCERTCertificateUpdate(c); |
| 489 } | 489 } |
| 490 } | 490 } |
| 491 nssCertificateArray_Destroy(cached); | 491 nssCertificateArray_Destroy(cached); |
| 492 } | 492 } |
| 493 nssList_Destroy(certList); |
| 493 return PR_SUCCESS; | 494 return PR_SUCCESS; |
| 494 } | 495 } |
| 495 | 496 |
| 496 static PRStatus | 497 static PRStatus |
| 497 add_issuer_and_serial_entry ( | 498 add_issuer_and_serial_entry ( |
| 498 NSSArena *arena, | 499 NSSArena *arena, |
| 499 nssTDCertificateCache *cache, | 500 nssTDCertificateCache *cache, |
| 500 NSSCertificate *cert | 501 NSSCertificate *cert |
| 501 ) | 502 ) |
| 502 { | 503 { |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 nssTrustDomain_DumpCacheInfo ( | 1138 nssTrustDomain_DumpCacheInfo ( |
| 1138 NSSTrustDomain *td, | 1139 NSSTrustDomain *td, |
| 1139 void (* cert_dump_iter)(const void *, void *, void *), | 1140 void (* cert_dump_iter)(const void *, void *, void *), |
| 1140 void *arg | 1141 void *arg |
| 1141 ) | 1142 ) |
| 1142 { | 1143 { |
| 1143 PZ_Lock(td->cache->lock); | 1144 PZ_Lock(td->cache->lock); |
| 1144 nssHash_Iterate(td->cache->issuerAndSN, cert_dump_iter, arg); | 1145 nssHash_Iterate(td->cache->issuerAndSN, cert_dump_iter, arg); |
| 1145 PZ_Unlock(td->cache->lock); | 1146 PZ_Unlock(td->cache->lock); |
| 1146 } | 1147 } |
| OLD | NEW |