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

Karsten Ohme ohme-guest at costa.debian.org
Tue Nov 15 03:07:21 UTC 2005


Author: ohme-guest
Date: 2005-11-15 03:07:20 +0000 (Tue, 15 Nov 2005)
New Revision: 362

Modified:
   trunk/muscleTool/README
   trunk/muscleTool/configure.in
   trunk/muscleTool/muscleTool.c
   trunk/muscleTool/parser.y
   trunk/muscleTool/scanner.l
Log:
Compilation error fixed
New GetStatus() for MuscleCard 2 included

Modified: trunk/muscleTool/README
===================================================================
--- trunk/muscleTool/README	2005-11-05 02:47:16 UTC (rev 361)
+++ trunk/muscleTool/README	2005-11-15 03:07:20 UTC (rev 362)
@@ -50,7 +50,7 @@
 
 Installation:
 
-Generel install instructions are in the file INSTALL.
+General install instructions are in the file INSTALL.
 Installation instructions for Windows are in the file Install.w32
 
 ./configure
@@ -70,7 +70,8 @@
 different location you have to set the environment variable
 PKG_CONFIG_PATH. E.g. the Debian path for pkgconfig is /usr/lib/pkgconfig.
 
-Optional GNU readline support can be enabled with:
+Optional GNU readline support can be enabled with (Very comfortable, so you
+scroll through you input.):
 
 ./configure --enable-readline
 

Modified: trunk/muscleTool/configure.in
===================================================================
--- trunk/muscleTool/configure.in	2005-11-05 02:47:16 UTC (rev 361)
+++ trunk/muscleTool/configure.in	2005-11-15 03:07:20 UTC (rev 362)
@@ -1,10 +1,10 @@
-# Require autoconf 2.52
-AC_PREREQ(2.52)
+# Require autoconf 2.53
+AC_PREREQ(2.53)
 
-AC_INIT(muscleTool, 2.0.0)
+AC_INIT(muscleTool, 2.1.0, [])
 AC_CONFIG_AUX_DIR(aux)
 AC_COPYRIGHT(COPYING)
-AM_INIT_AUTOMAKE([no-define])
+AM_INIT_AUTOMAKE()
 
 # check programs
 AC_PROG_CC
@@ -16,10 +16,8 @@
 # check header files
 AC_HEADER_STDC
 AC_HEADER_STAT
-AC_CHECK_HEADER(stdio.h, , [],
-[AC_MSG_ERROR([stdio.h not found.])])
-AC_CHECK_HEADER(errno.h, , [],
-[AC_MSG_ERROR([error.h not found.])])
+AC_CHECK_HEADER(stdio.h, , [], [AC_MSG_ERROR([stdio.h not found.])])
+AC_CHECK_HEADER(errno.h, , [], [AC_MSG_ERROR([error.h not found.])])
 
 # check library functions
 AC_FUNC_STAT
@@ -28,7 +26,7 @@
 [AC_MSG_ERROR([Necessary function is not supported.])])
 
 dnl look for MuscleCard
-PKG_CHECK_MODULES(MUSCLECARD, libmusclecard, [],
+PKG_CHECK_MODULES(MUSCLECARD, libmusclecard, [], 
 [AC_MSG_ERROR([libmusclecard not found, install libmusclecard 1.2.9-beta7 or later])])
 
 # special check for pthread support

Modified: trunk/muscleTool/muscleTool.c
===================================================================
--- trunk/muscleTool/muscleTool.c	2005-11-05 02:47:16 UTC (rev 361)
+++ trunk/muscleTool/muscleTool.c	2005-11-15 03:07:20 UTC (rev 362)
@@ -5,7 +5,7 @@
             Package: MuscleTools
             Author : David Corcoran
                      Karsten Ohme
-            Date   : 09/24/05
+            Date   : 11/11/05
             License: Copyright (C) 2002 David Corcoran
                      <corcoran at linuxnet.com>
             Purpose: A shell for the MuscleCard framework
@@ -50,15 +50,42 @@
 static int getChoice(char *, char *, char **, int);
 static int getStringValue(char *header, char *footer, char *stringValue, int stringValueLength);
 static int getNumberValue(char *header, char *footer, unsigned long *numberValue);
-void doPrintAUT(MSCUShort16);
+static void doPrintAUT(MSCUShort16);
+static void _8ByteTo4Short(MSCUChar8 byteArray[8], MSCUShort16 shortArray[4]);
+static MSCUShort16 getUShort16(MSCPUChar8 srcValue);
+static MSCULong32 getULong32(MSCPUChar8 srcValue);
 
-
 #define CHECK_ERR(cond, msg) { if (cond) { \
   printf("ERR: %s (0x%lX %s)\n", msg, rv, msc_error(rv)); goto end; } }
 
 #define PRINT_SUPPORT(cond) { if (cond) { \
   printf("X\n"); } else { printf("\n"); } }
 
