summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/arch
diff options
context:
space:
mode:
authorjsing <>2025-03-07 14:21:22 +0000
committerjsing <>2025-03-07 14:21:22 +0000
commit98a22bb72e4a20765f43cd5778f45ccd8072fa26 (patch)
treecdaa4718601092c89a7ce80734ed3833143670e9 /src/lib/libcrypto/arch
parent44ed550ca5e0b6e9358fa1dc3fe19cf4014eb338 (diff)
downloadopenbsd-98a22bb72e4a20765f43cd5778f45ccd8072fa26.tar.gz
openbsd-98a22bb72e4a20765f43cd5778f45ccd8072fa26.tar.bz2
openbsd-98a22bb72e4a20765f43cd5778f45ccd8072fa26.zip
Provide an accelerated SHA-256 assembly implementation for aarch64.
This provides a SHA-256 assembly implementation that makes use of the ARM Cryptographic Extension (CE), which is found on many arm64 CPUs. This gives a performance gain of up to 7.5x on an Apple M2 (dependent on block size). If an aarch64 machine does not have SHA2 support, then we'll fall back to using the existing C implementation. ok kettenis@ tb@
Diffstat (limited to 'src/lib/libcrypto/arch')
-rw-r--r--src/lib/libcrypto/arch/aarch64/Makefile.inc5
-rw-r--r--src/lib/libcrypto/arch/aarch64/crypto_arch.h6
2 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/libcrypto/arch/aarch64/Makefile.inc b/src/lib/libcrypto/arch/aarch64/Makefile.inc
index 20a634dc99..41198b069f 100644
--- a/src/lib/libcrypto/arch/aarch64/Makefile.inc
+++ b/src/lib/libcrypto/arch/aarch64/Makefile.inc
@@ -1,7 +1,10 @@
1# $OpenBSD: Makefile.inc,v 1.14 2024/11/08 13:34:24 jsing Exp $ 1# $OpenBSD: Makefile.inc,v 1.15 2025/03/07 14:21:22 jsing Exp $
2 2
3# aarch64-specific libcrypto build rules 3# aarch64-specific libcrypto build rules
4 4
5SRCS += crypto_cpu_caps.c 5SRCS += crypto_cpu_caps.c
6 6
7SRCS += sha256_aarch64.c
8SRCS += sha256_aarch64_ce.S
9
7AFLAGS+= -mmark-bti-property 10AFLAGS+= -mmark-bti-property
diff --git a/src/lib/libcrypto/arch/aarch64/crypto_arch.h b/src/lib/libcrypto/arch/aarch64/crypto_arch.h
index b0188c498a..adc91cd19f 100644
--- a/src/lib/libcrypto/arch/aarch64/crypto_arch.h
+++ b/src/lib/libcrypto/arch/aarch64/crypto_arch.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_arch.h,v 1.2 2024/11/08 13:34:24 jsing Exp $ */ 1/* $OpenBSD: crypto_arch.h,v 1.3 2025/03/07 14:21:22 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -33,4 +33,8 @@ extern uint64_t crypto_cpu_caps_aarch64;
33#define CRYPTO_CPU_CAPS_AARCH64_SHA512 (1ULL << 4) 33#define CRYPTO_CPU_CAPS_AARCH64_SHA512 (1ULL << 4)
34#define CRYPTO_CPU_CAPS_AARCH64_SHA3 (1ULL << 5) 34#define CRYPTO_CPU_CAPS_AARCH64_SHA3 (1ULL << 5)
35 35
36#ifndef OPENSSL_NO_ASM
37#define HAVE_SHA256_BLOCK_DATA_ORDER
38#endif
39
36#endif 40#endif