re-introduce old nss im too tired for this

This commit is contained in:
wuggy 2026-06-30 06:37:32 +01:00
commit 3a838106b9
2871 changed files with 1374431 additions and 1762417 deletions

View file

@ -26,9 +26,11 @@ lg_createCertObject(SDB *sdb, CK_OBJECT_HANDLE *handle,
SECItem derCert;
NSSLOWCERTCertificate *cert;
NSSLOWCERTCertTrust *trust = NULL;
NSSLOWCERTCertTrust userTrust = { CERTDB_USER, CERTDB_USER, CERTDB_USER };
NSSLOWCERTCertTrust defTrust = { CERTDB_TRUSTED_UNKNOWN,
CERTDB_TRUSTED_UNKNOWN, CERTDB_TRUSTED_UNKNOWN };
NSSLOWCERTCertTrust userTrust =
{ CERTDB_USER, CERTDB_USER, CERTDB_USER };
NSSLOWCERTCertTrust defTrust =
{ CERTDB_TRUSTED_UNKNOWN,
CERTDB_TRUSTED_UNKNOWN, CERTDB_TRUSTED_UNKNOWN };
char *label = NULL;
char *email = NULL;
SECStatus rv;
@ -572,8 +574,8 @@ lg_mkPrivKey(SDB *sdb, const CK_ATTRIBUTE *templ, CK_ULONG count,
&privKey->u.dsa.privateValue, sdb);
if (crv != CKR_OK)
break;
if (lg_hasAttribute(CKA_NSS_DB, templ, count)) {
crv = lg_Attribute2SSecItem(arena, CKA_NSS_DB, templ, count,
if (lg_hasAttribute(CKA_NETSCAPE_DB, templ, count)) {
crv = lg_Attribute2SSecItem(arena, CKA_NETSCAPE_DB, templ, count,
&privKey->u.dsa.publicValue);
/* privKey was zero'd so public value is already set to NULL, 0
* if we don't set it explicitly */
@ -594,8 +596,8 @@ lg_mkPrivKey(SDB *sdb, const CK_ATTRIBUTE *templ, CK_ULONG count,
&privKey->u.dh.privateValue, sdb);
if (crv != CKR_OK)
break;
if (lg_hasAttribute(CKA_NSS_DB, templ, count)) {
crv = lg_Attribute2SSecItem(arena, CKA_NSS_DB, templ, count,
if (lg_hasAttribute(CKA_NETSCAPE_DB, templ, count)) {
crv = lg_Attribute2SSecItem(arena, CKA_NETSCAPE_DB, templ, count,
&privKey->u.dh.publicValue);
/* privKey was zero'd so public value is already set to NULL, 0
* if we don't set it explicitly */
@ -621,8 +623,8 @@ lg_mkPrivKey(SDB *sdb, const CK_ATTRIBUTE *templ, CK_ULONG count,
&privKey->u.ec.privateValue, sdb);
if (crv != CKR_OK)
break;
if (lg_hasAttribute(CKA_NSS_DB, templ, count)) {
crv = lg_Attribute2SSecItem(arena, CKA_NSS_DB, templ, count,
if (lg_hasAttribute(CKA_NETSCAPE_DB, templ, count)) {
crv = lg_Attribute2SSecItem(arena, CKA_NETSCAPE_DB, templ, count,
&privKey->u.ec.publicValue);
if (crv != CKR_OK)
break;
@ -670,7 +672,7 @@ lg_createPrivateKeyObject(SDB *sdb, CK_KEY_TYPE key_type,
return crv;
label = lg_getString(CKA_LABEL, templ, count);
crv = lg_Attribute2SSecItem(NULL, CKA_NSS_DB, templ, count, &pubKey);
crv = lg_Attribute2SSecItem(NULL, CKA_NETSCAPE_DB, templ, count, &pubKey);
if (crv != CKR_OK) {
crv = CKR_TEMPLATE_INCOMPLETE;
rv = SECFailure;
@ -958,22 +960,6 @@ lg_createKeyObject(SDB *sdb, CK_OBJECT_CLASS objclass,
return CKR_ATTRIBUTE_VALUE_INVALID;
}
/*
* return the 'next' key handle
*/
CK_RV
lg_GetNewObjectID(SDB *sdb, CK_OBJECT_HANDLE *handle)
{
/* the upper level needs the Object ID early to populate any
* signature attributes. The legacy can't really return a new
* handle without the full object template (chicken and egg issue).
* Fortunately we can just return a bogus handle because the legacy
* database doesn't support meta data and can't store any of the signed
* attributes anyway */
*handle = CK_INVALID_HANDLE;
return CKR_OK;
}
/*
* Parse the template and create an object stored in the DB that reflects.
* the object specified in the database.