On Mon, Nov 25, 2024 at 06:37:54PM +0800, Herbert Xu wrote: > On Mon, Nov 25, 2024 at 11:29:30AM +0100, Lukas Wunner wrote: > > I deliberately avoided the crypto_akcipher_sync_encrypt() API > > in rsassa-pkcs1.c because the extra buffer allocation plus copying > > data around impacts performance for no benefit. > > This is temporary. The idea is to convert the akcipher software > implementations over to use virtual addresses directly so that no > unnecessary copy occurs. Have a look at what I did with ahash: > > https://lore.kernel.org/linux-crypto/bffef4bab1bf250bd64a3d02de53eb1fd047a96e.1730021644.git.herbert@xxxxxxxxxxxxxxxxxxx/ > > This is what I'd like to do with akcipher as well. > > Longer term there is potentially another unnecessary copy if you > go from a kmalloced virtual address to an akcipher hardware driver, > but we could eliminate that by adding a flag to indicate that the > virtual address is safe for use within an SG list. I'm proposing an optimized approach which auto-detects whether duplicating into the linear map is actually necessary: https://lore.kernel.org/r/3de5d373c86dcaa5abc36f501c1398c4fbf05f2f.1732865109.git.lukas@xxxxxxxxx/ I reckon that aside of selftests, duplicating is almost never needed. Let me know if you have any objections. My apologies for being stubborn and rebellious and not always following what I'm told. Thanks, Lukas