summaryrefslogtreecommitdiffstats
path: root/lib/Plugins/Python_hash.cpp
diff options
context:
space:
mode:
authorNikola Pajkovsky <npajkovs@redhat.com>2010-02-15 18:09:55 +0100
committerNikola Pajkovsky <npajkovs@redhat.com>2010-02-15 18:09:55 +0100
commitd93fc21129f08a149d7a1bb042179942485fcedb (patch)
tree72ec4eb636b15d8e2385f068881f86a6aa88db2b /lib/Plugins/Python_hash.cpp
parentdeef343e0372b0a167f1d35f9ef9d18694aa9a0e (diff)
parent3a0729e697b24d4d30e3a1a008f83ca605aaad5d (diff)
downloadabrt-d93fc21129f08a149d7a1bb042179942485fcedb.tar.gz
abrt-d93fc21129f08a149d7a1bb042179942485fcedb.tar.xz
abrt-d93fc21129f08a149d7a1bb042179942485fcedb.zip
Merge branch 'master' into bugzilla
Diffstat (limited to 'lib/Plugins/Python_hash.cpp')
-rw-r--r--lib/Plugins/Python_hash.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/Plugins/Python_hash.cpp b/lib/Plugins/Python_hash.cpp
index ae246b3..36ddacd 100644
--- a/lib/Plugins/Python_hash.cpp
+++ b/lib/Plugins/Python_hash.cpp
@@ -14,6 +14,7 @@
*/
#include "abrtlib.h"
#include "Python_hash.h"
+#include <byteswap.h>
#if defined(__BIG_ENDIAN__) && __BIG_ENDIAN__
# define MD5_BIG_ENDIAN 1
@@ -28,6 +29,16 @@
# error "Can't determine endianness"
#endif
+/* SWAP_LEnn means "convert CPU<->little_endian if needed (by swapping bytes)" */
+#if MD5_BIG_ENDIAN
+# define SWAP_BE32(x) (x)
+# define SWAP_LE32(x) bswap_32(x)
+#else
+# define SWAP_BE32(x) bswap_32(x)
+# define SWAP_LE32(x) (x)
+#endif
+
+
/* 0: fastest, 3: smallest */
#define MD5_SIZE_VS_SPEED 3
@@ -123,11 +134,7 @@ static void md5_hash_block(const void *buffer, md5_ctx_t *ctx)
uint32_t temp;
for (i = 0; i < 16; i++) {
-#if MD5_BIG_ENDIAN
- cwp[i] = bswap_32(words[i]);
-#else
- cwp[i] = words[i];
-#endif
+ cwp[i] = SWAP_LE32(words[i]);
}
words += 16;