From 479d8de31d54591d0157f2dd21323ba55b8c7ab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98rjan=20Malde?= Date: Wed, 20 May 2020 09:32:39 +0000 Subject: [PATCH] Add support for midipix, a POSIX layer for Microsoft Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ørjan Malde --- ChangeLog.d/midipix-support.txt | 2 ++ library/entropy_poll.c | 6 +++--- library/net_sockets.c | 2 +- library/timing.c | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 ChangeLog.d/midipix-support.txt diff --git a/ChangeLog.d/midipix-support.txt b/ChangeLog.d/midipix-support.txt new file mode 100644 index 000000000..53599abe4 --- /dev/null +++ b/ChangeLog.d/midipix-support.txt @@ -0,0 +1,2 @@ +Features + * Add support for midipix, a POSIX layer for Microsoft Windows. diff --git a/library/entropy_poll.c b/library/entropy_poll.c index c9b2c95c6..8b4a5af9e 100644 --- a/library/entropy_poll.c +++ b/library/entropy_poll.c @@ -52,7 +52,7 @@ #if !defined(unix) && !defined(__unix__) && !defined(__unix) && \ !defined(__APPLE__) && !defined(_WIN32) && !defined(__QNXNTO__) && \ - !defined(__HAIKU__) + !defined(__HAIKU__) && !defined(__midipix__) #error "Platform entropy sources only work on Unix and Windows, see MBEDTLS_NO_PLATFORM_ENTROPY in config.h" #endif @@ -95,7 +95,7 @@ int mbedtls_platform_entropy_poll( void *data, unsigned char *output, size_t len * Since there is no wrapper in the libc yet, use the generic syscall wrapper * available in GNU libc and compatible libc's (eg uClibc). */ -#if defined(__linux__) && defined(__GLIBC__) +#if ((defined(__linux__) && defined(__GLIBC__)) || defined(__midipix__)) #include #include #if defined(SYS_getrandom) @@ -113,7 +113,7 @@ static int getrandom_wrapper( void *buf, size_t buflen, unsigned int flags ) return( syscall( SYS_getrandom, buf, buflen, flags ) ); } #endif /* SYS_getrandom */ -#endif /* __linux__ */ +#endif /* __linux__ || __midipix__ */ #include diff --git a/library/net_sockets.c b/library/net_sockets.c index 5c1e665ea..8258aea73 100644 --- a/library/net_sockets.c +++ b/library/net_sockets.c @@ -34,7 +34,7 @@ #if !defined(unix) && !defined(__unix__) && !defined(__unix) && \ !defined(__APPLE__) && !defined(_WIN32) && !defined(__QNXNTO__) && \ - !defined(__HAIKU__) + !defined(__HAIKU__) && !defined(__midipix__) #error "This module only works on Unix and Windows, see MBEDTLS_NET_C in config.h" #endif diff --git a/library/timing.c b/library/timing.c index 009516a6e..4a654222a 100644 --- a/library/timing.c +++ b/library/timing.c @@ -40,7 +40,7 @@ #if !defined(unix) && !defined(__unix__) && !defined(__unix) && \ !defined(__APPLE__) && !defined(_WIN32) && !defined(__QNXNTO__) && \ - !defined(__HAIKU__) + !defined(__HAIKU__) && !defined(__midipix__) #error "This module only works on Unix and Windows, see MBEDTLS_TIMING_C in config.h" #endif