move CK_VERSION data from 'pkcs15' to 'sc-card'

CK_VERSION is included into PKCS#11 data but is not specified by PKCS#15.

CK_VERSION can be provided by card's pkcs15 emulator or by the card's driver,
including the cards with the native support of pkcs#15 (and thus without pkcs15 emulator).

That's why the more general solution is to have these data included into 'sc-card' data type.
This commit is contained in:
Viktor Tarasov 2012-10-21 16:08:04 +02:00
parent aaedef70b5
commit 4cf3a3b204
5 changed files with 18 additions and 18 deletions

View File

@ -526,7 +526,8 @@ typedef struct sc_card {
struct sc_card_cache cache;
sc_serial_number_t serialnr;
struct sc_serial_number serialnr;
struct sc_version version;
void *mutex;
#ifdef ENABLE_SM

View File

@ -491,10 +491,10 @@ static int sc_pkcs15emu_sc_hsm_init (sc_pkcs15_card_t * p15card)
r = sc_select_file(card, &path, &file);
LOG_TEST_RET(card->ctx, r, "Could not select SmartCard-HSM application");
p15card->tokeninfo->hw_major = 24; // JCOP 2.4.1r3
p15card->tokeninfo->hw_minor = 13;
p15card->tokeninfo->fw_major = file->prop_attr[file->prop_attr_len - 2];
p15card->tokeninfo->fw_minor = file->prop_attr[file->prop_attr_len - 1];
p15card->card->version.hw_major = 24; // JCOP 2.4.1r3
p15card->card->version.hw_minor = 13;
p15card->card->version.fw_major = file->prop_attr[file->prop_attr_len - 2];
p15card->card->version.fw_minor = file->prop_attr[file->prop_attr_len - 1];
sc_file_free(file);

View File

@ -572,14 +572,6 @@ typedef struct sc_pkcs15_tokeninfo {
size_t num_seInfo;
struct sc_supported_algo_info supported_algos[SC_MAX_SUPPORTED_ALGORITHMS];
// Additional information, not contained in on-card TokenInfo structure, but filled
// in by the card driver
unsigned char hw_major;
unsigned char hw_minor;
unsigned char fw_major;
unsigned char fw_minor;
} sc_pkcs15_tokeninfo_t;
struct sc_pkcs15_operations {
@ -611,7 +603,6 @@ typedef struct sc_pkcs15_card {
int pin_cache_ignore_user_consent;
} opts;
unsigned int magic;
void *dll_handle; /* shared lib for emulated cards */

View File

@ -82,6 +82,14 @@ struct sc_iid {
size_t len;
};
struct sc_version {
unsigned char hw_major;
unsigned char hw_minor;
unsigned char fw_major;
unsigned char fw_minor;
};
/* Discretionary ASN.1 data object */
struct sc_ddo {
struct sc_aid aid;

View File

@ -329,10 +329,10 @@ pkcs15_init_token_info(struct sc_pkcs15_card *p15card, CK_TOKEN_INFO_PTR pToken)
pToken->ulFreePublicMemory = CK_UNAVAILABLE_INFORMATION;
pToken->ulTotalPrivateMemory = CK_UNAVAILABLE_INFORMATION;
pToken->ulFreePrivateMemory = CK_UNAVAILABLE_INFORMATION;
pToken->hardwareVersion.major = p15card->tokeninfo->hw_major;
pToken->hardwareVersion.minor = p15card->tokeninfo->hw_minor;
pToken->firmwareVersion.major = p15card->tokeninfo->fw_major;
pToken->firmwareVersion.minor = p15card->tokeninfo->fw_minor;
pToken->hardwareVersion.major = p15card->card->version.hw_major;
pToken->hardwareVersion.minor = p15card->card->version.hw_minor;
pToken->firmwareVersion.major = p15card->card->version.fw_major;
pToken->firmwareVersion.minor = p15card->card->version.fw_minor;
}
#ifdef USE_PKCS15_INIT