summaryrefslogtreecommitdiff
path: root/lib/libcrypto/bn
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2023-06-21 07:56:44 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2023-06-21 07:56:44 +0000
commitba393905053c6025b80d50b428c707bf65af63e8 (patch)
tree908983cc07b6e0839b806687ee830c7a21db2ca9 /lib/libcrypto/bn
parent786f399cae7d341e91b832983c0d14bb691826cc (diff)
Provide optimised bn_clzw() for aarch64.
Diffstat (limited to 'lib/libcrypto/bn')
-rw-r--r--lib/libcrypto/bn/arch/aarch64/bn_arch.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/libcrypto/bn/arch/aarch64/bn_arch.h b/lib/libcrypto/bn/arch/aarch64/bn_arch.h
index aa780e09e91..66de3682d4c 100644
--- a/lib/libcrypto/bn/arch/aarch64/bn_arch.h
+++ b/lib/libcrypto/bn/arch/aarch64/bn_arch.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bn_arch.h,v 1.11 2023/06/17 15:40:46 jsing Exp $ */
+/* $OpenBSD: bn_arch.h,v 1.12 2023/06/21 07:56:43 jsing Exp $ */
/*
* Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
*
@@ -24,6 +24,20 @@
#if defined(__GNUC__)
+#define HAVE_BN_CLZW
+
+static inline int
+bn_clzw(BN_ULONG w)
+{
+ BN_ULONG n;
+
+ __asm__ ("clz %[n], %[w]"
+ : [n]"=r"(n)
+ : [w]"r"(w));
+
+ return n;
+}
+
#define HAVE_BN_ADDW
static inline void