Skip to content

Commit d31c080

Browse files
rmchelsiokuba-moo
authored andcommitted
net/tls: make sure tls offload sets salt_size
Recent changes made to remove AES constants started using protocol aware salt_size. ctx->prot_info's salt_size is filled in tls sw case, but not in tls offload mode, and was working so far because of the hard coded value was used. Fixes: 6942a28 ("net/tls: make inline helpers protocol-aware") Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com> Link: https://lore.kernel.org/r/20201201090752.27355-1-rohitm@chelsio.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 3d2f670 commit d31c080

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/tls/tls_device.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ static void tls_device_attach(struct tls_context *ctx, struct sock *sk,
998998

999999
int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
10001000
{
1001-
u16 nonce_size, tag_size, iv_size, rec_seq_size;
1001+
u16 nonce_size, tag_size, iv_size, rec_seq_size, salt_size;
10021002
struct tls_context *tls_ctx = tls_get_ctx(sk);
10031003
struct tls_prot_info *prot = &tls_ctx->prot_info;
10041004
struct tls_record_info *start_marker_record;
@@ -1039,6 +1039,7 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
10391039
iv_size = TLS_CIPHER_AES_GCM_128_IV_SIZE;
10401040
iv = ((struct tls12_crypto_info_aes_gcm_128 *)crypto_info)->iv;
10411041
rec_seq_size = TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE;
1042+
salt_size = TLS_CIPHER_AES_GCM_128_SALT_SIZE;
10421043
rec_seq =
10431044
((struct tls12_crypto_info_aes_gcm_128 *)crypto_info)->rec_seq;
10441045
break;
@@ -1059,6 +1060,7 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
10591060
prot->tag_size = tag_size;
10601061
prot->overhead_size = prot->prepend_size + prot->tag_size;
10611062
prot->iv_size = iv_size;
1063+
prot->salt_size = salt_size;
10621064
ctx->tx.iv = kmalloc(iv_size + TLS_CIPHER_AES_GCM_128_SALT_SIZE,
10631065
GFP_KERNEL);
10641066
if (!ctx->tx.iv) {

0 commit comments

Comments
 (0)