tls: Remove redundant vars from tls record structure
Subsystems (3)
PATCH 1/1 tls: Remove redundant vars from tls record structure
Structure 'tls_rec' contains sg_aead_in and sg_aead_out which point to a aad_space and then chain scatterlists sg_plaintext_data, sg_encrypted_data respectively. Rather than using chained scatterlists for plaintext and encrypted data in aead_req, it is efficient to store aad_space in sg_encrypted_data and sg_plaintext_data itself in the first index and get rid of sg_aead_in, sg_aead_in and further chaining.
This requires increasing size of sg_encrypted_data & sg_plaintext_data arrarys by 1 to accommodate entry for aad_space. The code which uses sg_encrypted_data and sg_plaintext_data has been modified to skip first index as it points to aad_space.
--- include/net/tls.h | 6 ++-- net/tls/tls_sw.c | 92 ++++++++++++++++++++++++++----------------------------- 2 files changed, 45 insertions(+), 53 deletions(-)
include/net/tls.h +2 -4
@@ -101,13 +101,11 @@ struct tls_rec {struct list_head list;int tx_ready;int tx_flags; -struct scatterlist sg_plaintext_data[MAX_SKB_FRAGS ]; -struct scatterlist sg_encrypted_data[MAX_SKB_FRAGS ];/* AAD | sg_plaintext_data | sg_tag */ -struct scatterlist sg_aead_in[2 ]; +struct scatterlist sg_plaintext_data[MAX_SKB_FRAGS +1 ];/* AAD | sg_encrypted_data (data contain overhead for hdr&iv&tag) */ -struct scatterlist sg_aead_out[2 ]; +struct scatterlist sg_encrypted_data[MAX_SKB_FRAGS +1 ];unsigned int sg_plaintext_size;unsigned int sg_encrypted_size;
net/tls/tls_sw.c +43 -49
250 lines not on this page · raw message
Signature · 1 line
2.13.6
From: Vakul Garg <[email protected]>
Date: Wed, 26 Sep 2018 16:22:08 +0530
Quoted 7 lines
Structure '
tls_rec' containssg_aead_inandsg_aead_outwhich point to aaad_spaceand then chain scatterlistssg_plaintext_data,sg_encrypted_datarespectively. Rather than using chained scatterlists for plaintext and encrypted data inaead_req, it is efficient to storeaad_spaceinsg_encrypted_dataandsg_plaintext_dataitself in the first index and get rid ofsg_aead_in,sg_aead_inand further chaining.
Quoted 6 lines
This requires increasing size of
sg_encrypted_data&sg_plaintext_dataarrarys by 1 to accommodate entry foraad_space. The code which usessg_encrypted_dataandsg_plaintext_datahas been modified to skip first index as it points toaad_space.Signed-off-by Vakul Garg <[email protected]>
Applied, thanks.