summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@ozlabs.org>2021-02-01 16:20:12 +1100
committerMatt Caswell <matt@openssl.org>2021-04-08 12:18:10 +0100
commitceaa6b319e01bd1ac74e3e7c5662745d3d3b3b9d (patch)
tree2c8ebf6f43ecd04198eb6c185836bc6942bbcedf
parenteb7bcff67c6bbd9cb463c44035afd00c37ca327f (diff)
Add a constant time zero check function for 64-bit integers
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14784)
-rw-r--r--include/internal/constant_time.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/internal/constant_time.h b/include/internal/constant_time.h
index cb4ce80830..0ed6f823c1 100644
--- a/include/internal/constant_time.h
+++ b/include/internal/constant_time.h
@@ -182,6 +182,11 @@ static ossl_inline uint32_t constant_time_is_zero_32(uint32_t a)
return constant_time_msb_32(~a & (a - 1));
}
+static ossl_inline uint64_t constant_time_is_zero_64(uint64_t a)
+{
+ return constant_time_msb_64(~a & (a - 1));
+}
+
static ossl_inline unsigned int constant_time_eq(unsigned int a,
unsigned int b)
{