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

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