Blame SOURCES/0034-EP11-Fix-setting-unknown-CPs-to-ON.patch

447573
From 45bc6dd09fb59d78ce9b2bca7125cfc2275f9bd1 Mon Sep 17 00:00:00 2001
447573
From: Ingo Franzki <ifranzki@linux.ibm.com>
447573
Date: Wed, 25 Jan 2023 13:21:44 +0100
447573
Subject: [PATCH 34/34] EP11: Fix setting unknown CPs to ON
447573
447573
The very last control point must also be applied from the queried bits to
447573
the combined bits. Otherwise the very last control point is always treated
447573
as being ON, although it might be OFF, and this can lead to mechanisms being
447573
used that are disabled by that control point.
447573
447573
Fixes https://github.com/opencryptoki/opencryptoki/commit/97248f73495695436f11fafd74c2ec41a5a6f796
447573
447573
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
447573
---
447573
 usr/lib/ep11_stdll/ep11_specific.c | 8 ++++----
447573
 1 file changed, 4 insertions(+), 4 deletions(-)
447573
447573
diff --git a/usr/lib/ep11_stdll/ep11_specific.c b/usr/lib/ep11_stdll/ep11_specific.c
447573
index d5d3de91..25ce82fe 100644
447573
--- a/usr/lib/ep11_stdll/ep11_specific.c
447573
+++ b/usr/lib/ep11_stdll/ep11_specific.c
447573
@@ -11340,8 +11340,8 @@ static CK_RV control_point_handler(uint_32 adapter, uint_32 domain,
447573
     if (data->first) {
447573
         data->first_adapter = adapter;
447573
         data->first_domain = domain;
447573
-        /* Apply CP bits 0 to max_cp_index-1 only */
447573
-        for (i = 0; i < max_cp_index; i++) {
447573
+        /* Apply CP bits 0 to max_cp_index only */
447573
+        for (i = 0; i <= max_cp_index; i++) {
447573
             data->combined_cp[CP_BYTE_NO(i)] &=
447573
                                     (cp[CP_BYTE_NO(i)] | ~CP_BIT_MASK(i));
447573
         }
447573
@@ -11362,8 +11362,8 @@ static CK_RV control_point_handler(uint_32 adapter, uint_32 domain,
447573
                        data->first_domain);
447573
         }
447573
 
447573
-        for (i = 0; i < max_cp_index; i++) {
447573
-            /* Apply CP bits 0 to max_cp_index-1 only */
447573
+        for (i = 0; i <= max_cp_index; i++) {
447573
+            /* Apply CP bits 0 to max_cp_index only */
447573
             data->combined_cp[CP_BYTE_NO(i)] &=
447573
                                     (cp[CP_BYTE_NO(i)] | ~CP_BIT_MASK(i));
447573
         }
447573
-- 
447573
2.16.2.windows.1
447573