@@ -293,14 +293,16 @@ static int skcipher_walk_first(struct skcipher_walk *walk)
293
293
return skcipher_walk_next (walk );
294
294
}
295
295
296
- int skcipher_walk_virt (struct skcipher_walk * walk ,
297
- struct skcipher_request * req , bool atomic )
296
+ int skcipher_walk_virt (struct skcipher_walk * __restrict walk ,
297
+ struct skcipher_request * __restrict req , bool atomic )
298
298
{
299
- const struct skcipher_alg * alg =
300
- crypto_skcipher_alg ( crypto_skcipher_reqtfm ( req )) ;
299
+ struct crypto_skcipher * tfm = crypto_skcipher_reqtfm ( req );
300
+ struct skcipher_alg * alg ;
301
301
302
302
might_sleep_if (req -> base .flags & CRYPTO_TFM_REQ_MAY_SLEEP );
303
303
304
+ alg = crypto_skcipher_alg (tfm );
305
+
304
306
walk -> total = req -> cryptlen ;
305
307
walk -> nbytes = 0 ;
306
308
walk -> iv = req -> iv ;
@@ -316,14 +318,9 @@ int skcipher_walk_virt(struct skcipher_walk *walk,
316
318
scatterwalk_start (& walk -> in , req -> src );
317
319
scatterwalk_start (& walk -> out , req -> dst );
318
320
319
- /*
320
- * Accessing 'alg' directly generates better code than using the
321
- * crypto_skcipher_blocksize() and similar helper functions here, as it
322
- * prevents the algorithm pointer from being repeatedly reloaded.
323
- */
324
- walk -> blocksize = alg -> base .cra_blocksize ;
325
- walk -> ivsize = alg -> co .ivsize ;
326
- walk -> alignmask = alg -> base .cra_alignmask ;
321
+ walk -> blocksize = crypto_skcipher_blocksize (tfm );
322
+ walk -> ivsize = crypto_skcipher_ivsize (tfm );
323
+ walk -> alignmask = crypto_skcipher_alignmask (tfm );
327
324
328
325
if (alg -> co .base .cra_type != & crypto_skcipher_type )
329
326
walk -> stride = alg -> co .chunksize ;
@@ -334,10 +331,11 @@ int skcipher_walk_virt(struct skcipher_walk *walk,
334
331
}
335
332
EXPORT_SYMBOL_GPL (skcipher_walk_virt );
336
333
337
- static int skcipher_walk_aead_common (struct skcipher_walk * walk ,
338
- struct aead_request * req , bool atomic )
334
+ static int skcipher_walk_aead_common (struct skcipher_walk * __restrict walk ,
335
+ struct aead_request * __restrict req ,
336
+ bool atomic )
339
337
{
340
- const struct aead_alg * alg = crypto_aead_alg ( crypto_aead_reqtfm (req ) );
338
+ struct crypto_aead * tfm = crypto_aead_reqtfm (req );
341
339
342
340
walk -> nbytes = 0 ;
343
341
walk -> iv = req -> iv ;
@@ -353,30 +351,27 @@ static int skcipher_walk_aead_common(struct skcipher_walk *walk,
353
351
scatterwalk_start_at_pos (& walk -> in , req -> src , req -> assoclen );
354
352
scatterwalk_start_at_pos (& walk -> out , req -> dst , req -> assoclen );
355
353
356
- /*
357
- * Accessing 'alg' directly generates better code than using the
358
- * crypto_aead_blocksize() and similar helper functions here, as it
359
- * prevents the algorithm pointer from being repeatedly reloaded.
360
- */
361
- walk -> blocksize = alg -> base .cra_blocksize ;
362
- walk -> stride = alg -> chunksize ;
363
- walk -> ivsize = alg -> ivsize ;
364
- walk -> alignmask = alg -> base .cra_alignmask ;
354
+ walk -> blocksize = crypto_aead_blocksize (tfm );
355
+ walk -> stride = crypto_aead_chunksize (tfm );
356
+ walk -> ivsize = crypto_aead_ivsize (tfm );
357
+ walk -> alignmask = crypto_aead_alignmask (tfm );
365
358
366
359
return skcipher_walk_first (walk );
367
360
}
368
361
369
- int skcipher_walk_aead_encrypt (struct skcipher_walk * walk ,
370
- struct aead_request * req , bool atomic )
362
+ int skcipher_walk_aead_encrypt (struct skcipher_walk * __restrict walk ,
363
+ struct aead_request * __restrict req ,
364
+ bool atomic )
371
365
{
372
366
walk -> total = req -> cryptlen ;
373
367
374
368
return skcipher_walk_aead_common (walk , req , atomic );
375
369
}
376
370
EXPORT_SYMBOL_GPL (skcipher_walk_aead_encrypt );
377
371
378
- int skcipher_walk_aead_decrypt (struct skcipher_walk * walk ,
379
- struct aead_request * req , bool atomic )
372
+ int skcipher_walk_aead_decrypt (struct skcipher_walk * __restrict walk ,
373
+ struct aead_request * __restrict req ,
374
+ bool atomic )
380
375
{
381
376
struct crypto_aead * tfm = crypto_aead_reqtfm (req );
382
377
0 commit comments