File: 0006-Answer-CKA_LABEL-attribute-request-with-dummy-value.patch

package info (click to toggle)
simple-tpm-pk11 0.06-6
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 448 kB
  • sloc: cpp: 2,623; makefile: 119; exp: 48; sh: 7
file content (36 lines) | stat: -rw-r--r-- 1,139 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From: Thomas Habets <thomas@habets.se>
Date: Thu, 16 May 2019 00:12:53 +0100
Subject: Answer CKA_LABEL attribute request with dummy value

A bug in RedHat's patched OpenSSH is preventing empty string, so
providing a one-letter dummy label is the workaround.

Fixes #48
---
 src/session.cc | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/session.cc b/src/session.cc
index 655673d..a8a1dec 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -243,6 +243,19 @@ Session::GetAttributeValue(CK_OBJECT_HANDLE hObject,
       pTemplate[i].ulValueLen = 0;
       break;
 
+    case CKA_LABEL:
+      config_.debug_log("   Attribute %d: Label (unsupported)", i);
+      if (pTemplate[i].pValue) {
+        *static_cast<char*>(pTemplate[i].pValue) = 'x';
+      }
+      pTemplate[i].ulValueLen = 1;
+      break;
+
+    case 0x202: // CKA_ALWAYS_AUTHENTICATE:
+      config_.debug_log("   Attribute %d: Always authenticate (unsupported)", i);
+      pTemplate[i].ulValueLen = 0;
+      break;
+
     default:
       config_.debug_log("   Attribute %d: Unknown (%d)", i, pTemplate[i].type);
       pTemplate[i].ulValueLen = 0;