зеркало из https://github.com/mozilla/pjs.git
more solaris fixes
This commit is contained in:
Родитель
7fe8a0eecb
Коммит
a1f9c34e10
|
@ -32,7 +32,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static const char CVS_ID[] = "@(#) $RCSfile: ckhelper.c,v $ $Revision: 1.6 $ $Date: 2001-10-11 17:05:08 $ $Name: $";
|
static const char CVS_ID[] = "@(#) $RCSfile: ckhelper.c,v $ $Revision: 1.7 $ $Date: 2001-10-11 18:40:31 $ $Name: $";
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
#ifndef PKIT_H
|
#ifndef PKIT_H
|
||||||
|
@ -60,23 +60,23 @@ static const char CVS_ID[] = "@(#) $RCSfile: ckhelper.c,v $ $Revision: 1.6 $ $Da
|
||||||
#endif /* BASE_H */
|
#endif /* BASE_H */
|
||||||
|
|
||||||
static const CK_BBOOL s_true = CK_TRUE;
|
static const CK_BBOOL s_true = CK_TRUE;
|
||||||
NSS_IMPLEMENT_DATA /* const */ NSSItem
|
NSS_IMPLEMENT_DATA const NSSItem
|
||||||
g_ck_true = { (CK_VOID_PTR)&s_true, sizeof(s_true) };
|
g_ck_true = { (CK_VOID_PTR)&s_true, sizeof(s_true) };
|
||||||
|
|
||||||
static const CK_BBOOL s_false = CK_FALSE;
|
static const CK_BBOOL s_false = CK_FALSE;
|
||||||
NSS_IMPLEMENT_DATA /* const */ NSSItem
|
NSS_IMPLEMENT_DATA const NSSItem
|
||||||
g_ck_false = { (CK_VOID_PTR)&s_false, sizeof(s_false) };
|
g_ck_false = { (CK_VOID_PTR)&s_false, sizeof(s_false) };
|
||||||
|
|
||||||
static const CK_OBJECT_CLASS s_class_cert = CKO_CERTIFICATE;
|
static const CK_OBJECT_CLASS s_class_cert = CKO_CERTIFICATE;
|
||||||
NSS_IMPLEMENT_DATA /* const */ NSSItem
|
NSS_IMPLEMENT_DATA const NSSItem
|
||||||
g_ck_class_cert = { (CK_VOID_PTR)&s_class_cert, sizeof(s_class_cert) };
|
g_ck_class_cert = { (CK_VOID_PTR)&s_class_cert, sizeof(s_class_cert) };
|
||||||
|
|
||||||
static const CK_OBJECT_CLASS s_class_pubkey = CKO_PUBLIC_KEY;
|
static const CK_OBJECT_CLASS s_class_pubkey = CKO_PUBLIC_KEY;
|
||||||
NSS_IMPLEMENT_DATA /* const */ NSSItem
|
NSS_IMPLEMENT_DATA const NSSItem
|
||||||
g_ck_class_pubkey = { (CK_VOID_PTR)&s_class_pubkey, sizeof(s_class_pubkey) };
|
g_ck_class_pubkey = { (CK_VOID_PTR)&s_class_pubkey, sizeof(s_class_pubkey) };
|
||||||
|
|
||||||
static const CK_OBJECT_CLASS s_class_privkey = CKO_PRIVATE_KEY;
|
static const CK_OBJECT_CLASS s_class_privkey = CKO_PRIVATE_KEY;
|
||||||
NSS_IMPLEMENT_DATA /* const */ NSSItem
|
NSS_IMPLEMENT_DATA const NSSItem
|
||||||
g_ck_class_privkey = { (CK_VOID_PTR)&s_class_privkey, sizeof(s_class_privkey) };
|
g_ck_class_privkey = { (CK_VOID_PTR)&s_class_privkey, sizeof(s_class_privkey) };
|
||||||
|
|
||||||
NSS_IMPLEMENT PRStatus
|
NSS_IMPLEMENT PRStatus
|
||||||
|
@ -193,8 +193,10 @@ nssCKObject_IsAttributeTrue
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CK_BBOOL bool;
|
CK_BBOOL bool;
|
||||||
CK_ATTRIBUTE attr = { attribute, (CK_VOID_PTR)&bool, sizeof(bool) };
|
CK_ATTRIBUTE attr = { 0, NULL, 0 };
|
||||||
CK_RV ckrv;
|
CK_RV ckrv;
|
||||||
|
attr.type = attribute;
|
||||||
|
NSS_CK_SET_ATTRIBUTE_VAR(&attr, 0, bool);
|
||||||
nssSession_EnterMonitor(session);
|
nssSession_EnterMonitor(session);
|
||||||
ckrv = CKAPI(slot)->C_GetAttributeValue(session->handle, object, &attr, 1);
|
ckrv = CKAPI(slot)->C_GetAttributeValue(session->handle, object, &attr, 1);
|
||||||
nssSession_ExitMonitor(session);
|
nssSession_ExitMonitor(session);
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#define CKHELPER_H
|
#define CKHELPER_H
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static const char CKHELPER_CVS_ID[] = "@(#) $RCSfile: ckhelper.h,v $ $Revision: 1.6 $ $Date: 2001-10-11 17:05:08 $ $Name: $";
|
static const char CKHELPER_CVS_ID[] = "@(#) $RCSfile: ckhelper.h,v $ $Revision: 1.7 $ $Date: 2001-10-11 18:40:31 $ $Name: $";
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
#ifdef NSS_3_4_CODE
|
#ifdef NSS_3_4_CODE
|
||||||
|
@ -63,13 +63,21 @@ PR_BEGIN_EXTERN_C
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Boolean values */
|
/* Boolean values */
|
||||||
NSS_EXTERN_DATA /* const */ NSSItem g_ck_true;
|
NSS_EXTERN_DATA const NSSItem g_ck_true;
|
||||||
NSS_EXTERN_DATA /* const */ NSSItem g_ck_false;
|
NSS_EXTERN_DATA const NSSItem g_ck_false;
|
||||||
|
|
||||||
/* Object classes */
|
/* Object classes */
|
||||||
NSS_EXTERN_DATA /* const */ NSSItem g_ck_class_cert;
|
NSS_EXTERN_DATA const NSSItem g_ck_class_cert;
|
||||||
NSS_EXTERN_DATA /* const */ NSSItem g_ck_class_pubkey;
|
NSS_EXTERN_DATA const NSSItem g_ck_class_pubkey;
|
||||||
NSS_EXTERN_DATA /* const */ NSSItem g_ck_class_privkey;
|
NSS_EXTERN_DATA const NSSItem g_ck_class_privkey;
|
||||||
|
|
||||||
|
#define NSS_CK_SET_ATTRIBUTE_VAR(cktemplate, index, var) \
|
||||||
|
(cktemplate)[index].pValue = (CK_VOID_PTR)&var; \
|
||||||
|
(cktemplate)[index].ulValueLen = (CK_ULONG)sizeof(var)
|
||||||
|
|
||||||
|
#define NSS_CK_SET_ATTRIBUTE_ITEM(cktemplate, index, item) \
|
||||||
|
(cktemplate)[index].pValue = (CK_VOID_PTR)(item)->data; \
|
||||||
|
(cktemplate)[index].ulValueLen = (CK_ULONG)(item)->size;
|
||||||
|
|
||||||
/* NSS_CK_ATTRIBUTE_TO_ITEM(attrib, item)
|
/* NSS_CK_ATTRIBUTE_TO_ITEM(attrib, item)
|
||||||
*
|
*
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static const char CVS_ID[] = "@(#) $RCSfile: token.c,v $ $Revision: 1.8 $ $Date: 2001-10-11 16:33:38 $ $Name: $";
|
static const char CVS_ID[] = "@(#) $RCSfile: token.c,v $ $Revision: 1.9 $ $Date: 2001-10-11 18:40:31 $ $Name: $";
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
#ifndef DEV_H
|
#ifndef DEV_H
|
||||||
|
@ -451,9 +451,10 @@ nssToken_TraverseCertificates
|
||||||
PRStatus nssrv;
|
PRStatus nssrv;
|
||||||
/* this is really traversal - the template is all certs */
|
/* this is really traversal - the template is all certs */
|
||||||
CK_ATTRIBUTE cert_template[] = {
|
CK_ATTRIBUTE cert_template[] = {
|
||||||
{ CKA_CLASS, g_ck_class_cert.data, g_ck_class_cert.size }
|
{ CKA_CLASS, NULL, 0 }
|
||||||
};
|
};
|
||||||
CK_ULONG ctsize = sizeof(cert_template) / sizeof(cert_template[0]);
|
CK_ULONG ctsize = sizeof(cert_template) / sizeof(cert_template[0]);
|
||||||
|
NSS_CK_SET_ATTRIBUTE_ITEM(cert_template, 0, &g_ck_class_cert);
|
||||||
nssrv = nssToken_FindCertificatesByTemplate(tok, sessionOpt,
|
nssrv = nssToken_FindCertificatesByTemplate(tok, sessionOpt,
|
||||||
cert_template, ctsize,
|
cert_template, ctsize,
|
||||||
callback, arg);
|
callback, arg);
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static const char CVS_ID[] = "@(#) $RCSfile: certificate.c,v $ $Revision: 1.5 $ $Date: 2001-10-11 16:34:44 $ $Name: $";
|
static const char CVS_ID[] = "@(#) $RCSfile: certificate.c,v $ $Revision: 1.6 $ $Date: 2001-10-11 18:40:33 $ $Name: $";
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
#ifndef NSSPKI_H
|
#ifndef NSSPKI_H
|
||||||
|
@ -69,7 +69,9 @@ static const char CVS_ID[] = "@(#) $RCSfile: certificate.c,v $ $Revision: 1.5 $
|
||||||
/* Hm, sadly, I'm using PK11_HashBuf... Need to get crypto context going to
|
/* Hm, sadly, I'm using PK11_HashBuf... Need to get crypto context going to
|
||||||
* get rid of that
|
* get rid of that
|
||||||
*/
|
*/
|
||||||
|
#ifndef NSS_3_4_CODE
|
||||||
#define NSS_3_4_CODE
|
#define NSS_3_4_CODE
|
||||||
|
#endif /* NSS_3_4_CODE */
|
||||||
#include "pk11func.h"
|
#include "pk11func.h"
|
||||||
#include "hasht.h"
|
#include "hasht.h"
|
||||||
|
|
||||||
|
@ -150,7 +152,6 @@ nss_cert_type_from_ck_attrib(CK_ATTRIBUTE_PTR attrib)
|
||||||
default:
|
default:
|
||||||
return NSSCertificateType_Unknown;
|
return NSSCertificateType_Unknown;
|
||||||
}
|
}
|
||||||
return NSSCertificateType_Unknown;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PRStatus
|
static PRStatus
|
||||||
|
@ -166,17 +167,18 @@ nssCertificate_SetCertTrust
|
||||||
CK_OBJECT_CLASS tobjc = CKO_NETSCAPE_TRUST;
|
CK_OBJECT_CLASS tobjc = CKO_NETSCAPE_TRUST;
|
||||||
CK_OBJECT_HANDLE tobjID;
|
CK_OBJECT_HANDLE tobjID;
|
||||||
CK_ATTRIBUTE tobj_template[] = {
|
CK_ATTRIBUTE tobj_template[] = {
|
||||||
{ CKA_CLASS, &tobjc, sizeof(CK_OBJECT_CLASS) },
|
{ CKA_CLASS, NULL, 0 },
|
||||||
{ CKA_CERT_SHA1_HASH, NULL, 0 }
|
{ CKA_CERT_SHA1_HASH, NULL, 0 }
|
||||||
};
|
};
|
||||||
CK_ATTRIBUTE trust_template[] = {
|
CK_ATTRIBUTE trust_template[] = {
|
||||||
{ CKA_TRUST_SERVER_AUTH, &saTrust, sizeof(CK_TRUST) },
|
{ CKA_TRUST_SERVER_AUTH, NULL, 0 },
|
||||||
{ CKA_TRUST_EMAIL_PROTECTION, &epTrust, sizeof(CK_TRUST) },
|
{ CKA_TRUST_EMAIL_PROTECTION, NULL, 0 },
|
||||||
{ CKA_TRUST_CODE_SIGNING, &csTrust, sizeof(CK_TRUST) }
|
{ CKA_TRUST_CODE_SIGNING, NULL, 0 }
|
||||||
};
|
};
|
||||||
unsigned char sha1_hash[SHA1_LENGTH];
|
unsigned char sha1_hash[SHA1_LENGTH];
|
||||||
tobj_size = sizeof(tobj_template) / sizeof(tobj_template[0]);
|
tobj_size = sizeof(tobj_template) / sizeof(tobj_template[0]);
|
||||||
trust_size = sizeof(trust_template) / sizeof(trust_template[0]);
|
trust_size = sizeof(trust_template) / sizeof(trust_template[0]);
|
||||||
|
NSS_CK_SET_ATTRIBUTE_VAR(tobj_template, 0, tobjc);
|
||||||
/* First, use the SHA-1 hash of the cert to locate the trust object */
|
/* First, use the SHA-1 hash of the cert to locate the trust object */
|
||||||
/* XXX get rid of this PK11_ call! */
|
/* XXX get rid of this PK11_ call! */
|
||||||
PK11_HashBuf(SEC_OID_SHA1, sha1_hash, c->encoding.data, c->encoding.size);
|
PK11_HashBuf(SEC_OID_SHA1, sha1_hash, c->encoding.data, c->encoding.size);
|
||||||
|
@ -188,6 +190,9 @@ nssCertificate_SetCertTrust
|
||||||
return PR_FAILURE;
|
return PR_FAILURE;
|
||||||
}
|
}
|
||||||
/* Then use the trust object to find the trust settings */
|
/* Then use the trust object to find the trust settings */
|
||||||
|
NSS_CK_SET_ATTRIBUTE_VAR(trust_template, 0, saTrust);
|
||||||
|
NSS_CK_SET_ATTRIBUTE_VAR(trust_template, 1, epTrust);
|
||||||
|
NSS_CK_SET_ATTRIBUTE_VAR(trust_template, 2, csTrust);
|
||||||
nssrv = nssCKObject_GetAttributes(tobjID,
|
nssrv = nssCKObject_GetAttributes(tobjID,
|
||||||
trust_template, trust_size,
|
trust_template, trust_size,
|
||||||
NULL, session, c->slot);
|
NULL, session, c->slot);
|
||||||
|
@ -563,11 +568,12 @@ NSSCertificate_GetPublicKey
|
||||||
{
|
{
|
||||||
PRStatus nssrv;
|
PRStatus nssrv;
|
||||||
CK_ATTRIBUTE pubktemplate[] = {
|
CK_ATTRIBUTE pubktemplate[] = {
|
||||||
{ CKA_CLASS, g_ck_class_pubkey.data, g_ck_class_pubkey.size },
|
{ CKA_CLASS, NULL, 0 },
|
||||||
{ CKA_ID, NULL, 0 },
|
{ CKA_ID, NULL, 0 },
|
||||||
{ CKA_SUBJECT, NULL, 0 }
|
{ CKA_SUBJECT, NULL, 0 }
|
||||||
};
|
};
|
||||||
CK_ULONG count = sizeof(pubktemplate) / sizeof(pubktemplate[0]);
|
CK_ULONG count = sizeof(pubktemplate) / sizeof(pubktemplate[0]);
|
||||||
|
NSS_CK_SET_ATTRIBUTE_ITEM(pubktemplate, 0, &g_ck_class_pubkey);
|
||||||
if (c->id.size > 0) {
|
if (c->id.size > 0) {
|
||||||
/* CKA_ID */
|
/* CKA_ID */
|
||||||
NSS_CK_ITEM_TO_ATTRIBUTE(&c->id, &pubktemplate[1]);
|
NSS_CK_ITEM_TO_ATTRIBUTE(&c->id, &pubktemplate[1]);
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static const char CVS_ID[] = "@(#) $RCSfile: tdcache.c,v $ $Revision: 1.2 $ $Date: 2001-10-11 17:41:44 $ $Name: $";
|
static const char CVS_ID[] = "@(#) $RCSfile: tdcache.c,v $ $Revision: 1.3 $ $Date: 2001-10-11 18:40:34 $ $Name: $";
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
#ifndef PKIT_H
|
#ifndef PKIT_H
|
||||||
|
@ -279,7 +279,9 @@ nssTrustDomain_RemoveCertFromCache
|
||||||
nssList *subjects;
|
nssList *subjects;
|
||||||
NSSItem *ias;
|
NSSItem *ias;
|
||||||
unsigned char buf[128];
|
unsigned char buf[128];
|
||||||
NSSItem s_ias = { (void *)buf, sizeof(buf) };
|
NSSItem s_ias;
|
||||||
|
s_ias.data = (void *)buf;
|
||||||
|
s_ias.size = sizeof(buf);
|
||||||
ias = get_static_ias(&s_ias, &cert->issuer, &cert->serial);
|
ias = get_static_ias(&s_ias, &cert->issuer, &cert->serial);
|
||||||
PZ_Lock(td->cache->lock);
|
PZ_Lock(td->cache->lock);
|
||||||
if (nssHash_Exists(td->cache->issuerAndSN, &ias)) {
|
if (nssHash_Exists(td->cache->issuerAndSN, &ias)) {
|
||||||
|
@ -504,7 +506,9 @@ nssTrustDomain_GetCertForIssuerAndSNFromCache
|
||||||
NSSCertificate *rvCert;
|
NSSCertificate *rvCert;
|
||||||
NSSItem *ias;
|
NSSItem *ias;
|
||||||
unsigned char buf[128];
|
unsigned char buf[128];
|
||||||
NSSItem s_ias = { (void *)buf, sizeof(buf) };
|
NSSItem s_ias;
|
||||||
|
s_ias.data = (void *)buf;
|
||||||
|
s_ias.size = sizeof(buf);
|
||||||
ias = get_static_ias(&s_ias, issuer, serial);
|
ias = get_static_ias(&s_ias, issuer, serial);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug_cache(td);
|
debug_cache(td);
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static const char CVS_ID[] = "@(#) $RCSfile: trustdomain.c,v $ $Revision: 1.6 $ $Date: 2001-10-11 16:34:49 $ $Name: $";
|
static const char CVS_ID[] = "@(#) $RCSfile: trustdomain.c,v $ $Revision: 1.7 $ $Date: 2001-10-11 18:40:34 $ $Name: $";
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
#ifndef NSSPKI_H
|
#ifndef NSSPKI_H
|
||||||
|
@ -373,12 +373,13 @@ NSSTrustDomain_FindBestCertificateByNickname
|
||||||
NSSToken *tok;
|
NSSToken *tok;
|
||||||
CK_ATTRIBUTE cert_template[] =
|
CK_ATTRIBUTE cert_template[] =
|
||||||
{
|
{
|
||||||
{ CKA_CLASS, g_ck_class_cert.data, g_ck_class_cert.size },
|
{ CKA_CLASS, NULL, 0 },
|
||||||
{ CKA_LABEL, NULL, 0 }
|
{ CKA_LABEL, NULL, 0 }
|
||||||
};
|
};
|
||||||
struct get_best_cert_arg_str best;
|
struct get_best_cert_arg_str best;
|
||||||
CK_ULONG ctsize;
|
CK_ULONG ctsize;
|
||||||
ctsize = (CK_ULONG)(sizeof(cert_template) / sizeof(cert_template[0]));
|
ctsize = (CK_ULONG)(sizeof(cert_template) / sizeof(cert_template[0]));
|
||||||
|
NSS_CK_SET_ATTRIBUTE_ITEM(cert_template, 0, &g_ck_class_cert);
|
||||||
cert_template[1].pValue = (CK_VOID_PTR)name;
|
cert_template[1].pValue = (CK_VOID_PTR)name;
|
||||||
cert_template[1].ulValueLen = (CK_ULONG)nssUTF8_Length(name, &nssrv);
|
cert_template[1].ulValueLen = (CK_ULONG)nssUTF8_Length(name, &nssrv);
|
||||||
best.td = td;
|
best.td = td;
|
||||||
|
@ -448,12 +449,13 @@ NSSTrustDomain_FindCertificatesByNickname
|
||||||
nssList *foundCerts;
|
nssList *foundCerts;
|
||||||
CK_ATTRIBUTE cert_template[] =
|
CK_ATTRIBUTE cert_template[] =
|
||||||
{
|
{
|
||||||
{ CKA_CLASS, g_ck_class_cert.data, g_ck_class_cert.size },
|
{ CKA_CLASS, NULL, 0 },
|
||||||
{ CKA_LABEL, NULL, 0 }
|
{ CKA_LABEL, NULL, 0 }
|
||||||
};
|
};
|
||||||
struct collect_arg_str ca;
|
struct collect_arg_str ca;
|
||||||
CK_ULONG ctsize;
|
CK_ULONG ctsize;
|
||||||
ctsize = (CK_ULONG)(sizeof(cert_template) / sizeof(cert_template[0]));
|
ctsize = (CK_ULONG)(sizeof(cert_template) / sizeof(cert_template[0]));
|
||||||
|
NSS_CK_SET_ATTRIBUTE_ITEM(cert_template, 0, &g_ck_class_cert);
|
||||||
cert_template[1].pValue = (CK_VOID_PTR)name;
|
cert_template[1].pValue = (CK_VOID_PTR)name;
|
||||||
cert_template[1].ulValueLen = (CK_ULONG)nssUTF8_Length(name, &nssrv);
|
cert_template[1].ulValueLen = (CK_ULONG)nssUTF8_Length(name, &nssrv);
|
||||||
foundCerts = nssList_Create(NULL, PR_FALSE);
|
foundCerts = nssList_Create(NULL, PR_FALSE);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче