Remove arc4random() OpenBSD support

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>
This commit is contained in:
Guilherme Janczak 2021-12-31 08:25:08 +00:00 committed by Guillem Jover
parent abb1a6b1a7
commit e5ed5fdd62
4 changed files with 1 additions and 66 deletions

View File

@ -364,7 +364,6 @@ Files:
man/strtonum.3bsd man/strtonum.3bsd
src/arc4random.c src/arc4random.c
src/arc4random_linux.h src/arc4random_linux.h
src/arc4random_openbsd.h
src/arc4random_uniform.c src/arc4random_uniform.c
src/arc4random_unix.h src/arc4random_unix.h
src/arc4random_win.h src/arc4random_win.h

View File

@ -66,7 +66,6 @@ libbsd_la_SOURCES = \
arc4random.c \ arc4random.c \
arc4random.h \ arc4random.h \
arc4random_linux.h \ arc4random_linux.h \
arc4random_openbsd.h \
arc4random_uniform.c \ arc4random_uniform.c \
arc4random_unix.h \ arc4random_unix.h \
arc4random_win.h \ arc4random_win.h \

View File

@ -32,9 +32,7 @@
int int
getentropy(void *buf, size_t len); getentropy(void *buf, size_t len);
#if defined(__OpenBSD__) #if defined(__linux__)
#include "arc4random_openbsd.h"
#elif defined(__linux__)
#include "arc4random_linux.h" #include "arc4random_linux.h"
#elif defined(_WIN32) #elif defined(_WIN32)
#include "arc4random_win.h" #include "arc4random_win.h"

View File

@ -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)
{
}