+
+
+static void _8ByteTo4Short(MSCUChar8 byteArray[8], MSCUShort16 shortArray[4])
+{
+	shortArray[0] = getUShort16(byteArray);
+	shortArray[1] = getUShort16(byteArray+2);
+	shortArray[2] = getUShort16(byteArray+4);
+	shortArray[3] = getUShort16(byteArray+6);
+}
+
+static MSCUShort16 getUShort16(MSCPUChar8 srcValue) 
+{
+	return (MSCUShort16)( ((srcValue[0]) << 8) | srcValue[1] );
+}
+
+static MSCULong32 getULong32(MSCPUChar8 srcValue) 
+{
+	MSCULong32 temp;
+	temp  = srcValue[0] * 0x1000000;
+	temp += srcValue[1] * 0x10000;
+	temp += srcValue[2] * 0x100;
+	temp += srcValue[3];
+	return temp;
+}
+
 void *printStatStars(void *arg)
 {
 	while (1)
@@ -635,7 +662,7 @@
  * Prints the need authentications
  * \param aut The authentication mask.
  */
-void doPrintAUT(MSCUShort16 aut)
+static void doPrintAUT(MSCUShort16 aut)
 {
 	if (aut == MSC_AUT_NONE)
 	{
@@ -736,23 +763,70 @@
 void doStatus()
 {
 	MSCLong32 rv = 0;
-	MSCStatusInfo pStatusStruct;
+#ifdef VERSION2
+	MSCULong32 dummy = 8;
+	MSCUChar8 temp[8];
+#else
+        MSCStatusInfo pStatusStruct;
+#endif
 
 	CHECK_ERR(pConnection == 0, "Must Connect First !");
 
-	rv = MSCGetStatus(pConnection, &pStatusStruct);
+#ifdef VERSION2
+	dummy = 8;
+	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_PROTO_VERSION, temp, &dummy);
 	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
+	printf(" Protocol Version: %d.%d\n", temp[0], temp[1]);
 
-	printf(" Protocol Version: %d.%d\n", (pStatusStruct.appVersion>>8) & 0xFF, 
-		(pStatusStruct.appVersion & 0x00FF));
-	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);
-	printf("        PINs Used: %d\n", pStatusStruct.usedPINs);
-	printf("        Keys Used: %d\n", pStatusStruct.usedKeys);
+	dummy = 8;
+	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_APPLET_VERSION, temp, &dummy);
+	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
+	printf(" Software Version: %d.%d\n", temp[0], temp[1]);
+
+	dummy = 8;
+	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_FREE_MEM, temp, &dummy);
+	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
+
+	dummy = (temp[0] << 24) | (temp[1] << 16) | (temp[2] << 8) | temp[3];
+	printf("      Free Memory: %ld\n", dummy);
+
+	dummy = 8;
+	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_TOTAL_MEM, temp, &dummy);
+	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
+	dummy = (temp[0] << 24) | (temp[1] << 16) | (temp[2] << 8) | temp[3];
+	printf("     Total Memory: %ld\n", dummy);
+
+	dummy = 8;
+	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_USED_PINS, temp, &dummy);
+	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
+	printf("        PINs Used: %d\n", temp[0]);
+
+	dummy = 8;
+	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_USED_KEYS, temp, &dummy);
+	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
+	printf("        Keys Used: %d\n", temp[0]);
+
+	dummy = 8;
+	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_LOGGED_IDS, temp, &dummy);
+	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
 	printf("       Logged IDs: ");
