[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 09/22: md5: improved performance of the first round on L
From: |
gnunet |
Subject: |
[libmicrohttpd] 09/22: md5: improved performance of the first round on LE arches |
Date: |
Sun, 25 Sep 2022 17:43:44 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit f11a6dcedefc58e454957536812fe27b1ef8fb52
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Sep 14 09:37:22 2022 +0300
md5: improved performance of the first round on LE arches
---
src/microhttpd/md5.c | 100 +++++++++++++++++++++++++++++++++------------------
1 file changed, 65 insertions(+), 35 deletions(-)
diff --git a/src/microhttpd/md5.c b/src/microhttpd/md5.c
index 246fa151..fceffdd1 100644
--- a/src/microhttpd/md5.c
+++ b/src/microhttpd/md5.c
@@ -120,41 +120,71 @@ md5_transform (uint32_t H[MD5_HASH_SIZE_WORDS],
/* Round 1. */
- MD5STEP_R1 (A, B, C, D, X[0] = GET_X_FROM_DATA (M, 0), 7, \
- UINT32_C (0xd76aa478));
- MD5STEP_R1 (D, A, B, C, X[1] = GET_X_FROM_DATA (M, 1), 12, \
- UINT32_C (0xe8c7b756));
- MD5STEP_R1 (C, D, A, B, X[2] = GET_X_FROM_DATA (M, 2), 17, \
- UINT32_C (0x242070db));
- MD5STEP_R1 (B, C, D, A, X[3] = GET_X_FROM_DATA (M, 3), 22, \
- UINT32_C (0xc1bdceee));
-
- MD5STEP_R1 (A, B, C, D, X[4] = GET_X_FROM_DATA (M, 4), 7, \
- UINT32_C (0xf57c0faf));
- MD5STEP_R1 (D, A, B, C, X[5] = GET_X_FROM_DATA (M, 5), 12, \
- UINT32_C (0x4787c62a));
- MD5STEP_R1 (C, D, A, B, X[6] = GET_X_FROM_DATA (M, 6), 17, \
- UINT32_C (0xa8304613));
- MD5STEP_R1 (B, C, D, A, X[7] = GET_X_FROM_DATA (M, 7), 22, \
- UINT32_C (0xfd469501));
-
- MD5STEP_R1 (A, B, C, D, X[8] = GET_X_FROM_DATA (M, 8), 7, \
- UINT32_C (0x698098d8));
- MD5STEP_R1 (D, A, B, C, X[9] = GET_X_FROM_DATA (M, 9), 12, \
- UINT32_C (0x8b44f7af));
- MD5STEP_R1 (C, D, A, B, X[10] = GET_X_FROM_DATA (M, 10), 17, \
- UINT32_C (0xffff5bb1));
- MD5STEP_R1 (B, C, D, A, X[11] = GET_X_FROM_DATA (M, 11), 22, \
- UINT32_C (0x895cd7be));
-
- MD5STEP_R1 (A, B, C, D, X[12] = GET_X_FROM_DATA (M, 12), 7, \
- UINT32_C (0x6b901122));
- MD5STEP_R1 (D, A, B, C, X[13] = GET_X_FROM_DATA (M, 13), 12, \
- UINT32_C (0xfd987193));
- MD5STEP_R1 (C, D, A, B, X[14] = GET_X_FROM_DATA (M, 14), 17, \
- UINT32_C (0xa679438e));
- MD5STEP_R1 (B, C, D, A, X[15] = GET_X_FROM_DATA (M, 15), 22, \
- UINT32_C (0x49b40821));
+#if ! defined(MHD_FAVOR_SMALL_CODE) && (_MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN)
+ if ((const void *) X == M)
+ {
+ /* The input data is already in the data buffer X[] in correct bytes
+ order. */
+ MD5STEP_R1 (A, B, C, D, X[0], 7, UINT32_C (0xd76aa478));
+ MD5STEP_R1 (D, A, B, C, X[1], 12, UINT32_C (0xe8c7b756));
+ MD5STEP_R1 (C, D, A, B, X[2], 17, UINT32_C (0x242070db));
+ MD5STEP_R1 (B, C, D, A, X[3], 22, UINT32_C (0xc1bdceee));
+
+ MD5STEP_R1 (A, B, C, D, X[4], 7, UINT32_C (0xf57c0faf));
+ MD5STEP_R1 (D, A, B, C, X[5], 12, UINT32_C (0x4787c62a));
+ MD5STEP_R1 (C, D, A, B, X[6], 17, UINT32_C (0xa8304613));
+ MD5STEP_R1 (B, C, D, A, X[7], 22, UINT32_C (0xfd469501));
+
+ MD5STEP_R1 (A, B, C, D, X[8], 7, UINT32_C (0x698098d8));
+ MD5STEP_R1 (D, A, B, C, X[9], 12, UINT32_C (0x8b44f7af));
+ MD5STEP_R1 (C, D, A, B, X[10], 17, UINT32_C (0xffff5bb1));
+ MD5STEP_R1 (B, C, D, A, X[11], 22, UINT32_C (0x895cd7be));
+
+ MD5STEP_R1 (A, B, C, D, X[12], 7, UINT32_C (0x6b901122));
+ MD5STEP_R1 (D, A, B, C, X[13], 12, UINT32_C (0xfd987193));
+ MD5STEP_R1 (C, D, A, B, X[14], 17, UINT32_C (0xa679438e));
+ MD5STEP_R1 (B, C, D, A, X[15], 22, UINT32_C (0x49b40821));
+ }
+ else /* Combined with the next 'if' */
+#endif /* ! MHD_FAVOR_SMALL_CODE && (_MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN) */
+ if (1)
+ {
+ MD5STEP_R1 (A, B, C, D, X[0] = GET_X_FROM_DATA (M, 0), 7, \
+ UINT32_C (0xd76aa478));
+ MD5STEP_R1 (D, A, B, C, X[1] = GET_X_FROM_DATA (M, 1), 12, \
+ UINT32_C (0xe8c7b756));
+ MD5STEP_R1 (C, D, A, B, X[2] = GET_X_FROM_DATA (M, 2), 17, \
+ UINT32_C (0x242070db));
+ MD5STEP_R1 (B, C, D, A, X[3] = GET_X_FROM_DATA (M, 3), 22, \
+ UINT32_C (0xc1bdceee));
+
+ MD5STEP_R1 (A, B, C, D, X[4] = GET_X_FROM_DATA (M, 4), 7, \
+ UINT32_C (0xf57c0faf));
+ MD5STEP_R1 (D, A, B, C, X[5] = GET_X_FROM_DATA (M, 5), 12, \
+ UINT32_C (0x4787c62a));
+ MD5STEP_R1 (C, D, A, B, X[6] = GET_X_FROM_DATA (M, 6), 17, \
+ UINT32_C (0xa8304613));
+ MD5STEP_R1 (B, C, D, A, X[7] = GET_X_FROM_DATA (M, 7), 22, \
+ UINT32_C (0xfd469501));
+
+ MD5STEP_R1 (A, B, C, D, X[8] = GET_X_FROM_DATA (M, 8), 7, \
+ UINT32_C (0x698098d8));
+ MD5STEP_R1 (D, A, B, C, X[9] = GET_X_FROM_DATA (M, 9), 12, \
+ UINT32_C (0x8b44f7af));
+ MD5STEP_R1 (C, D, A, B, X[10] = GET_X_FROM_DATA (M, 10), 17, \
+ UINT32_C (0xffff5bb1));
+ MD5STEP_R1 (B, C, D, A, X[11] = GET_X_FROM_DATA (M, 11), 22, \
+ UINT32_C (0x895cd7be));
+
+ MD5STEP_R1 (A, B, C, D, X[12] = GET_X_FROM_DATA (M, 12), 7, \
+ UINT32_C (0x6b901122));
+ MD5STEP_R1 (D, A, B, C, X[13] = GET_X_FROM_DATA (M, 13), 12, \
+ UINT32_C (0xfd987193));
+ MD5STEP_R1 (C, D, A, B, X[14] = GET_X_FROM_DATA (M, 14), 17, \
+ UINT32_C (0xa679438e));
+ MD5STEP_R1 (B, C, D, A, X[15] = GET_X_FROM_DATA (M, 15), 22, \
+ UINT32_C (0x49b40821));
+ }
/* One step of round 2 of MD5 computation, see RFC 1321, Clause 3.4 (step 4).
The original function was modified to use X[k] and T[i] as
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (8318f56e -> b6dcf9d2), gnunet, 2022/09/25
- [libmicrohttpd] 03/22: mhd_locks.h: cosmetics, gnunet, 2022/09/25
- [libmicrohttpd] 04/22: mhd_options: use standard _MHD_EXTERN if file used outside the library, gnunet, 2022/09/25
- [libmicrohttpd] 01/22: Fixed regression introduced by c3680cb737bcac2a4dc14cca5a80af6ca0de21e7, gnunet, 2022/09/25
- [libmicrohttpd] 06/22: sha256: implemented compact code version, similarly to SHA-512/256, gnunet, 2022/09/25
- [libmicrohttpd] 05/22: sha256: backported minor optimisations from SHA-512/256, gnunet, 2022/09/25
- [libmicrohttpd] 02/22: Fixed initialisation of old GnuTLS versions, gnunet, 2022/09/25
- [libmicrohttpd] 10/22: md5: added compact code version, gnunet, 2022/09/25
- [libmicrohttpd] 14/22: test_{md5,sha{256,512_256}}: added long test sequence, gnunet, 2022/09/25
- [libmicrohttpd] 07/22: sha512_256: additional trick for compacter code; doxy and comment fixes, gnunet, 2022/09/25
- [libmicrohttpd] 09/22: md5: improved performance of the first round on LE arches,
gnunet <=
- [libmicrohttpd] 17/22: digestauth: removed redundant check and report, gnunet, 2022/09/25
- [libmicrohttpd] 12/22: test_sha{256,512_256}: minor fixes, gnunet, 2022/09/25
- [libmicrohttpd] 08/22: md5: replaced public domain MD5 implementation with our own implementation, gnunet, 2022/09/25
- [libmicrohttpd] 20/22: digestauth: refactored hashing asserts, gnunet, 2022/09/25
- [libmicrohttpd] 15/22: sha{256, 512_256}: improved performance of the first steps on BE arches, gnunet, 2022/09/25
- [libmicrohttpd] 22/22: w32: sync projects with autotools, gnunet, 2022/09/25
- [libmicrohttpd] 11/22: test_{md5,sha256,sha512_256}: added more checks, gnunet, 2022/09/25
- [libmicrohttpd] 16/22: test_{md5,sha{256,512_256}}: re-use of the context structure, gnunet, 2022/09/25
- [libmicrohttpd] 19/22: digestauth: used weak pseudo-random generators to avoid nonces clashes, gnunet, 2022/09/25
- [libmicrohttpd] 21/22: Implemented support for hash calculation by GnuTLS lib functions, gnunet, 2022/09/25