Module Name: src Committed By: riastradh Date: Sun Mar 2 22:54:12 UTC 2025
Modified Files: src/lib/libc/gen: arc4random.c Log Message: arc4random(3): Don't ifdef out the self-test. The runtime cost of this test is negligible (64 bytes of data and a handful of instructions for the subroutine) and the security value of verifying a known input/output for the deterministic cryptographic function on whose security the whole API relies is high. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/lib/libc/gen/arc4random.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/gen/arc4random.c diff -u src/lib/libc/gen/arc4random.c:1.41 src/lib/libc/gen/arc4random.c:1.42 --- src/lib/libc/gen/arc4random.c:1.41 Sun Mar 2 22:53:45 2025 +++ src/lib/libc/gen/arc4random.c Sun Mar 2 22:54:11 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: arc4random.c,v 1.41 2025/03/02 22:53:45 riastradh Exp $ */ +/* $NetBSD: arc4random.c,v 1.42 2025/03/02 22:54:11 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -51,7 +51,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: arc4random.c,v 1.41 2025/03/02 22:53:45 riastradh Exp $"); +__RCSID("$NetBSD: arc4random.c,v 1.42 2025/03/02 22:54:11 riastradh Exp $"); #include "namespace.h" #include "reentrant.h" @@ -187,8 +187,6 @@ crypto_core(uint8_t *out, const uint8_t /* ChaCha self-test */ -#ifdef _DIAGNOSTIC - /* * Test vector for ChaCha20 from * <http://tools.ietf.org/html/draft-strombergson-chacha-test-vectors-00>, @@ -282,17 +280,6 @@ crypto_core_selftest(void) return 0; } -#else /* !_DIAGNOSTIC */ - -static int -crypto_core_selftest(void) -{ - - return 0; -} - -#endif - /* PRNG */ /*