hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/block/cryptoloop.c
....@@ -1,22 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 Linux loop encryption enabling module
34
45 Copyright (C) 2002 Herbert Valerio Riedel <hvr@gnu.org>
56 Copyright (C) 2003 Fruhwirth Clemens <clemens@endorphin.org>
67
7
- This module is free software; you can redistribute it and/or modify
8
- it under the terms of the GNU General Public License as published by
9
- the Free Software Foundation; either version 2 of the License, or
10
- (at your option) any later version.
11
-
12
- This module is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- GNU General Public License for more details.
16
-
17
- You should have received a copy of the GNU General Public License
18
- along with this module; if not, write to the Free Software
19
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
208 */
219
2210 #include <linux/module.h>
....@@ -45,7 +33,7 @@
4533 char cms[LO_NAME_SIZE]; /* cipher-mode string */
4634 char *mode;
4735 char *cmsp = cms; /* c-m string pointer */
48
- struct crypto_skcipher *tfm;
36
+ struct crypto_sync_skcipher *tfm;
4937
5038 /* encryption breaks for non sector aligned offsets */
5139
....@@ -80,13 +68,13 @@
8068 *cmsp++ = ')';
8169 *cmsp = 0;
8270
83
- tfm = crypto_alloc_skcipher(cms, 0, CRYPTO_ALG_ASYNC);
71
+ tfm = crypto_alloc_sync_skcipher(cms, 0, 0);
8472 if (IS_ERR(tfm))
8573 return PTR_ERR(tfm);
8674
87
- err = crypto_skcipher_setkey(tfm, info->lo_encrypt_key,
88
- info->lo_encrypt_key_size);
89
-
75
+ err = crypto_sync_skcipher_setkey(tfm, info->lo_encrypt_key,
76
+ info->lo_encrypt_key_size);
77
+
9078 if (err != 0)
9179 goto out_free_tfm;
9280
....@@ -94,7 +82,7 @@
9482 return 0;
9583
9684 out_free_tfm:
97
- crypto_free_skcipher(tfm);
85
+ crypto_free_sync_skcipher(tfm);
9886
9987 out:
10088 return err;
....@@ -109,8 +97,8 @@
10997 struct page *loop_page, unsigned loop_off,
11098 int size, sector_t IV)
11199 {
112
- struct crypto_skcipher *tfm = lo->key_data;
113
- SKCIPHER_REQUEST_ON_STACK(req, tfm);
100
+ struct crypto_sync_skcipher *tfm = lo->key_data;
101
+ SYNC_SKCIPHER_REQUEST_ON_STACK(req, tfm);
114102 struct scatterlist sg_out;
115103 struct scatterlist sg_in;
116104
....@@ -119,7 +107,7 @@
119107 unsigned in_offs, out_offs;
120108 int err;
121109
122
- skcipher_request_set_tfm(req, tfm);
110
+ skcipher_request_set_sync_tfm(req, tfm);
123111 skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP,
124112 NULL, NULL);
125113
....@@ -175,9 +163,9 @@
175163 static int
176164 cryptoloop_release(struct loop_device *lo)
177165 {
178
- struct crypto_skcipher *tfm = lo->key_data;
166
+ struct crypto_sync_skcipher *tfm = lo->key_data;
179167 if (tfm != NULL) {
180
- crypto_free_skcipher(tfm);
168
+ crypto_free_sync_skcipher(tfm);
181169 lo->key_data = NULL;
182170 return 0;
183171 }