diff options
author | jsing <> | 2025-02-14 12:01:58 +0000 |
---|---|---|
committer | jsing <> | 2025-02-14 12:01:58 +0000 |
commit | 55a1827d4b1706532809a68f02c30336000e01a9 (patch) | |
tree | 606af9a8caef4eada19e055b0a35e755d199b0d1 /src/lib/libcrypto/arch/amd64 | |
parent | aee4d44b17e8fc57dfaadf57efabb128712c9f72 (diff) | |
download | openbsd-55a1827d4b1706532809a68f02c30336000e01a9.tar.gz openbsd-55a1827d4b1706532809a68f02c30336000e01a9.tar.bz2 openbsd-55a1827d4b1706532809a68f02c30336000e01a9.zip |
Replace Makefile based SHA*_ASM defines with HAVE_SHA_* defines.
Currently, SHA{1,256,512}_ASM defines are used to remove the C
implementation of sha{1,256,512}_block_data_order() when it is provided
by assembly. However, this prevents the C implementation from being used
as a fallback.
Rename the C sha*_block_data_order() to sha*_block_generic() and provide
a sha*_block_data_order() that calls sha*_block_generic(). Replace the
Makefile based SHA*_ASM defines with two HAVE_SHA_* defines that allow
these functions to be compiled in or removed, such that machine specific
verisons can be provided. This should effectively be a no-op on any
platform that defined SHA{1,256,512}_ASM.
ok tb@
Diffstat (limited to 'src/lib/libcrypto/arch/amd64')
-rw-r--r-- | src/lib/libcrypto/arch/amd64/Makefile.inc | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/arch/amd64/crypto_arch.h | 11 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/lib/libcrypto/arch/amd64/Makefile.inc b/src/lib/libcrypto/arch/amd64/Makefile.inc index f4410e8059..b1a6563931 100644 --- a/src/lib/libcrypto/arch/amd64/Makefile.inc +++ b/src/lib/libcrypto/arch/amd64/Makefile.inc | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile.inc,v 1.36 2025/01/24 13:35:04 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.37 2025/02/14 12:01:58 jsing Exp $ |
2 | 2 | ||
3 | # amd64-specific libcrypto build rules | 3 | # amd64-specific libcrypto build rules |
4 | 4 | ||
@@ -48,15 +48,12 @@ SSLASM+= modes ghash-x86_64 | |||
48 | SSLASM+= rc4 rc4-x86_64 | 48 | SSLASM+= rc4 rc4-x86_64 |
49 | # ripemd | 49 | # ripemd |
50 | # sha | 50 | # sha |
51 | CFLAGS+= -DSHA1_ASM | ||
52 | SRCS+= sha1_amd64.c | 51 | SRCS+= sha1_amd64.c |
53 | SRCS+= sha1_amd64_generic.S | 52 | SRCS+= sha1_amd64_generic.S |
54 | SRCS+= sha1_amd64_shani.S | 53 | SRCS+= sha1_amd64_shani.S |
55 | CFLAGS+= -DSHA256_ASM | ||
56 | SRCS+= sha256_amd64.c | 54 | SRCS+= sha256_amd64.c |
57 | SRCS+= sha256_amd64_generic.S | 55 | SRCS+= sha256_amd64_generic.S |
58 | SRCS+= sha256_amd64_shani.S | 56 | SRCS+= sha256_amd64_shani.S |
59 | CFLAGS+= -DSHA512_ASM | ||
60 | SRCS+= sha512_amd64.c | 57 | SRCS+= sha512_amd64.c |
61 | SRCS+= sha512_amd64_generic.S | 58 | SRCS+= sha512_amd64_generic.S |
62 | 59 | ||
diff --git a/src/lib/libcrypto/arch/amd64/crypto_arch.h b/src/lib/libcrypto/arch/amd64/crypto_arch.h index 7546fb0dfd..951374250d 100644 --- a/src/lib/libcrypto/arch/amd64/crypto_arch.h +++ b/src/lib/libcrypto/arch/amd64/crypto_arch.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: crypto_arch.h,v 1.4 2024/11/16 13:05:35 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.5 2025/02/14 12:01:58 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -40,6 +40,15 @@ extern uint64_t crypto_cpu_caps_amd64; | |||
40 | #define HAVE_RC4_INTERNAL | 40 | #define HAVE_RC4_INTERNAL |
41 | #define HAVE_RC4_SET_KEY_INTERNAL | 41 | #define HAVE_RC4_SET_KEY_INTERNAL |
42 | 42 | ||
43 | #define HAVE_SHA1_BLOCK_DATA_ORDER | ||
44 | #define HAVE_SHA1_BLOCK_GENERIC | ||
45 | |||
46 | #define HAVE_SHA256_BLOCK_DATA_ORDER | ||
47 | #define HAVE_SHA256_BLOCK_GENERIC | ||
48 | |||
49 | #define HAVE_SHA512_BLOCK_DATA_ORDER | ||
50 | #define HAVE_SHA512_BLOCK_GENERIC | ||
51 | |||
43 | #endif | 52 | #endif |
44 | 53 | ||
45 | #endif | 54 | #endif |