[Pcsclite-cvs-commit] r365 - in trunk/muscleTool: . win32

Karsten Ohme ohme-guest at costa.debian.org
Mon Jan 9 09:34:24 UTC 2006


Author: ohme-guest
Date: 2006-01-09 09:34:22 +0000 (Mon, 09 Jan 2006)
New Revision: 365

Modified:
   trunk/muscleTool/Install.w32
   trunk/muscleTool/README
   trunk/muscleTool/muscleTool.c
   trunk/muscleTool/parser.y
   trunk/muscleTool/win32/MuscleTools.mak
Log:
Windows compilation fixes
Documentation updates

Modified: trunk/muscleTool/Install.w32
===================================================================
--- trunk/muscleTool/Install.w32	2006-01-03 08:01:00 UTC (rev 364)
+++ trunk/muscleTool/Install.w32	2006-01-09 09:34:22 UTC (rev 365)
@@ -48,7 +48,7 @@
 
 	The path to the GnuWin32 tools should be in your PATH variable.
 
-	Maybe you may also consider using bison from the Cygwin environment www.cygwin.com. 
+	Maybe you may also consider using bison from the Cygwin environment www.cygwin.com.
 	If you experience problems with the GnuWin32 bison install Cygwin and
 	select bison to install. The path to the Cygwin should be in your PATH variable.
 
@@ -60,23 +60,21 @@
 information open the Visual Studio project of the pthread library and build a debug version.
 
 There are two versions depending of the compile switch VERSION2.
-If VERSION2 is defined some new features are enabled for which you need the new version 2.0 of the
-MuscleCard library, MuscleCard Plug-In and CardEdge Applet. For Windows this is implicitly assumed, if you
-want to build a version compatible with the old components you must manually remove the /D "VERSION2" switch
-from the MuscleTools.mak file under win32.
+If VERSION2 is defined some new features are enabled for which you need the new version 2.0.0 of the
+MuscleCard library, MuscleCard Plug-In and CardEdge Applet 1.0.1 implementing the CardEdge protocol 1.30.
 
 You can also use the MuscleTools.sln file for VS .NET 2003. Then you have to adjust the
 C/C++->General->Additional Include Directories, Linker->General->Additional Library Directories,
 Linker->Input->Additional Depencies and Build Events->Pre-Build Event->Command Line fields according to
 the following.
 
-Instead of editing the project settings, it may be more convenient for you 
-to set globally the following environment variables. So you do not need to 
+Instead of editing the project settings, it may be more convenient for you
+to set globally the following environment variables. So you do not need to
 touch the project settings.
 
 GnuWin32 - The path to the GnuWin32 tools
 	--> http://gnuwin32.sourceforge.net/
-	This is the directory where all related files for the GnuWin32 packages 
+	This is the directory where all related files for the GnuWin32 packages,
 	e.g. flex and bison are placed there below the bin directory.
 
 pthreads - The path to the Pthreads library
@@ -85,8 +83,8 @@
 	If you have not build pthreads by your own, you maybe have to extent the Include
 	and Library directory with "/include" and "/lib" respectively.
 
-ProgramFiles - Path for the program files. E.g. C:\Program Files. In this directory under 
-	Muscle\MuscleCard\ the build executable is placed.
+ProgramFiles - Path for the program files. E.g. C:\Program Files. In this directory under
+	Muscle\MuscleCard\ the build executable is placed. This should be automatically set by the system.
 
 There is also a legagy MuscleTools.dsw file for VS 6.0. You must change the above mentioned points.
 
@@ -108,6 +106,7 @@
 
 	This arguments are:
 
+	VERSION2       - Compile for MuscleCard 2.0.0
 	MUSCLECARD_INC - Path to MuscleCard includes
 	MUSCLECARD_LIB - Path to MuscleCard link library (.lib)
 	PCSC_INC       - The path to the headers for PC/SC Lite
@@ -118,13 +117,13 @@
 	FLEX_INC	   - Some includes shipped with flex.
 	BISON          - Path including file name of the bison executable
 
-	E.g. nmake -f PCSC.mak PTHREADS_INC=C:\pthreads\Pre-build\include 
+	E.g. nmake -f MuscleTool.mak VERSION2= PTHREADS_INC=C:\pthreads\Pre-build\include
 		PTHREADS_LIB=C:\pthreads\Pre-build\lib
