summaryrefslogtreecommitdiff
path: root/security/nss/cmd/lib
diff options
context:
space:
mode:
Diffstat (limited to 'security/nss/cmd/lib')
-rw-r--r--security/nss/cmd/lib/pk11table.c28
-rw-r--r--security/nss/cmd/lib/secutil.c22
2 files changed, 24 insertions, 26 deletions
diff --git a/security/nss/cmd/lib/pk11table.c b/security/nss/cmd/lib/pk11table.c
index ec5d889260..f7a45fa84c 100644
--- a/security/nss/cmd/lib/pk11table.c
+++ b/security/nss/cmd/lib/pk11table.c
@@ -102,7 +102,7 @@ const Constant _consts[] = {
mkEntry(CKF_WRAP, MechanismFlags),
mkEntry(CKF_UNWRAP, MechanismFlags),
mkEntry(CKF_DERIVE, MechanismFlags),
- mkEntry(CKF_EC_FP, MechanismFlags),
+ mkEntry(CKF_EC_F_P, MechanismFlags),
mkEntry(CKF_EC_F_2M, MechanismFlags),
mkEntry(CKF_EC_ECPARAMETERS, MechanismFlags),
mkEntry(CKF_EC_NAMEDCURVE, MechanismFlags),
@@ -128,7 +128,6 @@ const Constant _consts[] = {
mkEntry(CKO_SECRET_KEY, Object),
mkEntry(CKO_HW_FEATURE, Object),
mkEntry(CKO_DOMAIN_PARAMETERS, Object),
- mkEntry(CKO_KG_PARAMETERS, Object),
mkEntry(CKO_NSS_CRL, Object),
mkEntry(CKO_NSS_SMIME, Object),
mkEntry(CKO_NSS_TRUST, Object),
@@ -255,8 +254,8 @@ const Constant _consts[] = {
mkEntry2(CKA_TRUST_TIME_STAMPING, Attribute, Trust),
mkEntry2(CKA_CERT_SHA1_HASH, Attribute, None),
mkEntry2(CKA_CERT_MD5_HASH, Attribute, None),
- mkEntry2(CKA_NETSCAPE_DB, Attribute, None),
- mkEntry2(CKA_NETSCAPE_TRUST, Attribute, Trust),
+ mkEntry2(CKA_NSS_DB, Attribute, None),
+ mkEntry2(CKA_NSS_TRUST, Attribute, Trust),
mkEntry(CKM_RSA_PKCS, Mechanism),
mkEntry(CKM_RSA_9796, Mechanism),
@@ -473,16 +472,16 @@ const Constant _consts[] = {
mkEntry(CKM_DH_PKCS_PARAMETER_GEN, Mechanism),
mkEntry(CKM_NSS_AES_KEY_WRAP, Mechanism),
mkEntry(CKM_NSS_AES_KEY_WRAP_PAD, Mechanism),
- mkEntry(CKM_NETSCAPE_PBE_SHA1_DES_CBC, Mechanism),
- mkEntry(CKM_NETSCAPE_PBE_SHA1_TRIPLE_DES_CBC, Mechanism),
- mkEntry(CKM_NETSCAPE_PBE_SHA1_40_BIT_RC2_CBC, Mechanism),
- mkEntry(CKM_NETSCAPE_PBE_SHA1_128_BIT_RC2_CBC, Mechanism),
- mkEntry(CKM_NETSCAPE_PBE_SHA1_40_BIT_RC4, Mechanism),
- mkEntry(CKM_NETSCAPE_PBE_SHA1_128_BIT_RC4, Mechanism),
- mkEntry(CKM_NETSCAPE_PBE_SHA1_FAULTY_3DES_CBC, Mechanism),
- mkEntry(CKM_NETSCAPE_PBE_SHA1_HMAC_KEY_GEN, Mechanism),
- mkEntry(CKM_NETSCAPE_PBE_MD5_HMAC_KEY_GEN, Mechanism),
- mkEntry(CKM_NETSCAPE_PBE_MD2_HMAC_KEY_GEN, Mechanism),
+ mkEntry(CKM_NSS_PBE_SHA1_DES_CBC, Mechanism),
+ mkEntry(CKM_NSS_PBE_SHA1_TRIPLE_DES_CBC, Mechanism),
+ mkEntry(CKM_NSS_PBE_SHA1_40_BIT_RC2_CBC, Mechanism),
+ mkEntry(CKM_NSS_PBE_SHA1_128_BIT_RC2_CBC, Mechanism),
+ mkEntry(CKM_NSS_PBE_SHA1_40_BIT_RC4, Mechanism),
+ mkEntry(CKM_NSS_PBE_SHA1_128_BIT_RC4, Mechanism),
+ mkEntry(CKM_NSS_PBE_SHA1_FAULTY_3DES_CBC, Mechanism),
+ mkEntry(CKM_NSS_PBE_SHA1_HMAC_KEY_GEN, Mechanism),
+ mkEntry(CKM_NSS_PBE_MD5_HMAC_KEY_GEN, Mechanism),
+ mkEntry(CKM_NSS_PBE_MD2_HMAC_KEY_GEN, Mechanism),
mkEntry(CKM_TLS_PRF_GENERAL, Mechanism),
mkEntry(CKM_NSS_TLS_PRF_GENERAL_SHA256, Mechanism),
@@ -520,7 +519,6 @@ const Constant _consts[] = {
mkEntry(CKR_KEY_FUNCTION_NOT_PERMITTED, Result),
mkEntry(CKR_KEY_NOT_WRAPPABLE, Result),
mkEntry(CKR_KEY_UNEXTRACTABLE, Result),
- mkEntry(CKR_KEY_PARAMS_INVALID, Result),
mkEntry(CKR_MECHANISM_INVALID, Result),
mkEntry(CKR_MECHANISM_PARAM_INVALID, Result),
mkEntry(CKR_OBJECT_HANDLE_INVALID, Result),
diff --git a/security/nss/cmd/lib/secutil.c b/security/nss/cmd/lib/secutil.c
index 703845e984..b05dc79383 100644
--- a/security/nss/cmd/lib/secutil.c
+++ b/security/nss/cmd/lib/secutil.c
@@ -494,23 +494,30 @@ SECU_ReadDERFromFile(SECItem *der, PRFileDesc *inFile, PRBool ascii,
if (ascii) {
/* First convert ascii to binary */
SECItem filedata;
- char *asc, *body;
/* Read in ascii data */
rv = SECU_FileToItem(&filedata, inFile);
if (rv != SECSuccess)
return rv;
- asc = (char *)filedata.data;
- if (!asc) {
+ if (!filedata.data) {
fprintf(stderr, "unable to read data from input file\n");
return SECFailure;
}
+ /* need one additional byte for zero terminator */
+ rv = SECITEM_ReallocItemV2(NULL, &filedata, filedata.len + 1);
+ if (rv != SECSuccess) {
+ PORT_Free(filedata.data);
+ return rv;
+ }
+ char *asc = (char *)filedata.data;
+ asc[filedata.len - 1] = '\0';
if (warnOnPrivateKeyInAsciiFile && strstr(asc, "PRIVATE KEY")) {
fprintf(stderr, "Warning: ignoring private key. Consider to use "
"pk12util.\n");
}
+ char *body;
/* check for headers and trailers and remove them */
if ((body = strstr(asc, "-----BEGIN")) != NULL) {
char *trailer = NULL;
@@ -528,14 +535,7 @@ SECU_ReadDERFromFile(SECItem *der, PRFileDesc *inFile, PRBool ascii,
return SECFailure;
}
} else {
- /* need one additional byte for zero terminator */
- rv = SECITEM_ReallocItemV2(NULL, &filedata, filedata.len + 1);
- if (rv != SECSuccess) {
- PORT_Free(filedata.data);
- return rv;
- }
- body = (char *)filedata.data;
- body[filedata.len - 1] = '\0';
+ body = asc;
}
/* Convert to binary */