36 lines
1.3 KiB
Diff
36 lines
1.3 KiB
Diff
From 577471d781d1ee0365f6739b1cfc1c9c566c893a Mon Sep 17 00:00:00 2001
|
|
From: Jakub Jelen <jjelen@redhat.com>
|
|
Date: Mon, 3 Mar 2025 15:54:07 +0100
|
|
Subject: [PATCH] utils: Do not fail if non-mandatory attribute is not
|
|
available
|
|
|
|
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
|
|
---
|
|
src/util.c | 9 ++++++---
|
|
1 file changed, 6 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/util.c b/src/util.c
|
|
index 66a3bd0..a956f9d 100644
|
|
--- a/src/util.c
|
|
+++ b/src/util.c
|
|
@@ -34,10 +34,13 @@ CK_RV p11prov_fetch_attributes(P11PROV_CTX *ctx, P11PROV_SESSION *session,
|
|
unsigned long retrnums = 0;
|
|
for (size_t i = 0; i < attrnums; i++) {
|
|
if (q[i].ulValueLen == CK_UNAVAILABLE_INFORMATION) {
|
|
- /* This can't happen according to the algorithm described
|
|
- * in the spec when the call returns CKR_OK. */
|
|
+ /* This means the attribute is valid, but not available for a
|
|
+ * given object. Just skip it, unless it is required */
|
|
+ if (!attrs[i].required) {
|
|
+ continue;
|
|
+ }
|
|
ret = CKR_GENERAL_ERROR;
|
|
- P11PROV_raise(ctx, ret, "Failed to get attributes");
|
|
+ P11PROV_raise(ctx, ret, "Failed to get required attributes");
|
|
goto done;
|
|
}
|
|
if (attrs[i].allocate) {
|
|
--
|
|
2.48.1
|
|
|