$OpenBSD: patch-common_platform_linux_cpp,v 1.10 2016/01/02 16:16:00 robert Exp $
--- common/platform.linux.cpp.orig	Sat Oct 31 00:03:13 2015
+++ common/platform.linux.cpp	Sat Jan  2 17:00:47 2016
@@ -59,6 +59,8 @@
 #include <cerrno>
 #include <climits>
 
+#include <signal.h>
+
 #include <string>
 #include <map>
 
@@ -69,7 +71,7 @@
 #define ICONV_CONST const
 #elif OPENBSD
 // bsd
-#define ICONV_CONST const
+#define ICONV_CONST
 #else
 // linux
 #define ICONV_CONST
@@ -94,22 +96,10 @@ HRESULT CoCreateGuid(LPGUID pNewGUID) {
 		return MAPI_E_INVALID_PARAMETER;
 
 #if HAVE_UUID_CREATE
-#ifdef OPENBSD
-	uuid_t *g = NULL;
-	void *vp = NULL;
-	size_t n = 0;
-	// error codes are not checked!
-	uuid_create(&g);
-	uuid_make(g, UUID_MAKE_V1);
-	uuid_export(g, UUID_FMT_BIN, &vp, &n);
-	memcpy(pNewGUID, &vp, UUID_LEN_BIN);
-	uuid_destroy(g);
-#else
 	uuid_t g;
 	uint32_t uid_ret;
 	uuid_create(&g, &uid_ret);
 	memcpy(pNewGUID, &g, sizeof(g));
-#endif // OPENBSD
 #else
 	uuid_t g;
 	uuid_generate(g);
@@ -166,6 +156,12 @@ void Sleep(unsigned int msec) {
 	nanosleep(&ts, NULL);
 }
 
+#ifdef HAVE_ARC4RANDOM_BUF
+void rand_get(char *p, int n)
+{
+	arc4random_buf(p, n);
+}
+#else
 static void rand_fail(void)
 {
 	fprintf(stderr, "Cannot access/use /dev/urandom, this is fatal (%s)\n", strerror(errno));
@@ -202,6 +198,7 @@ void rand_get(char *p, int n)
 
 		close(fd);
 	}
+#endif
 	
 void rand_init() {
 	unsigned int seed = 0;
