138 lines
5.0 KiB
Diff
138 lines
5.0 KiB
Diff
|
From 4cad40e594b916ef3416dd574304b2c60138a6fe Mon Sep 17 00:00:00 2001
|
||
|
From: Ingo Franzki <ifranzki@linux.ibm.com>
|
||
|
Date: Mon, 19 Sep 2022 09:01:13 +0200
|
||
|
Subject: [PATCH 13/34] EP11: Support EP11 host library version 4
|
||
|
|
||
|
Try to load the EP11 host library version 4 (libep11.so.4) first,
|
||
|
but fall back to version 3, 2, 1, or even the un-versioned shared library.
|
||
|
|
||
|
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
|
||
|
---
|
||
|
usr/lib/ep11_stdll/ep11_specific.c | 15 ++++++++++++---
|
||
|
usr/sbin/pkcsep11_migrate/pkcsep11_migrate.c | 11 +++++++++--
|
||
|
usr/sbin/pkcsep11_session/pkcsep11_session.c | 11 +++++++++--
|
||
|
3 files changed, 30 insertions(+), 7 deletions(-)
|
||
|
|
||
|
diff --git a/usr/lib/ep11_stdll/ep11_specific.c b/usr/lib/ep11_stdll/ep11_specific.c
|
||
|
index 1dbfe0f5..304989fc 100644
|
||
|
--- a/usr/lib/ep11_stdll/ep11_specific.c
|
||
|
+++ b/usr/lib/ep11_stdll/ep11_specific.c
|
||
|
@@ -66,6 +66,7 @@
|
||
|
#include "pkey_utils.h"
|
||
|
|
||
|
#define EP11SHAREDLIB_NAME "OCK_EP11_LIBRARY"
|
||
|
+#define EP11SHAREDLIB_V4 "libep11.so.4"
|
||
|
#define EP11SHAREDLIB_V3 "libep11.so.3"
|
||
|
#define EP11SHAREDLIB_V2 "libep11.so.2"
|
||
|
#define EP11SHAREDLIB_V1 "libep11.so.1"
|
||
|
@@ -2209,9 +2210,17 @@ static void *ep11_load_host_lib()
|
||
|
return lib_ep11;
|
||
|
}
|
||
|
|
||
|
- ep11_lib_name = EP11SHAREDLIB_V3;
|
||
|
+ ep11_lib_name = EP11SHAREDLIB_V4;
|
||
|
lib_ep11 = dlopen(ep11_lib_name, DLOPEN_FLAGS);
|
||
|
|
||
|
+ if (lib_ep11 == NULL) {
|
||
|
+ TRACE_DEVEL("%s Error loading shared library '%s', trying '%s'\n",
|
||
|
+ __func__, EP11SHAREDLIB_V4, EP11SHAREDLIB_V3);
|
||
|
+ /* Try version 3 instead */
|
||
|
+ ep11_lib_name = EP11SHAREDLIB_V3;
|
||
|
+ lib_ep11 = dlopen(ep11_lib_name, DLOPEN_FLAGS);
|
||
|
+ }
|
||
|
+
|
||
|
if (lib_ep11 == NULL) {
|
||
|
TRACE_DEVEL("%s Error loading shared library '%s', trying '%s'\n",
|
||
|
__func__, EP11SHAREDLIB_V3, EP11SHAREDLIB_V2);
|
||
|
@@ -2239,9 +2248,9 @@ static void *ep11_load_host_lib()
|
||
|
if (lib_ep11 == NULL) {
|
||
|
errstr = dlerror();
|
||
|
OCK_SYSLOG(LOG_ERR,
|
||
|
- "%s: Error loading shared library '%s[.3|.2|.1]' [%s]\n",
|
||
|
+ "%s: Error loading shared library '%s[.4][.3|.2|.1]' [%s]\n",
|
||
|
__func__, EP11SHAREDLIB, errstr);
|
||
|
- TRACE_ERROR("%s Error loading shared library '%s[.3|.2|.1]' [%s]\n",
|
||
|
+ TRACE_ERROR("%s Error loading shared library '%s[.4][.3|.2|.1]' [%s]\n",
|
||
|
__func__, EP11SHAREDLIB, errstr);
|
||
|
return NULL;
|
||
|
}
|
||
|
diff --git a/usr/sbin/pkcsep11_migrate/pkcsep11_migrate.c b/usr/sbin/pkcsep11_migrate/pkcsep11_migrate.c
|
||
|
index 4a42a085..f80cfa9f 100644
|
||
|
--- a/usr/sbin/pkcsep11_migrate/pkcsep11_migrate.c
|
||
|
+++ b/usr/sbin/pkcsep11_migrate/pkcsep11_migrate.c
|
||
|
@@ -30,6 +30,7 @@
|
||
|
#include "pin_prompt.h"
|
||
|
|
||
|
#define EP11SHAREDLIB_NAME "OCK_EP11_LIBRARY"
|
||
|
+#define EP11SHAREDLIB_V4 "libep11.so.4"
|
||
|
#define EP11SHAREDLIB_V3 "libep11.so.3"
|
||
|
#define EP11SHAREDLIB_V2 "libep11.so.2"
|
||
|
#define EP11SHAREDLIB_V1 "libep11.so.1"
|
||
|
@@ -424,9 +425,15 @@ static void *ep11_load_host_lib()
|
||
|
return lib_ep11;
|
||
|
}
|
||
|
|
||
|
- ep11_lib_name = EP11SHAREDLIB_V3;
|
||
|
+ ep11_lib_name = EP11SHAREDLIB_V4;
|
||
|
lib_ep11 = dlopen(ep11_lib_name, DLOPEN_FLAGS);
|
||
|
|
||
|
+ if (lib_ep11 == NULL) {
|
||
|
+ /* Try version 3 instead */
|
||
|
+ ep11_lib_name = EP11SHAREDLIB_V3;
|
||
|
+ lib_ep11 = dlopen(ep11_lib_name, DLOPEN_FLAGS);
|
||
|
+ }
|
||
|
+
|
||
|
if (lib_ep11 == NULL) {
|
||
|
/* Try version 2 instead */
|
||
|
ep11_lib_name = EP11SHAREDLIB_V2;
|
||
|
@@ -447,7 +454,7 @@ static void *ep11_load_host_lib()
|
||
|
|
||
|
if (lib_ep11 == NULL) {
|
||
|
errstr = dlerror();
|
||
|
- fprintf(stderr, "Error loading shared library '%s[.3|.2|.1]' [%s]\n",
|
||
|
+ fprintf(stderr, "Error loading shared library '%s[.4|.3|.2|.1]' [%s]\n",
|
||
|
EP11SHAREDLIB, errstr);
|
||
|
return NULL;
|
||
|
}
|
||
|
diff --git a/usr/sbin/pkcsep11_session/pkcsep11_session.c b/usr/sbin/pkcsep11_session/pkcsep11_session.c
|
||
|
index 0c210135..b7b9e9c4 100644
|
||
|
--- a/usr/sbin/pkcsep11_session/pkcsep11_session.c
|
||
|
+++ b/usr/sbin/pkcsep11_session/pkcsep11_session.c
|
||
|
@@ -35,6 +35,7 @@
|
||
|
#include "pin_prompt.h"
|
||
|
|
||
|
#define EP11SHAREDLIB_NAME "OCK_EP11_LIBRARY"
|
||
|
+#define EP11SHAREDLIB_V4 "libep11.so.4"
|
||
|
#define EP11SHAREDLIB_V3 "libep11.so.3"
|
||
|
#define EP11SHAREDLIB_V2 "libep11.so.2"
|
||
|
#define EP11SHAREDLIB_V1 "libep11.so.1"
|
||
|
@@ -1050,9 +1051,15 @@ static void *ep11_load_host_lib()
|
||
|
return lib_ep11;
|
||
|
}
|
||
|
|
||
|
- ep11_lib_name = EP11SHAREDLIB_V3;
|
||
|
+ ep11_lib_name = EP11SHAREDLIB_V4;
|
||
|
lib_ep11 = dlopen(ep11_lib_name, DLOPEN_FLAGS);
|
||
|
|
||
|
+ if (lib_ep11 == NULL) {
|
||
|
+ /* Try version 3 instead */
|
||
|
+ ep11_lib_name = EP11SHAREDLIB_V3;
|
||
|
+ lib_ep11 = dlopen(ep11_lib_name, DLOPEN_FLAGS);
|
||
|
+ }
|
||
|
+
|
||
|
if (lib_ep11 == NULL) {
|
||
|
/* Try version 2 instead */
|
||
|
ep11_lib_name = EP11SHAREDLIB_V2;
|
||
|
@@ -1073,7 +1080,7 @@ static void *ep11_load_host_lib()
|
||
|
|
||
|
if (lib_ep11 == NULL) {
|
||
|
errstr = dlerror();
|
||
|
- fprintf(stderr, "Error loading shared library '%s[.3|.2|.1]' [%s]\n",
|
||
|
+ fprintf(stderr, "Error loading shared library '%s[.4|.3|.2|.1]' [%s]\n",
|
||
|
EP11SHAREDLIB, errstr);
|
||
|
return NULL;
|
||
|
}
|
||
|
--
|
||
|
2.16.2.windows.1
|
||
|
|