-	doLoggedID(pStatusStruct.loggedID);
+	doLoggedID((MSCUShort16)*temp);
+#else
+        rv = MSCGetStatus(pConnection, &pStatusStruct);
+        CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
+
+        printf(" Protocol Version: %d.%d\n", (pStatusStruct.appVersion>>8) & 0xFF, 
+               (pStatusStruct.appVersion & 0x00FF));
+        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);
+        printf("        PINs Used: %d\n", pStatusStruct.usedPINs);
+        printf("        Keys Used: %d\n", pStatusStruct.usedKeys);
+        printf("       Logged IDs: ");
+        doLoggedID(pStatusStruct.loggedID);
+#endif
+
 	printf("\n");
 end:
 	return;
@@ -761,6 +835,7 @@
 void doResume(char *type)
 {
 	MSCLong32 rv = 0;
+	MSCUChar8 temp[8];
 	MSCULong32 retLength;
 	MSCUShort16 capability[4];
 	MSCULong32 ulValue;
@@ -776,10 +851,11 @@
 	{
 		if (strcmp(type, "crypt") == 0)
 		{
-			usValue = 0;
+			retLength = 8;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_SUPPORT_CRYPTOALG,
-				(MSCPUChar8) & usValue, &retLength);
+				temp, &retLength);
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_SUPPORT_CRYPTOALG");
+			usValue = getUShort16(temp);
 			printf("\n");
 			printf("Crypto Algorithm    Supported\n");
 			printf("-------------------------------\n");
@@ -799,9 +875,11 @@
 		}
 		else if (strcmp(type, "rsa") == 0)
 		{
+			retLength = 8;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_RSA,
-				(MSCPUChar8) capability, &retLength);
+				temp, &retLength);
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_RSA");
+			_8ByteTo4Short(temp, capability);
 			usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS];
 			printf("%04lX\n",usValue);
 			printf("\n");
@@ -923,9 +1001,11 @@
 		}
 		else if (strcmp(type, "dsa") == 0)
 		{
+			retLength = 8;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_DSA,
-				(MSCPUChar8) capability, &retLength);
+				temp, &retLength);
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_DSA");
+			_8ByteTo4Short(temp, capability);
 			usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS];
 			printf("\n");
 			printf("DSA Capabilities                                      Supported\n");
@@ -972,9 +1052,11 @@
 		}
 		else if (strcmp(type, "ec") == 0)
 		{
+			retLength = 8;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_ECURVE,
-				(MSCPUChar8) capability, &retLength);
+				temp, &retLength);
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_ECURVE");
+			_8ByteTo4Short(temp, capability);
 			usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS];
 			printf("\n");
 			printf("EC Capabilities                                       Supported\n");
@@ -1051,9 +1133,11 @@
 		}
 		else if (strcmp(type, "aes") == 0)
 		{
+			retLength = 8;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_AES,
-				(MSCPUChar8) capability, &retLength);
+				temp, &retLength);
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_AES");
+			_8ByteTo4Short(temp, capability);
 			usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS];
 			printf("\n");
 			printf("AES Capabilities                                      Supported\n");
@@ -1094,9 +1178,11 @@
 		}
 		else if ((strcmp(type, "des") == 0) ||(strcmp(type, "3des") == 0))
 		{
+			retLength = 8;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_DES,
-				(MSCPUChar8) capability, &retLength);
+				temp, &retLength);
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_RSA");
+			_8ByteTo4Short(temp, capability);
 			usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS];
 			printf("\n");
 			printf("DES Capabilities                                      Supported\n");
