summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2023-06-21 07:56:43 +0000
committerjsing <>2023-06-21 07:56:43 +0000
commit4c0df1809176af2c27699157cf128a4348f6daa5 (patch)
tree852fe6b8f3809b05db8cb2c6522acb67f06c5506
parentf91290f116c7d9e13993e1e56be029f210d76516 (diff)
downloadopenbsd-4c0df1809176af2c27699157cf128a4348f6daa5.tar.gz
openbsd-4c0df1809176af2c27699157cf128a4348f6daa5.tar.bz2
openbsd-4c0df1809176af2c27699157cf128a4348f6daa5.zip
Provide optimised bn_clzw() for aarch64.
-rw-r--r--src/lib/libcrypto/bn/arch/aarch64/bn_arch.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/arch/aarch64/bn_arch.h b/src/lib/libcrypto/bn/arch/aarch64/bn_arch.h
index aa780e09e9..66de3682d4 100644
--- a/src/lib/libcrypto/bn/arch/aarch64/bn_arch.h
+++ b/src/lib/libcrypto/bn/arch/aarch64/bn_arch.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_arch.h,v 1.11 2023/06/17 15:40:46 jsing Exp $ */ 1/* $OpenBSD: bn_arch.h,v 1.12 2023/06/21 07:56:43 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -24,6 +24,20 @@
24 24
25#if defined(__GNUC__) 25#if defined(__GNUC__)
26 26
27#define HAVE_BN_CLZW
28
29static inline int
30bn_clzw(BN_ULONG w)
31{
32 BN_ULONG n;
33
34 __asm__ ("clz %[n], %[w]"
35 : [n]"=r"(n)
36 : [w]"r"(w));
37
38 return n;
39}
40
27#define HAVE_BN_ADDW 41#define HAVE_BN_ADDW
28 42
29static inline void 43static inline void