Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP1
openCryptoki.14879
ocki-3.11.1-EP11-Support-tolerated-new-crypto-c...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ocki-3.11.1-EP11-Support-tolerated-new-crypto-cards.patch of Package openCryptoki.14879
From d6ba9ff61743ce869a5a677f6f77339642efef4b Mon Sep 17 00:00:00 2001 From: Ingo Franzki <ifranzki@linux.ibm.com> Date: Tue, 24 Sep 2019 14:35:59 +0200 Subject: [PATCH] EP11: Support tolerated new crypto cards With just toleration support of new crypt cards, new crypto cards are reported as the last known crypto card version. E.g. a CEX7 card is reported as CEX6, when CEX6 is the last known crypto card version. The EP11 token checks the card versions and needs to distinguish tolerated cards from supported cards. New (tolerated) crypto cards may have different API and firmware versions, and thus need to be handled differently. Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com> --- usr/lib/ep11_stdll/ep11_specific.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/usr/lib/ep11_stdll/ep11_specific.c b/usr/lib/ep11_stdll/ep11_specific.c index e22dad5d..a65accea 100644 --- a/usr/lib/ep11_stdll/ep11_specific.c +++ b/usr/lib/ep11_stdll/ep11_specific.c @@ -8205,6 +8205,7 @@ static CK_RV get_card_type(uint_32 adapter, CK_ULONG *type) char fname[PATH_MAX]; char buf[250]; CK_RV rc; + CK_ULONG hwtype, rawtype; sprintf(fname, "%scard%02x/type", SYSFS_DEVICES_AP, adapter); rc = file_fgets(fname, buf, sizeof(buf)); @@ -8212,6 +8213,28 @@ static CK_RV get_card_type(uint_32 adapter, CK_ULONG *type) return rc; if (sscanf(buf, "CEX%luP", type) != 1) return CKR_FUNCTION_FAILED; + + sprintf(fname, "%scard%02x/hwtype", SYSFS_DEVICES_AP, adapter); + rc = file_fgets(fname, buf, sizeof(buf)); + if (rc != CKR_OK) + return rc; + if (sscanf(buf, "%lu", &hwtype) != 1) + return CKR_FUNCTION_FAILED; + + sprintf(fname, "%scard%02x/raw_hwtype", SYSFS_DEVICES_AP, adapter); + rc = file_fgets(fname, buf, sizeof(buf)); + if (rc != CKR_OK) + return rc; + if (sscanf(buf, "%lu", &rawtype) != 1) + return CKR_FUNCTION_FAILED; + + if (rawtype > hwtype) { + TRACE_DEVEL("%s adapter: %u hwtype: %lu raw_hwtype: %lu\n", + __func__, adapter, hwtype, rawtype); + /* Tolerated new card level: report calculated type */ + *type += (rawtype - hwtype); + } + return CKR_OK; } -- 2.13.7
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor