summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2024-11-23 07:37:21 +0000
committertb <>2024-11-23 07:37:21 +0000
commit66beef8bfe83b33a0c5aaad6a85d57cca57cd62f (patch)
tree9f6e47de41c0b3faa23e562bf38ca06a24e5239e
parentb694ac34c67a61603d51be4ed12f815e39102235 (diff)
downloadopenbsd-66beef8bfe83b33a0c5aaad6a85d57cca57cd62f.tar.gz
openbsd-66beef8bfe83b33a0c5aaad6a85d57cca57cd62f.tar.bz2
openbsd-66beef8bfe83b33a0c5aaad6a85d57cca57cd62f.zip
Drop bn is zero special case
This is a corner case that isn't really of interest. We're making a few calculations that don't really hurt, but it's super cheap, so one more complication bites the dust. ok jsing
-rw-r--r--src/lib/libcrypto/ec/ec_mult.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/lib/libcrypto/ec/ec_mult.c b/src/lib/libcrypto/ec/ec_mult.c
index 382174a367..c33a033805 100644
--- a/src/lib/libcrypto/ec/ec_mult.c
+++ b/src/lib/libcrypto/ec/ec_mult.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_mult.c,v 1.49 2024/11/23 07:33:26 tb Exp $ */ 1/* $OpenBSD: ec_mult.c,v 1.50 2024/11/23 07:37:21 tb Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project. 3 * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project.
4 */ 4 */
@@ -111,9 +111,6 @@ ec_compute_wNAF(const BIGNUM *bn, signed char **out_wNAF, size_t *out_wNAF_len,
111 wbits = ec_window_bits(bn); 111 wbits = ec_window_bits(bn);
112 len = 1 << (wbits - 1); 112 len = 1 << (wbits - 1);
113 113
114 if (BN_is_zero(bn))
115 goto done;
116
117 sign = BN_is_negative(bn) ? -1 : 1; 114 sign = BN_is_negative(bn) ? -1 : 1;
118 115
119 bit = 1 << wbits; 116 bit = 1 << wbits;
@@ -150,7 +147,6 @@ ec_compute_wNAF(const BIGNUM *bn, signed char **out_wNAF, size_t *out_wNAF_len,
150 window += bit * BN_is_bit_set(bn, i + wbits + 1); 147 window += bit * BN_is_bit_set(bn, i + wbits + 1);
151 } 148 }
152 149
153 done:
154 *out_wNAF = wNAF; 150 *out_wNAF = wNAF;
155 wNAF = NULL; 151 wNAF = NULL;
156 *out_wNAF_len = wNAF_len; 152 *out_wNAF_len = wNAF_len;