@@ -73,7 +73,7 @@ static mempool_t *bio_fallback_crypt_ctx_pool;
73
73
static DEFINE_MUTEX (tfms_init_lock );
74
74
static bool tfms_inited [BLK_ENCRYPTION_MODE_MAX ];
75
75
76
- static struct blk_crypto_keyslot {
76
+ static struct blk_crypto_fallback_keyslot {
77
77
enum blk_crypto_mode_num crypto_mode ;
78
78
struct crypto_skcipher * tfms [BLK_ENCRYPTION_MODE_MAX ];
79
79
} * blk_crypto_keyslots ;
@@ -89,9 +89,9 @@ static struct bio_set crypto_bio_split;
89
89
*/
90
90
static u8 blank_key [BLK_CRYPTO_MAX_KEY_SIZE ];
91
91
92
- static void blk_crypto_evict_keyslot (unsigned int slot )
92
+ static void blk_crypto_fallback_evict_keyslot (unsigned int slot )
93
93
{
94
- struct blk_crypto_keyslot * slotp = & blk_crypto_keyslots [slot ];
94
+ struct blk_crypto_fallback_keyslot * slotp = & blk_crypto_keyslots [slot ];
95
95
enum blk_crypto_mode_num crypto_mode = slotp -> crypto_mode ;
96
96
int err ;
97
97
@@ -104,34 +104,34 @@ static void blk_crypto_evict_keyslot(unsigned int slot)
104
104
slotp -> crypto_mode = BLK_ENCRYPTION_MODE_INVALID ;
105
105
}
106
106
107
- static int blk_crypto_keyslot_program (struct blk_keyslot_manager * ksm ,
108
- const struct blk_crypto_key * key ,
109
- unsigned int slot )
107
+ static int blk_crypto_fallback_keyslot_program (struct blk_keyslot_manager * ksm ,
108
+ const struct blk_crypto_key * key ,
109
+ unsigned int slot )
110
110
{
111
- struct blk_crypto_keyslot * slotp = & blk_crypto_keyslots [slot ];
111
+ struct blk_crypto_fallback_keyslot * slotp = & blk_crypto_keyslots [slot ];
112
112
const enum blk_crypto_mode_num crypto_mode =
113
113
key -> crypto_cfg .crypto_mode ;
114
114
int err ;
115
115
116
116
if (crypto_mode != slotp -> crypto_mode &&
117
117
slotp -> crypto_mode != BLK_ENCRYPTION_MODE_INVALID )
118
- blk_crypto_evict_keyslot (slot );
118
+ blk_crypto_fallback_evict_keyslot (slot );
119
119
120
120
slotp -> crypto_mode = crypto_mode ;
121
121
err = crypto_skcipher_setkey (slotp -> tfms [crypto_mode ], key -> raw ,
122
122
key -> size );
123
123
if (err ) {
124
- blk_crypto_evict_keyslot (slot );
124
+ blk_crypto_fallback_evict_keyslot (slot );
125
125
return err ;
126
126
}
127
127
return 0 ;
128
128
}
129
129
130
- static int blk_crypto_keyslot_evict (struct blk_keyslot_manager * ksm ,
131
- const struct blk_crypto_key * key ,
132
- unsigned int slot )
130
+ static int blk_crypto_fallback_keyslot_evict (struct blk_keyslot_manager * ksm ,
131
+ const struct blk_crypto_key * key ,
132
+ unsigned int slot )
133
133
{
134
- blk_crypto_evict_keyslot (slot );
134
+ blk_crypto_fallback_evict_keyslot (slot );
135
135
return 0 ;
136
136
}
137
137
@@ -141,8 +141,8 @@ static int blk_crypto_keyslot_evict(struct blk_keyslot_manager *ksm,
141
141
* hardware.
142
142
*/
143
143
static const struct blk_ksm_ll_ops blk_crypto_ksm_ll_ops = {
144
- .keyslot_program = blk_crypto_keyslot_program ,
145
- .keyslot_evict = blk_crypto_keyslot_evict ,
144
+ .keyslot_program = blk_crypto_fallback_keyslot_program ,
145
+ .keyslot_evict = blk_crypto_fallback_keyslot_evict ,
146
146
};
147
147
148
148
static void blk_crypto_fallback_encrypt_endio (struct bio * enc_bio )
@@ -160,7 +160,7 @@ static void blk_crypto_fallback_encrypt_endio(struct bio *enc_bio)
160
160
bio_endio (src_bio );
161
161
}
162
162
163
- static struct bio * blk_crypto_clone_bio (struct bio * bio_src )
163
+ static struct bio * blk_crypto_fallback_clone_bio (struct bio * bio_src )
164
164
{
165
165
struct bvec_iter iter ;
166
166
struct bio_vec bv ;
@@ -187,12 +187,13 @@ static struct bio *blk_crypto_clone_bio(struct bio *bio_src)
187
187
return bio ;
188
188
}
189
189
190
- static bool blk_crypto_alloc_cipher_req (struct blk_ksm_keyslot * slot ,
191
- struct skcipher_request * * ciph_req_ret ,
192
- struct crypto_wait * wait )
190
+ static bool
191
+ blk_crypto_fallback_alloc_cipher_req (struct blk_ksm_keyslot * slot ,
192
+ struct skcipher_request * * ciph_req_ret ,
193
+ struct crypto_wait * wait )
193
194
{
194
195
struct skcipher_request * ciph_req ;
195
- const struct blk_crypto_keyslot * slotp ;
196
+ const struct blk_crypto_fallback_keyslot * slotp ;
196
197
int keyslot_idx = blk_ksm_get_slot_idx (slot );
197
198
198
199
slotp = & blk_crypto_keyslots [keyslot_idx ];
@@ -210,7 +211,7 @@ static bool blk_crypto_alloc_cipher_req(struct blk_ksm_keyslot *slot,
210
211
return true;
211
212
}
212
213
213
- static bool blk_crypto_split_bio_if_needed (struct bio * * bio_ptr )
214
+ static bool blk_crypto_fallback_split_bio_if_needed (struct bio * * bio_ptr )
214
215
{
215
216
struct bio * bio = * bio_ptr ;
216
217
unsigned int i = 0 ;
@@ -277,15 +278,15 @@ static bool blk_crypto_fallback_encrypt_bio(struct bio **bio_ptr)
277
278
blk_status_t blk_st ;
278
279
279
280
/* Split the bio if it's too big for single page bvec */
280
- if (!blk_crypto_split_bio_if_needed (bio_ptr ))
281
+ if (!blk_crypto_fallback_split_bio_if_needed (bio_ptr ))
281
282
return false;
282
283
283
284
src_bio = * bio_ptr ;
284
285
bc = src_bio -> bi_crypt_context ;
285
286
data_unit_size = bc -> bc_key -> crypto_cfg .data_unit_size ;
286
287
287
288
/* Allocate bounce bio for encryption */
288
- enc_bio = blk_crypto_clone_bio (src_bio );
289
+ enc_bio = blk_crypto_fallback_clone_bio (src_bio );
289
290
if (!enc_bio ) {
290
291
src_bio -> bi_status = BLK_STS_RESOURCE ;
291
292
return false;
@@ -302,7 +303,7 @@ static bool blk_crypto_fallback_encrypt_bio(struct bio **bio_ptr)
302
303
}
303
304
304
305
/* and then allocate an skcipher_request for it */
305
- if (!blk_crypto_alloc_cipher_req (slot , & ciph_req , & wait )) {
306
+ if (!blk_crypto_fallback_alloc_cipher_req (slot , & ciph_req , & wait )) {
306
307
src_bio -> bi_status = BLK_STS_RESOURCE ;
307
308
goto out_release_keyslot ;
308
309
}
@@ -404,7 +405,7 @@ static void blk_crypto_fallback_decrypt_bio(struct work_struct *work)
404
405
}
405
406
406
407
/* and then allocate an skcipher_request for it */
407
- if (!blk_crypto_alloc_cipher_req (slot , & ciph_req , & wait )) {
408
+ if (!blk_crypto_fallback_alloc_cipher_req (slot , & ciph_req , & wait )) {
408
409
bio -> bi_status = BLK_STS_RESOURCE ;
409
410
goto out ;
410
411
}
@@ -474,9 +475,9 @@ static void blk_crypto_fallback_decrypt_endio(struct bio *bio)
474
475
* @bio_ptr: pointer to the bio to prepare
475
476
*
476
477
* If bio is doing a WRITE operation, this splits the bio into two parts if it's
477
- * too big (see blk_crypto_split_bio_if_needed) . It then allocates a bounce bio
478
- * for the first part, encrypts it, and update bio_ptr to point to the bounce
479
- * bio.
478
+ * too big (see blk_crypto_fallback_split_bio_if_needed()) . It then allocates a
479
+ * bounce bio for the first part, encrypts it, and updates bio_ptr to point to
480
+ * the bounce bio.
480
481
*
481
482
* For a READ operation, we mark the bio for decryption by using bi_private and
482
483
* bi_end_io.
@@ -611,7 +612,7 @@ static int blk_crypto_fallback_init(void)
611
612
int blk_crypto_fallback_start_using_mode (enum blk_crypto_mode_num mode_num )
612
613
{
613
614
const char * cipher_str = blk_crypto_modes [mode_num ].cipher_str ;
614
- struct blk_crypto_keyslot * slotp ;
615
+ struct blk_crypto_fallback_keyslot * slotp ;
615
616
unsigned int i ;
616
617
int err = 0 ;
617
618
0 commit comments