diff options
| author | jsing <> | 2026-01-17 16:18:32 +0000 |
|---|---|---|
| committer | jsing <> | 2026-01-17 16:18:32 +0000 |
| commit | 03fc8f9b9ecbb65326348dd8eccc5d22344abefe (patch) | |
| tree | 304533a0e18e53486c5458ff9c69099a939484be /src/lib/libcrypto/arch/amd64 | |
| parent | fdea186c25361674646de3b0a16b3ad37c8f0ec3 (diff) | |
| download | openbsd-03fc8f9b9ecbb65326348dd8eccc5d22344abefe.tar.gz openbsd-03fc8f9b9ecbb65326348dd8eccc5d22344abefe.tar.bz2 openbsd-03fc8f9b9ecbb65326348dd8eccc5d22344abefe.zip | |
Provide LIBRESSL_USE_.*_ASSEMBLY defines.
Make life easier for portable by providing LIBRESSL_USE_.*_ASSEMBLY
defines, which enable/disable assembly for a specific algorithm. This
means that selected platforms can include the assembly files and specify
a define, rather than having to try to patch the crypto_arch.h headers.
Discussed with tb@
Diffstat (limited to 'src/lib/libcrypto/arch/amd64')
| -rw-r--r-- | src/lib/libcrypto/arch/amd64/Makefile.inc | 9 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/amd64/crypto_arch.h | 15 |
2 files changed, 18 insertions, 6 deletions
diff --git a/src/lib/libcrypto/arch/amd64/Makefile.inc b/src/lib/libcrypto/arch/amd64/Makefile.inc index 8f1681322d..ea03944273 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.45 2026/01/17 14:53:09 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.46 2026/01/17 16:18:32 jsing Exp $ |
| 2 | 2 | ||
| 3 | # amd64-specific libcrypto build rules | 3 | # amd64-specific libcrypto build rules |
| 4 | 4 | ||
| @@ -8,6 +8,7 @@ EXTRA_PL = ${LCRYPTO_SRC}/perlasm/x86_64-xlate.pl | |||
| 8 | SRCS += crypto_cpu_caps.c | 8 | SRCS += crypto_cpu_caps.c |
| 9 | 9 | ||
| 10 | # aes | 10 | # aes |
| 11 | CFLAGS+= -DLIBRESSL_USE_AES_ASSEMBLY | ||
| 11 | SSLASM+= aes aes-x86_64 | 12 | SSLASM+= aes aes-x86_64 |
| 12 | SSLASM+= aes aesni-x86_64 | 13 | SSLASM+= aes aesni-x86_64 |
| 13 | SRCS += aes_amd64.c | 14 | SRCS += aes_amd64.c |
| @@ -20,6 +21,7 @@ CFLAGS+= -DOPENSSL_BN_ASM_MONT5 | |||
| 20 | SSLASM+= bn x86_64-mont5 | 21 | SSLASM+= bn x86_64-mont5 |
| 21 | 22 | ||
| 22 | # bn s2n-bignum | 23 | # bn s2n-bignum |
| 24 | CFLAGS+= -DLIBRESSL_USE_BN_ASSEMBLY | ||
| 23 | SRCS += bn_arch.c | 25 | SRCS += bn_arch.c |
| 24 | SRCS += bignum_add.S | 26 | SRCS += bignum_add.S |
| 25 | SRCS += bignum_cmadd.S | 27 | SRCS += bignum_cmadd.S |
| @@ -44,17 +46,20 @@ SRCS += bignum_sub.S | |||
| 44 | SRCS += word_clz.S | 46 | SRCS += word_clz.S |
| 45 | 47 | ||
| 46 | # md5 | 48 | # md5 |
| 49 | CFLAGS+= -DLIBRESSL_USE_MD5_ASSEMBLY | ||
| 47 | SRCS+= md5_amd64_generic.S | 50 | SRCS+= md5_amd64_generic.S |
| 48 | 51 | ||
| 49 | # modes | 52 | # modes |
| 53 | CFLAGS+= -DLIBRESSL_USE_GCM_ASSEMBLY | ||
| 50 | SSLASM+= modes ghash-x86_64 | 54 | SSLASM+= modes ghash-x86_64 |
| 51 | SRCS += gcm128_amd64.c | 55 | SRCS += gcm128_amd64.c |
| 52 | 56 | ||
| 53 | # rc4 | 57 | # rc4 |
| 58 | CFLAGS+= -DLIBRESSL_USE_RC4_ASSEMBLY | ||
| 54 | SSLASM+= rc4 rc4-x86_64 | 59 | SSLASM+= rc4 rc4-x86_64 |
| 55 | 60 | ||
| 56 | # ripemd | ||
| 57 | # sha | 61 | # sha |
| 62 | CFLAGS+= -DLIBRESSL_USE_SHA_ASSEMBLY | ||
| 58 | SRCS+= sha1_amd64.c | 63 | SRCS+= sha1_amd64.c |
| 59 | SRCS+= sha1_amd64_generic.S | 64 | SRCS+= sha1_amd64_generic.S |
| 60 | SRCS+= sha1_amd64_shani.S | 65 | SRCS+= sha1_amd64_shani.S |
diff --git a/src/lib/libcrypto/arch/amd64/crypto_arch.h b/src/lib/libcrypto/arch/amd64/crypto_arch.h index 411deb0e5d..09f771b6c6 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.17 2026/01/17 14:53:09 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.18 2026/01/17 16:18:32 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,11 +33,11 @@ extern uint64_t crypto_cpu_caps_amd64; | |||
| 33 | 33 | ||
| 34 | #ifndef OPENSSL_NO_ASM | 34 | #ifndef OPENSSL_NO_ASM |
| 35 | 35 | ||
| 36 | #ifdef LIBRESSL_USE_AES_ASSEMBLY | ||
| 36 | #define HAVE_AES_SET_ENCRYPT_KEY_GENERIC | 37 | #define HAVE_AES_SET_ENCRYPT_KEY_GENERIC |
| 37 | #define HAVE_AES_SET_DECRYPT_KEY_GENERIC | 38 | #define HAVE_AES_SET_DECRYPT_KEY_GENERIC |
| 38 | #define HAVE_AES_ENCRYPT_GENERIC | 39 | #define HAVE_AES_ENCRYPT_GENERIC |
| 39 | #define HAVE_AES_DECRYPT_GENERIC | 40 | #define HAVE_AES_DECRYPT_GENERIC |
| 40 | |||
| 41 | #define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL | 41 | #define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL |
| 42 | #define HAVE_AES_SET_DECRYPT_KEY_INTERNAL | 42 | #define HAVE_AES_SET_DECRYPT_KEY_INTERNAL |
| 43 | #define HAVE_AES_ENCRYPT_INTERNAL | 43 | #define HAVE_AES_ENCRYPT_INTERNAL |
| @@ -47,24 +47,31 @@ extern uint64_t crypto_cpu_caps_amd64; | |||
| 47 | #define HAVE_AES_CTR32_ENCRYPT_INTERNAL | 47 | #define HAVE_AES_CTR32_ENCRYPT_INTERNAL |
| 48 | #define HAVE_AES_ECB_ENCRYPT_INTERNAL | 48 | #define HAVE_AES_ECB_ENCRYPT_INTERNAL |
| 49 | #define HAVE_AES_XTS_ENCRYPT_INTERNAL | 49 | #define HAVE_AES_XTS_ENCRYPT_INTERNAL |
| 50 | #endif | ||
| 50 | 51 | ||
| 52 | #ifdef LIBRESSL_USE_GCM_ASSEMBLY | ||
| 51 | #define HAVE_GCM128_INIT | 53 | #define HAVE_GCM128_INIT |
| 52 | #define HAVE_GCM_GHASH_4BIT | 54 | #define HAVE_GCM_GHASH_4BIT |
| 53 | #define HAVE_GCM_GMULT_4BIT | 55 | #define HAVE_GCM_GMULT_4BIT |
| 56 | #endif | ||
| 54 | 57 | ||
| 58 | #ifdef LIBRESSL_USE_MD5_ASSEMBLY | ||
| 55 | #define HAVE_MD5_BLOCK_DATA_ORDER | 59 | #define HAVE_MD5_BLOCK_DATA_ORDER |
| 60 | #endif | ||
| 56 | 61 | ||
| 62 | #ifdef LIBRESSL_USE_RC4_ASSEMBLY | ||
| 57 | #define HAVE_RC4_INTERNAL | 63 | #define HAVE_RC4_INTERNAL |
| 58 | #define HAVE_RC4_SET_KEY_INTERNAL | 64 | #define HAVE_RC4_SET_KEY_INTERNAL |
| 65 | #endif | ||
| 59 | 66 | ||
| 67 | #ifdef LIBRESSL_USE_SHA_ASSEMBLY | ||
| 60 | #define HAVE_SHA1_BLOCK_DATA_ORDER | 68 | #define HAVE_SHA1_BLOCK_DATA_ORDER |
| 61 | #define HAVE_SHA1_BLOCK_GENERIC | 69 | #define HAVE_SHA1_BLOCK_GENERIC |
| 62 | |||
| 63 | #define HAVE_SHA256_BLOCK_DATA_ORDER | 70 | #define HAVE_SHA256_BLOCK_DATA_ORDER |
| 64 | #define HAVE_SHA256_BLOCK_GENERIC | 71 | #define HAVE_SHA256_BLOCK_GENERIC |
| 65 | |||
| 66 | #define HAVE_SHA512_BLOCK_DATA_ORDER | 72 | #define HAVE_SHA512_BLOCK_DATA_ORDER |
| 67 | #define HAVE_SHA512_BLOCK_GENERIC | 73 | #define HAVE_SHA512_BLOCK_GENERIC |
| 74 | #endif | ||
| 68 | 75 | ||
| 69 | #endif | 76 | #endif |
| 70 | 77 | ||
