net/mlx5: Add const to the key pointer of encryption key creation
authorJianbo Liu <jianbol@nvidia.com>
Mon, 8 Aug 2022 02:47:17 +0000 (02:47 +0000)
committerSaeed Mahameed <saeedm@nvidia.com>
Tue, 31 Jan 2023 03:10:05 +0000 (19:10 -0800)
Change key pointer to const void *, as there is no need to change the
key content. This is also to avoid modifying the key by mistake.

Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c
drivers/net/ethernet/mellanox/mlx5/core/lib/crypto.c
drivers/net/ethernet/mellanox/mlx5/core/lib/crypto.h

index d36788119b8bf777d87953e213f394717057e69f..f80d6fce28d2d5c95a39258d3703dd51b402014f 100644 (file)
@@ -13,8 +13,8 @@ int mlx5_ktls_create_key(struct mlx5_core_dev *mdev,
                         struct tls_crypto_info *crypto_info,
                         u32 *p_key_id)
 {
+       const void *key;
        u32 sz_bytes;
-       void *key;
 
        switch (crypto_info->cipher_type) {
        case TLS_CIPHER_AES_GCM_128: {
index 02bc365efade476d3e82e7cf1a1446b8b7474109..bc2a72491e10149a30d32d0e75a124e448cf384f 100644 (file)
@@ -10,7 +10,7 @@ struct mlx5_crypto_dek_priv {
 };
 
 int mlx5_create_encryption_key(struct mlx5_core_dev *mdev,
-                              void *key, u32 sz_bytes,
+                              const void *key, u32 sz_bytes,
                               u32 key_type, u32 *p_key_id)
 {
        u32 in[MLX5_ST_SZ_DW(create_encryption_key_in)] = {};
index 5968536047cafdf1d52081cfd9f8241924c03cb5..ee3ed8c863d19925c56ffc5b61d2b6afd989ed49 100644 (file)
@@ -11,7 +11,7 @@ enum {
 };
 
 int mlx5_create_encryption_key(struct mlx5_core_dev *mdev,
-                              void *key, u32 sz_bytes,
+                              const void *key, u32 sz_bytes,
                               u32 key_type, u32 *p_key_id);
 
 void mlx5_destroy_encryption_key(struct mlx5_core_dev *mdev, u32 key_id);