-		PTHREADS_NAME=pthreadVC1 FLEX=C:\Program Files\GnuWin32\bin\flex.exe 
-		FLEX_INC=C:\Program Files\GnuWin32\include 
-		PCSC_INC=C:\Program Files\Muscle\Includes 
-		BISON=C:\Program Files\GnuWin32\bin\bison.exe 
-		MUSCLECARD_INC=C:\Program Files\Muscle\MuscleCard\Includes 
+		PTHREADS_NAME=pthreadVC1 FLEX=C:\Program Files\GnuWin32\bin\flex.exe
+		FLEX_INC=C:\Program Files\GnuWin32\include
+		PCSC_INC=C:\Program Files\Muscle\Includes
+		BISON=C:\Program Files\GnuWin32\bin\bison.exe
+		MUSCLECARD_INC=C:\Program Files\Muscle\MuscleCard\Includes
 		MUSCLECARD_LIB=C:\Program Files\Muscle\MuscleCard\Libraries
 
 

Modified: trunk/muscleTool/README
===================================================================
--- trunk/muscleTool/README	2006-01-03 08:01:00 UTC (rev 364)
+++ trunk/muscleTool/README	2006-01-09 09:34:22 UTC (rev 365)
@@ -24,25 +24,26 @@
 
 You can generate keys, list keys, import and export
 and use keys for cryptographic operations.
-The last import and export commands are at the moment only for testing,
+At the moment the import and export commands are only for testing,
 because the keys are imported and exported as key blobs, an
 internal format of the application on the smart card. You
 will need a conversion utility for getting a standard key format.
 Maybe a next release will enable with the OpenSSL library a
 usable key import and export. The crypto operations does allow also the
 encryption of a given file in addition to a supplied user string.
-With the new version, you can also delete keys.
+With the new version, you can also delete keys, renumber keys 
+and change their ACLs.
 
 You can create, read, write object, delete and list objects.
 With the new version you can also rename objects and change the ACL for objects.
 
 You can create, list, change, unblock and verify and PINs.
 With the new version you can also delete IDs (PINs or keys).
-With the new version you can also renumber keys and change their ACL.
 
 General commands are the status command, the connect and
 release command and maybe very informative the resume command,
 which shows the capabilities of your card.
+The new version can also set the label and teh serial number of the card.
 
 You can get a short help with the "help".
 If you want to have a help for a command call "help commmand".

Modified: trunk/muscleTool/muscleTool.c
===================================================================
--- trunk/muscleTool/muscleTool.c	2006-01-03 08:01:00 UTC (rev 364)
+++ trunk/muscleTool/muscleTool.c	2006-01-09 09:34:22 UTC (rev 365)
@@ -25,6 +25,7 @@
 
 #ifdef WIN32
 #include <io.h>
+#define snprintf _snprintf
 #endif
 
 #include <sys/stat.h>
@@ -1139,7 +1140,9 @@
 	MSCLong32 rv = 0;
 	MSCUChar8 temp[8];
 	MSCULong32 retLength;
+#ifdef VERSION2
 	MSCUShort16 capability[4];
+#endif
 	MSCULong32 ulValue;
 	MSCUChar8 ucValue;
 	MSCUShort16 usValue;
@@ -2113,7 +2116,9 @@
 	MSCULong32 pinSize;
 	int usePinpad = 0;
 	MSCUChar8 pinData[17];
+#ifdef VERSION2
 	MSCULong32 dummy, units;
+#endif
 
 	CHECK_ERR(pConnection == 0, "Must Connect First !");
 
