Skip to contentSkip to conversation

rng-random: only build on POSIX platforms

PATCH In review Anthony Liguori 3 participants 3 messages Nov 17, 2012 – Nov 18, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rng-random: only build on POSIX platforms

There is no /dev/random on win32.

---
 backends/Makefile.objs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
backends/Makefile.objs +2 -1
index 875eebc..8836761 100644
@@ -1 +1,2 @@
-common-obj-y += rng.o rng-random.o rng-egd.o
+common-obj-y += rng.o rng-egd.o
+common-obj-$(CONFIG_POSIX) += rng-random.o
Signature · 1 line
1.8.0
#1 lore raw

Am 17.11.2012 14:41, schrieb Anthony Liguori:

Quoted 13 lines

There is no /dev/random on win32.

---
  backends/Makefile.objs | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
backends/Makefile.objs +0 -0
index 875eebc..8836761 100644

backends/Makefile.objs line 2

Quoted 3 lines
backends/Makefile.objs +2 -1
@@ -1 +1,2 @@
-common-obj-y += rng.o rng-random.o rng-egd.o
+common-obj-y += rng.o rng-egd.o
+common-obj-$(CONFIG_POSIX) += rng-random.o

The patch fixes a build issue on w32 / w64, but the reason given is misleading: yes, Windows has no /dev files, but the MinGW library tries to emulate the most important interfaces from /dev.

There is a /dev/random with MinGW, and it does what it is supposed to do. See this URL for more supported "devices":
http://srv.onzk.net/linwin/apache-php3-mysql/CygWin_20b_98-4_Documents_OnLine/CygWin-Ug-Net/using-specialnames.html

Regards
Stefan W.

#2 lore raw

Il 18/11/2012 11:29, Stefan Weil ha scritto:

Quoted 9 lines

Am 17.11.2012 14:41, schrieb Anthony Liguori:

Quoted 8 lines

There is no /dev/random on win32.

---
  backends/Makefile.objs | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 12 lines

backends/Makefile.objs line 2

Quoted 8 lines
backends/Makefile.objs +2 -1
index 875eebc..8836761 100644
@@ -1 +1,2 @@
-common-obj-y += rng.o rng-random.o rng-egd.o
+common-obj-y += rng.o rng-egd.o
+common-obj-$(CONFIG_POSIX) += rng-random.o

The patch fixes a build issue on w32 / w64, but the reason given is misleading: yes, Windows has no /dev files, but the MinGW library tries to emulate the most important interfaces from /dev.

Ah, I thought that was only MSYS and Cygiwin, not MinGW.

Quoted 3 lines

There is a /dev/random with MinGW, and it does what it is supposed to do. See this URL for more supported "devices":
http://srv.onzk.net/linwin/apache-php3-mysql/CygWin_20b_98-4_Documents_OnLine/CygWin-Ug-Net/using-specialnames.html

But a properly-implemented /dev/random will block more often than not, so it is not a good idea to use a "fake" O_NONBLOCK. Using native Win32 crypto APIs is a much better idea.

Paolo