From 272026603fbe4c3b7bb13897d2c7ca1254ab746c Mon Sep 17 00:00:00 2001 From: Theo Buehler Date: Tue, 9 Apr 2024 18:12:12 +0000 Subject: whirlpool_test: avoid calling arc4random_uniform(0) This causes a SIGFPE on solaris Fixes https://github.com/libressl/portable/issues/1042 --- regress/lib/libcrypto/whirlpool/whirlpool_test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'regress') diff --git a/regress/lib/libcrypto/whirlpool/whirlpool_test.c b/regress/lib/libcrypto/whirlpool/whirlpool_test.c index 940531d49a8..809edbba164 100644 --- a/regress/lib/libcrypto/whirlpool/whirlpool_test.c +++ b/regress/lib/libcrypto/whirlpool/whirlpool_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: whirlpool_test.c,v 1.2 2024/04/09 18:08:43 tb Exp $ */ +/* $OpenBSD: whirlpool_test.c,v 1.3 2024/04/09 18:12:11 tb Exp $ */ /* * Copyright (c) 2024 Joshua Sing * @@ -192,7 +192,9 @@ whirlpool_test(void) } for (l = 0; l < wt->in_len;) { - in_len = arc4random_uniform(wt->in_len / 2); + in_len = 1; + if (wt->in_len > 1) + in_len = arc4random_uniform(wt->in_len / 2); if (in_len < 1) in_len = 1; if (in_len > wt->in_len - l) -- cgit v1.2.3