- pin pad changes from Stef
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@839 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
8229351cce
commit
9c5782e2b2
|
@ -253,6 +253,8 @@ static void pkcs15_init_slot(struct sc_pkcs15_card *card,
|
||||||
slot->token_info.flags |= CKF_USER_PIN_INITIALIZED
|
slot->token_info.flags |= CKF_USER_PIN_INITIALIZED
|
||||||
| CKF_TOKEN_INITIALIZED
|
| CKF_TOKEN_INITIALIZED
|
||||||
| CKF_WRITE_PROTECTED;
|
| CKF_WRITE_PROTECTED;
|
||||||
|
if (card->card->slot->capabilities & SC_SLOT_CAP_PIN_PAD)
|
||||||
|
slot->token_info.flags |= CKF_PROTECTED_AUTHENTICATION_PATH;
|
||||||
slot->fw_data = fw_data = (struct pkcs15_slot_data *) calloc(1, sizeof(*fw_data));
|
slot->fw_data = fw_data = (struct pkcs15_slot_data *) calloc(1, sizeof(*fw_data));
|
||||||
fw_data->auth_obj = auth;
|
fw_data->auth_obj = auth;
|
||||||
|
|
||||||
|
@ -448,6 +450,16 @@ static CK_RV pkcs15_login(struct sc_pkcs11_card *p11card,
|
||||||
}
|
}
|
||||||
pin = (struct sc_pkcs15_pin_info *) auth_object->data;
|
pin = (struct sc_pkcs15_pin_info *) auth_object->data;
|
||||||
|
|
||||||
|
if (p11card->card->slot->capabilities & SC_SLOT_CAP_PIN_PAD) {
|
||||||
|
/* pPin should be NULL in case of a pin pad reader, but
|
||||||
|
* some apps (e.g. older Netscapes) don't know about it.
|
||||||
|
* So we don't require that pPin == NULL, but set it to
|
||||||
|
* NULL ourselves. This way, you can supply an empty (if
|
||||||
|
* possible) or fake PIN if an application asks a PIN).
|
||||||
|
*/
|
||||||
|
pPin = NULL;
|
||||||
|
ulPinLen = 0;
|
||||||
|
} else
|
||||||
if (ulPinLen < pin->min_length ||
|
if (ulPinLen < pin->min_length ||
|
||||||
ulPinLen > pin->stored_length)
|
ulPinLen > pin->stored_length)
|
||||||
return CKR_PIN_LEN_RANGE;
|
return CKR_PIN_LEN_RANGE;
|
||||||
|
@ -498,6 +510,16 @@ static CK_RV pkcs15_change_pin(struct sc_pkcs11_card *p11card,
|
||||||
if (!(pin = slot_data_pin_info(fw_token)))
|
if (!(pin = slot_data_pin_info(fw_token)))
|
||||||
return CKR_USER_PIN_NOT_INITIALIZED;
|
return CKR_USER_PIN_NOT_INITIALIZED;
|
||||||
|
|
||||||
|
if (p11card->card->slot->capabilities & SC_SLOT_CAP_PIN_PAD) {
|
||||||
|
/* pPin should be NULL in case of a pin pad reader, but
|
||||||
|
* some apps (e.g. older Netscapes) don't know about it.
|
||||||
|
* So we don't require that pPin == NULL, but set it to
|
||||||
|
* NULL ourselves. This way, you can supply an empty (if
|
||||||
|
* possible) or fake PIN if an application asks a PIN).
|
||||||
|
*/
|
||||||
|
pOldPin = pNewPin = NULL;
|
||||||
|
ulOldLen = ulNewLen = 0;
|
||||||
|
} else
|
||||||
if (ulNewLen < pin->min_length ||
|
if (ulNewLen < pin->min_length ||
|
||||||
ulNewLen > pin->stored_length)
|
ulNewLen > pin->stored_length)
|
||||||
return CKR_PIN_LEN_RANGE;
|
return CKR_PIN_LEN_RANGE;
|
||||||
|
|
|
@ -53,6 +53,8 @@ CK_RV sc_to_cryptoki_error(int rc, int reader)
|
||||||
return CKR_TOKEN_NOT_RECOGNIZED;
|
return CKR_TOKEN_NOT_RECOGNIZED;
|
||||||
case SC_ERROR_WRONG_LENGTH:
|
case SC_ERROR_WRONG_LENGTH:
|
||||||
return CKR_DATA_LEN_RANGE;
|
return CKR_DATA_LEN_RANGE;
|
||||||
|
case SC_ERROR_INVALID_PIN_LENGTH:
|
||||||
|
return CKR_PIN_LEN_RANGE;
|
||||||
}
|
}
|
||||||
return CKR_GENERAL_ERROR;
|
return CKR_GENERAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue