From fdea186c25361674646de3b0a16b3ad37c8f0ec3 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Sat, 17 Jan 2026 14:53:09 +0000 Subject: Replace MD5_ASM with function specific defines. Use the same pattern that is now used for most other code - provide HAVE_MD5_BLOCK_DATA_ORDER and use this to selectively enable source code. --- src/lib/libcrypto/arch/amd64/Makefile.inc | 3 +-- src/lib/libcrypto/arch/amd64/crypto_arch.h | 4 +++- src/lib/libcrypto/arch/i386/Makefile.inc | 3 +-- src/lib/libcrypto/arch/i386/crypto_arch.h | 4 +++- src/lib/libcrypto/md5/md5.c | 6 +++--- 5 files changed, 11 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/arch/amd64/Makefile.inc b/src/lib/libcrypto/arch/amd64/Makefile.inc index 49f2f6e627..8f1681322d 100644 --- a/src/lib/libcrypto/arch/amd64/Makefile.inc +++ b/src/lib/libcrypto/arch/amd64/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.44 2026/01/17 14:30:37 jsing Exp $ +# $OpenBSD: Makefile.inc,v 1.45 2026/01/17 14:53:09 jsing Exp $ # amd64-specific libcrypto build rules @@ -44,7 +44,6 @@ SRCS += bignum_sub.S SRCS += word_clz.S # md5 -CFLAGS+= -DMD5_ASM SRCS+= md5_amd64_generic.S # modes diff --git a/src/lib/libcrypto/arch/amd64/crypto_arch.h b/src/lib/libcrypto/arch/amd64/crypto_arch.h index fdc17b8110..411deb0e5d 100644 --- a/src/lib/libcrypto/arch/amd64/crypto_arch.h +++ b/src/lib/libcrypto/arch/amd64/crypto_arch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto_arch.h,v 1.16 2026/01/17 14:30:37 jsing Exp $ */ +/* $OpenBSD: crypto_arch.h,v 1.17 2026/01/17 14:53:09 jsing Exp $ */ /* * Copyright (c) 2024 Joel Sing * @@ -52,6 +52,8 @@ extern uint64_t crypto_cpu_caps_amd64; #define HAVE_GCM_GHASH_4BIT #define HAVE_GCM_GMULT_4BIT +#define HAVE_MD5_BLOCK_DATA_ORDER + #define HAVE_RC4_INTERNAL #define HAVE_RC4_SET_KEY_INTERNAL diff --git a/src/lib/libcrypto/arch/i386/Makefile.inc b/src/lib/libcrypto/arch/i386/Makefile.inc index 18d316e64d..26c3bc4568 100644 --- a/src/lib/libcrypto/arch/i386/Makefile.inc +++ b/src/lib/libcrypto/arch/i386/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.33 2026/01/17 14:30:37 jsing Exp $ +# $OpenBSD: Makefile.inc,v 1.34 2026/01/17 14:53:09 jsing Exp $ # i386-specific libcrypto build rules @@ -19,7 +19,6 @@ CFLAGS+= -DOPENSSL_BN_ASM_MONT SSLASM+= bn x86-mont # md5 -CFLAGS+= -DMD5_ASM SSLASM+= md5 md5-586 # modes diff --git a/src/lib/libcrypto/arch/i386/crypto_arch.h b/src/lib/libcrypto/arch/i386/crypto_arch.h index 143dce6ce0..ff14881f36 100644 --- a/src/lib/libcrypto/arch/i386/crypto_arch.h +++ b/src/lib/libcrypto/arch/i386/crypto_arch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto_arch.h,v 1.15 2026/01/17 14:30:37 jsing Exp $ */ +/* $OpenBSD: crypto_arch.h,v 1.16 2026/01/17 14:53:09 jsing Exp $ */ /* * Copyright (c) 2024 Joel Sing * @@ -52,6 +52,8 @@ extern uint64_t crypto_cpu_caps_i386; #define HAVE_GCM_GHASH_4BIT #define HAVE_GCM_GMULT_4BIT +#define HAVE_MD5_BLOCK_DATA_ORDER + #define HAVE_RC4_INTERNAL #define HAVE_RC4_SET_KEY_INTERNAL diff --git a/src/lib/libcrypto/md5/md5.c b/src/lib/libcrypto/md5/md5.c index f1c9223d86..f5ad5570a4 100644 --- a/src/lib/libcrypto/md5/md5.c +++ b/src/lib/libcrypto/md5/md5.c @@ -1,4 +1,4 @@ -/* $OpenBSD: md5.c,v 1.25 2025/01/24 13:35:04 jsing Exp $ */ +/* $OpenBSD: md5.c,v 1.26 2026/01/17 14:53:09 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -70,11 +70,11 @@ /* Ensure that MD5_LONG and uint32_t are equivalent size. */ CTASSERT(sizeof(MD5_LONG) == sizeof(uint32_t)); -#ifdef MD5_ASM +#ifdef HAVE_MD5_BLOCK_DATA_ORDER void md5_block_data_order(MD5_CTX *c, const void *p, size_t num); #endif -#ifndef MD5_ASM +#ifndef HAVE_MD5_BLOCK_DATA_ORDER static inline uint32_t md5_F(uint32_t x, uint32_t y, uint32_t z) { -- cgit v1.2.3-55-g6feb