1. 08 Dec, 2023 32 commits
  2. 01 Dec, 2023 8 commits
    • Chen Ni's avatar
      crypto: sa2ul - Return crypto_aead_setkey to transfer the error · ce852f13
      Chen Ni authored
      Return crypto_aead_setkey() in order to transfer the error if
      it fails.
      
      Fixes: d2c8ac18 ("crypto: sa2ul - Add AEAD algorithm support")
      Signed-off-by: default avatarChen Ni <nichen@iscas.ac.cn>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      ce852f13
    • Weili Qian's avatar
      crypto: hisilicon/qm - add comments and remove redundant array element · a10d17a4
      Weili Qian authored
      1. Remove redundant array element, prevent the size obtained by
      ARRAY_SIZE() from qm_log_hw_error is greater than actual size.
      2. Add comments in function qm_set_vf_mse() and qm_cq_ctx_cfg()
      to make it easier to understand.
      Signed-off-by: default avatarWeili Qian <qianweili@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      a10d17a4
    • Weili Qian's avatar
      crypto: hisilicon/qm - simplify the status of qm · c66272a4
      Weili Qian authored
      The 'QM_INIT' and 'QM_CLOSE' status of qm and 'QP_INIT'
      and 'QP_CLOSE' status of queue are not actually used. Currently,
      driver only needs to switch status when the device or queue
      is enabled or stopped, Therefore, remove unneeded status to
      simplify driver. In addition, rename'QM_START to'QM_WORK' for
      ease to understand.
      Signed-off-by: default avatarWeili Qian <qianweili@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c66272a4
    • Weili Qian's avatar
      crypto: hisilicon/sgl - small cleanups for sgl.c · fb4ac519
      Weili Qian authored
      1. Remove unnecessary brackets in function hisi_acc_create_sgl_pool().
      2. Modify local variable type, ensure that the variable type is
      consistent with the variable type to be compared.
      3. Because the function clear_hw_sgl_sge() is in the task process,
      obtain the value of le16_to_cpu(hw_sgl->entry_sum_in_sgl) before
      loop execting to shorten the loop execution time.
      Signed-off-by: default avatarWeili Qian <qianweili@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      fb4ac519
    • Chenghai Huang's avatar
      crypto: hisilicon/zip - add zip comp high perf mode configuration · a9864bae
      Chenghai Huang authored
      To meet specific application scenarios, the function of switching between
      the high performance mode and the high compression mode is added.
      
      Use the perf_mode=0/1 configuration to set the compression high perf mode,
      0(default, high compression mode), 1(high performance mode). These two
      modes only apply to the compression direction and are compatible with
      software algorithm in both directions.
      Signed-off-by: default avatarChenghai Huang <huangchenghai2@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      a9864bae
    • Gustavo A. R. Silva's avatar
      crypto: p10-aes-gcm - Avoid -Wstringop-overflow warnings · aaa03fdb
      Gustavo A. R. Silva authored
      The compiler doesn't know that `32` is an offset into the Hash table:
      
       56 struct Hash_ctx {
       57         u8 H[16];       /* subkey */
       58         u8 Htable[256]; /* Xi, Hash table(offset 32) */
       59 };
      
      So, it legitimately complains about a potential out-of-bounds issue
      if `256 bytes` are accessed in `htable` (this implies going
      `32 bytes` beyond the boundaries of `Htable`):
      
      arch/powerpc/crypto/aes-gcm-p10-glue.c: In function 'gcmp10_init':
      arch/powerpc/crypto/aes-gcm-p10-glue.c:120:9: error: 'gcm_init_htable' accessing 256 bytes in a region of size 224 [-Werror=stringop-overflow=]
        120 |         gcm_init_htable(hash->Htable+32, hash->H);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      arch/powerpc/crypto/aes-gcm-p10-glue.c:120:9: note: referencing argument 1 of type 'unsigned char[256]'
      arch/powerpc/crypto/aes-gcm-p10-glue.c:120:9: note: referencing argument 2 of type 'unsigned char[16]'
      arch/powerpc/crypto/aes-gcm-p10-glue.c:40:17: note: in a call to function 'gcm_init_htable'
         40 | asmlinkage void gcm_init_htable(unsigned char htable[256], unsigned char Xi[16]);
            |                 ^~~~~~~~~~~~~~~
      
      Address this by avoiding specifying the size of `htable` in the function
      prototype; and just for consistency, do the same for parameter `Xi`.
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Closes: https://lore.kernel.org/linux-next/20231121131903.68a37932@canb.auug.org.au/Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      aaa03fdb
    • Damian Muszynski's avatar
      crypto: qat - add sysfs_added flag for rate limiting · d71fdd0f
      Damian Muszynski authored
      The qat_rl sysfs attribute group is registered within the adf_dev_start()
      function, alongside other driver components.
      If any of the functions preceding the group registration fails,
      the adf_dev_start() function returns, and the caller, to undo the
      operation, invokes adf_dev_stop() followed by adf_dev_shutdown().
      However, the current flow lacks information about whether the
      registration of the qat_rl attribute group was successful or not.
      
      In cases where this condition is encountered, an error similar to
      the following might be reported:
      
          4xxx 0000:6b:00.0: Starting device qat_dev0
          4xxx 0000:6b:00.0: qat_dev0 started 9 acceleration engines
          4xxx 0000:6b:00.0: Failed to send init message
          4xxx 0000:6b:00.0: Failed to start device qat_dev0
          sysfs group 'qat_rl' not found for kobject '0000:6b:00.0'
          ...
          sysfs_remove_groups+0x2d/0x50
          adf_sysfs_rl_rm+0x44/0x70 [intel_qat]
          adf_rl_stop+0x2d/0xb0 [intel_qat]
          adf_dev_stop+0x33/0x1d0 [intel_qat]
          adf_dev_down+0xf1/0x150 [intel_qat]
          ...
          4xxx 0000:6b:00.0: qat_dev0 stopped 9 acceleration engines
          4xxx 0000:6b:00.0: Resetting device qat_dev0
      
      To prevent attempting to remove attributes from a group that has not
      been added yet, a flag named 'sysfs_added' is introduced. This flag
      is set to true upon the successful registration of the attribute group.
      
      Fixes: d9fb8408 ("crypto: qat - add rate limiting feature to qat_4xxx")
      Signed-off-by: default avatarDamian Muszynski <damian.muszynski@intel.com>
      Reviewed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Reviewed-by: default avatarAhsan Atta <ahsan.atta@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      d71fdd0f
    • Damian Muszynski's avatar
      crypto: qat - add sysfs_added flag for ras · 65089000
      Damian Muszynski authored
      The qat_ras sysfs attribute group is registered within the
      adf_dev_start() function, alongside other driver components.
      If any of the functions preceding the group registration fails,
      the adf_dev_start() function returns, and the caller, to undo the
      operation, invokes adf_dev_stop() followed by adf_dev_shutdown().
      However, the current flow lacks information about whether the
      registration of the qat_ras attribute group was successful or not.
      
      In cases where this condition is encountered, an error similar to
      the following might be reported:
      
          4xxx 0000:6b:00.0: Starting device qat_dev0
          4xxx 0000:6b:00.0: qat_dev0 started 9 acceleration engines
          4xxx 0000:6b:00.0: Failed to send init message
          4xxx 0000:6b:00.0: Failed to start device qat_dev0
          sysfs group 'qat_ras' not found for kobject '0000:6b:00.0'
          ...
          sysfs_remove_groups+0x29/0x50
          adf_sysfs_stop_ras+0x4b/0x80 [intel_qat]
          adf_dev_stop+0x43/0x1d0 [intel_qat]
          adf_dev_down+0x4b/0x150 [intel_qat]
          ...
          4xxx 0000:6b:00.0: qat_dev0 stopped 9 acceleration engines
          4xxx 0000:6b:00.0: Resetting device qat_dev0
      
      To prevent attempting to remove attributes from a group that has not
      been added yet, a flag named 'sysfs_added' is introduced. This flag
      is set to true upon the successful registration of the attribute group.
      
      Fixes: 532d7f6b ("crypto: qat - add error counters")
      Signed-off-by: default avatarDamian Muszynski <damian.muszynski@intel.com>
      Reviewed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
      Reviewed-by: default avatarAhsan Atta <ahsan.atta@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      65089000