@@ -1182,14 +1268,15 @@
 		}
 		else if (strcmp(type, "keys") == 0)
 		{
+			retLength = 8;
 			printf("\n");
 			printf("AUT needed to import/generate keys:\n    ");
 
 			usValue = 0;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_KEY_AUTH,
-				(MSCPUChar8) & usValue, &retLength);
+				temp, &retLength);
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_KEY_AUTH");
-
+			usValue = getUShort16(temp);
 			doPrintAUT(usValue);
 			printf("\n");
 
@@ -1197,6 +1284,7 @@
 		}
 		else if (strcmp(type, "pins") == 0)
 		{
+			retLength = 8;
 			printf("\n");
 			printf("PIN Policies\n");
 			printf("-------------------------------\n");
@@ -1242,12 +1330,11 @@
 			else
 				printf(" NO\n");
 
-			usValue = 0;
 			printf("AUT needed to create pins:\n    ");
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_PIN_AUTH,
-				(MSCPUChar8) & usValue, &retLength);
+				temp, &retLength);
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_PIN_AUTH");
-
+			usValue = getUShort16(temp);
 			doPrintAUT(usValue);
 			printf("\n");
 
@@ -1255,6 +1342,7 @@
 		}
 		else if (strcmp(type, "objects") == 0)
 		{
+			retLength = 8;
 			printf("\n");
 			printf("Object Capabilities\n");
 			printf("-------------------------------\n");
@@ -1280,12 +1368,11 @@
 
 			printf("%03ld\n", ucValue);
 
-			usValue = 0;
 			printf("AUT needed to create objects:\n    ");
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_OBJ_AUTH,
-				(MSCPUChar8) & usValue, &retLength);
+				temp, &retLength);
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_OBJ_AUTH");
-
+			usValue = getUShort16(temp);
 			doPrintAUT(usValue);
 			printf("\n");
 
@@ -1297,11 +1384,12 @@
 	{
 		if (strcmp(type, "crypt") == 0)
 		{
+			retLength = 8;
 			ulValue = 0;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_SUPPORT_CRYPTOALG,
-				(MSCPUChar8) & ulValue, &retLength);
+				temp, &retLength);
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_SUPPORT_CRYPTOALG");
-
+			ulValue = getULong32(temp);
 			printf("Crypto Algorithm    Supported\n");
 			printf("-------------------------------\n");
 			printf("RSA                    ");
@@ -1332,12 +1420,12 @@
 		}
 		else if (strcmp(type, "rsa") == 0)
 		{
-
+			retLength = 8;
 			ulValue = 0;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_RSA,
-				(MSCPUChar8) & ulValue, &retLength);
+				temp, &retLength);
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_RSA");
-
+			ulValue = getULong32(temp);
 			printf("RSA Capabilities     Supported\n");
 			printf("-------------------------------\n");
 			printf("512 Bit                ");
@@ -1358,17 +1446,18 @@
 			PRINT_SUPPORT(ulValue & MSC_CAPABLE_RSA_PKCS1);
 			return;
 		}
-                else if (strcmp(type, "aes") == 0) {
-  printf("Not supported in MuscleTool 1.0 \n");
-  return;
-                }
+		else if (strcmp(type, "aes") == 0) {
+			printf("Not supported in this MuscleTool version.\n");
+			return;
+		}
 		else if (strcmp(type, "dsa") == 0)
 		{
+			retLength = 8;
 			ulValue = 0;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_DSA,
-				(MSCPUChar8) & ulValue, &retLength);
+				temp, &retLength);
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_DSA");
-
+			ulValue = getULong32(temp);
 			printf("DSA Capabilities     Supported\n");
 			printf("-------------------------------\n");
 			printf("512 Bit                ");
@@ -1387,11 +1476,12 @@
 		}
 		else if (strcmp(type, "des") == 0)
 		{
+			retLength = 8;
 			ulValue = 0;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_DES,
-				(MSCPUChar8) & ulValue, &retLength);
+				temp, &retLength);
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_DES");
-
+			ulValue = getULong32(temp);
 			printf("DES Capabilities     Supported\n");
 			printf("-------------------------------\n");
 			printf("CBC Mode               ");
