File: blowfish_endianess.diff

package info (click to toggle)
kf6-kwallet 6.18.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,068 kB
  • sloc: cpp: 12,594; xml: 743; sh: 16; makefile: 6
file content (61 lines) | stat: -rw-r--r-- 1,834 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From: Debian/Kubuntu Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Date: Sat, 9 Jul 2016 12:31:10 +0200
Subject: blowfish_endianess

---
 src/runtime/kwalletd/backend/blowfish.cc | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

--- a/src/runtime/kwalletbackend/blowfish.cc
+++ b/src/runtime/kwalletbackend/blowfish.cc
@@ -21,10 +21,7 @@
 
 // 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 bit
     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 l
     }
 
     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 l
     }
 
     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