Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37401293
en ru br
ALT Linux repos
S:5.4.2-alt1
5.0: 4.2.5-alt1
4.1: 4.2.5-alt1

Group :: System/Libraries
RPM: jss

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: jss-HSM-manufacturerID.patch
Download


diff -up jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyPairGenerator.c.cfu jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyPairGenerator.c
--- jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyPairGenerator.c.cfu	2011-11-10 17:18:02.706421000 -0800
+++ jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyPairGenerator.c	2011-11-10 17:18:23.370442000 -0800
@@ -195,7 +195,8 @@ JSS_PK11_generateKeyPairWithOpFlags(JNIE
             }
             PR_GetErrorText(errBuf);
         }
-        msgBuf = PR_smprintf("Keypair Generation failed on token: %s",
+        msgBuf = PR_smprintf("Keypair Generation failed on token with error: %d : %s",
+            PR_GetError(),
             errLength>0? errBuf : "");
         if(errLength>0) {
             PR_Free(errBuf);
diff -up jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyWrapper.c.cfu jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyWrapper.c
--- jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyWrapper.c.cfu	2011-11-10 17:18:10.767429000 -0800
+++ jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyWrapper.c	2011-11-10 17:52:34.703491000 -0800
@@ -334,32 +334,36 @@ Java_org_mozilla_jss_pkcs11_PK11KeyWrapp
     PRBool isExtractable = PR_FALSE;
 
     /* special case nethsm and lunasa*/
-    CK_UTF8CHAR nethsmLabel[4] = {'N','H','S','M'};
-    CK_UTF8CHAR lunasaLabel[4] = {'l','u','n','a'};
+    const int numManufacturerIDchars = 7;
+    CK_UTF8CHAR nethsmManufacturerID[] = {'n','C','i','p','h','e','r'};
+    CK_UTF8CHAR lunasaManufacturerID[] = {'S','a','f','e','n','e','t'};
     PRBool isNethsm = PR_TRUE;
     PRBool isLunasa = PR_TRUE;
 
+    tokenInfo.manufacturerID[0] = 0;
+
     if( JSS_PK11_getTokenSlotPtr(env, tokenObj, &slot) != PR_SUCCESS) {
         /* exception was thrown */
         goto finish;
     }
 
-    if ( PK11_GetTokenInfo(slot, &tokenInfo) == PR_SUCCESS) {
+    if ( (PK11_GetTokenInfo(slot, &tokenInfo) == PR_SUCCESS) &&
+       (tokenInfo.manufacturerID[0] != 0)) {
         int ix = 0;
-        for(ix=0; ix < 4; ix++) {
-            if (tokenInfo.label[ix] != nethsmLabel[ix]) {
+
+        for(ix=0; ix < numManufacturerIDchars; ix++) {
+            if (tokenInfo.manufacturerID[ix] != nethsmManufacturerID[ix]) {
                isNethsm = PR_FALSE;
                break;
             }
         }
-        ix = 0;
-        for(ix=0; ix < 4; ix++) {
-            if (tokenInfo.label[ix] != lunasaLabel[ix]) {
+
+        for(ix=0; ix < numManufacturerIDchars; ix++) {
+            if (tokenInfo.manufacturerID[ix] != lunasaManufacturerID[ix]) {
                isLunasa = PR_FALSE;
                break;
             }
         }
-
     } else {
         isNethsm = PR_FALSE;
         isLunasa = PR_FALSE;
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin