hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/arch/x86/crypto/cast5_avx_glue.c
....@@ -46,7 +46,7 @@
4646
4747 static int ecb_crypt(struct skcipher_request *req, bool enc)
4848 {
49
- bool fpu_enabled;
49
+ bool fpu_enabled = false;
5050 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
5151 struct cast5_ctx *ctx = crypto_skcipher_ctx(tfm);
5252 struct skcipher_walk walk;
....@@ -61,7 +61,7 @@
6161 u8 *wsrc = walk.src.virt.addr;
6262 u8 *wdst = walk.dst.virt.addr;
6363
64
- fpu_enabled = cast5_fpu_begin(false, &walk, nbytes);
64
+ fpu_enabled = cast5_fpu_begin(fpu_enabled, &walk, nbytes);
6565
6666 /* Process multi-block batch */
6767 if (nbytes >= bsize * CAST5_PARALLEL_BLOCKS) {
....@@ -90,9 +90,10 @@
9090 } while (nbytes >= bsize);
9191
9292 done:
93
- cast5_fpu_end(fpu_enabled);
9493 err = skcipher_walk_done(&walk, nbytes);
9594 }
95
+
96
+ cast5_fpu_end(fpu_enabled);
9697 return err;
9798 }
9899
....@@ -196,7 +197,7 @@
196197 {
197198 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
198199 struct cast5_ctx *ctx = crypto_skcipher_ctx(tfm);
199
- bool fpu_enabled;
200
+ bool fpu_enabled = false;
200201 struct skcipher_walk walk;
201202 unsigned int nbytes;
202203 int err;
....@@ -204,11 +205,12 @@
204205 err = skcipher_walk_virt(&walk, req, false);
205206
206207 while ((nbytes = walk.nbytes)) {
207
- fpu_enabled = cast5_fpu_begin(false, &walk, nbytes);
208
+ fpu_enabled = cast5_fpu_begin(fpu_enabled, &walk, nbytes);
208209 nbytes = __cbc_decrypt(ctx, &walk);
209
- cast5_fpu_end(fpu_enabled);
210210 err = skcipher_walk_done(&walk, nbytes);
211211 }
212
+
213
+ cast5_fpu_end(fpu_enabled);
212214 return err;
213215 }
214216
....@@ -275,7 +277,7 @@
275277 {
276278 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
277279 struct cast5_ctx *ctx = crypto_skcipher_ctx(tfm);
278
- bool fpu_enabled;
280
+ bool fpu_enabled = false;
279281 struct skcipher_walk walk;
280282 unsigned int nbytes;
281283 int err;
....@@ -283,12 +285,13 @@
283285 err = skcipher_walk_virt(&walk, req, false);
284286
285287 while ((nbytes = walk.nbytes) >= CAST5_BLOCK_SIZE) {
286
- fpu_enabled = cast5_fpu_begin(false, &walk, nbytes);
288
+ fpu_enabled = cast5_fpu_begin(fpu_enabled, &walk, nbytes);
287289 nbytes = __ctr_crypt(&walk, ctx);
288
- cast5_fpu_end(fpu_enabled);
289290 err = skcipher_walk_done(&walk, nbytes);
290291 }
291292
293
+ cast5_fpu_end(fpu_enabled);
294
+
292295 if (walk.nbytes) {
293296 ctr_crypt_final(&walk, ctx);
294297 err = skcipher_walk_done(&walk, 0);