Skip to content

Commit

Permalink
net/tls: Support 256 bit keys with TX device offload
Browse files Browse the repository at this point in the history
Add the missing clause for 256 bit keys in tls_set_device_offload(), and
the needed adjustments in tls_device_fallback.c.

Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
gal-pressman authored and kuba-moo committed Sep 23, 2022
1 parent ea7a9d8 commit 56e5a6d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/tls/tls_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,7 @@ tls_device_reencrypt(struct sock *sk, struct tls_context *tls_ctx)

switch (tls_ctx->crypto_recv.info.cipher_type) {
case TLS_CIPHER_AES_GCM_128:
case TLS_CIPHER_AES_GCM_256:
break;
default:
return -EINVAL;
Expand Down Expand Up @@ -1111,6 +1112,11 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
rec_seq =
((struct tls12_crypto_info_aes_gcm_128 *)crypto_info)->rec_seq;
break;
case TLS_CIPHER_AES_GCM_256:
iv = ((struct tls12_crypto_info_aes_gcm_256 *)crypto_info)->iv;
rec_seq =
((struct tls12_crypto_info_aes_gcm_256 *)crypto_info)->rec_seq;
break;
default:
rc = -EINVAL;
goto release_netdev;
Expand Down
7 changes: 7 additions & 0 deletions net/tls/tls_device_fallback.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ static int tls_enc_record(struct aead_request *aead_req,

switch (prot->cipher_type) {
case TLS_CIPHER_AES_GCM_128:
case TLS_CIPHER_AES_GCM_256:
break;
default:
return -EINVAL;
Expand Down Expand Up @@ -341,6 +342,9 @@ static struct sk_buff *tls_enc_skb(struct tls_context *tls_ctx,
case TLS_CIPHER_AES_GCM_128:
salt = tls_ctx->crypto_send.aes_gcm_128.salt;
break;
case TLS_CIPHER_AES_GCM_256:
salt = tls_ctx->crypto_send.aes_gcm_256.salt;
break;
default:
return NULL;
}
Expand Down Expand Up @@ -484,6 +488,9 @@ int tls_sw_fallback_init(struct sock *sk,
case TLS_CIPHER_AES_GCM_128:
key = ((struct tls12_crypto_info_aes_gcm_128 *)crypto_info)->key;
break;
case TLS_CIPHER_AES_GCM_256:
key = ((struct tls12_crypto_info_aes_gcm_256 *)crypto_info)->key;
break;
default:
return -EINVAL;
}
Expand Down

0 comments on commit 56e5a6d

Please sign in to comment.