[meta-oe] pkcs11-helper: Fix build with nss >= 3.73.1

Message ID 20211225212945.3727095-1-raj.khem@gmail.com
State New
Headers show
Series [meta-oe] pkcs11-helper: Fix build with nss >= 3.73.1 | expand

Commit Message

Khem Raj Dec. 25, 2021, 9:29 p.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../0001-nss-use-nss-pkcs11-h.patch           | 61 +++++++++++++++++++
 .../pkcs11-helper/pkcs11-helper_1.27.bb       |  1 +
 2 files changed, 62 insertions(+)
 create mode 100644 meta-oe/recipes-crypto/pkcs11-helper/pkcs11-helper/0001-nss-use-nss-pkcs11-h.patch

Patch

diff --git a/meta-oe/recipes-crypto/pkcs11-helper/pkcs11-helper/0001-nss-use-nss-pkcs11-h.patch b/meta-oe/recipes-crypto/pkcs11-helper/pkcs11-helper/0001-nss-use-nss-pkcs11-h.patch
new file mode 100644
index 0000000000..3070fc41a0
--- /dev/null
+++ b/meta-oe/recipes-crypto/pkcs11-helper/pkcs11-helper/0001-nss-use-nss-pkcs11-h.patch
@@ -0,0 +1,61 @@ 
+From 083a3a62f2e631deec2fb2799d10660a41c50294 Mon Sep 17 00:00:00 2001
+From: Alon Bar-Lev <alon.barlev@gmail.com>
+Date: Fri, 30 Jul 2021 20:06:36 +0300
+Subject: [PATCH] nss: use nss pkcs11.h
+
+make nss happy with its own extensions and non-standard behavior.
+
+Taken from Archlinux [1]
+
+[1] https://github.com/archlinux/svntogit-packages/commit/238f5e90946f527b2d4a507e02c30e977db38a97
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ lib/_pkcs11h-crypto-nss.c | 14 ++++++++++----
+ lib/common.h              |  7 +++++++
+ 2 files changed, 17 insertions(+), 4 deletions(-)
+
+--- a/lib/_pkcs11h-crypto-nss.c
++++ b/lib/_pkcs11h-crypto-nss.c
+@@ -48,15 +48,21 @@
+  * POSSIBILITY OF SUCH DAMAGE.
+  */
+ 
+-#include "common.h"
+-
+-#include "_pkcs11h-crypto.h"
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
+ 
+ #if defined(ENABLE_PKCS11H_ENGINE_NSS)
+-#define _PKCS11T_H_ /* required so no conflict with ours */
+ #include <nss.h>
+ #include <cert.h>
+ 
++/* Use PKCS#11 of nss to avoid conflicts and make nss happy with its own extensions */
++#define PKCS11_H 1
++
++#include "common.h"
++
++#include "_pkcs11h-crypto.h"
++
+ static
+ int
+ __pkcs11h_crypto_nss_initialize (
+--- a/lib/common.h
++++ b/lib/common.h
+@@ -72,5 +72,12 @@
+ 
+ #define _PKCS11H_ASSERT		assert
+ 
++#ifndef FALSE
++#define FALSE 0
++#endif
++#ifndef TRUE
++#define TRUE 1
++#endif
++
+ #endif
+ 
diff --git a/meta-oe/recipes-crypto/pkcs11-helper/pkcs11-helper_1.27.bb b/meta-oe/recipes-crypto/pkcs11-helper/pkcs11-helper_1.27.bb
index 1af9004fea..389d1bc7bb 100644
--- a/meta-oe/recipes-crypto/pkcs11-helper/pkcs11-helper_1.27.bb
+++ b/meta-oe/recipes-crypto/pkcs11-helper/pkcs11-helper_1.27.bb
@@ -17,6 +17,7 @@  LIC_FILES_CHKSUM = " \
 "
 SRC_URI = "git://github.com/OpenSC/${BPN}.git;branch=master;protocol=https \
            file://0001-build-openssl-remove-RSA_SSLV23_PADDING-constant-usa.patch \
+           file://0001-nss-use-nss-pkcs11-h.patch \
            "
 
 S = "${WORKDIR}/git"