Check-in [6ba1dff55a]
Overview
Comment:Updated to deal with 6E00 and added support for win32 build options
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | piv
Files: files | file ages | folders
SHA1:6ba1dff55aa7d7e17bc220bf48492d88e152d4a7
User & Date: rkeene on 2013-10-17 20:29:07
Other Links: manifest | tags
Context
2015-07-15
20:10
Merged divergent PIV branches Closed-Leaf check-in: 466549fe92 user: rkeene tags: piv
2013-10-17
20:29
Merged in PIV support check-in: 3e5963d5d9 user: rkeene tags: trunk
20:29
Updated to deal with 6E00 and added support for win32 build options check-in: 6ba1dff55a user: rkeene tags: piv
2013-09-14
02:50
Updated to treat a return code of 0x6E00 (wrong instruction class) the same as 0x6982 (security status not satisified) check-in: 2e1e0bfc20 user: rkeene tags: piv
Changes

Modified build/cackey_win32_build/build.sh from [716f40add4] to [fbfa3a5bbe].

     1      1   #! /bin/bash
     2      2   
     3      3   make distclean
     4      4   
     5         -./configure --with-pcsc-headers="$(pwd)/build/cackey_win32_build/include" --with-pcsc-libs="-L$(pwd)/build/cackey_win32_build/lib -lwinscard" --host=i586-mingw32msvc  CPPFLAGS="-I$(pwd)/build/cackey_win32_build/include" || exit 1
            5  +./configure --with-pcsc-headers="$(pwd)/build/cackey_win32_build/include" --with-pcsc-libs="-L$(pwd)/build/cackey_win32_build/lib -lwinscard" --host=i586-mingw32msvc  CPPFLAGS="-I$(pwd)/build/cackey_win32_build/include" "$@" || exit 1
     6      6   
     7      7   make || exit 1
     8      8   
     9      9   exit 0

Modified cackey.c from [c06e51ee9b] to [e6fa629162].

  2872   2872   				CACKEY_DEBUG_PRINTF("Security status not satisified (respcode = 0x%04x).  Returning NEEDLOGIN", (int) respcode);
  2873   2873   
  2874   2874   				cackey_mark_slot_reset(slot);
  2875   2875   				slot->token_flags = CKF_LOGIN_REQUIRED;
  2876   2876   
  2877   2877   				return(CACKEY_PCSC_E_NEEDLOGIN);
  2878   2878   			}
         2879  +
         2880  +			if (respcode == 0x6E00) {
         2881  +				CACKEY_DEBUG_PRINTF("Got \"WRONG CLASS\", this means we are talking to the wrong object (likely because the card went away) -- resetting");
         2882  +
         2883  +				cackey_mark_slot_reset(slot);
         2884  +				slot->token_flags = CKF_LOGIN_REQUIRED;
         2885  +
         2886  +				return(CACKEY_PCSC_E_NEEDLOGIN);
         2887  +			}
  2879   2888   
  2880   2889   			if (send_ret == CACKEY_PCSC_E_TOKENABSENT) {
  2881   2890   				CACKEY_DEBUG_PRINTF("Token absent.  Returning TOKENABSENT");
  2882   2891   
  2883   2892   				cackey_mark_slot_reset(slot);
  2884   2893   
  2885   2894   				return(CACKEY_PCSC_E_TOKENABSENT);
................................................................................
  3069   3078   	}
  3070   3079   
  3071   3080   	/* PIV authentication uses a "key_reference" of 0x80 */
  3072   3081   	pcsc_identities = cackey_read_certs(slot, NULL, &num_certs);
  3073   3082   	if (num_certs > 0 && pcsc_identities != NULL) {
  3074   3083   		switch (pcsc_identities[0].id_type) {
  3075   3084   			case CACKEY_ID_TYPE_PIV:
  3076         -				CACKEY_DEBUG_PRINTF("We recently had a PIV card, so we will attempt to authenticate using the PIV Application key reference");
         3085  +				CACKEY_DEBUG_PRINTF("We have PIV card, so we will attempt to authenticate using the PIV Application key reference");
  3077   3086   
  3078   3087   				key_reference = 0x80;
  3079   3088   				break;
  3080   3089   			default:
  3081   3090   				break;
  3082   3091   		}
  3083   3092