From 12f7dbbb3dc50edd79052c28cdba7860ba5111dd Mon Sep 17 00:00:00 2001 From: Ingo Franzki Date: Fri, 10 Jun 2022 14:35:08 +0200 Subject: [PATCH] zkey: Fix EP11 host library version checking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extract the minor version and modification level separately. Previously only the modification level has been extracted, and was reported as minor version. Currently no one is checking the minor version or modification level, so it does not hurt. But maybe in the future one will check, so report it correctly. Signed-off-by: Ingo Franzki Signed-off-by: Jan Höppner --- zkey/ep11.c | 8 +++++--- zkey/ep11.h | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/zkey/ep11.c b/zkey/ep11.c index e0c80cbd..58dc3c58 100644 --- a/zkey/ep11.c +++ b/zkey/ep11.c @@ -63,7 +63,8 @@ static int get_ep11_version(struct ep11_lib *ep11, bool verbose) pr_verbose(verbose, "host_version: 0x%08x", host_version); ep11->version.major = (host_version & 0x00FF0000) >> 16; - ep11->version.minor = host_version & 0x000000FF; + ep11->version.minor = (host_version & 0x0000FF00) >> 8; + ep11->version.modification = host_version & 0x000000FF; /* * EP11 host library < v2.0 returns an invalid version (i.e. 0x100). * This can safely be treated as version 1.0 @@ -73,8 +74,9 @@ static int get_ep11_version(struct ep11_lib *ep11, bool verbose) ep11->version.minor = 0; } - pr_verbose(verbose, "EP11 library version: %u.%u", - ep11->version.major, ep11->version.minor); + pr_verbose(verbose, "EP11 library version: %u.%u.%u", + ep11->version.major, ep11->version.minor, + ep11->version.modification); return 0; } diff --git a/zkey/ep11.h b/zkey/ep11.h index fe90cfd4..6ad5bedc 100644 --- a/zkey/ep11.h +++ b/zkey/ep11.h @@ -140,8 +140,9 @@ typedef long (*xcpa_internal_rv_t)(const unsigned char *rsp, size_t rlen, struct XCPadmresp *rspblk, CK_RV *rv); struct ep11_version { - unsigned int minor; unsigned int major; + unsigned int minor; + unsigned int modification; }; struct ep11_lib {