From f43b806e9c49f2808400fc8ecb084846433c8052 Mon Sep 17 00:00:00 2001 From: tb <> Date: Sat, 12 Sep 2020 17:16:36 +0000 Subject: Unindent a bit of code that performs a few too many checks to figure out whether top > 0 or top == 0. --- src/lib/libcrypto/bn/bn_rand.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/bn/bn_rand.c b/src/lib/libcrypto/bn/bn_rand.c index 4626960a0d..f94ce1dceb 100644 --- a/src/lib/libcrypto/bn/bn_rand.c +++ b/src/lib/libcrypto/bn/bn_rand.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_rand.c,v 1.23 2020/09/12 15:24:39 tb Exp $ */ +/* $OpenBSD: bn_rand.c,v 1.24 2020/09/12 17:16:36 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -171,18 +171,16 @@ bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) } #endif - if (top >= 0) { - if (top > 0) { - if (bit == 0) { - buf[0] = 1; - buf[1] |= 0x80; - } else { - buf[0] |= (3 << (bit - 1)); - } + if (top > 0) { + if (bit == 0) { + buf[0] = 1; + buf[1] |= 0x80; } else { - buf[0] |= (1 << bit); + buf[0] |= (3 << (bit - 1)); } } + if (top == 0) + buf[0] |= (1 << bit); buf[0] &= ~mask; if (bottom) /* set bottom bit if requested */ buf[bytes - 1] |= 1; -- cgit v1.2.3-55-g6feb