From 33fc534a81b7c163936064c96f1fb902255f7ff1 Mon Sep 17 00:00:00 2001 From: Ingo Franzki Date: Thu, 3 Apr 2025 11:26:47 +0200 Subject: [PATCH] zkey: Adjust CCA host library version detection for newer CCA versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Newer CCA versions might report the version string with CSUACFV or CSUACFQ with keyword STATCCA using a different indicator character after the version information. Ignore the indication character and the remaining data entirely. Only the version information as such is of interest. Signed-off-by: Ingo Franzki Signed-off-by: Jan Höppner --- zkey/cca.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/zkey/cca.c b/zkey/cca.c index 71c08ad1..9d79c4b3 100644 --- a/zkey/cca.c +++ b/zkey/cca.c @@ -91,7 +91,6 @@ static int get_cca_version(struct cca_lib *cca, bool verbose) long return_code, reason_code; long version_data_length; long exit_data_len = 0; - char date[20]; util_assert(cca != NULL, "Internal error: cca is NULL"); @@ -111,8 +110,8 @@ static int get_cca_version(struct cca_lib *cca, bool verbose) version_data[sizeof(version_data) - 1] = '\0'; pr_verbose(verbose, "CCA Version string: %s", version_data); - if (sscanf((char *)version_data, "%u.%u.%uz%s", &cca->version.ver, - &cca->version.rel, &cca->version.mod, date) != 4) { + if (sscanf((char *)version_data, "%u.%u.%u", &cca->version.ver, + &cca->version.rel, &cca->version.mod) != 3) { warnx("CCA library version is invalid: %s", version_data); return -EINVAL; } @@ -536,7 +535,7 @@ static int get_cca_adapter_version(struct cca_lib *cca, pr_verbose(verbose, "CCA firmware version string: %s", version_data); - if (sscanf((char *)version_data, "%u.%u.%uz", &version->ver, + if (sscanf((char *)version_data, "%u.%u.%u", &version->ver, &version->rel, &version->mod) != 3) { warnx("CCA formware version is invalid: %s", version_data); return -EINVAL;