1From d159a5c59c80552c3e8ea75d9bcf29b3a8e8289d Mon Sep 17 00:00:00 2001 2From: Alon Bar-Lev <alon.barlev@gmail.com> 3Date: Fri, 30 Jul 2021 20:06:36 +0300 4Subject: [PATCH] nss: use nss pkcs11.h 5 6make nss happy with its own extensions and non-standard behavior. 7[Retrieved (and updated to remove ChangeLog update) from: 8https://github.com/OpenSC/pkcs11-helper/pull/39] 9Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> 10--- 11 ChangeLog | 1 + 12 lib/_pkcs11h-crypto-nss.c | 14 ++++++++++---- 13 lib/common.h | 7 +++++++ 14 3 files changed, 18 insertions(+), 4 deletions(-) 15 16diff --git a/lib/_pkcs11h-crypto-nss.c b/lib/_pkcs11h-crypto-nss.c 17index 4b70e826..f57f9e6b 100644 18--- a/lib/_pkcs11h-crypto-nss.c 19+++ b/lib/_pkcs11h-crypto-nss.c 20@@ -48,15 +48,21 @@ 21 * POSSIBILITY OF SUCH DAMAGE. 22 */ 23 24-#include "common.h" 25- 26-#include "_pkcs11h-crypto.h" 27+#ifdef HAVE_CONFIG_H 28+#include <config.h> 29+#endif 30 31 #if defined(ENABLE_PKCS11H_ENGINE_NSS) 32-#define _PKCS11T_H_ /* required so no conflict with ours */ 33 #include <nss.h> 34 #include <cert.h> 35 36+/* Use PKCS#11 of nss to avoid conflicts and make nss happy with its own extensions */ 37+#define PKCS11_H 1 38+ 39+#include "common.h" 40+ 41+#include "_pkcs11h-crypto.h" 42+ 43 static 44 int 45 __pkcs11h_crypto_nss_initialize ( 46diff --git a/lib/common.h b/lib/common.h 47index 61a958af..2499e9c5 100644 48--- a/lib/common.h 49+++ b/lib/common.h 50@@ -72,5 +72,12 @@ 51 52 #define _PKCS11H_ASSERT assert 53 54+#ifndef FALSE 55+#define FALSE 0 56+#endif 57+#ifndef TRUE 58+#define TRUE 1 59+#endif 60+ 61 #endif 62 63