Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

pksc11: Added ability to indicate hardware and firmware version infor…

…mation at PKCS#11 interface
  • Loading branch information...
commit fba298c6f44da9cdb1a9445ec6a561ae472b8195 1 parent 6b7d8af
Andreas Schwier authored viktorTarasov committed
View
6 src/libopensc/pkcs15-sc-hsm.c
@@ -490,6 +490,12 @@ static int sc_pkcs15emu_sc_hsm_init (sc_pkcs15_card_t * p15card)
sc_path_set(&path, SC_PATH_TYPE_DF_NAME, sc_hsm_aid.value, sc_hsm_aid.len, 0, 0);
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];
+
sc_file_free(file);
// Read device certificate to determine serial number
View
8 src/libopensc/pkcs15.h
@@ -572,6 +572,14 @@ 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 {
View
8 src/pkcs11/framework-pkcs15.c
@@ -327,10 +327,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 = 0;
- pToken->hardwareVersion.minor = 0;
- pToken->firmwareVersion.major = 0;
- pToken->firmwareVersion.minor = 0;
+ 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;
}
#ifdef USE_PKCS15_INIT
View
12 src/tools/pkcs11-tool.c
@@ -955,18 +955,20 @@ static void show_token(CK_SLOT_ID slot)
return;
}
- printf(" token label: %s\n",
+ printf(" token label : %s\n",
p11_utf8_to_local(info.label,
sizeof(info.label)));
- printf(" token manuf: %s\n",
+ printf(" token manufacturer : %s\n",
p11_utf8_to_local(info.manufacturerID,
sizeof(info.manufacturerID)));
- printf(" token model: %s\n",
+ printf(" token model : %s\n",
p11_utf8_to_local(info.model,
sizeof(info.model)));
- printf(" token flags: %s\n",
+ printf(" token flags : %s\n",
p11_token_info_flags(info.flags));
- printf(" serial num : %s\n", p11_utf8_to_local(info.serialNumber,
+ printf(" hardware version : %d.%d\n", info.hardwareVersion.major, info.hardwareVersion.minor);
+ printf(" firmware version : %d.%d\n", info.firmwareVersion.major, info.firmwareVersion.minor);
+ printf(" serial num : %s\n", p11_utf8_to_local(info.serialNumber,
sizeof(info.serialNumber)));
}
Please sign in to comment.
Something went wrong with that request. Please try again.