/*1* SPDX-License-Identifier: ISC2*3* Copyright (c) 2018 Todd C. Miller <[email protected]>4*5* Permission to use, copy, modify, and distribute this software for any6* purpose with or without fee is hereby granted, provided that the above7* copyright notice and this permission notice appear in all copies.8*9* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES10* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF11* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR12* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES13* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN14* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF15* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.16*17* Sponsored in part by the Defense Advanced Research Projects18* Agency (DARPA) and Air Force Research Laboratory, Air Force19* Materiel Command, USAF, under agreement number F39502-99-1-0512.20*/2122#ifndef SUDO_RAND_H23#define SUDO_RAND_H2425#include <stdlib.h> /* For arc4random() on systems that have it */2627/*28* All libc replacements are prefixed with "sudo_" to avoid namespace issues.29*/3031#ifndef HAVE_ARC4RANDOM32sudo_dso_public uint32_t sudo_arc4random(void);33# undef arc4random34# define arc4random() sudo_arc4random()35#endif /* ARC4RANDOM */3637#ifndef HAVE_ARC4RANDOM_BUF38sudo_dso_public void sudo_arc4random_buf(void *buf, size_t n);39# undef arc4random_buf40# define arc4random_buf(a, b) sudo_arc4random_buf((a), (b))41#endif /* ARC4RANDOM_BUF */4243#ifndef HAVE_ARC4RANDOM_UNIFORM44sudo_dso_public uint32_t sudo_arc4random_uniform(uint32_t upper_bound);45# undef arc4random_uniform46# define arc4random_uniform(_a) sudo_arc4random_uniform((_a))47#endif /* ARC4RANDOM_UNIFORM */4849#ifndef HAVE_GETENTROPY50/* Note: not exported by libutil. */51int sudo_getentropy(void *buf, size_t buflen);52# undef getentropy53# define getentropy(_a, _b) sudo_getentropy((_a), (_b))54#endif /* HAVE_GETENTROPY */5556#endif /* SUDO_RAND_H */575859