blowfish_endianess
authorDebian/Kubuntu Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Sat, 9 Jul 2016 10:31:10 +0000 (12:31 +0200)
committerPeter Michael Green <plugwash@raspbian.org>
Fri, 13 Sep 2024 00:01:37 +0000 (00:01 +0000)
Gbp-Pq: Name blowfish_endianess.diff

src/runtime/kwalletd/backend/blowfish.cc

index da04c870302a6965c8d01718e3896e269674aa5c..c3f3360ddb3ec6faa323542f69ae8801e1e9d214 100644 (file)
 
 // DO NOT INCLUDE THIS. IT BREAKS KWALLET.
 // We need to live with -Wundef until someone really figures out the problem.
-//#include <QtCore/qglobal.h> // for Q_BYTE_ORDER and friends
-// Workaround for -Wundef
-#define Q_BIG_ENDIAN 1
-#define Q_BYTE_ORDER Q_BIG_ENDIAN
+#include <QtCore/qglobal.h> // for Q_BYTE_ORDER and friends
 
 BlowFish::BlowFish()
 {
@@ -126,7 +123,7 @@ bool BlowFish::setKey(void *key, int bitlength)
     return init();
 }
 // clang-format off
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
 #define shuffle(x) do {             \
         uint32_t r = x;             \
         x  = (r & 0xff000000) >> 24;    \
@@ -146,12 +143,12 @@ int BlowFish::encrypt(void *block, int len)
     }
 
     for (int i = 0; i < len / _blksz; i++) {
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
         shuffle(*d);
         shuffle(*(d + 1));
 #endif
         encipher(d, d + 1);
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
         shuffle(*d);
         shuffle(*(d + 1));
 #endif
@@ -170,12 +167,12 @@ int BlowFish::decrypt(void *block, int len)
     }
 
     for (int i = 0; i < len / _blksz; i++) {
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
         shuffle(*d);
         shuffle(*(d + 1));
 #endif
         decipher(d, d + 1);
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
         shuffle(*d);
         shuffle(*(d + 1));
 #endif