Skip to content

Commit 4f260c4

Browse files
user: track mbedtls getrandom patch
1 parent ce4b22d commit 4f260c4

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

user/apps/mbedtls/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
build/
22
*tar.gz
3-
patches/
3+
!patches/
4+
!patches/*.patch
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--- a/library/entropy_poll.c
2+
+++ b/library/entropy_poll.c
3+
@@ -109,6 +109,20 @@
4+
#endif /* SYS_getrandom */
5+
#endif /* __linux__ || __midipix__ */
6+
7+
+/*
8+
+ * musl and other non-glibc libcs expose getrandom() via <sys/random.h>.
9+
+ * Use it when available so Linux targets do not hard depend on /dev/urandom.
10+
+ */
11+
+#if defined(__linux__) && !defined(HAVE_GETRANDOM)
12+
+#include <errno.h>
13+
+#include <sys/random.h>
14+
+static int getrandom_wrapper( void *buf, size_t buflen, unsigned int flags )
15+
+{
16+
+ return getrandom( buf, buflen, flags );
17+
+}
18+
+#define HAVE_GETRANDOM
19+
+#endif /* __linux__ && !defined(HAVE_GETRANDOM) */
20+
+
21+
#if defined(__FreeBSD__) || defined(__DragonFly__)
22+
#include <sys/param.h>
23+
#if (defined(__FreeBSD__) && __FreeBSD_version >= 1200000) || \

0 commit comments

Comments
 (0)