* fails only with 32bit MACHINEs, e.g. full log from qemux86:
  http://errors.yoctoproject.org/Errors/Details/790494/

Signed-off-by: Martin Jansa <[email protected]>
---
 ...001-Fix-types-for-old-32-bit-systems.patch | 49 +++++++++++++++++++
 .../pkcs11-provider/pkcs11-provider_0.3.bb    |  4 +-
 2 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 
meta-oe/recipes-support/pkcs11-provider/pkcs11-provider/0001-Fix-types-for-old-32-bit-systems.patch

diff --git 
a/meta-oe/recipes-support/pkcs11-provider/pkcs11-provider/0001-Fix-types-for-old-32-bit-systems.patch
 
b/meta-oe/recipes-support/pkcs11-provider/pkcs11-provider/0001-Fix-types-for-old-32-bit-systems.patch
new file mode 100644
index 0000000000..189a0e21b3
--- /dev/null
+++ 
b/meta-oe/recipes-support/pkcs11-provider/pkcs11-provider/0001-Fix-types-for-old-32-bit-systems.patch
@@ -0,0 +1,49 @@
+From 088f038de633b5de777fb0f95cd9598f320151f6 Mon Sep 17 00:00:00 2001
+From: Simo Sorce <[email protected]>
+Date: Wed, 5 Jun 2024 11:22:35 -0400
+Subject: [PATCH] Fix types for old 32 bit systems
+
+On x86 CK_ULONG and size_t have different sizes, ensure we use
+compatible types on our helper functions.
+
+Signed-off-by: Simo Sorce <[email protected]>
+Signed-off-by: Martin Jansa <[email protected]>
+---
+Upstream-Status: Backport 
[https://github.com/latchset/pkcs11-provider/commit/9fa16b7fd398b62f06cb10892fe93dc574d67399]
+
+ src/asymmetric_cipher.c | 4 ++--
+ src/util.h              | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/asymmetric_cipher.c b/src/asymmetric_cipher.c
+index 4d87b1c..3256fd2 100644
+--- a/src/asymmetric_cipher.c
++++ b/src/asymmetric_cipher.c
+@@ -251,12 +251,12 @@ static int p11prov_rsaenc_decrypt_init(void *ctx, void 
*provkey,
+ static int
+ p11prov_tls_constant_time_depadding(struct p11prov_rsaenc_ctx *encctx,
+                                     unsigned char *out, unsigned char *buf,
+-                                    size_t *out_size, CK_ULONG *ret_cond)
++                                    CK_ULONG *out_size, CK_ULONG *ret_cond)
+ {
+     unsigned char randbuf[SSL_MAX_MASTER_KEY_LENGTH];
+     CK_ULONG ver_cond = 0;
+     CK_ULONG cond = 0;
+-    size_t length = SSL_MAX_MASTER_KEY_LENGTH;
++    CK_ULONG length = SSL_MAX_MASTER_KEY_LENGTH;
+     int err;
+ 
+     /* always generate a random buffer, to constant_time swap in
+diff --git a/src/util.h b/src/util.h
+index bcbc2db..1b24666 100644
+--- a/src/util.h
++++ b/src/util.h
+@@ -120,7 +120,7 @@ static inline int constant_select_int(CK_ULONG cond, int 
a, int b)
+     return (int)((A & mask) | (B & ~mask));
+ }
+ 
+-static inline void constant_select_buf(CK_ULONG cond, size_t size,
++static inline void constant_select_buf(CK_ULONG cond, CK_ULONG size,
+                                        unsigned char *dst, unsigned char *a,
+                                        unsigned char *b)
+ {
diff --git a/meta-oe/recipes-support/pkcs11-provider/pkcs11-provider_0.3.bb 
b/meta-oe/recipes-support/pkcs11-provider/pkcs11-provider_0.3.bb
index 816ee967c1..daf0c2137d 100644
--- a/meta-oe/recipes-support/pkcs11-provider/pkcs11-provider_0.3.bb
+++ b/meta-oe/recipes-support/pkcs11-provider/pkcs11-provider_0.3.bb
@@ -18,7 +18,9 @@ DEPENDS = "\
 
 SRCREV = "58040b4e32975cc1d7f39e424ee7b0097cd11311"
 
-SRC_URI = "git://github.com/latchset/${BPN}.git;branch=main;protocol=https"
+SRC_URI = "git://github.com/latchset/${BPN}.git;branch=main;protocol=https \
+    file://0001-Fix-types-for-old-32-bit-systems.patch \
+"
 
 S = "${WORKDIR}/git"
 
-- 
2.45.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#111317): 
https://lists.openembedded.org/g/openembedded-devel/message/111317
Mute This Topic: https://lists.openembedded.org/mt/107179060/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to