mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
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: 6942a284fb
("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>
This commit is contained in:
parent
3d2f670a87
commit
d31c080075
1 changed files with 3 additions and 1 deletions
|
@ -998,7 +998,7 @@ static void tls_device_attach(struct tls_context *ctx, struct sock *sk,
|
|||
|
||||
int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
|
||||
{
|
||||
u16 nonce_size, tag_size, iv_size, rec_seq_size;
|
||||
u16 nonce_size, tag_size, iv_size, rec_seq_size, salt_size;
|
||||
struct tls_context *tls_ctx = tls_get_ctx(sk);
|
||||
struct tls_prot_info *prot = &tls_ctx->prot_info;
|
||||
struct tls_record_info *start_marker_record;
|
||||
|
@ -1039,6 +1039,7 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
|
|||
iv_size = TLS_CIPHER_AES_GCM_128_IV_SIZE;
|
||||
iv = ((struct tls12_crypto_info_aes_gcm_128 *)crypto_info)->iv;
|
||||
rec_seq_size = TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE;
|
||||
salt_size = TLS_CIPHER_AES_GCM_128_SALT_SIZE;
|
||||
rec_seq =
|
||||
((struct tls12_crypto_info_aes_gcm_128 *)crypto_info)->rec_seq;
|
||||
break;
|
||||
|
@ -1059,6 +1060,7 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
|
|||
prot->tag_size = tag_size;
|
||||
prot->overhead_size = prot->prepend_size + prot->tag_size;
|
||||
prot->iv_size = iv_size;
|
||||
prot->salt_size = salt_size;
|
||||
ctx->tx.iv = kmalloc(iv_size + TLS_CIPHER_AES_GCM_128_SALT_SIZE,
|
||||
GFP_KERNEL);
|
||||
if (!ctx->tx.iv) {
|
||||
|
|
Loading…
Reference in a new issue