| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | Linux loop encryption enabling module |
|---|
| 3 | 4 | |
|---|
| 4 | 5 | Copyright (C) 2002 Herbert Valerio Riedel <hvr@gnu.org> |
|---|
| 5 | 6 | Copyright (C) 2003 Fruhwirth Clemens <clemens@endorphin.org> |
|---|
| 6 | 7 | |
|---|
| 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 |
|---|
| 20 | 8 | */ |
|---|
| 21 | 9 | |
|---|
| 22 | 10 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 45 | 33 | char cms[LO_NAME_SIZE]; /* cipher-mode string */ |
|---|
| 46 | 34 | char *mode; |
|---|
| 47 | 35 | char *cmsp = cms; /* c-m string pointer */ |
|---|
| 48 | | - struct crypto_skcipher *tfm; |
|---|
| 36 | + struct crypto_sync_skcipher *tfm; |
|---|
| 49 | 37 | |
|---|
| 50 | 38 | /* encryption breaks for non sector aligned offsets */ |
|---|
| 51 | 39 | |
|---|
| .. | .. |
|---|
| 80 | 68 | *cmsp++ = ')'; |
|---|
| 81 | 69 | *cmsp = 0; |
|---|
| 82 | 70 | |
|---|
| 83 | | - tfm = crypto_alloc_skcipher(cms, 0, CRYPTO_ALG_ASYNC); |
|---|
| 71 | + tfm = crypto_alloc_sync_skcipher(cms, 0, 0); |
|---|
| 84 | 72 | if (IS_ERR(tfm)) |
|---|
| 85 | 73 | return PTR_ERR(tfm); |
|---|
| 86 | 74 | |
|---|
| 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 | + |
|---|
| 90 | 78 | if (err != 0) |
|---|
| 91 | 79 | goto out_free_tfm; |
|---|
| 92 | 80 | |
|---|
| .. | .. |
|---|
| 94 | 82 | return 0; |
|---|
| 95 | 83 | |
|---|
| 96 | 84 | out_free_tfm: |
|---|
| 97 | | - crypto_free_skcipher(tfm); |
|---|
| 85 | + crypto_free_sync_skcipher(tfm); |
|---|
| 98 | 86 | |
|---|
| 99 | 87 | out: |
|---|
| 100 | 88 | return err; |
|---|
| .. | .. |
|---|
| 109 | 97 | struct page *loop_page, unsigned loop_off, |
|---|
| 110 | 98 | int size, sector_t IV) |
|---|
| 111 | 99 | { |
|---|
| 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); |
|---|
| 114 | 102 | struct scatterlist sg_out; |
|---|
| 115 | 103 | struct scatterlist sg_in; |
|---|
| 116 | 104 | |
|---|
| .. | .. |
|---|
| 119 | 107 | unsigned in_offs, out_offs; |
|---|
| 120 | 108 | int err; |
|---|
| 121 | 109 | |
|---|
| 122 | | - skcipher_request_set_tfm(req, tfm); |
|---|
| 110 | + skcipher_request_set_sync_tfm(req, tfm); |
|---|
| 123 | 111 | skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP, |
|---|
| 124 | 112 | NULL, NULL); |
|---|
| 125 | 113 | |
|---|
| .. | .. |
|---|
| 175 | 163 | static int |
|---|
| 176 | 164 | cryptoloop_release(struct loop_device *lo) |
|---|
| 177 | 165 | { |
|---|
| 178 | | - struct crypto_skcipher *tfm = lo->key_data; |
|---|
| 166 | + struct crypto_sync_skcipher *tfm = lo->key_data; |
|---|
| 179 | 167 | if (tfm != NULL) { |
|---|
| 180 | | - crypto_free_skcipher(tfm); |
|---|
| 168 | + crypto_free_sync_skcipher(tfm); |
|---|
| 181 | 169 | lo->key_data = NULL; |
|---|
| 182 | 170 | return 0; |
|---|
| 183 | 171 | } |
|---|