Rely on OpenSSL bits only if we're building a system with OpenSSL.

Also, adjust the MD5 calls to rely on libmd instead of libcrypto,
so we keep MD5 support even in the !OpenSSL case.
This commit is contained in:
kientzle 2009-04-18 06:06:47 +00:00
parent 392ab3c6f7
commit caeeb07250
3 changed files with 22 additions and 20 deletions

View File

@ -1,4 +1,5 @@
# $FreeBSD$
.include <bsd.own.mk>
LIB= archive
DPADD= ${LIBBZ2} ${LIBZ}
@ -11,6 +12,11 @@ SHLIB_MAJOR= 4
CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\"
CFLAGS+= -I${.OBJDIR}
.if ${MK_OPENSSL} != "no"
CFLAGS+= -DWITH_OPENSSL
.endif
WARNS?= 6
# Headers to be installed in /usr/include

View File

@ -33,13 +33,13 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_OPENSSL_MD5_H
#include <openssl/md5.h>
#else /* HAVE_OPENSSL_MD5_H */
#ifdef HAVE_MD5_H
#include <md5.h>
#endif
#else
#ifdef HAVE_OPENSSL_MD5_H
#include <openssl/md5.h>
#endif /* HAVE_OPENSSL_MD5_H */
#endif /* HAVE_MD5_H */
#ifdef HAVE_OPENSSL_RIPEMD_H
#include <openssl/ripemd.h>
#else /* HAVE_OPENSSL_RIPEMD_H */
@ -618,7 +618,7 @@ archive_write_mtree_header(struct archive_write *a,
if ((mtree->keys & F_MD5) != 0 &&
archive_entry_filetype(entry) == AE_IFREG) {
mtree->compute_sum |= F_MD5;
MD5_Init(&mtree->md5ctx);
MD5Init(&mtree->md5ctx);
} else
mtree->compute_sum &= ~F_MD5;
#endif
@ -803,7 +803,7 @@ archive_write_mtree_finish_entry(struct archive_write *a)
if (mtree->compute_sum & F_MD5) {
unsigned char buf[16];
MD5_Final(buf, &mtree->md5ctx);
MD5Final(buf, &mtree->md5ctx);
archive_strcat(str, " md5digest=");
strappend_bin(str, buf, sizeof(buf));
}
@ -901,7 +901,7 @@ archive_write_mtree_data(struct archive_write *a, const void *buff, size_t n)
}
#ifdef HAVE_MD5
if (mtree->compute_sum & F_MD5)
MD5_Update(&mtree->md5ctx, buff, n);
MD5Update(&mtree->md5ctx, buff, n);
#endif
#ifdef HAVE_RMD160
if (mtree->compute_sum & F_RMD160)

View File

@ -42,6 +42,14 @@
#define HAVE_SYS_EXTATTR_H 1
#endif
#ifdef WITH_OPENSSL
#define HAVE_OPENSSL_MD5_H 1
#define HAVE_OPENSSL_RIPEMD_H 1
#define HAVE_OPENSSL_SHA_H 1
#define HAVE_SHA384 1
#define HAVE_SHA512 1
#endif
#define HAVE_BZLIB_H 1
#define HAVE_CHFLAGS 1
#define HAVE_CHOWN 1
@ -75,38 +83,26 @@
#define HAVE_LIMITS_H 1
#define HAVE_LUTIMES 1
#define HAVE_MALLOC 1
#if 0
#define HAVE_MD5 1
#define HAVE_MD5_H 1
#endif
#define HAVE_MEMMOVE 1
#define HAVE_MEMSET 1
#define HAVE_MKDIR 1
#define HAVE_MKFIFO 1
#define HAVE_MKNOD 1
#if 0
#define HAVE_OPENSSL_MD5_H 1
#define HAVE_OPENSSL_RIPEMD_H 1
#define HAVE_OPENSSL_SHA_H 1
#endif
#define HAVE_PIPE 1
#define HAVE_POLL 1
#define HAVE_POLL_H 1
#define HAVE_PWD_H 1
#define HAVE_READLINK 1
#if 0
#define HAVE_RIPEMD_H
#define HAVE_RMD160 1
#endif
#define HAVE_SELECT 1
#define HAVE_SETENV 1
#if 0
#define HAVE_SHA_H 1
#define HAVE_SHA1 1
#define HAVE_SHA256 1
#define HAVE_SHA256_H 1
#define HAVE_SHA384 1
#define HAVE_SHA512 1
#endif
#define HAVE_SIGNAL_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1