/*- * Copyright (c) 2009-2010 Brad Penoff * Copyright (c) 2009-2010 Humaira Kamal * Copyright (c) 2011-2012 Irene Ruengeler * Copyright (c) 2011-2012 Michael Tuexen * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE.
*/
/* See user_include/user_environment.h for comments about these variables */ int maxsockets = 25600; int hz = uHZ; int ip_defttl = 64; int ipport_firstauto = 49152, ipport_lastauto = 65535; int nmbclusters = 65536;
/* Source ip_output.c. extern'd in ip_var.h */
u_short ip_id = 0; /*__Userspace__ TODO Should it be initialized to zero? */
/* used in user_include/user_atomic.h in order to make the operations * defined there truly atomic
*/
userland_mutex_t atomic_mtx;
/* If the entropy device is not loaded, make a token effort to * provide _some_ kind of randomness. This should only be used * inside other RNG's, like arc4random(9).
*/ #ifdefined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) #include <string.h>
void
finish_random(void)
{ return;
} /* This define can be used to optionally use OpenSSL's random number utility, * which is capable of bypassing the chromium sandbox which normally would * prevent opening files, including /dev/urandom.
*/ #elifdefined(SCTP_USE_OPENSSL_RAND) #include <openssl/rand.h>
/* Requiring BoringSSL because it guarantees that RAND_bytes will succeed. */ #ifndef OPENSSL_IS_BORINGSSL #error Only BoringSSL is supported with SCTP_USE_OPENSSL_RAND. #endif
void
init_random(void)
{ #ifdef __NR_getrandom char dummy;
ssize_t n = syscall(__NR_getrandom, &dummy, sizeof(dummy), GRND_NONBLOCK); if (n > 0 || errno == EINTR || errno == EAGAIN) { /* Either getrandom succeeded, was interrupted or is waiting for entropy; * all of which mean the syscall is available.
*/
getrandom_available = 1;
} else { #ifdef INVARIANTS if (errno != ENOSYS) {
panic("getrandom syscall returned unexpected error: %d", errno);
} #endif /* If the syscall isn't available, fall back to /dev/urandom. */ #endif
fd = open("/dev/urandom", O_RDONLY); #ifdef __NR_getrandom
} #endif return;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.