aboutsummaryrefslogtreecommitdiffstats
path: root/net/tls/tls_device.c
diff options
context:
space:
mode:
authorSabrina Dubroca <[email protected]>2023-10-09 20:50:48 +0000
committerDavid S. Miller <[email protected]>2023-10-13 10:26:10 +0000
commit1a074f7618e8b82a7cebf45df6e005d2284446ce (patch)
treee87977b94d9aeea66d5e61670a8a42dff3520452 /net/tls/tls_device.c
parenttls: move tls_prot_info initialization out of tls_set_sw_offload (diff)
downloadkernel-1a074f7618e8b82a7cebf45df6e005d2284446ce.tar.gz
kernel-1a074f7618e8b82a7cebf45df6e005d2284446ce.zip
tls: also use init_prot_info in tls_set_device_offload
Most values are shared. Nonce size turns out to be equal to IV size for all offloadable ciphers. Signed-off-by: Sabrina Dubroca <[email protected]> Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/tls/tls_device.c')
-rw-r--r--net/tls/tls_device.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index 0981496c6294..3d73dd97e903 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -1076,20 +1076,14 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
goto release_netdev;
}
+ rc = init_prot_info(prot, crypto_info, cipher_desc, TLS_HW);
+ if (rc)
+ goto release_netdev;
+
iv = crypto_info_iv(crypto_info, cipher_desc);
rec_seq = crypto_info_rec_seq(crypto_info, cipher_desc);
- prot->version = crypto_info->version;
- prot->cipher_type = crypto_info->cipher_type;
- prot->prepend_size = TLS_HEADER_SIZE + cipher_desc->iv;
- prot->tag_size = cipher_desc->tag;
- prot->overhead_size = prot->prepend_size + prot->tag_size;
- prot->iv_size = cipher_desc->iv;
- prot->salt_size = cipher_desc->salt;
-
memcpy(ctx->tx.iv + cipher_desc->salt, iv, cipher_desc->iv);
-
- prot->rec_seq_size = cipher_desc->rec_seq;
memcpy(ctx->tx.rec_seq, rec_seq, cipher_desc->rec_seq);
start_marker_record = kmalloc(sizeof(*start_marker_record), GFP_KERNEL);