gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [libmicrohttpd] 05/06: MD5: some optimisations for little-e


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] 05/06: MD5: some optimisations for little-endian
Date: Tue, 16 Apr 2019 09:59:50 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 608b77383e8a79f7e527a66851a5766548660015
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Mon Apr 15 23:03:04 2019 +0300

    MD5: some optimisations for little-endian
---
 src/microhttpd/md5.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/microhttpd/md5.c b/src/microhttpd/md5.c
index 867e0d3f..f3b09aea 100644
--- a/src/microhttpd/md5.c
+++ b/src/microhttpd/md5.c
@@ -21,6 +21,10 @@
 #include "mhd_byteorder.h"
 #include "mhd_assert.h"
 
+#if _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN
+#define PUT_64BIT_LE(cp, value) ((*(uint64_t*)(cp)) = (uint64_t)(value))
+#define PUT_32BIT_LE(cp, value) ((*(uint32_t*)(cp)) = (uint32_t)(value))
+#else
 #define PUT_64BIT_LE(cp, value) do {                                   \
        (cp)[7] = (uint8_t)((value) >> 56);                             \
        (cp)[6] = (uint8_t)((value) >> 48);                             \
@@ -36,6 +40,7 @@
        (cp)[2] = (uint8_t)((value) >> 16);                             \
        (cp)[1] = (uint8_t)((value) >> 8);                              \
        (cp)[0] = (uint8_t)((value)); } while (0)
+#endif
 
 static uint8_t PADDING[MD5_BLOCK_SIZE] = {
   0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -135,11 +140,12 @@ static void
 MD5Transform (uint32_t state[4],
               const uint8_t block[MD5_BLOCK_SIZE])
 {
-  uint32_t a, b, c, d, in[MD5_BLOCK_SIZE / 4];
+  uint32_t a, b, c, d;
 
 #if _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN
-  memcpy(in, block, sizeof(in));
+  const uint32_t *in = (const uint32_t *)block;
 #else
+  uint32_t in[MD5_BLOCK_SIZE / 4];
   for (a = 0; a < MD5_BLOCK_SIZE / 4; a++)
   {
     in[a] = (uint32_t)(

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]