2025-11-14, 11:40:29 +0100, Ralf Lici wrote:
> Currently ovpn uses three separate dynamically allocated structures to
> set up cryptographic operations for both encryption and decryption. This
> adds overhead to performance-critical paths and contribute to memory
> fragmentation.
> 
> This commit consolidates those allocations into a single temporary blob,
> similar to what esp_alloc_tmp() does.
> 
> The resulting performance gain is +7.7% and +4.3% for UDP when using AES
> and ChaChaPoly respectively, and +4.3% for TCP.
> 
> Signed-off-by: Ralf Lici <[email protected]>
> Signed-off-by: Antonio Quartulli <[email protected]>
> ---
> Changes since v2:
> - Replaced manual multiplication with array_size() helper
> - Made ovpn_aead_crypto_tmp_size() less generic by asserting that IV
>   size equals OVPN_NONCE_SIZE
> 
> Changes since v1:
> - Fixed typo in commit message
> - Adjusted ovpn_aead_crypto_tmp_size comment to follow kdoc style
> - Stored allocated blob in the skb control block immediately after
>   allocation to prevent leakage on failure
> - Removed 'inline' from function declarations in crypto_aead.c
> 
>  drivers/net/ovpn/crypto_aead.c | 160 +++++++++++++++++++++++++--------
>  drivers/net/ovpn/io.c          |   8 +-
>  drivers/net/ovpn/skb.h         |  13 ++-
>  3 files changed, 135 insertions(+), 46 deletions(-)

Reviewed-by: Sabrina Dubroca <[email protected]>

Thanks Ralf.

-- 
Sabrina


_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to