[au1000] prefer ath5k over madwifi and include kexec-tools in the default profile
[openwrt.git] / target / linux / generic-2.6 / patches-2.6.30 / 050-pcomp_update.patch
1 --- a/crypto/testmgr.c
2 +++ b/crypto/testmgr.c
3 @@ -914,24 +914,25 @@ static int test_pcomp(struct crypto_pcom
4 const char *algo = crypto_tfm_alg_driver_name(crypto_pcomp_tfm(tfm));
5 unsigned int i;
6 char result[COMP_BUF_SIZE];
7 - int error;
8 + int res;
9
10 for (i = 0; i < ctcount; i++) {
11 struct comp_request req;
12 + unsigned int produced = 0;
13
14 - error = crypto_compress_setup(tfm, ctemplate[i].params,
15 - ctemplate[i].paramsize);
16 - if (error) {
17 + res = crypto_compress_setup(tfm, ctemplate[i].params,
18 + ctemplate[i].paramsize);
19 + if (res) {
20 pr_err("alg: pcomp: compression setup failed on test "
21 - "%d for %s: error=%d\n", i + 1, algo, error);
22 - return error;
23 + "%d for %s: error=%d\n", i + 1, algo, res);
24 + return res;
25 }
26
27 - error = crypto_compress_init(tfm);
28 - if (error) {
29 + res = crypto_compress_init(tfm);
30 + if (res) {
31 pr_err("alg: pcomp: compression init failed on test "
32 - "%d for %s: error=%d\n", i + 1, algo, error);
33 - return error;
34 + "%d for %s: error=%d\n", i + 1, algo, res);
35 + return res;
36 }
37
38 memset(result, 0, sizeof(result));
39 @@ -941,32 +942,37 @@ static int test_pcomp(struct crypto_pcom
40 req.next_out = result;
41 req.avail_out = ctemplate[i].outlen / 2;
42
43 - error = crypto_compress_update(tfm, &req);
44 - if (error && (error != -EAGAIN || req.avail_in)) {
45 + res = crypto_compress_update(tfm, &req);
46 + if (res < 0 && (res != -EAGAIN || req.avail_in)) {
47 pr_err("alg: pcomp: compression update failed on test "
48 - "%d for %s: error=%d\n", i + 1, algo, error);
49 - return error;
50 + "%d for %s: error=%d\n", i + 1, algo, res);
51 + return res;
52 }
53 + if (res > 0)
54 + produced += res;
55
56 /* Add remaining input data */
57 req.avail_in += (ctemplate[i].inlen + 1) / 2;
58
59 - error = crypto_compress_update(tfm, &req);
60 - if (error && (error != -EAGAIN || req.avail_in)) {
61 + res = crypto_compress_update(tfm, &req);
62 + if (res < 0 && (res != -EAGAIN || req.avail_in)) {
63 pr_err("alg: pcomp: compression update failed on test "
64 - "%d for %s: error=%d\n", i + 1, algo, error);
65 - return error;
66 + "%d for %s: error=%d\n", i + 1, algo, res);
67 + return res;
68 }
69 + if (res > 0)
70 + produced += res;
71
72 /* Provide remaining output space */
73 req.avail_out += COMP_BUF_SIZE - ctemplate[i].outlen / 2;
74
75 - error = crypto_compress_final(tfm, &req);
76 - if (error) {
77 + res = crypto_compress_final(tfm, &req);
78 + if (res < 0) {
79 pr_err("alg: pcomp: compression final failed on test "
80 - "%d for %s: error=%d\n", i + 1, algo, error);
81 - return error;
82 + "%d for %s: error=%d\n", i + 1, algo, res);
83 + return res;
84 }
85 + produced += res;
86
87 if (COMP_BUF_SIZE - req.avail_out != ctemplate[i].outlen) {
88 pr_err("alg: comp: Compression test %d failed for %s: "
89 @@ -976,6 +982,13 @@ static int test_pcomp(struct crypto_pcom
90 return -EINVAL;
91 }
92
93 + if (produced != ctemplate[i].outlen) {
94 + pr_err("alg: comp: Compression test %d failed for %s: "
95 + "returned len = %u (expected %d)\n", i + 1,
96 + algo, produced, ctemplate[i].outlen);
97 + return -EINVAL;
98 + }
99 +
100 if (memcmp(result, ctemplate[i].output, ctemplate[i].outlen)) {
101 pr_err("alg: pcomp: Compression test %d failed for "
102 "%s\n", i + 1, algo);
103 @@ -986,21 +999,21 @@ static int test_pcomp(struct crypto_pcom
104
105 for (i = 0; i < dtcount; i++) {
106 struct comp_request req;
107 + unsigned int produced = 0;
108
109 - error = crypto_decompress_setup(tfm, dtemplate[i].params,
110 - dtemplate[i].paramsize);
111 - if (error) {
112 + res = crypto_decompress_setup(tfm, dtemplate[i].params,
113 + dtemplate[i].paramsize);
114 + if (res) {
115 pr_err("alg: pcomp: decompression setup failed on "
116 - "test %d for %s: error=%d\n", i + 1, algo,
117 - error);
118 - return error;
119 + "test %d for %s: error=%d\n", i + 1, algo, res);
120 + return res;
121 }
122
123 - error = crypto_decompress_init(tfm);
124 - if (error) {
125 + res = crypto_decompress_init(tfm);
126 + if (res) {
127 pr_err("alg: pcomp: decompression init failed on test "
128 - "%d for %s: error=%d\n", i + 1, algo, error);
129 - return error;
130 + "%d for %s: error=%d\n", i + 1, algo, res);
131 + return res;
132 }
133
134 memset(result, 0, sizeof(result));
135 @@ -1010,35 +1023,38 @@ static int test_pcomp(struct crypto_pcom
136 req.next_out = result;
137 req.avail_out = dtemplate[i].outlen / 2;
138
139 - error = crypto_decompress_update(tfm, &req);
140 - if (error && (error != -EAGAIN || req.avail_in)) {
141 + res = crypto_decompress_update(tfm, &req);
142 + if (res < 0 && (res != -EAGAIN || req.avail_in)) {
143 pr_err("alg: pcomp: decompression update failed on "
144 - "test %d for %s: error=%d\n", i + 1, algo,
145 - error);
146 - return error;
147 + "test %d for %s: error=%d\n", i + 1, algo, res);
148 + return res;
149 }
150 + if (res > 0)
151 + produced += res;
152
153 /* Add remaining input data */
154 req.avail_in += (dtemplate[i].inlen + 1) / 2;
155
156 - error = crypto_decompress_update(tfm, &req);
157 - if (error && (error != -EAGAIN || req.avail_in)) {
158 + res = crypto_decompress_update(tfm, &req);
159 + if (res < 0 && (res != -EAGAIN || req.avail_in)) {
160 pr_err("alg: pcomp: decompression update failed on "
161 - "test %d for %s: error=%d\n", i + 1, algo,
162 - error);
163 - return error;
164 + "test %d for %s: error=%d\n", i + 1, algo, res);
165 + return res;
166 }
167 + if (res > 0)
168 + produced += res;
169
170 /* Provide remaining output space */
171 req.avail_out += COMP_BUF_SIZE - dtemplate[i].outlen / 2;
172
173 - error = crypto_decompress_final(tfm, &req);
174 - if (error && (error != -EAGAIN || req.avail_in)) {
175 + res = crypto_decompress_final(tfm, &req);
176 + if (res < 0 && (res != -EAGAIN || req.avail_in)) {
177 pr_err("alg: pcomp: decompression final failed on "
178 - "test %d for %s: error=%d\n", i + 1, algo,
179 - error);
180 - return error;
181 + "test %d for %s: error=%d\n", i + 1, algo, res);
182 + return res;
183 }
184 + if (res > 0)
185 + produced += res;
186
187 if (COMP_BUF_SIZE - req.avail_out != dtemplate[i].outlen) {
188 pr_err("alg: comp: Decompression test %d failed for "
189 @@ -1048,6 +1064,13 @@ static int test_pcomp(struct crypto_pcom
190 return -EINVAL;
191 }
192
193 + if (produced != dtemplate[i].outlen) {
194 + pr_err("alg: comp: Decompression test %d failed for "
195 + "%s: returned len = %u (expected %d)\n", i + 1,
196 + algo, produced, dtemplate[i].outlen);
197 + return -EINVAL;
198 + }
199 +
200 if (memcmp(result, dtemplate[i].output, dtemplate[i].outlen)) {
201 pr_err("alg: pcomp: Decompression test %d failed for "
202 "%s\n", i + 1, algo);
203 --- a/crypto/zlib.c
204 +++ b/crypto/zlib.c
205 @@ -165,15 +165,15 @@ static int zlib_compress_update(struct c
206 return -EINVAL;
207 }
208
209 + ret = req->avail_out - stream->avail_out;
210 pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n",
211 stream->avail_in, stream->avail_out,
212 - req->avail_in - stream->avail_in,
213 - req->avail_out - stream->avail_out);
214 + req->avail_in - stream->avail_in, ret);
215 req->next_in = stream->next_in;
216 req->avail_in = stream->avail_in;
217 req->next_out = stream->next_out;
218 req->avail_out = stream->avail_out;
219 - return 0;
220 + return ret;
221 }
222
223 static int zlib_compress_final(struct crypto_pcomp *tfm,
224 @@ -195,15 +195,15 @@ static int zlib_compress_final(struct cr
225 return -EINVAL;
226 }
227
228 + ret = req->avail_out - stream->avail_out;
229 pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n",
230 stream->avail_in, stream->avail_out,
231 - req->avail_in - stream->avail_in,
232 - req->avail_out - stream->avail_out);
233 + req->avail_in - stream->avail_in, ret);
234 req->next_in = stream->next_in;
235 req->avail_in = stream->avail_in;
236 req->next_out = stream->next_out;
237 req->avail_out = stream->avail_out;
238 - return 0;
239 + return ret;
240 }
241
242
243 @@ -280,15 +280,15 @@ static int zlib_decompress_update(struct
244 return -EINVAL;
245 }
246
247 + ret = req->avail_out - stream->avail_out;
248 pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n",
249 stream->avail_in, stream->avail_out,
250 - req->avail_in - stream->avail_in,
251 - req->avail_out - stream->avail_out);
252 + req->avail_in - stream->avail_in, ret);
253 req->next_in = stream->next_in;
254 req->avail_in = stream->avail_in;
255 req->next_out = stream->next_out;
256 req->avail_out = stream->avail_out;
257 - return 0;
258 + return ret;
259 }
260
261 static int zlib_decompress_final(struct crypto_pcomp *tfm,
262 @@ -328,15 +328,15 @@ static int zlib_decompress_final(struct
263 return -EINVAL;
264 }
265
266 + ret = req->avail_out - stream->avail_out;
267 pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n",
268 stream->avail_in, stream->avail_out,
269 - req->avail_in - stream->avail_in,
270 - req->avail_out - stream->avail_out);
271 + req->avail_in - stream->avail_in, ret);
272 req->next_in = stream->next_in;
273 req->avail_in = stream->avail_in;
274 req->next_out = stream->next_out;
275 req->avail_out = stream->avail_out;
276 - return 0;
277 + return ret;
278 }
279
280
This page took 0.05291 seconds and 5 git commands to generate.