@@ -1404,11 +1494,12 @@
 		}
 		else if (strcmp(type, "3des") == 0)
 		{
+			retLength = 8;
 			ulValue = 0;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_3DES,
-				(MSCPUChar8) & ulValue, &retLength);
+				temp, &retLength);
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_3DES");
-
+			ulValue = getULong32(temp);
 			printf("3DES Capabilities     Supported\n");
 			printf("-------------------------------\n");
 			printf("CBC Mode               ");
@@ -1423,13 +1514,14 @@
 		}
 		else if (strcmp(type, "keys") == 0)
 		{
+			retLength = 8;
 			printf("AUT needed to import/generate keys:\n    ");
 
 			usValue = 0;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_KEY_AUTH,
-				(MSCPUChar8) & usValue, &retLength);
+				temp, &retLength);
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_KEY_AUTH");
-
+			usValue = getUShort16(temp);
 			doPrintAUT(usValue);
 			printf("\n");
 
@@ -1437,6 +1529,7 @@
 		}
 		else if (strcmp(type, "pins") == 0)
 		{
+			retLength = 8;
 			ucValue = 0;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_PIN_MAXSIZE,
 				(MSCPUChar8) & ucValue, &retLength);
@@ -1447,6 +1540,7 @@
 			printf("-------------------------------\n");
 			printf("Maximum PIN size         %03d\n", ucValue);
 
+			retLength = 8;
 			ucValue = 0;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_PIN_MINSIZE,
 				(MSCPUChar8) & ucValue, &retLength);
@@ -1455,6 +1549,7 @@
 
 			printf("Minimum PIN size         %03d\n", ucValue);
 
+			retLength = 8;
 			ucValue = 0;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_PIN_MAXNUM,
 				(MSCPUChar8) & ucValue, &retLength);
@@ -1463,12 +1558,12 @@
 
 			printf("Maximum number of PINs   %03d\n", ucValue);
 
-			ulValue = 0;
+			retLength = 8;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_PIN_ATTR,
-				(MSCPUChar8) & ulValue, &retLength);
+				temp, &retLength);
 
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_PIN_ATTR");
-
+			ulValue = getULong32(temp);
 			printf("Unblock PIN resets PIN   ");
 			if (ulValue & MSC_CAPABLE_PIN_RESET)
 				printf("YES\n");
@@ -1483,12 +1578,12 @@
 
 			printf("AUT needed to create pins:\n    ");
 
-			usValue = 0;
+			retLength = 8;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_PIN_AUTH,
-				(MSCPUChar8) & usValue, &retLength);
+				temp, &retLength);
 			
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_PIN_AUTH");
-
+			usValue = getUShort16(temp);
 			doPrintAUT(usValue);
 			printf("\n");
 
@@ -1496,6 +1591,7 @@
 		}
 		else if (strcmp(type, "objects") == 0)
 		{
+			retLength = 8;
 			ucValue = 0;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_OBJ_IDSIZE,
 				(MSCPUChar8) & ucValue, &retLength);
@@ -1506,22 +1602,23 @@
 			printf("-------------------------------\n");
 			printf("Maximum Object ID size   %03d\n", ucValue);
 
-			ulValue = 0;
+			retLength = 8;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_OBJ_MAXNUM,
-				(MSCPUChar8) & ucValue, &retLength);
+				temp, &retLength);
 
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_OBJ_MAXNUM");
+			ulValue = getULong32(temp);
 
 			printf("Maximum number objects   %03ld\n", ulValue);
 
 			printf("AUT needed to create objects:\n    ");
 
-			usValue = 0;
+			retLength = 8;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_OBJ_AUTH,
-				(MSCPUChar8) & usValue, &retLength);
+				temp, &retLength);
 			
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_OBJ_AUTH");
-
+			usValue = getUShort16(temp);
 			doPrintAUT(usValue);
 			printf("\n");
 
