summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/arch
diff options
context:
space:
mode:
authorjsing <>2025-03-12 14:13:41 +0000
committerjsing <>2025-03-12 14:13:41 +0000
commite7d0828785b67e44a3306faac670eee789fc7b10 (patch)
treeb0d2ca8b4fd6a1b59a0984597c85260e091e41e2 /src/lib/libcrypto/arch
parent8627628c24553fa0821bff8f761d620577f97c3b (diff)
downloadopenbsd-e7d0828785b67e44a3306faac670eee789fc7b10.tar.gz
openbsd-e7d0828785b67e44a3306faac670eee789fc7b10.tar.bz2
openbsd-e7d0828785b67e44a3306faac670eee789fc7b10.zip
Provide an accelerated SHA-512 assembly implementation for aarch64.
This provides a SHA-512 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 2.5x on an Apple M2 (dependent on block size). If an aarch64 machine does not have SHA512 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.inc4
-rw-r--r--src/lib/libcrypto/arch/aarch64/crypto_arch.h5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/libcrypto/arch/aarch64/Makefile.inc b/src/lib/libcrypto/arch/aarch64/Makefile.inc
index 41198b069f..d93cb815ef 100644
--- a/src/lib/libcrypto/arch/aarch64/Makefile.inc
+++ b/src/lib/libcrypto/arch/aarch64/Makefile.inc
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile.inc,v 1.15 2025/03/07 14:21:22 jsing Exp $ 1# $OpenBSD: Makefile.inc,v 1.16 2025/03/12 14:13:41 jsing Exp $
2 2
3# aarch64-specific libcrypto build rules 3# aarch64-specific libcrypto build rules
4 4
@@ -6,5 +6,7 @@ SRCS += crypto_cpu_caps.c
6 6
7SRCS += sha256_aarch64.c 7SRCS += sha256_aarch64.c
8SRCS += sha256_aarch64_ce.S 8SRCS += sha256_aarch64_ce.S
9SRCS += sha512_aarch64.c
10SRCS += sha512_aarch64_ce.S
9 11
10AFLAGS+= -mmark-bti-property 12AFLAGS+= -mmark-bti-property
diff --git a/src/lib/libcrypto/arch/aarch64/crypto_arch.h b/src/lib/libcrypto/arch/aarch64/crypto_arch.h
index adc91cd19f..35ecba9394 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.3 2025/03/07 14:21:22 jsing Exp $ */ 1/* $OpenBSD: crypto_arch.h,v 1.4 2025/03/12 14:13:41 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -34,7 +34,10 @@ extern uint64_t crypto_cpu_caps_aarch64;
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 36#ifndef OPENSSL_NO_ASM
37
37#define HAVE_SHA256_BLOCK_DATA_ORDER 38#define HAVE_SHA256_BLOCK_DATA_ORDER
39#define HAVE_SHA512_BLOCK_DATA_ORDER
40
38#endif 41#endif
39 42
40#endif 43#endif