]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Move OpenSSL-related MD4/5 defines and imports to lib/mdigest.h
authorJorrit Jongma <git@jongma.org>
Mon, 25 May 2020 16:16:19 +0000 (18:16 +0200)
committerWayne Davison <wayne@opencoder.net>
Tue, 2 Jun 2020 00:57:38 +0000 (17:57 -0700)
Works just as well, prevents having to repeat them across files

checksum.c
lib/mdigest.h

index 19df32a312039c3a382161f62647ea5d88fb8705..d6a91e7ce1750af3bf5d0cb52b55ea40c9198d06 100644 (file)
 #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 */
 
index 86c1140f090674691da4eb14e2a840e24b49b197..e543d6f3a8d6d2ddd148cd0ed782ab7cf79f56f9 100644 (file)
@@ -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]);