From: Jorrit Jongma Date: Mon, 25 May 2020 16:16:19 +0000 (+0200) Subject: Move OpenSSL-related MD4/5 defines and imports to lib/mdigest.h X-Git-Tag: v3.2.0pre1~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71c4ae23362bcd5a2f71127f13008f3b1b7f171d;p=thirdparty%2Frsync.git Move OpenSSL-related MD4/5 defines and imports to lib/mdigest.h Works just as well, prevents having to repeat them across files --- 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]);