]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
Remove arc4random() OpenBSD support
authorGuilherme Janczak <guilherme.janczak@yandex.com>
Fri, 31 Dec 2021 08:25:08 +0000 (08:25 +0000)
committerGuillem Jover <guillem@hadrons.org>
Wed, 30 Mar 2022 20:55:56 +0000 (22:55 +0200)
The arc4random() support for OpenBSD does not build. The intention was
to include any portability code so that the library could be easily
ported to such systems, but it makes little sense to build it on OpenBSD
where most of the functionality will be already present, or the software
would have been ported anyway.

[guillem@hadrons.org: Reword commit message to add rationale. ]

Closes: !15
Signed-off-by: Guillem Jover <guillem@hadrons.org>
COPYING
src/Makefile.am
src/arc4random.h
src/arc4random_openbsd.h [deleted file]

diff --git a/COPYING b/COPYING
index c225edeeb7374b26b2d6165b4fb50f0cfcde8466..7fd11fad1dcf546b2c5462d08cf37e9732a6bad3 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -364,7 +364,6 @@ Files:
  man/strtonum.3bsd
  src/arc4random.c
  src/arc4random_linux.h
- src/arc4random_openbsd.h
  src/arc4random_uniform.c
  src/arc4random_unix.h
  src/arc4random_win.h
index ea0bdbef0d35c46959f133b93558fa21e85f3ee5..7cf4a09c5139508c9bb286e059d86489d6e3e66c 100644 (file)
@@ -66,7 +66,6 @@ libbsd_la_SOURCES = \
        arc4random.c \
        arc4random.h \
        arc4random_linux.h \
-       arc4random_openbsd.h \
        arc4random_uniform.c \
        arc4random_unix.h \
        arc4random_win.h \
index 812188bd50f4554f5b54f3afd2b248cd3a54a8f4..b8675b490298d15ded881b7d02ed7bcb2388bda3 100644 (file)
@@ -32,9 +32,7 @@
 int
 getentropy(void *buf, size_t len);
 
-#if defined(__OpenBSD__)
-#include "arc4random_openbsd.h"
-#elif defined(__linux__)
+#if defined(__linux__)
 #include "arc4random_linux.h"
 #elif defined(_WIN32)
 #include "arc4random_win.h"
diff --git a/src/arc4random_openbsd.h b/src/arc4random_openbsd.h
deleted file mode 100644 (file)
index 9cd8b68..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*     $OpenBSD: arc4random.h,v 1.3 2014/07/20 20:51:13 bcook Exp $    */
-
-/*
- * Copyright (c) 1996, David Mazieres <dm@uun.org>
- * Copyright (c) 2008, Damien Miller <djm@openbsd.org>
- * Copyright (c) 2013, Markus Friedl <markus@openbsd.org>
- * Copyright (c) 2014, Theo de Raadt <deraadt@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Stub functions for portability.
- */
-#include <sys/mman.h>
-
-#include <signal.h>
-
-#include "thread_private.h"
-
-static inline void
-_getentropy_fail(void)
-{
-       raise(SIGKILL);
-}
-
-static inline int
-_rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
-{
-       struct {
-               struct _rs rs;
-               struct _rsx rsx;
-       } *p;
-
-       if ((p = mmap(NULL, sizeof(*p), PROT_READ|PROT_WRITE,
-           MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
-               return (-1);
-       if (minherit(p, sizeof(*p), MAP_INHERIT_ZERO) == -1) {
-               munmap(p, sizeof(*p));
-               return (-1);
-       }
-
-       *rsp = &p->rs;
-       *rsxp = &p->rsx;
-       return (0);
-}
-
-static inline void
-_rs_forkdetect(void)
-{
-}