From 37a6669e710bbc64b62998b00de5f588d6c17c44 Mon Sep 17 00:00:00 2001 From: Benjamin Lamowski Date: Wed, 13 Sep 2023 23:27:59 +0200 Subject: [PATCH] libc: add support for FreeBSDs KERN_ARND sysctl Provide FreeBSDs KERN_ARND systemctl by calling getentropy(). To use it, configure an RNG via the `rng` libc runtime parameter. Ref #4997 --- repos/libports/src/lib/libc/sysctl.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/repos/libports/src/lib/libc/sysctl.cc b/repos/libports/src/lib/libc/sysctl.cc index 39d036f50e..4297727047 100644 --- a/repos/libports/src/lib/libc/sysctl.cc +++ b/repos/libports/src/lib/libc/sysctl.cc @@ -1,11 +1,12 @@ /* * \brief Sysctl facade * \author Emery Hemingway + * \author Benjamin Lamowski * \date 2016-04-27 */ /* - * Copyright (C) 2016-2019 Genode Labs GmbH + * Copyright (C) 2016-2023 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU Affero General Public License version 3. @@ -84,6 +85,10 @@ extern "C" int __sysctl(const int *name, u_int namelen, /* builtins */ { switch(index_a) { + case CTL_KERN: switch(index_b) { + case KERN_ARND: + return getentropy(oldp, *oldlenp); + } case CTL_HW: switch(index_b) { case HW_REALMEM: