[Pcsclite-cvs-commit] r364 - trunk/muscleTool

Karsten Ohme ohme-guest at costa.debian.org
Tue Jan 3 08:01:01 UTC 2006


Author: ohme-guest
Date: 2006-01-03 08:01:00 +0000 (Tue, 03 Jan 2006)
New Revision: 364

Modified:
   trunk/muscleTool/muscleTool.c
Log:
Compilation errors fixed because of missing #ifdef VERSION2 for compatibility

Modified: trunk/muscleTool/muscleTool.c
===================================================================
--- trunk/muscleTool/muscleTool.c	2006-01-02 18:33:35 UTC (rev 363)
+++ trunk/muscleTool/muscleTool.c	2006-01-03 08:01:00 UTC (rev 364)
@@ -80,12 +80,12 @@
 	shortArray[3] = getUShort16(byteArray+6);
 }
 
-static MSCUShort16 getUShort16(MSCPUChar8 srcValue)
+static MSCUShort16 getUShort16(MSCPUChar8 srcValue) 
 {
 	return (MSCUShort16)( ((srcValue[0]) << 8) | srcValue[1] );
 }
 
-static MSCULong32 getULong32(MSCPUChar8 srcValue)
+static MSCULong32 getULong32(MSCPUChar8 srcValue) 
 {
 	MSCULong32 temp;
 	temp  = srcValue[0] * 0x1000000;
@@ -235,7 +235,7 @@
 }
 
 /**
-* Pads data at the beginning with 0x01 and continues 0x00s so.
+* Pads data at the beginning with 0x01 and continues 0x00s so. 
 * If inSize == outSize the first byte is now allowed to be larger than
 * 0x80.
 * So the RSA modulus is smaller and the exponentiation exceeds modulus.
@@ -878,6 +878,7 @@
 	if (aut & MSC_AUT_PIN_4)
 		printf("%16s\n", "PIN #4");
 
+#ifdef VERSION2
 	if (aut & MSC_AUT_PIN_5)
 		printf("%16s\n", "PIN #5");
 
@@ -886,6 +887,7 @@
 
 	if (aut & MSC_AUT_PIN_7)
 		printf("%16s\n", "PIN #7");
+#endif
 
 	if (aut & MSC_AUT_KEY_0)
 		printf("%16s\n", "KEY #0");
@@ -982,6 +984,7 @@
 	if (aut & MSC_AUT_PIN_4)
 		printf("PIN #4 ");
 
+#ifdef VERSION2
 	if (aut & MSC_AUT_PIN_5)
 		printf("PIN #5 ");
 
@@ -990,6 +993,7 @@
 
 	if (aut & MSC_AUT_PIN_7)
 		printf("PIN #7 ");
+#endif
 
 	if (aut & MSC_AUT_KEY_0)
 		printf("KEY #0 ");
@@ -1113,9 +1117,9 @@
     rv = MSCGetStatus(pConnection, &pStatusStruct);
     CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
 
-    printf(" Protocol Version: %d.%d\n", (pStatusStruct.appVersion>>8) & 0xFF,
+    printf(" Protocol Version: %d.%d\n", (pStatusStruct.appVersion>>8) & 0xFF, 
             (pStatusStruct.appVersion & 0x00FF));
-    printf(" Software Version: %d.%d\n", (pStatusStruct.swVersion>>8) & 0xFF,
+    printf(" Software Version: %d.%d\n", (pStatusStruct.swVersion>>8) & 0xFF, 
             (pStatusStruct.swVersion & 0x00FF));
     printf("      Free Memory: %ld\n", pStatusStruct.freeMemory);
     printf("     Total Memory: %ld\n", pStatusStruct.totalMemory);
@@ -1881,7 +1885,7 @@
 			retLength = 8;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_PIN_AUTH,
 				temp, &retLength);
-
+			
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_PIN_AUTH");
 			usValue = getUShort16(temp);
 			doPrintAUT(usValue);
@@ -1916,7 +1920,7 @@
 			retLength = 8;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_OBJ_AUTH,
 				temp, &retLength);
-
+			
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_OBJ_AUTH");
 			usValue = getUShort16(temp);
 			doPrintAUT(usValue);
@@ -2286,9 +2290,9 @@
                 rv = getStringValue(dummyString, "Enter PIN", (char *)newPinData, 17);
 		if (rv == 0)
 			goto abort;
-
+		
                 newPinSize = strlen((char *)newPinData);
-
+		
 		rv = MSCChangePIN(pConnection, (MSCUChar8) pinNumber,
 			(MSCUChar8 *) pinData, (MSCUChar8)pinSize, (MSCUChar8 *) newPinData, (MSCUChar8)newPinSize);
 	}
@@ -2361,7 +2365,11 @@
 
 	CHECK_ERR(pConnection == 0, "Must Connect First !");
 
+#ifdef VERSION2
 	rv = MSCDeleteObject(pConnection, objectID);
+#else
+	rv = MSCDeleteObject(pConnection, objectID, MSC_ZF_WRITE_ZERO);
+#endif
 	CHECK_ERR(rv != MSC_SUCCESS, "DeleteObject Failed !");
 	printf("DeleteObject Successful\n");
 end:
@@ -2695,7 +2703,7 @@
 		case MSC_KEY_3DES:
 		case MSC_KEY_3DES3:
 		case MSC_KEY_DES:
-#ifdef VERSION2
+#ifdef VERSION2	
         case MSC_KEY_AES:
 #endif
 #ifdef VERSION2
@@ -2728,7 +2736,7 @@
 			}
 #endif
 			break;
-#ifdef VERSION2
+#ifdef VERSION2	
 		case MSC_KEY_EC_F2M_PRIVATE:
 		case MSC_KEY_EC_FP_PRIVATE:
 #endif
@@ -2741,7 +2749,7 @@
 				default: goto abort;
 			}
 			break;
-#ifdef VERSION2
+#ifdef VERSION2	
 		case MSC_KEY_EC_F2M_PUBLIC:
 		case MSC_KEY_EC_FP_PUBLIC:
 #endif
@@ -3104,7 +3112,7 @@
 					}
 					break;
 #endif
-#ifdef VERSION2
+#ifdef VERSION2	
 				case MSC_KEY_EC_F2M_PRIVATE:
 				case MSC_KEY_EC_FP_PRIVATE:
 				case MSC_KEY_EC_FP_PUBLIC:
@@ -3392,7 +3400,7 @@
 	CHECK_ERR(pConnection == 0, "Must Connect First !");
 
 	printf("\n");
-
+	
 	keySize = sizeof(keyData);
 
 	rv = MSCExportKey(pConnection, (MSCUChar8) keyNumber,
@@ -3423,6 +3431,9 @@
 	MSCKeyACL keyACL;
 	MSCKeyPolicy keyPolicy;
 	MSCPUChar8 objectData;
+#ifdef VERSION2
+	unsigned long keyPartner;
+#endif
 	unsigned long readACL, writeACL, useACL;
 	MSCULong32 dataSize;
 	struct stat fileStat;
@@ -3481,8 +3492,12 @@
 	keyACL.writePermission = (MSCUShort16)writeACL;
 	keyACL.usePermission = (MSCUShort16)useACL;
 #ifdef VERSION2
+	rv = getNumberValue("Enter the key partner number", "Enter key number", &keyPartner);
+	if (rv == 0)
+		goto abort;
+
 	rv = MSCImportKey(pConnection, (MSCUChar8) keyNumber,
-		&keyACL, objectData, dataSize, &keyPolicy, 0, 0, 0);
+		&keyACL, objectData, dataSize, &keyPolicy, 0, (MSCUChar8) keyPartner, NULL, 0);
 #else
 	rv = MSCImportKey(pConnection, (MSCUChar8) keyNumber,
                           &keyACL, objectData, dataSize, &keyPolicy, 0, 0);
@@ -3605,16 +3620,16 @@
 #else
 		rv = getNumberValue("Enter the ACL for using the public key\nExample: 0x0000 for all users", "Enter ACL mask", &pubUseACL);
 #endif
-
+			
 		if (rv == 0)
 			goto abort;
 
 #ifdef VERSION2
-		rv = getNumberValue("Enter the ACL for reading the private key\nExample: 0x0000 for nobody", "Enter ACL mask", &prvReadACL);
+		rv = getNumberValue("Enter the ACL for reading the private key\nExample: 0x0000 for nobody", "Enter ACL mask", &prvReadACL);			
 #else
 		rv = getNumberValue("Enter the ACL for reading the private key\nExample: 0xFFFF for nobody", "Enter ACL mask", &prvReadACL);
 #endif
-
+			
 		if (rv == 0)
 			goto abort;
 
@@ -3632,11 +3647,11 @@
 			goto abort;
 
 #ifdef VERSION2
-		rv = getNumberValue("Enter the ACL for reading the secret key\nExample: 0x0000 for nobody", "Enter ACL mask", (unsigned long *)&pubReadACL);
+		rv = getNumberValue("Enter the ACL for reading the secret key\nExample: 0x0000 for nobody", "Enter ACL mask", (unsigned long *)&pubReadACL);			
 #else
 		rv = getNumberValue("Enter the ACL for reading the secret key\nExample: 0xFFFF for nobody", "Enter ACL mask", (unsigned long *)&pubReadACL);
 #endif
-
+			
 		if (rv == 0)
 			goto abort;
 
@@ -3982,7 +3997,7 @@
 				MSC_TOKENLABEL_SIZE+1
 			);
 		}
-
+		
 		if (rv == 0){
 			goto abort;
 		}
@@ -4002,7 +4017,7 @@
 				MSC_SERIALNUMBER_SIZE+1
 			);
 		}
-
+		
 		if (rv == 0){
 			goto abort;
 		}




More information about the Pcsclite-cvs-commit mailing list