--- embedaddon/rsync/lib/md5.c 2012/02/17 15:09:30 1.1.1.1 +++ embedaddon/rsync/lib/md5.c 2021/03/17 00:32:36 1.1.1.2 @@ -2,6 +2,7 @@ * RFC 1321 compliant MD5 implementation * * Copyright (C) 2001-2003 Christophe Devine + * Copyright (C) 2007-2020 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +20,7 @@ #include "rsync.h" +#ifndef USE_OPENSSL void md5_begin(md_context *ctx) { ctx->A = 0x67452301; @@ -146,6 +148,10 @@ static void md5_process(md_context *ctx, const uchar d ctx->D += D; } +#if defined HAVE_ASM && CSUM_CHUNK == 64 +extern void md5_process_asm(md_context *ctx, const void *data, size_t num); +#endif + void md5_update(md_context *ctx, const uchar *input, uint32 length) { uint32 left, fill; @@ -170,11 +176,20 @@ void md5_update(md_context *ctx, const uchar *input, u left = 0; } +#if defined HAVE_ASM && CSUM_CHUNK == 64 + if (length >= CSUM_CHUNK) { + uint32 chunks = length / CSUM_CHUNK; + md5_process_asm(ctx, input, chunks); + length -= chunks * CSUM_CHUNK; + input += chunks * CSUM_CHUNK; + } +#else while (length >= CSUM_CHUNK) { md5_process(ctx, input); length -= CSUM_CHUNK; input += CSUM_CHUNK; } +#endif if (length) memcpy(ctx->buffer + left, input, length); @@ -206,7 +221,10 @@ void md5_result(md_context *ctx, uchar digest[MD5_DIGE SIVALu(digest, 8, ctx->C); SIVALu(digest, 12, ctx->D); } +#endif +#ifdef TEST_MD5 + void get_md5(uchar *out, const uchar *input, int n) { md_context ctx; @@ -214,8 +232,6 @@ void get_md5(uchar *out, const uchar *input, int n) md5_update(&ctx, input, n); md5_result(&ctx, out); } - -#ifdef TEST_MD5 #include #include