diff options
author | ian.mcgreer%sun.com <devnull@localhost> | 2002-03-04 17:13:54 +0000 |
---|---|---|
committer | ian.mcgreer%sun.com <devnull@localhost> | 2002-03-04 17:13:54 +0000 |
commit | 584180740c970de066c37a958ae8a490f7d69da1 (patch) | |
tree | 1c556857dd5906fcdb672892d66c5fe40f4676ea | |
parent | c1274fed90943164e1c54f950a7cb09997d07445 (diff) | |
download | nss-hg-584180740c970de066c37a958ae8a490f7d69da1.tar.gz |
bug 125808, update cert token instances when caching smart card certs that are already cached
-rw-r--r-- | security/nss/lib/dev/dev.h | 12 | ||||
-rw-r--r-- | security/nss/lib/dev/devobject.c | 15 | ||||
-rw-r--r-- | security/nss/lib/pki/pki3hack.c | 11 |
3 files changed, 38 insertions, 0 deletions
diff --git a/security/nss/lib/dev/dev.h b/security/nss/lib/dev/dev.h index 3102817eb..bbc8fce4f 100644 --- a/security/nss/lib/dev/dev.h +++ b/security/nss/lib/dev/dev.h @@ -450,6 +450,18 @@ NSSAlgorithmAndParameters_CreateMD5Digest NSSArena *arenaOpt ); +#ifdef NSS_3_4_CODE +/* exposing this for the smart card cache code */ +NSS_IMPLEMENT nssCryptokiInstance * +nssCryptokiInstance_Create +( + NSSArena *arena, + NSSToken *t, + CK_OBJECT_HANDLE h, + PRBool isTokenObject +); +#endif + PR_END_EXTERN_C #endif /* DEV_H */ diff --git a/security/nss/lib/dev/devobject.c b/security/nss/lib/dev/devobject.c index 46c40120e..fdb699544 100644 --- a/security/nss/lib/dev/devobject.c +++ b/security/nss/lib/dev/devobject.c @@ -302,6 +302,21 @@ create_cryptoki_instance return instance; } +#ifdef NSS_3_4_CODE +/* exposing this for the smart card cache code */ +NSS_IMPLEMENT nssCryptokiInstance * +nssCryptokiInstance_Create +( + NSSArena *arena, + NSSToken *t, + CK_OBJECT_HANDLE h, + PRBool isTokenObject +) +{ + return create_cryptoki_instance(arena, t, h, isTokenObject); +} +#endif + static NSSCertificateType nss_cert_type_from_ck_attrib(CK_ATTRIBUTE_PTR attrib) { diff --git a/security/nss/lib/pki/pki3hack.c b/security/nss/lib/pki/pki3hack.c index 0fc28ee26..1df51b1e1 100644 --- a/security/nss/lib/pki/pki3hack.c +++ b/security/nss/lib/pki/pki3hack.c @@ -120,6 +120,17 @@ cache_token_cert(NSSCertificate *c, void *arg) nssTrustDomain_AddCertsToCache(td, &c, 1); if (cp == c) { NSSCertificate_Destroy(cp); + } else { + /* The cert was already in the cache, from another token. Add this + * token's instance to the cert. + */ + nssCryptokiInstance *tokenInstance, *instance; + nssList_GetArray(cp->object.instanceList, (void **)&tokenInstance, 1); + instance = nssCryptokiInstance_Create(c->object.arena, token, + tokenInstance->handle, PR_TRUE); + nssList_Add(c->object.instanceList, instance); + nssListIterator_Destroy(c->object.instances); + c->object.instances = nssList_CreateIterator(c->object.instanceList); } /* This list reference persists with the token */ nssList_Add(token->certList, nssCertificate_AddRef(c)); |