File p11-kit-pkcs11-gnu-Enable-testing-with-p11-kit-pkcs11x.h.patch of Package p11-kit.31290

From d1782b694f75f4a7c1449b2d006df7aeaffbb576 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@gnu.org>
Date: Wed, 27 Jul 2022 15:18:05 +0900
Subject: pkcs11-gnu: Enable testing with <p11-kit/pkcs11x.h>

This ensures that programs using <p11-kit/pkcs11x.h> can be compiled
with CRYPTOKI_GNU.  The previous coverage was partial as pkcs11-gnu.c
didn't include "pkcs11x.h" and Meson didn't supply -DCRYPTOKI_GNU=1.

Signed-off-by: Daiki Ueno <ueno@gnu.org>

diff --git a/p11-kit/meson.build b/p11-kit/meson.build
index 386f612..7912684 100644
--- a/p11-kit/meson.build
+++ b/p11-kit/meson.build
@@ -217,6 +217,9 @@ gnu_h = gnu_h_gen.process(pkcs11_gnu_headers)
 static_library('p11-kit-pkcs11-gnu',
                gnu_h,
                'pkcs11-gnu.c',
+               c_args: [
+                 '-DCRYPTOKI_GNU=1', '-DP11_KIT_FUTURE_UNSTABLE_API=1',
+               ],
                include_directories: [configinc, commoninc])
 
 # Tests ----------------------------------------------------------------
diff --git a/p11-kit/p11-kit.h b/p11-kit/p11-kit.h
index cc89595..aa8323e 100644
--- a/p11-kit/p11-kit.h
+++ b/p11-kit/p11-kit.h
@@ -43,12 +43,17 @@
  */
 #ifdef CRYPTOKI_GNU
 typedef ck_rv_t CK_RV;
+typedef ck_object_handle_t CK_OBJECT_HANDLE;
+typedef unsigned long int CK_ULONG;
 typedef struct ck_function_list* CK_FUNCTION_LIST_PTR;
 typedef struct ck_function_list CK_FUNCTION_LIST;
 #endif
 
 #include "p11-kit/deprecated.h"
 
+/* For size_t.  */
+#include <stddef.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/p11-kit/pkcs11-gnu.c b/p11-kit/pkcs11-gnu.c
index 86d9374..c75f4b0 100644
--- a/p11-kit/pkcs11-gnu.c
+++ b/p11-kit/pkcs11-gnu.c
@@ -1,3 +1,8 @@
+#include "config.h"
+
+#include "p11-kit.h"
+#include "pkcs11x.h"
+
 #include "pkcs11-gnu-iter.h"
 #include "pkcs11-gnu-pin.h"
 #include "pkcs11-gnu-uri.h"
-- 
2.42.0

openSUSE Build Service is sponsored by