From efdc2fdd7e31b41f518a70445b050722a765ff02 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Thu, 28 Mar 2024 01:49:29 +0000 Subject: Use C functions for RC4 public API. Rather than having public API switch between C and assembly, always use C functions as entry points, which then call an assembly implementation (if available). This makes it significantly easier to deal with symbol aliasing/namespaces and it also means we benefit from vulnerability prevention provided by the C compiler. Rename the assembly generated functions from RC4() to rc4_internal() and RC4_set_key() to rc4_set_key_internal(). Always include rc4.c and change it to use defines that are similar to those used in BN. ok beck@ joshua@ tb@ --- src/lib/libcrypto/arch/amd64/Makefile.inc | 5 ++++- src/lib/libcrypto/arch/i386/Makefile.inc | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/lib/libcrypto/arch') diff --git a/src/lib/libcrypto/arch/amd64/Makefile.inc b/src/lib/libcrypto/arch/amd64/Makefile.inc index b04923b596..617b9feb9a 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.16 2024/03/28 01:41:16 jsing Exp $ +# $OpenBSD: Makefile.inc,v 1.17 2024/03/28 01:49:29 jsing Exp $ # amd64-specific libcrypto build rules @@ -46,7 +46,10 @@ SSLASM+= md5 md5-x86_64 CFLAGS+= -DGHASH_ASM SSLASM+= modes ghash-x86_64 # rc4 +CFLAGS+= -DHAVE_RC4_INTERNAL +CFLAGS+= -DHAVE_RC4_SET_KEY_INTERNAL SSLASM+= rc4 rc4-x86_64 +SRCS+= rc4.c # ripemd # sha CFLAGS+= -DSHA1_ASM diff --git a/src/lib/libcrypto/arch/i386/Makefile.inc b/src/lib/libcrypto/arch/i386/Makefile.inc index c1a52e786a..911f02073b 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.13 2024/03/28 01:41:16 jsing Exp $ +# $OpenBSD: Makefile.inc,v 1.14 2024/03/28 01:49:29 jsing Exp $ # i386-specific libcrypto build rules @@ -26,7 +26,10 @@ SSLASM+= md5 md5-586 CFLAGS+= -DGHASH_ASM SSLASM+= modes ghash-x86 # rc4 +CFLAGS+= -DHAVE_RC4_INTERNAL +CFLAGS+= -DHAVE_RC4_SET_KEY_INTERNAL SSLASM+= rc4 rc4-586 +SRCS+= rc4.c # sha CFLAGS+= -DSHA1_ASM SSLASM+= sha sha1-586 -- cgit v1.2.3-55-g6feb