summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2024-04-09 18:12:11 +0000
committertb <>2024-04-09 18:12:11 +0000
commitdd303cf95a55e7ed2d56234a22f99bc1f0e08dfe (patch)
treeb6055284dfd25247fafe195cdb22a54cab671431 /src
parent0fcb4043e3ed11c96544cb9bf6af905fd39a3ea9 (diff)
downloadopenbsd-dd303cf95a55e7ed2d56234a22f99bc1f0e08dfe.tar.gz
openbsd-dd303cf95a55e7ed2d56234a22f99bc1f0e08dfe.tar.bz2
openbsd-dd303cf95a55e7ed2d56234a22f99bc1f0e08dfe.zip
whirlpool_test: avoid calling arc4random_uniform(0)
This causes a SIGFPE on solaris Fixes https://github.com/libressl/portable/issues/1042
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libcrypto/whirlpool/whirlpool_test.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/regress/lib/libcrypto/whirlpool/whirlpool_test.c b/src/regress/lib/libcrypto/whirlpool/whirlpool_test.c
index 940531d49a..809edbba16 100644
--- a/src/regress/lib/libcrypto/whirlpool/whirlpool_test.c
+++ b/src/regress/lib/libcrypto/whirlpool/whirlpool_test.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: whirlpool_test.c,v 1.2 2024/04/09 18:08:43 tb Exp $ */ 1/* $OpenBSD: whirlpool_test.c,v 1.3 2024/04/09 18:12:11 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joshua Sing <joshua@joshuasing.dev> 3 * Copyright (c) 2024 Joshua Sing <joshua@joshuasing.dev>
4 * 4 *
@@ -192,7 +192,9 @@ whirlpool_test(void)
192 } 192 }
193 193
194 for (l = 0; l < wt->in_len;) { 194 for (l = 0; l < wt->in_len;) {
195 in_len = arc4random_uniform(wt->in_len / 2); 195 in_len = 1;
196 if (wt->in_len > 1)
197 in_len = arc4random_uniform(wt->in_len / 2);
196 if (in_len < 1) 198 if (in_len < 1)
197 in_len = 1; 199 in_len = 1;
198 if (in_len > wt->in_len - l) 200 if (in_len > wt->in_len - l)