new file mode 100644
@@ -0,0 +1,37 @@
+From a507b628a5a5d4e4f1cf0f0a9a72967470ee7624 Mon Sep 17 00:00:00 2001
+From: Brecht Sanders <brecht@sanders.org>
+Date: Fri, 3 Feb 2023 08:44:49 +0100
+Subject: [PATCH] Fix for compilation on Windows
+
+This fix allows the library to build on Windows (at least with MinGW-w64).
+
+`.symver` is only supported for ELF format but Windows uses COFF/PE.
+
+Workaround dummy define of `symver_set()`
+
+Upstream-Status: Backport [https://github.com/besser82/libxcrypt/commit/a507b628a5a5d4e4f1cf0f0a9a72967470ee7624]
+
+Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
+---
+ lib/crypt-port.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/lib/crypt-port.h b/lib/crypt-port.h
+index f06ca24..a707939 100644
+--- a/lib/crypt-port.h
++++ b/lib/crypt-port.h
+@@ -201,6 +201,11 @@ extern size_t strcpy_or_abort (void *dst, size_t d_size, const void *src);
+ __asm__(".globl _" extstr); \
+ __asm__(".set _" extstr ", _" #intname)
+
++#elif defined _WIN32
++
++/* .symver is only supported for ELF format, Windows uses COFF/PE */
++# define symver_set(extstr, intname, version, mode)
++
+ #elif defined __GNUC__ && __GNUC__ >= 3
+
+ # define _strong_alias(name, aliasname) \
+--
+2.34.1
+
new file mode 100644
@@ -0,0 +1,47 @@
+From ff99091eb8a6b9e6edc567f6d2552183fbaacec3 Mon Sep 17 00:00:00 2001
+From: Wenlin Kang <wenlin.kang@windriver.com>
+Date: Mon, 6 Nov 2023 14:43:28 +0800
+Subject: [PATCH] lib/util-get-random-bytes.c: fixed conversion error with
+ mingw
+
+With x86_64-w64-mingw32-gcc. get below error:
+| ../git/lib/util-get-random-bytes.c: In function '_crypt_get_random_bytes':
+| ../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]
+| 140 | ssize_t nread = read (fd, buf, buflen);
+| | ^~~~~~
+
+In util-get-random-bytes.c, has get_random_bytes(void *buf, size_t buflen),
+but in mingw-w64-mingw-w64/mingw-w64-headers/crt/io.h, read() has "unsigned int"
+read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount), and has:
+ #ifdef _WIN64
+ __MINGW_EXTENSION typedef unsigned __int64 size_t;
+ #else
+ typedef unsigned int size_t;
+ #endif /* _WIN64 */
+
+Upstream-Status: Pending
+
+Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
+---
+ lib/util-get-random-bytes.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/lib/util-get-random-bytes.c b/lib/util-get-random-bytes.c
+index 79816db..68cd378 100644
+--- a/lib/util-get-random-bytes.c
++++ b/lib/util-get-random-bytes.c
+@@ -137,7 +137,11 @@ get_random_bytes(void *buf, size_t buflen)
+ dev_urandom_doesnt_work = true;
+ else
+ {
++#ifdef _WIN64
++ ssize_t nread = read (fd, buf, (unsigned int)buflen);
++#else
+ ssize_t nread = read (fd, buf, buflen);
++#endif
+ if (nread < 0 || (size_t)nread < buflen)
+ dev_urandom_doesnt_work = true;
+
+--
+2.25.1
+
@@ -16,6 +16,8 @@ SRCBRANCH ?= "master"
SRC_URI += "file://fix_cflags_handling.patch \
file://0001-Make-BuildCommon.pm-compatible-with-latest-perl.patch \
file://0002-Remove-smartmatch-usage-from-gen-crypt-h.patch \
+ file://0001-Fix-for-compilation-on-Windows.patch \
+ file://0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch \
"
PROVIDES = "virtual/crypt"
@@ -29,4 +31,6 @@ CPPFLAGS:append:class-nativesdk = " -Wno-error"
API = "--disable-obsolete-api"
EXTRA_OECONF += "${API}"
+CFLAGS:append:class-nativesdk = " -Wno-pedantic"
+
BBCLASSEXTEND = "native nativesdk"