1 # |
|
2 # Resolves issues reported by 'make check': |
|
3 # selftest for CFB failed - see syslog for details |
|
4 # pass 0, algo 4, mode 1, gcry_cipher_setkey failed: Selftest failed |
|
5 # pass 0, algo 4, mode 2, gcry_cipher_setkey failed: Selftest failed |
|
6 # pass 0, algo 4, mode 5, gcry_cipher_setkey failed: Selftest failed |
|
7 # pass 0, algo 4, mode 3, gcry_cipher_setkey failed: Selftest failed |
|
8 # pass 0, algo 4, mode 3, gcry_cipher_setkey failed: Selftest failed |
|
9 # pass 0, algo 4, mode 6, gcry_cipher_setkey failed: Selftest failed |
|
10 # FAIL: basic |
|
11 # |
|
12 # The original bug in the upstream: https://bugs.gnupg.org/gnupg/issue2144 |
|
13 # This is an alternate patch to the fix delivered by the upstream. This |
|
14 # is because upstream has resolved the issue in a source code of a later |
|
15 # version of libgcrypt (post 1.6.4); the patch used by the upstream |
|
16 # patches files not yet existing in the version 1.6.4. This patch will |
|
17 # go away once libgcrypt is update to a version > 1.6.4. |
|
18 # |
|
19 # This is an in-house developed patch inspired by the comments made by |
|
20 # the libgcrypt community in the respective email thread on |
|
21 # [email protected]. |
|
22 # |
|
23 --- ./cipher/bufhelp.h.aliasing 2015-02-27 10:54:03.000000000 +0100 |
|
24 +++ ./cipher/bufhelp.h 2015-03-13 15:03:43.301749751 +0100 |
|
25 @@ -80,7 +80,7 @@ do_bytes: |
|
26 for (; len; len--) |
|
27 *dst++ = *src++; |
|
28 #endif /*__GNUC__ >= 4 && (__x86_64__ || __i386__)*/ |
|
29 -} |
|
30 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
31 |
|
32 |
|
33 /* Optimized function for buffer xoring */ |
|
34 @@ -117,7 +117,7 @@ do_bytes: |
|
35 /* Handle tail. */ |
|
36 for (; len; len--) |
|
37 *dst++ = *src1++ ^ *src2++; |
|
38 -} |
|
39 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
40 |
|
41 |
|
42 /* Optimized function for buffer xoring with two destination buffers. Used |
|
43 @@ -155,7 +155,7 @@ do_bytes: |
|
44 /* Handle tail. */ |
|
45 for (; len; len--) |
|
46 *dst1++ = (*dst2++ ^= *src++); |
|
47 -} |
|
48 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
49 |
|
50 |
|
51 /* Optimized function for combined buffer xoring and copying. Used by mainly |
|
52 @@ -208,7 +208,7 @@ do_bytes: |
|
53 *dst_xor++ = *srcdst_cpy ^ *src_xor++; |
|
54 *srcdst_cpy++ = temp; |
|
55 } |
|
56 -} |
|
57 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
58 |
|
59 |
|
60 /* Optimized function for combined buffer xoring and copying. Used by mainly |
|
61 @@ -234,7 +234,7 @@ buf_eq_const(const void *_a, const void |
|
62 diff -= !!(a[i] - b[i]); |
|
63 |
|
64 return !diff; |
|
65 -} |
|
66 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
67 |
|
68 |
|
69 #ifndef BUFHELP_FAST_UNALIGNED_ACCESS |
|
70 @@ -246,14 +246,14 @@ static inline u32 buf_get_be32(const voi |
|
71 const byte *in = _buf; |
|
72 return ((u32)in[0] << 24) | ((u32)in[1] << 16) | \ |
|
73 ((u32)in[2] << 8) | (u32)in[3]; |
|
74 -} |
|
75 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
76 |
|
77 static inline u32 buf_get_le32(const void *_buf) |
|
78 { |
|
79 const byte *in = _buf; |
|
80 return ((u32)in[3] << 24) | ((u32)in[2] << 16) | \ |
|
81 ((u32)in[1] << 8) | (u32)in[0]; |
|
82 -} |
|
83 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
84 |
|
85 static inline void buf_put_be32(void *_buf, u32 val) |
|
86 { |
|
87 @@ -262,7 +262,7 @@ static inline void buf_put_be32(void *_b |
|
88 out[1] = val >> 16; |
|
89 out[2] = val >> 8; |
|
90 out[3] = val; |
|
91 -} |
|
92 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
93 |
|
94 static inline void buf_put_le32(void *_buf, u32 val) |
|
95 { |
|
96 @@ -271,7 +271,7 @@ static inline void buf_put_le32(void *_b |
|
97 out[2] = val >> 16; |
|
98 out[1] = val >> 8; |
|
99 out[0] = val; |
|
100 -} |
|
101 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
102 |
|
103 #ifdef HAVE_U64_TYPEDEF |
|
104 /* Functions for loading and storing unaligned u64 values of different |
|
105 @@ -283,7 +283,7 @@ static inline u64 buf_get_be64(const voi |
|
106 ((u64)in[2] << 40) | ((u64)in[3] << 32) | \ |
|
107 ((u64)in[4] << 24) | ((u64)in[5] << 16) | \ |
|
108 ((u64)in[6] << 8) | (u64)in[7]; |
|
109 -} |
|
110 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
111 |
|
112 static inline u64 buf_get_le64(const void *_buf) |
|
113 { |
|
114 @@ -292,7 +292,7 @@ static inline u64 buf_get_le64(const voi |
|
115 ((u64)in[5] << 40) | ((u64)in[4] << 32) | \ |
|
116 ((u64)in[3] << 24) | ((u64)in[2] << 16) | \ |
|
117 ((u64)in[1] << 8) | (u64)in[0]; |
|
118 -} |
|
119 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
120 |
|
121 static inline void buf_put_be64(void *_buf, u64 val) |
|
122 { |
|
123 @@ -305,7 +305,7 @@ static inline void buf_put_be64(void *_b |
|
124 out[5] = val >> 16; |
|
125 out[6] = val >> 8; |
|
126 out[7] = val; |
|
127 -} |
|
128 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
129 |
|
130 static inline void buf_put_le64(void *_buf, u64 val) |
|
131 { |
|
132 @@ -318,7 +318,7 @@ static inline void buf_put_le64(void *_b |
|
133 out[2] = val >> 16; |
|
134 out[1] = val >> 8; |
|
135 out[0] = val; |
|
136 -} |
|
137 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
138 #endif /*HAVE_U64_TYPEDEF*/ |
|
139 |
|
140 #else /*BUFHELP_FAST_UNALIGNED_ACCESS*/ |
|
141 @@ -328,24 +328,24 @@ static inline void buf_put_le64(void *_b |
|
142 static inline u32 buf_get_be32(const void *_buf) |
|
143 { |
|
144 return be_bswap32(*(const u32 *)_buf); |
|
145 -} |
|
146 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
147 |
|
148 static inline u32 buf_get_le32(const void *_buf) |
|
149 { |
|
150 return le_bswap32(*(const u32 *)_buf); |
|
151 -} |
|
152 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
153 |
|
154 static inline void buf_put_be32(void *_buf, u32 val) |
|
155 { |
|
156 u32 *out = _buf; |
|
157 *out = be_bswap32(val); |
|
158 -} |
|
159 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
160 |
|
161 static inline void buf_put_le32(void *_buf, u32 val) |
|
162 { |
|
163 u32 *out = _buf; |
|
164 *out = le_bswap32(val); |
|
165 -} |
|
166 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
167 |
|
168 #ifdef HAVE_U64_TYPEDEF |
|
169 /* Functions for loading and storing unaligned u64 values of different |
|
170 @@ -353,24 +353,24 @@ static inline void buf_put_le32(void *_b |
|
171 static inline u64 buf_get_be64(const void *_buf) |
|
172 { |
|
173 return be_bswap64(*(const u64 *)_buf); |
|
174 -} |
|
175 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
176 |
|
177 static inline u64 buf_get_le64(const void *_buf) |
|
178 { |
|
179 return le_bswap64(*(const u64 *)_buf); |
|
180 -} |
|
181 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
182 |
|
183 static inline void buf_put_be64(void *_buf, u64 val) |
|
184 { |
|
185 u64 *out = _buf; |
|
186 *out = be_bswap64(val); |
|
187 -} |
|
188 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
189 |
|
190 static inline void buf_put_le64(void *_buf, u64 val) |
|
191 { |
|
192 u64 *out = _buf; |
|
193 *out = le_bswap64(val); |
|
194 -} |
|
195 +} __attribute__ ((optimize("no-strict-aliasing"))) |
|
196 #endif /*HAVE_U64_TYPEDEF*/ |
|
197 |
|
198 #endif /*BUFHELP_FAST_UNALIGNED_ACCESS*/ |
|