net/mlx5e: kTLS, Save a copy of the crypto info
Do not assume the crypto info is accessible during the
connection lifetime. Save a copy of it in the private
TX context.
Fixes: d2ead1f360
("net/mlx5e: Add kTLS TX HW offload support")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Reviewed-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
ecdc65a3ec
commit
af11a7a424
@ -38,7 +38,7 @@ static int mlx5e_ktls_add(struct net_device *netdev, struct sock *sk,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
tx_priv->expected_seq = start_offload_tcp_sn;
|
tx_priv->expected_seq = start_offload_tcp_sn;
|
||||||
tx_priv->crypto_info = crypto_info;
|
tx_priv->crypto_info = *(struct tls12_crypto_info_aes_gcm_128 *)crypto_info;
|
||||||
mlx5e_set_ktls_tx_priv_ctx(tls_ctx, tx_priv);
|
mlx5e_set_ktls_tx_priv_ctx(tls_ctx, tx_priv);
|
||||||
|
|
||||||
/* tc and underlay_qpn values are not in use for tls tis */
|
/* tc and underlay_qpn values are not in use for tls tis */
|
||||||
|
@ -44,7 +44,7 @@ enum {
|
|||||||
|
|
||||||
struct mlx5e_ktls_offload_context_tx {
|
struct mlx5e_ktls_offload_context_tx {
|
||||||
struct tls_offload_context_tx *tx_ctx;
|
struct tls_offload_context_tx *tx_ctx;
|
||||||
struct tls_crypto_info *crypto_info;
|
struct tls12_crypto_info_aes_gcm_128 crypto_info;
|
||||||
u32 expected_seq;
|
u32 expected_seq;
|
||||||
u32 tisn;
|
u32 tisn;
|
||||||
u32 key_id;
|
u32 key_id;
|
||||||
|
@ -24,14 +24,12 @@ enum {
|
|||||||
static void
|
static void
|
||||||
fill_static_params_ctx(void *ctx, struct mlx5e_ktls_offload_context_tx *priv_tx)
|
fill_static_params_ctx(void *ctx, struct mlx5e_ktls_offload_context_tx *priv_tx)
|
||||||
{
|
{
|
||||||
struct tls_crypto_info *crypto_info = priv_tx->crypto_info;
|
struct tls12_crypto_info_aes_gcm_128 *info = &priv_tx->crypto_info;
|
||||||
struct tls12_crypto_info_aes_gcm_128 *info;
|
|
||||||
char *initial_rn, *gcm_iv;
|
char *initial_rn, *gcm_iv;
|
||||||
u16 salt_sz, rec_seq_sz;
|
u16 salt_sz, rec_seq_sz;
|
||||||
char *salt, *rec_seq;
|
char *salt, *rec_seq;
|
||||||
u8 tls_version;
|
u8 tls_version;
|
||||||
|
|
||||||
info = (struct tls12_crypto_info_aes_gcm_128 *)crypto_info;
|
|
||||||
EXTRACT_INFO_FIELDS;
|
EXTRACT_INFO_FIELDS;
|
||||||
|
|
||||||
gcm_iv = MLX5_ADDR_OF(tls_static_params, ctx, gcm_iv);
|
gcm_iv = MLX5_ADDR_OF(tls_static_params, ctx, gcm_iv);
|
||||||
@ -233,14 +231,12 @@ tx_post_resync_params(struct mlx5e_txqsq *sq,
|
|||||||
struct mlx5e_ktls_offload_context_tx *priv_tx,
|
struct mlx5e_ktls_offload_context_tx *priv_tx,
|
||||||
u64 rcd_sn)
|
u64 rcd_sn)
|
||||||
{
|
{
|
||||||
struct tls_crypto_info *crypto_info = priv_tx->crypto_info;
|
struct tls12_crypto_info_aes_gcm_128 *info = &priv_tx->crypto_info;
|
||||||
struct tls12_crypto_info_aes_gcm_128 *info;
|
|
||||||
__be64 rn_be = cpu_to_be64(rcd_sn);
|
__be64 rn_be = cpu_to_be64(rcd_sn);
|
||||||
bool skip_static_post;
|
bool skip_static_post;
|
||||||
u16 rec_seq_sz;
|
u16 rec_seq_sz;
|
||||||
char *rec_seq;
|
char *rec_seq;
|
||||||
|
|
||||||
info = (struct tls12_crypto_info_aes_gcm_128 *)crypto_info;
|
|
||||||
rec_seq = info->rec_seq;
|
rec_seq = info->rec_seq;
|
||||||
rec_seq_sz = sizeof(info->rec_seq);
|
rec_seq_sz = sizeof(info->rec_seq);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user