Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
[llvm22] cyrus-sasl2 build fix
To:
ports@openbsd.org
Cc:
ajacoutot@openbsd.org
Date:
Tue, 19 May 2026 20:22:20 +0200

Download raw body.

Thread
libdes's md5 is starting to show its age. It's abusing unsigned char *
for void * which causes llvm22 to error with

md5.c:400:14: error: incompatible pointer types passing 'unsigned char (*)[65]' to parameter of type 'POINTER' (aka 'unsigned char *') [-Wincompatible-pointer-types]

The crude patch below replaces the hand-rolled memcpy() and memset()
with the libc ones. (Redefining POINTER to void * causes other problems).

Index: Makefile
===================================================================
RCS file: /cvs/ports/security/cyrus-sasl2/Makefile,v
diff -u -p -r1.118 Makefile
--- Makefile	21 Jul 2025 16:10:45 -0000	1.118
+++ Makefile	19 May 2026 18:10:16 -0000
@@ -5,7 +5,7 @@ COMMENT=		RFC 2222 SASL (Simple Authenti
 
 V=			2.1.28
 DISTNAME=		cyrus-sasl-${V}
-REVISION=		2
+REVISION=		3
 
 SHARED_LIBS +=  sasl2                3.1      # 3.0
 SHARED_LIBS +=	anonymous                 0.0 # 3.0
Index: patches/patch-lib_md5_c
===================================================================
RCS file: patches/patch-lib_md5_c
diff -N patches/patch-lib_md5_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_md5_c	19 May 2026 18:10:07 -0000
@@ -0,0 +1,32 @@
+Index: lib/md5.c
+--- lib/md5.c.orig
++++ lib/md5.c
+@@ -59,8 +59,12 @@ static void Encode PROTO_LIST
+        ((unsigned char *, UINT4 *, unsigned int)); 
+ static void Decode PROTO_LIST
+        ((UINT4 *, const unsigned char *, unsigned int)); 
++#if 0
+ static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
+ static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
++#endif
++#define MD5_memcpy memcpy
++#define MD5_memset memset
+ 
+ static unsigned char PADDING[64] = {
+        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+@@ -317,6 +321,7 @@ unsigned int len;
+ 
+         */
+ 
++#if 0
+ static void MD5_memcpy (output, input, len)
+ POINTER output;
+ POINTER input;
+@@ -341,6 +346,7 @@ unsigned int len;
+        for (i = 0; i < len; i++) 
+        ((char *)output)[i] = (char)value; 
+ }
++#endif
+ 
+ void _sasl_hmac_md5_init(HMAC_MD5_CTX *hmac,
+ 			 const unsigned char *key,
Index: patches/patch-saslauthd_md5_c
===================================================================
RCS file: patches/patch-saslauthd_md5_c
diff -N patches/patch-saslauthd_md5_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-saslauthd_md5_c	19 May 2026 18:10:07 -0000
@@ -0,0 +1,32 @@
+Index: saslauthd/md5.c
+--- saslauthd/md5.c.orig
++++ saslauthd/md5.c
+@@ -59,8 +59,12 @@ static void Encode PROTO_LIST
+        ((unsigned char *, UINT4 *, unsigned int)); 
+ static void Decode PROTO_LIST
+        ((UINT4 *, unsigned char *, unsigned int)); 
++#if 0
+ static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
+ static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
++#endif
++#define MD5_memcpy memcpy
++#define MD5_memset memset
+ 
+ static unsigned char PADDING[64] = {
+        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+@@ -317,6 +321,7 @@ unsigned int len;
+ 
+         */
+ 
++#if 0
+ static void MD5_memcpy (output, input, len)
+ POINTER output;
+ POINTER input;
+@@ -341,6 +346,7 @@ unsigned int len;
+        for (i = 0; i < len; i++) 
+        ((char *)output)[i] = (char)value; 
+ }
++#endif
+ 
+ void _saslauthd_hmac_md5_init(HMAC_MD5_CTX *hmac,
+ 			 const unsigned char *key,