bug 125808, update cert token instances when caching smart card certs that are already cached

git-svn-id: svn://10.0.0.236/trunk@115724 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ian.mcgreer%sun.com
2002-03-04 17:13:54 +00:00
parent e5ac95f0ec
commit c6c1bc65dc
3 changed files with 41 additions and 3 deletions

View File

@@ -35,7 +35,7 @@
#define DEV_H
#ifdef DEBUG
static const char DEV_CVS_ID[] = "@(#) $RCSfile: dev.h,v $ $Revision: 1.17 $ $Date: 2002-02-04 21:57:03 $ $Name: not supported by cvs2svn $";
static const char DEV_CVS_ID[] = "@(#) $RCSfile: dev.h,v $ $Revision: 1.18 $ $Date: 2002-03-04 17:13:52 $ $Name: not supported by cvs2svn $";
#endif /* DEBUG */
#ifndef DEVT_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 */

View File

@@ -32,7 +32,7 @@
*/
#ifdef DEBUG
static const char CVS_ID[] = "@(#) $RCSfile: devobject.c,v $ $Revision: 1.18 $ $Date: 2002-02-15 17:37:58 $ $Name: not supported by cvs2svn $";
static const char CVS_ID[] = "@(#) $RCSfile: devobject.c,v $ $Revision: 1.19 $ $Date: 2002-03-04 17:13:52 $ $Name: not supported by cvs2svn $";
#endif /* DEBUG */
#ifndef DEV_H
@@ -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)
{

View File

@@ -32,7 +32,7 @@
*/
#ifdef DEBUG
static const char CVS_ID[] = "@(#) $RCSfile: pki3hack.c,v $ $Revision: 1.37 $ $Date: 2002-03-01 21:43:55 $ $Name: not supported by cvs2svn $";
static const char CVS_ID[] = "@(#) $RCSfile: pki3hack.c,v $ $Revision: 1.38 $ $Date: 2002-03-04 17:13:54 $ $Name: not supported by cvs2svn $";
#endif /* DEBUG */
/*
@@ -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));