Selaa lähdekoodia

2008-09-29 Marcus Brinkmann <marcus@g10code.com>

	* src/slots.c (MIN): Remove macro.
	(slot_token_maxpinlen, slot_token_pincount): Do not consider
	second pincount, which meaning depends on the card version.
Marcus Brinkmann 17 vuotta sitten
vanhempi
commit
b60a65ca49
2 muutettua tiedostoa jossa 12 lisäystä ja 4 poistoa
  1. 6 0
      ChangeLog
  2. 6 4
      src/slots.c

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+2008-09-29  Marcus Brinkmann  <marcus@g10code.com>
+
+	* src/slots.c (MIN): Remove macro.
+	(slot_token_maxpinlen, slot_token_pincount): Do not consider
+	second pincount, which meaning depends on the card version.
+
 2008-09-26  Marcus Brinkmann  <marcus@g10code.de>
 
 	* src/agent.c: Include "cert.h".

+ 6 - 4
src/slots.c

@@ -46,8 +46,6 @@
 
 #include "debug.h"
 
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-
 
 /* A session is just a slot identifier with a per-slot session
    identifier.  */
@@ -612,7 +610,9 @@ slot_token_maxpinlen (slot_iterator_t id, CK_ULONG *max, CK_ULONG *min)
 {
   struct slot *slot = scute_table_data (slots, id);
 
-  *max = MIN (slot->info.chvmaxlen[0], slot->info.chvmaxlen[1]);
+  /* In version 2 of the OpenPGP card, the second counter is for the
+     reset operation, so we only take the first counter.  */
+  *max = slot->info.chvmaxlen[0];
 
   /* FIXME: This is true at least for the user pin (CHV1 and CHV2).  */
   *min = 6;
@@ -626,7 +626,9 @@ slot_token_pincount (slot_iterator_t id, int *max, int *len)
   struct slot *slot = scute_table_data (slots, id);
 
   *max = 3;
-  *len = MIN (slot->info.chvretry[0], slot->info.chvretry[1]);
+  /* In version 2 of the OpenPGP card, the second counter is for the
+     reset operation, so we only take the first counter.  */
+  *len = slot->info.chvretry[0];
 }