summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorrit Jongma <git@jongma.org>2020-05-25 18:16:19 +0200
committerWayne Davison <wayne@opencoder.net>2020-06-01 17:57:38 -0700
commit71c4ae23362bcd5a2f71127f13008f3b1b7f171d (patch)
treec8be2df3b318fe59ea498738022bf6de2ba6cb1d
parentc0268d9217ebe1affab268a86696c33caf21485c (diff)
downloadrsync-71c4ae23362bcd5a2f71127f13008f3b1b7f171d.tar.gz
Move OpenSSL-related MD4/5 defines and imports to lib/mdigest.h
Works just as well, prevents having to repeat them across files
-rw-r--r--checksum.c11
-rw-r--r--lib/mdigest.h10
2 files changed, 10 insertions, 11 deletions
diff --git a/checksum.c b/checksum.c
index 19df32a3..d6a91e7c 100644
--- a/checksum.c
+++ b/checksum.c
@@ -30,10 +30,6 @@
#ifdef SUPPORT_XXHASH
#include "xxhash.h"
#endif
-#ifdef USE_OPENSSL
-#include "openssl/md4.h"
-#include "openssl/md5.h"
-#endif
extern int am_server;
extern int whole_file;
@@ -63,13 +59,6 @@ struct name_num_obj valid_checksums = {
}
};
-#ifndef USE_OPENSSL
-#define MD5_CTX md_context
-#define MD5_Init md5_begin
-#define MD5_Update md5_update
-#define MD5_Final(digest, cptr) md5_result(cptr, digest)
-#endif
-
int xfersum_type = 0; /* used for the file transfer checksums */
int checksum_type = 0; /* used for the pre-transfer (--checksum) checksums */
diff --git a/lib/mdigest.h b/lib/mdigest.h
index 86c1140f..e543d6f3 100644
--- a/lib/mdigest.h
+++ b/lib/mdigest.h
@@ -1,5 +1,10 @@
/* The include file for both the MD4 and MD5 routines. */
+#ifdef USE_OPENSSL
+#include "openssl/md4.h"
+#include "openssl/md5.h"
+#endif
+
#define MD4_DIGEST_LEN 16
#define MD5_DIGEST_LEN 16
#define MAX_DIGEST_LEN MD5_DIGEST_LEN
@@ -18,6 +23,11 @@ void mdfour_update(md_context *md, const uchar *in, uint32 length);
void mdfour_result(md_context *md, uchar digest[MD4_DIGEST_LEN]);
#ifndef USE_OPENSSL
+#define MD5_CTX md_context
+#define MD5_Init md5_begin
+#define MD5_Update md5_update
+#define MD5_Final(digest, cptr) md5_result(cptr, digest)
+
void md5_begin(md_context *ctx);
void md5_update(md_context *ctx, const uchar *input, uint32 length);
void md5_result(md_context *ctx, uchar digest[MD5_DIGEST_LEN]);