@@ -2151,11 +2156,14 @@
 void doUnblockPIN(int pinNumber)
 {
 	MSCLong32 rv = 0;
-	MSCULong32 pinSize, newPinSize;
+	MSCULong32 pinSize;
 	int usePinpad = 0;
+	MSCUChar8 pinData[17];
+#ifdef VERSION2
+	MSCULong32 newPinSize;
 	MSCULong32 dummy, units;
-	MSCUChar8 pinData[17];
 	MSCUChar8 newPinData[17];
+#endif
 
 	CHECK_ERR(pConnection == 0, "Must Connect First !");
 #ifdef VERSION2
@@ -2208,7 +2216,9 @@
 	MSCLong32 rv = 0;
 	MSCULong32 pinSize;
 	MSCULong32 pinUnblockSize;
+#ifdef VERSION2
 	MSCULong32 dummy;
+#endif
 	MSCUChar8 pinMaxSize = 16;
 	MSCUChar8 pinTries = MUSCLETOOL_PIN_MAXTRIES;
 
@@ -2251,7 +2261,9 @@
 	MSCULong32 pinSize;
 	MSCULong32 newPinSize;
 	MSCUChar8 pinData[17], newPinData[17];
+#ifdef VERSION2
 	MSCULong32 dummy, units;
+#endif
 	MSCUChar8 pinMaxSize = 16;
 	int usePinpad = 0;
 	char dummyString[32];
@@ -3736,16 +3748,19 @@
 #endif
 	MSCULong32 userPINTries;
 	MSCULong32 userUnblockPINTries;
-	MSCChar8 dummyString[256];
 
 	MSCULong32 memoryAlloc;
 	MSCUChar8 transportKey[9];
 	MSCULong32 transportKeyLength = 9;
 	pthread_t pthThread;
+#ifdef VERSION2
+	MSCChar8 dummyString[256];
 	MSCUChar8 pinMaxSize;
+	MSCULong32 dummy;
+#endif
 	MSCUChar8 pinMinSize = 4;
-	MSCULong32 dummy;
 
+
 	unsigned long pinACL;
 	unsigned long keyACL;
 	unsigned long objectACL;

Modified: trunk/muscleTool/parser.y
===================================================================
--- trunk/muscleTool/parser.y	2006-01-03 08:01:00 UTC (rev 364)
+++ trunk/muscleTool/parser.y	2006-01-09 09:34:22 UTC (rev 365)
@@ -6,7 +6,7 @@
  * Copyright (C) 2004
  *  Toni Andjelkovic <toni at soth.at>
  *  Ludovic Rousseau <ludovic.rousseau at free.fr>
- *  Karsten Ohme <karsten.ohme at inf.tu-dresden.de>
+ *  Karsten Ohme <k_o_ at users.sourceforge.net>
  *
  * $Id$
  */
@@ -16,6 +16,10 @@
 #include <stdlib.h>
 #include <musclecard.h>
 
+#ifdef WIN32
+#define snprintf _snprintf
+#endif
+
 #ifdef HAVE_READLINE
 #include <readline/readline.h>
 #include <readline/history.h>

Modified: trunk/muscleTool/win32/MuscleTools.mak
===================================================================
--- trunk/muscleTool/win32/MuscleTools.mak	2006-01-03 08:01:00 UTC (rev 364)
+++ trunk/muscleTool/win32/MuscleTools.mak	2006-01-09 09:34:22 UTC (rev 365)
@@ -3,6 +3,7 @@
 !MESSAGE ALL [DEBUG=] - Build version.
 !MESSAGE CLEAN - Delete Debug and Release directories
 !MESSAGE
+!MESSAGE VERSION2       - Compile for MuscleCard 2.0.0
 !MESSAGE MUSCLECARD_INC - Path to MuscleCard includes
 !MESSAGE MUSCLECARD_LIB - Path to MuscleCard link library (.lib)
 !MESSAGE PTHREADS_INC   - Path to pthreads includes
@@ -16,35 +17,34 @@
 
 # replace with your path to the MuscleCard header files
 # or specify on command line
-MUSCLECARD_INC=C:\Dokumente und Einstellungen\Widerstand\Eigene Dateien\Uni\Javacard\Muscle\libmusclecard\src\PCSC
+MUSCLECARD_INC=$(PROGRAMFILES)\Muscle\MuscleCard\Includes
 
 !IF !EXIST("$(MUSCLECARD_INC)")
 !ERROR Your path to the header files for MuscleCard is wrong. \
 Replace it in the Makefile or call nmake with MUSCLECARD_INC=<PATH_TO_MUSCLECARD_HEADERS>
 !ENDIF
 
-# replace with your path to the MuscleCard header files
+# replace with your path to the PC/SC Lite header files
 # or specify on command line
-PCSC_INC=C:\Dokumente und Einstellungen\Widerstand\Eigene Dateien\Uni\Javacard\Muscle\libmusclecard\src\PCSC\win32
+PCSC_INC=$(PROGRAMFILES)\Muscle\MuscleCard\Includes
 
 !IF !EXIST("$(PCSC_INC)")
-!ERROR Your path to the header files for MuscleCard is wrong. \
+!ERROR Your path to the header files for PC/SC Lite is wrong. \
 Replace it in the Makefile or call nmake with PCSC_INC=<PATH_TO_PCSC_HEADERS>
 !ENDIF
 
 # replace with your path to the MuscleCard link library (.lib) file
-# or specify on command line excluding the Release or Debug directory
-MUSCLECARD_LIB=C:\Dokumente und Einstellungen\Widerstand\Eigene Dateien\Uni\Javacard\Muscle\libmusclecard\win32
+# or specify on command line
+MUSCLECARD_LIB=$(ProgramFiles)\Muscle\MuscleCard\Libraries
 
 !IF !EXIST("$(MUSCLECARD_LIB)")
-!ERROR Your path to the link library (.lib) file for MuscleCard \
-excluding the Release or Debug directory is wrong \
+!ERROR Your path to the link library (.lib) file for MuscleCard is wrong. \
 Replace it in the Makefile or call nmake with MUSCLECARD_LIB=<PATH_TO_MUSCLECARD_LIBS>
 !ENDIF
 
 # replace with your path to the Pthreads header files
 # or specify on command line
-PTHREADS_INC=e:\quarantine\pthread\pthreads
+PTHREADS_INC=$(PTHREADS)
 
 !IF !EXIST("$(PTHREADS_INC)")
 !ERROR Your path to the header files for Pthreads is wrong. \
@@ -53,7 +53,7 @@
 
 # replace with your path to the Pthreads library files
 # or specify on command line
-PTHREADS_LIB=e:\quarantine\pthread\pthreads
+PTHREADS_LIB=$(PTHREADS)
 
 !IF !EXIST("$(PTHREADS_LIB)")
 !ERROR Your path to the library files for Pthreads is wrong. \
@@ -66,12 +66,12 @@
 
 # replace with the location of your flex executable
 # or specify at command line
-FLEX="e:\Programme\GnuWin32\bin\flex.exe"
+FLEX=$(GNUWIN32)\bin\flex.exe
 
 # replace with the location of the include directory of your flex distribution
 # or specify it at command line
 # A file called unistd.h is needed to compile C files generated by flex.
-FLEX_INC="e:\Programme\GnuWin32\include"
+FLEX_INC=$(GNUWIN32)\include
 
 !IF !EXIST($(FLEX_INC))
 !ERROR Your path to the header file needed to compile C files generated by flex is wrong. \
@@ -81,7 +81,7 @@
 
 # replace with the location of your bison executable
 # or specify at command line
-BISON="e:\Programme\GnuWin32\bin\bison.exe"
+BISON=$(GNUWIN32)\bin\bison.exe
 
 
 
@@ -100,7 +100,7 @@
 LINK32=link.exe
 CPP=cl.exe
 
-ALL : $(OUTDIR)\MuscleTool.exe
+ALL : $(OUTDIR)\MuscleTools.exe
 
 CLEAN :
 	- at rd /S /Q $(DEBUG_OUTDIR)
@@ -120,10 +120,15 @@
 
 !IFNDEF DEBUG
 
-CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "$(MUSCLECARD_INC)" /I "$(PCSC_INC)" /I "$(PTHREADS_INC)" /D "WIN32" \
-/D "NDEBUG" /D "VERSION2" /D "_CONSOLE" /D "_MBCS" /Fo"$(OUTDIR)\\" /Fd"$(OUTDIR)\\" /FD /c
+!IFDEF VERSION2
+CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "$(MUSCLECARD_INC)" /I "$(PCSC_INC)" /I "$(PTHREADS_INC)" \
+/D "WIN32" /D "NDEBUG" /D "VERSION2" /D "_CONSOLE" /D "_MBCS" /Fo"$(OUTDIR)\\" /Fd"$(OUTDIR)\\" /FD /c
+!ELSE
+CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "$(MUSCLECARD_INC)" /I "$(PCSC_INC)" /I "$(PTHREADS_INC)" \
+/D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fo"$(OUTDIR)\\" /Fd"$(OUTDIR)\\" /FD /c
+!ENDIF
 
-LINK32_FLAGS=$(PTHREADS_NAME).lib musclecard.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\MuscleTools.pdb" /machine:I386 /out:"$(OUTDIR)\MuscleTool.exe" /libpath:"$(MUSCLECARD_LIB)/$(OUTDIR)" /libpath:"$(PTHREADS_LIB)"
+LINK32_FLAGS=$(PTHREADS_NAME).lib musclecard.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\MuscleTools.pdb" /machine:I386 /out:"$(OUTDIR)\MuscleTools.exe" /libpath:"$(MUSCLECARD_LIB)" /libpath:"$(PTHREADS_LIB)"
 
 
 
@@ -132,18 +137,20 @@
 
 
 
+!IFDEF VERSION2
+CPP_PROJ=/nologo /MD /W3 /Gm /GX /ZI /Od /I "$(MUSCLECARD_INC)" /I "$(PCSC_INC)" /I "$(PTHREADS_INC)" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "VERSION2" /D "_MBCS" /FR"$(OUTDIR)\\" /Fo"$(OUTDIR)\\" /Fd"$(OUTDIR)\\" /FD /GZ /c
+!ELSE
+CPP_PROJ=/nologo /MD /W3 /Gm /GX /ZI /Od /I "$(MUSCLECARD_INC)" /I "$(PCSC_INC)" /I "$(PTHREADS_INC)" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"$(OUTDIR)\\" /Fo"$(OUTDIR)\\" /Fd"$(OUTDIR)\\" /FD /GZ /c
+!ENDIF
 
-CPP_PROJ=/nologo /MD /W3 /Gm /GX /ZI /Od /I "$(MUSCLECARD_INC)" /I "$(PCSC_INC)" /I "$(PTHREADS_INC)" /D "VERSION2" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"$(OUTDIR)\\" /Fo"$(OUTDIR)\\" /Fd"$(OUTDIR)\\" /FD /GZ /c
+LINK32_FLAGS=$(PTHREADS_NAME).lib musclecard.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\MuscleTools.pdb" /debug /machine:I386 /out:"$(OUTDIR)\MuscleTools.exe" /pdbtype:sept /libpath:"$(MUSCLECARD_LIB)" /libpath:"$(PTHREADS_LIB)"
 
-LINK32_FLAGS=$(PTHREADS_NAME).lib musclecard.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\MuscleTools.pdb" /debug /machine:I386 /out:"$(OUTDIR)\MuscleTool.exe" /pdbtype:sept /libpath:"$(MUSCLECARD_LIB)/$(OUTDIR)" /libpath:"$(PTHREADS_LIB)"
-
 !ENDIF
 
 
 
 
-
-$(OUTDIR)\MuscleTool.exe : ../scanner.c ../parser.c $(OUTDIR) $(LINK32_OBJS)
+$(OUTDIR)\MuscleTools.exe : ../scanner.c ../parser.c $(OUTDIR) $(LINK32_OBJS)
     $(LINK32) $(LINK32_FLAGS) $(LINK32_OBJS)
 
 
@@ -168,7 +175,7 @@
 	ERROR Flex not found. Change the macro FLEX in this Makefile to point to the \
 	correct location or specify it on the command line FLEX=<LOCATION_OF_FLEX_EXECUTABLE>
 !ELSE
-	flex -o../scanner.c ../scanner.l
+	$(FLEX) -o../scanner.c ../scanner.l
 !ENDIF
 
 
@@ -177,7 +184,7 @@
 	ERROR Bison not found. Change the macro BISON in this Makefile to point to the \
 	correct location or specify it on the command line BISON=<LOCATION_OF_BISON_EXECUTABLE>
 !ELSE
-	bison -do ../parser.c ../parser.y
+	$(BISON) -do ../parser.c ../parser.y
 !ENDIF
 
 




More information about the Pcsclite-cvs-commit mailing list