summaryrefslogtreecommitdiffstats
path: root/recipes-core
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-core')
-rw-r--r--recipes-core/libxcrypt/libxcrypt/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch47
-rw-r--r--recipes-core/libxcrypt/libxcrypt_%.bbappend7
2 files changed, 54 insertions, 0 deletions
diff --git a/recipes-core/libxcrypt/libxcrypt/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch b/recipes-core/libxcrypt/libxcrypt/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch
new file mode 100644
index 0000000..6320494
--- /dev/null
+++ b/recipes-core/libxcrypt/libxcrypt/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch
@@ -0,0 +1,47 @@
1From 7c45edc1e55295fc5f45cf8ff9e782febfa7fd84 Mon Sep 17 00:00:00 2001
2From: Wenlin Kang <wenlin.kang@windriver.com>
3Date: Mon, 6 Nov 2023 14:43:28 +0800
4Subject: [PATCH] lib/util-get-random-bytes.c: fixed conversion error with
5 mingw
6
7With x86_64-w64-mingw32-gcc. get below error:
8| ../git/lib/util-get-random-bytes.c: In function '_crypt_get_random_bytes':
9| ../git/lib/util-get-random-bytes.c:140:42: error: conversion from 'size_t' {aka 'long long unsigned int'} to 'unsigned int' may change value [-Werror=conversion]
10| 140 | ssize_t nread = read (fd, buf, buflen);
11| | ^~~~~~
12
13In util-get-random-bytes.c, has get_random_bytes(void *buf, size_t buflen),
14but in mingw-w64-mingw-w64/mingw-w64-headers/crt/io.h, read() has "unsigned int"
15read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount), and has:
16 #ifdef _WIN64
17 __MINGW_EXTENSION typedef unsigned __int64 size_t;
18 #else
19 typedef unsigned int size_t;
20 #endif /* _WIN64 */
21
22Upstream-Status: Pending
23
24Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
25---
26 lib/util-get-random-bytes.c | 4 ++++
27 1 file changed, 4 insertions(+)
28
29diff --git a/lib/util-get-random-bytes.c b/lib/util-get-random-bytes.c
30index 79816db..68cd378 100644
31--- a/lib/util-get-random-bytes.c
32+++ b/lib/util-get-random-bytes.c
33@@ -137,7 +137,11 @@ get_random_bytes(void *buf, size_t buflen)
34 dev_urandom_doesnt_work = true;
35 else
36 {
37+#ifdef _WIN64
38+ ssize_t nread = read (fd, buf, (unsigned int)buflen);
39+#else
40 ssize_t nread = read (fd, buf, buflen);
41+#endif
42 if (nread < 0 || (size_t)nread < buflen)
43 dev_urandom_doesnt_work = true;
44
45--
462.34.1
47
diff --git a/recipes-core/libxcrypt/libxcrypt_%.bbappend b/recipes-core/libxcrypt/libxcrypt_%.bbappend
new file mode 100644
index 0000000..97bf008
--- /dev/null
+++ b/recipes-core/libxcrypt/libxcrypt_%.bbappend
@@ -0,0 +1,7 @@
1FILESEXTRAPATHS:prepend:mingw32 := "${THISDIR}/${BPN}:"
2
3SRC_URI:append:mingw32 = " \
4 file://0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch \
5 "
6
7CFLAGS:append:class-nativesdk:mingw32 = " -Wno-pedantic"