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

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