crypto: qat - optimize allocations for fw authentication
authorJack Xu <jack.xu@intel.com>
Fri, 14 Mar 2025 12:57:54 +0000 (12:57 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 21 Mar 2025 09:33:39 +0000 (17:33 +0800)
commit987fd1a4bad6cd0c5daf422bc65621c70c88087d
tree686f74c0b3523f03012b5a8e74255a8cd7676c68
parent0d5cb730b59ba23d6472b8b1eacd351e7bc48c2b
crypto: qat - optimize allocations for fw authentication

The memory requested to hold the image data for authentication will
never exceed `ICP_QAT_CSS_RSA4K_MAX_IMAGE_LEN`. Therefore, we can
simplify the allocation by always requesting the maximum size needed for
any image.

Also introduce the following checks:
 * Ensure the allocated memory is 8-byte aligned to meet the
   requirements of the authentication firmware.
 * Prevent overflow when constructing the authentication descriptor.

Signed-off-by: Jack Xu <jack.xu@intel.com>
Reviewed-by: Ahsan Atta <ahsan.atta@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/intel/qat/qat_common/icp_qat_uclo.h
drivers/crypto/intel/qat/qat_common/qat_uclo.c