cardos: create pin in mf

If cardos cards are initialized by other software and there is a pinref
without the msb set, also the pin verify works without that bit set.

This patch changes pin initialisation so that the pin is created in mf
which has the effect that pin verify works without | 0x80 to the
pin ref.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
This commit is contained in:
Andreas Kemnade 2018-06-07 06:41:53 +02:00 committed by Frank Morgner
parent 694822554e
commit 23706635a8
1 changed files with 2 additions and 2 deletions

View File

@ -201,7 +201,7 @@ cardos_create_pin(sc_profile_t *profile, sc_pkcs15_card_t *p15card, sc_file_t *d
if (auth_info->auth_type != SC_PKCS15_PIN_AUTH_TYPE_PIN)
return SC_ERROR_OBJECT_NOT_VALID;
r = sc_select_file(card, &df->path, NULL);
r = sc_select_file(card, auth_info->attrs.pin.reference & 0x80 ? &df->path : sc_get_mf_path(), NULL);
if (r < 0)
return r;
@ -499,7 +499,7 @@ cardos_store_pin(sc_profile_t *profile, sc_card_t *card,
/* object address: class, id */
tlv_next(&tlv, 0x83);
tlv_add(&tlv, 0x00); /* class byte: usage TEST, k=0 */
tlv_add(&tlv, auth_info->attrs.pin.reference);
tlv_add(&tlv, auth_info->attrs.pin.reference & 0x7f);
/* parameters */
tlv_next(&tlv, 0x85);