summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2023-02-14 18:01:15 +0000
committerjsing <>2023-02-14 18:01:15 +0000
commitc4da4796b5f8b3f5445265388a82bebcaff2fc44 (patch)
tree42bbcbb222ffeb39e69fb732a8d31d40999168f5 /src
parent1a1fa9f0d7ff940ecfbf5e78d0cdbcd33b5e08b7 (diff)
downloadopenbsd-c4da4796b5f8b3f5445265388a82bebcaff2fc44.tar.gz
openbsd-c4da4796b5f8b3f5445265388a82bebcaff2fc44.tar.bz2
openbsd-c4da4796b5f8b3f5445265388a82bebcaff2fc44.zip
Make BN_set_negative() closer to constant time.
ok tb@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c
index e00909bb3b..32ac7ae606 100644
--- a/src/lib/libcrypto/bn/bn_lib.c
+++ b/src/lib/libcrypto/bn/bn_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_lib.c,v 1.73 2023/02/13 04:03:38 jsing Exp $ */ 1/* $OpenBSD: bn_lib.c,v 1.74 2023/02/14 18:01:15 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -66,6 +66,7 @@
66#include <openssl/err.h> 66#include <openssl/err.h>
67 67
68#include "bn_local.h" 68#include "bn_local.h"
69#include "bn_internal.h"
69 70
70BIGNUM * 71BIGNUM *
71BN_new(void) 72BN_new(void)
@@ -730,7 +731,7 @@ BN_mask_bits(BIGNUM *a, int n)
730void 731void
731BN_set_negative(BIGNUM *bn, int neg) 732BN_set_negative(BIGNUM *bn, int neg)
732{ 733{
733 bn->neg = (neg != 0) && !BN_is_zero(bn); 734 bn->neg = ~BN_is_zero(bn) & bn_ct_ne_zero(neg);
734} 735}
735 736
736int 737int