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

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