@@ -1532,10 +1629,11 @@
 #endif
 	else {
 #ifdef VERSION2
+		retLength = 8;
 		rv = MSCGetCapabilities(pConnection, MSC_TAG_SUPPORT_FUNCTIONS,
-			(MSCPUChar8)capability, &retLength);
+			temp, &retLength);
 		CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_SUPPORT_FUNCTIONS");
-
+		_8ByteTo4Short(temp, capability);
 		printf("\n");
 		printf("Functions             Supported\n");
 		printf("-------------------------------\n");
@@ -1587,13 +1685,14 @@
 		PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_OBJECT_USE_AND_MANGEMENT] & MSC_SUPPORT_READOBJECT);
 		printf("MSCGetCapabilities       ");
 		PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_STATUS] & MSC_SUPPORT_GETCAPABILITIES);
-		printf("MSCGetState             ");
+		printf("MSCGetState              ");
 		PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_STATUS] & MSC_SUPPORT_GETSTATUS);
 #else
+	retLength = 8;
 	rv = MSCGetCapabilities(pConnection, MSC_TAG_SUPPORT_FUNCTIONS,
-		(MSCPUChar8)(&ulValue), &retLength);
+		temp, &retLength);
 	CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_SUPPORT_FUNCTIONS");
-
+	ulValue = getULong32(temp);
 	printf("Functions             Supported\n");
 	printf("-------------------------------\n");
         printf("MSCGenerateKeys          ");
@@ -3307,7 +3406,7 @@
 	MSCULong32 transportKeyLength = 9;
 	pthread_t pthThread;
 	MSCUChar8 pinMaxSize;
-	MSCUChar8 pinMinSize;
+	MSCUChar8 pinMinSize = 4;
 	MSCULong32 dummy;
 
 	unsigned long pinACL;
@@ -3601,7 +3700,6 @@
 	quitStat = 0;
 	rv = pthread_create(&pthThread, NULL, printStatStars, 0);
 
-	initParams.transportBehavior = MSC_INIT_USE_KEY;
 	memcpy(initParams.transportKey, transportKey, transportKeyLength);
 	initParams.transportKeyLen = transportKeyLength;
 #ifdef VERSION2

Modified: trunk/muscleTool/parser.y
===================================================================
--- trunk/muscleTool/parser.y	2005-11-05 02:47:16 UTC (rev 361)
+++ trunk/muscleTool/parser.y	2005-11-15 03:07:20 UTC (rev 362)
@@ -94,7 +94,7 @@
 %token STATUS
 %token CHALLENGE
 %token LOGOUT
-%token VERSION
+%token _VERSION
 %token EXIT
 %token HELP
 
@@ -164,7 +164,7 @@
 	|	CHALLENGE			{ doChallenge(8); }
 	|	CHALLENGE NUMBER		{ doChallenge($2); }
 	|	LOGOUT				{ doLogout(); }
-	|	VERSION				{ doVersion(); }
+	|	_VERSION				{ doVersion(); }
 	|	EXIT				{ doExit(); bye=1; }
 	|	TEST NUMBER STRING		{ test($2, $3); }
 	;
@@ -208,7 +208,7 @@
 	|	HELP STATUS			{ help_status(); }
 	|	HELP CHALLENGE			{ help_challenge(); }
 	|	HELP LOGOUT			{ help_logout(); }
-	|	HELP VERSION			{ help_version(); }
+	|	HELP _VERSION			{ help_version(); }
 	|	HELP EXIT			{ help_exit(); }
 	|	HELP HELP			{ help_help(); }
 	;

Modified: trunk/muscleTool/scanner.l
===================================================================
--- trunk/muscleTool/scanner.l	2005-11-05 02:47:16 UTC (rev 361)
+++ trunk/muscleTool/scanner.l	2005-11-15 03:07:20 UTC (rev 362)
@@ -89,7 +89,7 @@
 status		return STATUS;
 challenge	return CHALLENGE;
 logout		return LOGOUT;
-version		return VERSION;
+version		return _VERSION;
 exit|quit	return EXIT;
 help|\?		return HELP;
 




More information about the Pcsclite-cvs-commit mailing list