зеркало из https://github.com/mozilla/gecko-dev.git
close hole in trust lookups.
This commit is contained in:
Родитель
675de20876
Коммит
24adc2754c
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: ckhelper.c,v $ $Revision: 1.24 $ $Date: 2002/08/09 18:05:24 $ $Name: $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: ckhelper.c,v $ $Revision: 1.25 $ $Date: 2002/08/27 23:37:55 $ $Name: $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef NSSCKEPV_H
|
||||
|
@ -552,6 +552,7 @@ nssCryptokiTrust_GetAttributes
|
|||
(
|
||||
nssCryptokiObject *trustObject,
|
||||
nssSession *sessionOpt,
|
||||
NSSItem *sha1_hash,
|
||||
nssTrustLevel *serverAuth,
|
||||
nssTrustLevel *clientAuth,
|
||||
nssTrustLevel *codeSigning,
|
||||
|
@ -564,7 +565,7 @@ nssCryptokiTrust_GetAttributes
|
|||
CK_BBOOL isToken;
|
||||
CK_TRUST saTrust, caTrust, epTrust, csTrust;
|
||||
CK_ATTRIBUTE_PTR attr;
|
||||
CK_ATTRIBUTE trust_template[5];
|
||||
CK_ATTRIBUTE trust_template[6];
|
||||
CK_ULONG trust_size;
|
||||
|
||||
/* Use the trust object to find the trust settings */
|
||||
|
@ -574,6 +575,7 @@ nssCryptokiTrust_GetAttributes
|
|||
NSS_CK_SET_ATTRIBUTE_VAR(attr, CKA_TRUST_CLIENT_AUTH, caTrust);
|
||||
NSS_CK_SET_ATTRIBUTE_VAR(attr, CKA_TRUST_EMAIL_PROTECTION, epTrust);
|
||||
NSS_CK_SET_ATTRIBUTE_VAR(attr, CKA_TRUST_CODE_SIGNING, csTrust);
|
||||
NSS_CK_SET_ATTRIBUTE_ITEM(attr, CKA_CERT_SHA1_HASH, sha1_hash);
|
||||
NSS_CK_TEMPLATE_FINISH(trust_template, attr, trust_size);
|
||||
|
||||
status = nssToken_GetCachedObjectAttributes(trustObject->token, NULL,
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char DEV_CVS_ID[] = "@(#) $RCSfile: dev.h,v $ $Revision: 1.29 $ $Date: 2002/06/24 22:36:53 $ $Name: $";
|
||||
static const char DEV_CVS_ID[] = "@(#) $RCSfile: dev.h,v $ $Revision: 1.30 $ $Date: 2002/08/27 23:37:56 $ $Name: $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef NSSCKT_H
|
||||
|
@ -741,6 +741,7 @@ nssCryptokiTrust_GetAttributes
|
|||
(
|
||||
nssCryptokiObject *trustObject,
|
||||
nssSession *sessionOpt,
|
||||
NSSItem *sha1_hash,
|
||||
nssTrustLevel *serverAuth,
|
||||
nssTrustLevel *clientAuth,
|
||||
nssTrustLevel *codeSigning,
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: certificate.c,v $ $Revision: 1.38 $ $Date: 2002/08/01 01:21:27 $ $Name: $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: certificate.c,v $ $Revision: 1.39 $ $Date: 2002/08/27 23:38:29 $ $Name: $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef NSSPKI_H
|
||||
|
@ -53,6 +53,8 @@ static const char CVS_ID[] = "@(#) $RCSfile: certificate.c,v $ $Revision: 1.38 $
|
|||
|
||||
#ifdef NSS_3_4_CODE
|
||||
#include "pki3hack.h"
|
||||
#include "pk11func.h"
|
||||
#include "hasht.h"
|
||||
#endif
|
||||
|
||||
#ifndef BASE_H
|
||||
|
@ -950,15 +952,20 @@ nssCertificateList_AddReferences
|
|||
NSS_IMPLEMENT NSSTrust *
|
||||
nssTrust_Create
|
||||
(
|
||||
nssPKIObject *object
|
||||
nssPKIObject *object,
|
||||
NSSItem *certData
|
||||
)
|
||||
{
|
||||
PRStatus status;
|
||||
PRUint32 i;
|
||||
PRUint32 lastTrustOrder, myTrustOrder;
|
||||
unsigned char sha1_hashcmp[SHA1_LENGTH];
|
||||
unsigned char sha1_hashin[SHA1_LENGTH];
|
||||
NSSItem sha1_hash;
|
||||
NSSTrust *rvt;
|
||||
nssCryptokiObject *instance;
|
||||
nssTrustLevel serverAuth, clientAuth, codeSigning, emailProtection;
|
||||
SECStatus rv; /* Should be stan flavor */
|
||||
lastTrustOrder = 1<<16; /* just make it big */
|
||||
PR_ASSERT(object->instances != NULL && object->numInstances > 0);
|
||||
rvt = nss_ZNEW(object->arena, NSSTrust);
|
||||
|
@ -966,12 +973,21 @@ nssTrust_Create
|
|||
return (NSSTrust *)NULL;
|
||||
}
|
||||
rvt->object = *object;
|
||||
|
||||
/* should be stan flavor of Hashbuf */
|
||||
rv = PK11_HashBuf(SEC_OID_SHA1,sha1_hashcmp,certData->data,certData->size);
|
||||
if (rv != SECSuccess) {
|
||||
return (NSSTrust *)NULL;
|
||||
}
|
||||
sha1_hash.data = sha1_hashin;
|
||||
sha1_hash.size = sizeof (sha1_hashin);
|
||||
/* trust has to peek into the base object members */
|
||||
PZ_Lock(object->lock);
|
||||
for (i=0; i<object->numInstances; i++) {
|
||||
instance = object->instances[i];
|
||||
myTrustOrder = nssToken_GetTrustOrder(instance->token);
|
||||
status = nssCryptokiTrust_GetAttributes(instance, NULL,
|
||||
&sha1_hash,
|
||||
&serverAuth,
|
||||
&clientAuth,
|
||||
&codeSigning,
|
||||
|
@ -980,6 +996,10 @@ nssTrust_Create
|
|||
PZ_Unlock(object->lock);
|
||||
return (NSSTrust *)NULL;
|
||||
}
|
||||
if (PORT_Memcmp(sha1_hashin,sha1_hashcmp,SHA1_LENGTH) != 0) {
|
||||
PZ_Unlock(object->lock);
|
||||
return (NSSTrust *)NULL;
|
||||
}
|
||||
if (rvt->serverAuth == nssTrustLevel_Unknown ||
|
||||
myTrustOrder < lastTrustOrder)
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#define PKIM_H
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char PKIM_CVS_ID[] = "@(#) $RCSfile: pkim.h,v $ $Revision: 1.20 $ $Date: 2002/04/26 14:34:04 $ $Name: $";
|
||||
static const char PKIM_CVS_ID[] = "@(#) $RCSfile: pkim.h,v $ $Revision: 1.21 $ $Date: 2002/08/27 23:38:29 $ $Name: $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef BASE_H
|
||||
|
@ -247,7 +247,8 @@ nssDecodedCert_Destroy
|
|||
NSS_EXTERN NSSTrust *
|
||||
nssTrust_Create
|
||||
(
|
||||
nssPKIObject *object
|
||||
nssPKIObject *object,
|
||||
NSSCertificate *nssCert
|
||||
);
|
||||
|
||||
NSS_EXTERN NSSCRL *
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: trustdomain.c,v $ $Revision: 1.42 $ $Date: 2002/04/26 14:34:05 $ $Name: $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: trustdomain.c,v $ $Revision: 1.43 $ $Date: 2002/08/27 23:38:29 $ $Name: $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef DEV_H
|
||||
|
@ -1261,7 +1261,7 @@ nssTrustDomain_FindTrustForCertificate
|
|||
}
|
||||
}
|
||||
if (pkio) {
|
||||
rvt = nssTrust_Create(pkio);
|
||||
rvt = nssTrust_Create(pkio, &c->encoding);
|
||||
if (!rvt) {
|
||||
goto loser;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче