diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/libcrypto/arch/alpha/Makefile.inc | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/alpha/crypto_arch.h | 9 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/amd64/Makefile.inc | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/amd64/crypto_arch.h | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/hppa/Makefile.inc | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/hppa/crypto_arch.h | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/i386/Makefile.inc | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/i386/crypto_arch.h | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/sparc64/Makefile.inc | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/sparc64/crypto_arch.h | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/modes/gcm128.c | 21 |
11 files changed, 41 insertions, 22 deletions
diff --git a/src/lib/libcrypto/arch/alpha/Makefile.inc b/src/lib/libcrypto/arch/alpha/Makefile.inc index 1073ac3c1e..d89f32dc9d 100644 --- a/src/lib/libcrypto/arch/alpha/Makefile.inc +++ b/src/lib/libcrypto/arch/alpha/Makefile.inc | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.15 2025/02/14 12:01:58 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.16 2026/01/17 14:30:37 jsing Exp $ |
| 2 | 2 | ||
| 3 | # alpha-specific libcrypto build rules | 3 | # alpha-specific libcrypto build rules |
| 4 | 4 | ||
| @@ -6,7 +6,6 @@ | |||
| 6 | SSLASM+= bn alpha-mont | 6 | SSLASM+= bn alpha-mont |
| 7 | CFLAGS+= -DOPENSSL_BN_ASM_MONT | 7 | CFLAGS+= -DOPENSSL_BN_ASM_MONT |
| 8 | # modes | 8 | # modes |
| 9 | CFLAGS+= -DGHASH_ASM | ||
| 10 | SSLASM+= modes ghash-alpha | 9 | SSLASM+= modes ghash-alpha |
| 11 | # sha | 10 | # sha |
| 12 | SSLASM+= sha sha1-alpha | 11 | SSLASM+= sha sha1-alpha |
diff --git a/src/lib/libcrypto/arch/alpha/crypto_arch.h b/src/lib/libcrypto/arch/alpha/crypto_arch.h index 1d553b7e07..8fec3e2855 100644 --- a/src/lib/libcrypto/arch/alpha/crypto_arch.h +++ b/src/lib/libcrypto/arch/alpha/crypto_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_arch.h,v 1.2 2025/02/14 12:01:58 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.3 2026/01/17 14:30:37 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -18,7 +18,14 @@ | |||
| 18 | #ifndef HEADER_CRYPTO_ARCH_H | 18 | #ifndef HEADER_CRYPTO_ARCH_H |
| 19 | #define HEADER_CRYPTO_ARCH_H | 19 | #define HEADER_CRYPTO_ARCH_H |
| 20 | 20 | ||
| 21 | #ifndef OPENSSL_NO_ASM | ||
| 22 | |||
| 23 | #define HAVE_GCM_GHASH_4BIT | ||
| 24 | #define HAVE_GCM_GMULT_4BIT | ||
| 25 | |||
| 21 | #define HAVE_SHA1_BLOCK_DATA_ORDER | 26 | #define HAVE_SHA1_BLOCK_DATA_ORDER |
| 22 | #define HAVE_SHA1_BLOCK_GENERIC | 27 | #define HAVE_SHA1_BLOCK_GENERIC |
| 23 | 28 | ||
| 24 | #endif | 29 | #endif |
| 30 | |||
| 31 | #endif | ||
diff --git a/src/lib/libcrypto/arch/amd64/Makefile.inc b/src/lib/libcrypto/arch/amd64/Makefile.inc index 27c61edf58..49f2f6e627 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.43 2026/01/17 13:55:30 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.44 2026/01/17 14:30:37 jsing Exp $ |
| 2 | 2 | ||
| 3 | # amd64-specific libcrypto build rules | 3 | # amd64-specific libcrypto build rules |
| 4 | 4 | ||
| @@ -48,7 +48,6 @@ CFLAGS+= -DMD5_ASM | |||
| 48 | SRCS+= md5_amd64_generic.S | 48 | SRCS+= md5_amd64_generic.S |
| 49 | 49 | ||
| 50 | # modes | 50 | # modes |
| 51 | CFLAGS+= -DGHASH_ASM | ||
| 52 | SSLASM+= modes ghash-x86_64 | 51 | SSLASM+= modes ghash-x86_64 |
| 53 | SRCS += gcm128_amd64.c | 52 | SRCS += gcm128_amd64.c |
| 54 | 53 | ||
diff --git a/src/lib/libcrypto/arch/amd64/crypto_arch.h b/src/lib/libcrypto/arch/amd64/crypto_arch.h index 9a179a571e..fdc17b8110 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.15 2025/09/08 12:56:17 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.16 2026/01/17 14:30:37 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -49,6 +49,8 @@ extern uint64_t crypto_cpu_caps_amd64; | |||
| 49 | #define HAVE_AES_XTS_ENCRYPT_INTERNAL | 49 | #define HAVE_AES_XTS_ENCRYPT_INTERNAL |
| 50 | 50 | ||
| 51 | #define HAVE_GCM128_INIT | 51 | #define HAVE_GCM128_INIT |
| 52 | #define HAVE_GCM_GHASH_4BIT | ||
| 53 | #define HAVE_GCM_GMULT_4BIT | ||
| 52 | 54 | ||
| 53 | #define HAVE_RC4_INTERNAL | 55 | #define HAVE_RC4_INTERNAL |
| 54 | #define HAVE_RC4_SET_KEY_INTERNAL | 56 | #define HAVE_RC4_SET_KEY_INTERNAL |
diff --git a/src/lib/libcrypto/arch/hppa/Makefile.inc b/src/lib/libcrypto/arch/hppa/Makefile.inc index ebcc4c8208..4244c20fef 100644 --- a/src/lib/libcrypto/arch/hppa/Makefile.inc +++ b/src/lib/libcrypto/arch/hppa/Makefile.inc | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.28 2026/01/17 13:55:30 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.29 2026/01/17 14:30:37 jsing Exp $ |
| 2 | 2 | ||
| 3 | # hppa-specific libcrypto build rules | 3 | # hppa-specific libcrypto build rules |
| 4 | 4 | ||
| @@ -8,7 +8,6 @@ SSLASM+= aes aes-parisc aes-parisc | |||
| 8 | SSLASM+= bn parisc-mont parisc-mont | 8 | SSLASM+= bn parisc-mont parisc-mont |
| 9 | CFLAGS+= -DOPENSSL_BN_ASM_MONT | 9 | CFLAGS+= -DOPENSSL_BN_ASM_MONT |
| 10 | # modes | 10 | # modes |
| 11 | CFLAGS+= -DGHASH_ASM | ||
| 12 | SSLASM+= modes ghash-parisc ghash-parisc | 11 | SSLASM+= modes ghash-parisc ghash-parisc |
| 13 | # sha | 12 | # sha |
| 14 | SSLASM+= sha sha1-parisc sha1-parisc | 13 | SSLASM+= sha sha1-parisc sha1-parisc |
diff --git a/src/lib/libcrypto/arch/hppa/crypto_arch.h b/src/lib/libcrypto/arch/hppa/crypto_arch.h index 08fcaca045..80260c93e7 100644 --- a/src/lib/libcrypto/arch/hppa/crypto_arch.h +++ b/src/lib/libcrypto/arch/hppa/crypto_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_arch.h,v 1.2 2025/02/14 12:01:58 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.3 2026/01/17 14:30:37 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -23,6 +23,9 @@ | |||
| 23 | #define HAVE_AES_ENCRYPT_INTERNAL | 23 | #define HAVE_AES_ENCRYPT_INTERNAL |
| 24 | #define HAVE_AES_DECRYPT_INTERNAL | 24 | #define HAVE_AES_DECRYPT_INTERNAL |
| 25 | 25 | ||
| 26 | #define HAVE_GCM_GHASH_4BIT | ||
| 27 | #define HAVE_GCM_GMULT_4BIT | ||
| 28 | |||
| 26 | #define HAVE_SHA1_BLOCK_DATA_ORDER | 29 | #define HAVE_SHA1_BLOCK_DATA_ORDER |
| 27 | #define HAVE_SHA1_BLOCK_GENERIC | 30 | #define HAVE_SHA1_BLOCK_GENERIC |
| 28 | 31 | ||
diff --git a/src/lib/libcrypto/arch/i386/Makefile.inc b/src/lib/libcrypto/arch/i386/Makefile.inc index d0c1aeea6a..18d316e64d 100644 --- a/src/lib/libcrypto/arch/i386/Makefile.inc +++ b/src/lib/libcrypto/arch/i386/Makefile.inc | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.32 2026/01/17 13:55:30 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.33 2026/01/17 14:30:37 jsing Exp $ |
| 2 | 2 | ||
| 3 | # i386-specific libcrypto build rules | 3 | # i386-specific libcrypto build rules |
| 4 | 4 | ||
| @@ -23,7 +23,6 @@ CFLAGS+= -DMD5_ASM | |||
| 23 | SSLASM+= md5 md5-586 | 23 | SSLASM+= md5 md5-586 |
| 24 | 24 | ||
| 25 | # modes | 25 | # modes |
| 26 | CFLAGS+= -DGHASH_ASM | ||
| 27 | SSLASM+= modes ghash-x86 | 26 | SSLASM+= modes ghash-x86 |
| 28 | SRCS += gcm128_i386.c | 27 | SRCS += gcm128_i386.c |
| 29 | 28 | ||
diff --git a/src/lib/libcrypto/arch/i386/crypto_arch.h b/src/lib/libcrypto/arch/i386/crypto_arch.h index f0e9e4c065..143dce6ce0 100644 --- a/src/lib/libcrypto/arch/i386/crypto_arch.h +++ b/src/lib/libcrypto/arch/i386/crypto_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_arch.h,v 1.14 2025/12/31 10:06:41 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.15 2026/01/17 14:30:37 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -49,6 +49,8 @@ extern uint64_t crypto_cpu_caps_i386; | |||
| 49 | #define HAVE_AES_XTS_ENCRYPT_INTERNAL | 49 | #define HAVE_AES_XTS_ENCRYPT_INTERNAL |
| 50 | 50 | ||
| 51 | #define HAVE_GCM128_INIT | 51 | #define HAVE_GCM128_INIT |
| 52 | #define HAVE_GCM_GHASH_4BIT | ||
| 53 | #define HAVE_GCM_GMULT_4BIT | ||
| 52 | 54 | ||
| 53 | #define HAVE_RC4_INTERNAL | 55 | #define HAVE_RC4_INTERNAL |
| 54 | #define HAVE_RC4_SET_KEY_INTERNAL | 56 | #define HAVE_RC4_SET_KEY_INTERNAL |
diff --git a/src/lib/libcrypto/arch/sparc64/Makefile.inc b/src/lib/libcrypto/arch/sparc64/Makefile.inc index f09a9769a9..2343b3b3e2 100644 --- a/src/lib/libcrypto/arch/sparc64/Makefile.inc +++ b/src/lib/libcrypto/arch/sparc64/Makefile.inc | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.22 2026/01/17 13:55:31 jsing Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.23 2026/01/17 14:30:37 jsing Exp $ |
| 2 | 2 | ||
| 3 | # sparc64-specific libcrypto build rules | 3 | # sparc64-specific libcrypto build rules |
| 4 | 4 | ||
| @@ -6,7 +6,6 @@ | |||
| 6 | SSLASM+= aes aes-sparcv9 aes-sparcv9 | 6 | SSLASM+= aes aes-sparcv9 aes-sparcv9 |
| 7 | # bn | 7 | # bn |
| 8 | # modes | 8 | # modes |
| 9 | CFLAGS+= -DGHASH_ASM | ||
| 10 | SSLASM+= modes ghash-sparcv9 ghash-sparcv9 | 9 | SSLASM+= modes ghash-sparcv9 ghash-sparcv9 |
| 11 | # sha | 10 | # sha |
| 12 | SSLASM+= sha sha1-sparcv9 sha1-sparcv9 | 11 | SSLASM+= sha sha1-sparcv9 sha1-sparcv9 |
diff --git a/src/lib/libcrypto/arch/sparc64/crypto_arch.h b/src/lib/libcrypto/arch/sparc64/crypto_arch.h index 251957a5bc..405f1c3657 100644 --- a/src/lib/libcrypto/arch/sparc64/crypto_arch.h +++ b/src/lib/libcrypto/arch/sparc64/crypto_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_arch.h,v 1.2 2025/02/14 12:01:58 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.3 2026/01/17 14:30:37 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -23,6 +23,9 @@ | |||
| 23 | #define HAVE_AES_ENCRYPT_INTERNAL | 23 | #define HAVE_AES_ENCRYPT_INTERNAL |
| 24 | #define HAVE_AES_DECRYPT_INTERNAL | 24 | #define HAVE_AES_DECRYPT_INTERNAL |
| 25 | 25 | ||
| 26 | #define HAVE_GCM_GHASH_4BIT | ||
| 27 | #define HAVE_GCM_GMULT_4BIT | ||
| 28 | |||
| 26 | #define HAVE_SHA1_BLOCK_DATA_ORDER | 29 | #define HAVE_SHA1_BLOCK_DATA_ORDER |
| 27 | #define HAVE_SHA1_BLOCK_GENERIC | 30 | #define HAVE_SHA1_BLOCK_GENERIC |
| 28 | 31 | ||
diff --git a/src/lib/libcrypto/modes/gcm128.c b/src/lib/libcrypto/modes/gcm128.c index b6874296e0..a88f589b00 100644 --- a/src/lib/libcrypto/modes/gcm128.c +++ b/src/lib/libcrypto/modes/gcm128.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: gcm128.c,v 1.54 2025/06/28 12:39:10 jsing Exp $ */ | 1 | /* $OpenBSD: gcm128.c,v 1.55 2026/01/17 14:30:37 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -52,6 +52,7 @@ | |||
| 52 | 52 | ||
| 53 | #include <openssl/crypto.h> | 53 | #include <openssl/crypto.h> |
| 54 | 54 | ||
| 55 | #include "crypto_arch.h" | ||
| 55 | #include "crypto_internal.h" | 56 | #include "crypto_internal.h" |
| 56 | #include "modes_local.h" | 57 | #include "modes_local.h" |
| 57 | 58 | ||
| @@ -84,17 +85,17 @@ gcm_init_4bit(u128 Htable[16], uint64_t H[2]) | |||
| 84 | } | 85 | } |
| 85 | } | 86 | } |
| 86 | 87 | ||
| 87 | #ifdef GHASH_ASM | 88 | #if !defined(HAVE_GCM_GHASH_4BIT) && !defined(HAVE_GCM_GMULT_4BIT) |
| 88 | void gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16]); | ||
| 89 | void gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp, | ||
| 90 | size_t len); | ||
| 91 | |||
| 92 | #else | ||
| 93 | static const uint16_t rem_4bit[16] = { | 89 | static const uint16_t rem_4bit[16] = { |
| 94 | 0x0000, 0x1c20, 0x3840, 0x2460, 0x7080, 0x6ca0, 0x48c0, 0x54e0, | 90 | 0x0000, 0x1c20, 0x3840, 0x2460, 0x7080, 0x6ca0, 0x48c0, 0x54e0, |
| 95 | 0xe100, 0xfd20, 0xd940, 0xc560, 0x9180, 0x8da0, 0xa9c0, 0xb5e0, | 91 | 0xe100, 0xfd20, 0xd940, 0xc560, 0x9180, 0x8da0, 0xa9c0, 0xb5e0, |
| 96 | }; | 92 | }; |
| 93 | #endif | ||
| 94 | |||
| 95 | #ifdef HAVE_GCM_GMULT_4BIT | ||
| 96 | void gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16]); | ||
| 97 | 97 | ||
| 98 | #else | ||
| 98 | static void | 99 | static void |
| 99 | gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16]) | 100 | gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16]) |
| 100 | { | 101 | { |
| @@ -135,7 +136,13 @@ gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16]) | |||
| 135 | Xi[0] = htobe64(Z.hi); | 136 | Xi[0] = htobe64(Z.hi); |
| 136 | Xi[1] = htobe64(Z.lo); | 137 | Xi[1] = htobe64(Z.lo); |
| 137 | } | 138 | } |
| 139 | #endif | ||
| 138 | 140 | ||
| 141 | #ifdef HAVE_GCM_GHASH_4BIT | ||
| 142 | void gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp, | ||
| 143 | size_t len); | ||
| 144 | |||
| 145 | #else | ||
| 139 | static void | 146 | static void |
| 140 | gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16], | 147 | gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16], |
| 141 | const uint8_t *inp, size_t len) | 148 | const uint8_t *inp, size_t len) |
