pkcs15: don't override TokenInfo PRNG flag. pkcs11: announce CKF_RNG if the card driver supports it, bypassing PKCS#15.

GET CHALLENGE and RNG don't match 1:1 anyway.

Thanks to Andre Zepezauer for noticing this.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4661 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
martin 2010-09-01 06:23:17 +00:00
parent fc4dff1d12
commit 12a1e9d49b
2 changed files with 3 additions and 4 deletions

View File

@ -825,9 +825,6 @@ int sc_pkcs15_bind(sc_card_t *card,
goto error;
}
done:
/* If card driver states that it has a (P)RNG, overwrite (possibly missing) tokeninfo flags */
if (card->caps & SC_CARD_CAP_RNG)
p15card->flags |= SC_PKCS15_CARD_FLAG_PRN_GENERATION;
/* for starcos cards only: fix asn1 integers */
if (strcmp(p15card->card->driver->short_name,"starcos") == 0

View File

@ -722,8 +722,10 @@ static void pkcs15_init_slot(struct sc_pkcs15_card *p15card,
if (p15card->card->reader->capabilities & SC_READER_CAP_PIN_PAD) {
slot->token_info.flags |= CKF_PROTECTED_AUTHENTICATION_PATH;
}
if (p15card->card->caps & SC_CARD_CAP_RNG)
if (p15card->card->caps & SC_CARD_CAP_RNG && p15card->card->ops->get_challenge != NULL)
slot->token_info.flags |= CKF_RNG;
slot->fw_data = fw_data = calloc(1, sizeof(*fw_data));
fw_data->auth_obj = auth;