Author: stevek
Date: Fri Sep  4 04:31:56 2020
New Revision: 365325
URL: https://svnweb.freebsd.org/changeset/base/365325
Log:
  Avoid collisions with function names in openssl headers.
  
  Just using MD5, SHA1, RMD160 and SHA256 for defines collides with
  functions of the same name in OpenSSL. This can cause compilation
  issues in downstream consumers if they use OpenSSL for the hash
  functions instead of libmd.
  
  Reviewed by:  sjg
  Obtained from:        Juniper Networks, Inc.
  Differential Revision:        https://reviews.freebsd.org/D26321

Modified:
  head/usr.sbin/fmtree/Makefile
  head/usr.sbin/fmtree/compare.c

Modified: head/usr.sbin/fmtree/Makefile
==============================================================================
--- head/usr.sbin/fmtree/Makefile       Fri Sep  4 02:22:27 2020        
(r365324)
+++ head/usr.sbin/fmtree/Makefile       Fri Sep  4 04:31:56 2020        
(r365325)
@@ -10,7 +10,7 @@ MAN=  fmtree.8
 SRCS=  compare.c crc.c create.c excludes.c misc.c mtree.c spec.c verify.c
 SRCS+= specspec.c
 
-CFLAGS+= -DMD5 -DSHA1 -DRMD160 -DSHA256
+CFLAGS+= -DWITH_MD5 -DWITH_SHA1 -DWITH_RMD160 -DWITH_SHA256
 LIBADD=        md
 
 CLEANFILES+=   fmtree.8

Modified: head/usr.sbin/fmtree/compare.c
==============================================================================
--- head/usr.sbin/fmtree/compare.c      Fri Sep  4 02:22:27 2020        
(r365324)
+++ head/usr.sbin/fmtree/compare.c      Fri Sep  4 04:31:56 2020        
(r365325)
@@ -43,16 +43,16 @@ __FBSDID("$FreeBSD$");
 #include <errno.h>
 #include <fcntl.h>
 #include <fts.h>
-#ifdef MD5
+#ifdef WITH_MD5
 #include <md5.h>
 #endif
-#ifdef RMD160
+#ifdef WITH_RMD160
 #include <ripemd.h>
 #endif
-#ifdef SHA1
+#ifdef WITH_SHA1
 #include <sha.h>
 #endif
-#ifdef SHA256
+#ifdef WITH_SHA256
 #include <sha256.h>
 #endif
 #include <stdint.h>
@@ -244,7 +244,7 @@ typeerr:            LABEL;
                        (void)printf("\n");
                tab = "\t";
        }
-#ifdef MD5
+#ifdef WITH_MD5
        if (s->flags & F_MD5) {
                char *new_digest, buf[33];
 
@@ -262,7 +262,7 @@ typeerr:            LABEL;
                }
        }
 #endif /* MD5 */
-#ifdef SHA1
+#ifdef WITH_SHA1
        if (s->flags & F_SHA1) {
                char *new_digest, buf[41];
 
@@ -280,7 +280,7 @@ typeerr:            LABEL;
                }
        }
 #endif /* SHA1 */
-#ifdef RMD160
+#ifdef WITH_RMD160
        if (s->flags & F_RMD160) {
                char *new_digest, buf[41];
 
@@ -298,7 +298,7 @@ typeerr:            LABEL;
                }
        }
 #endif /* RMD160 */
-#ifdef SHA256
+#ifdef WITH_SHA256
        if (s->flags & F_SHA256) {
                char *new_digest, buf[65];
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to