Corrected highly misleading, confusing and ambiguous use of PIN length_offset
field. Now only the PIN offset fields are used.
This change synchronizes the code with similar changes in reader-pcsc.c
(commit eb3e00a385
).
This commit is contained in:
parent
57f37ffd8d
commit
7c8c77cf1f
@ -325,9 +325,6 @@ TKSmartCardPINFormat *getPINFormat(struct sc_pin_cmd_pin *pin)
|
|||||||
}
|
}
|
||||||
format.minPINLength = pin->min_length;
|
format.minPINLength = pin->min_length;
|
||||||
format.maxPINLength = pin->max_length;
|
format.maxPINLength = pin->max_length;
|
||||||
if (pin->length_offset > 4) {
|
|
||||||
format.PINLengthBitOffset = (pin->length_offset-5)*8;
|
|
||||||
}
|
|
||||||
|
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
@ -363,7 +360,7 @@ int cryptotokenkit_perform_verify(struct sc_reader *reader, struct sc_pin_cmd_da
|
|||||||
case SC_PIN_CMD_VERIFY:
|
case SC_PIN_CMD_VERIFY:
|
||||||
format = getPINFormat(pin_ref);
|
format = getPINFormat(pin_ref);
|
||||||
NSInteger offset;
|
NSInteger offset;
|
||||||
if (data->pin1.length_offset != 4) {
|
if (data->pin1.offset >= 5) {
|
||||||
offset = data->pin1.offset - 5;
|
offset = data->pin1.offset - 5;
|
||||||
} else {
|
} else {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
@ -378,13 +375,10 @@ int cryptotokenkit_perform_verify(struct sc_reader *reader, struct sc_pin_cmd_da
|
|||||||
/* TODO: set confirmation and text */
|
/* TODO: set confirmation and text */
|
||||||
format = getPINFormat(pin_ref);
|
format = getPINFormat(pin_ref);
|
||||||
NSInteger oldOffset, newOffset;
|
NSInteger oldOffset, newOffset;
|
||||||
if (data->pin1.length_offset != 4) {
|
|
||||||
oldOffset = data->pin1.offset - 5;
|
/* Set offsets if available, otherwise default to 0 */
|
||||||
newOffset = data->pin2.offset - 5;
|
oldOffset = (data->pin1.offset >= 5 ? data->pin1.offset - 5 : 0);
|
||||||
} else {
|
newOffset = (data->pin2.offset >= 5 ? data->pin2.offset - 5 : 0);
|
||||||
oldOffset = 0;
|
|
||||||
newOffset = 0;
|
|
||||||
}
|
|
||||||
interaction = [priv->tksmartcard userInteractionForSecurePINChangeWithPINFormat:format APDU:apdu currentPINByteOffset:oldOffset newPINByteOffset:newOffset];
|
interaction = [priv->tksmartcard userInteractionForSecurePINChangeWithPINFormat:format APDU:apdu currentPINByteOffset:oldOffset newPINByteOffset:newOffset];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user