提交 c044b62c 编写于 作者: S Shant KumarX Sonnad 提交者: Herbert Xu

crypto: qat - add check for negative offset in alg precompute function

The offset is calculated based on type of hash algorithum.
If the algorithum is invalid the offset can have negative value.
Hence added negative offset check and return -EFAULT.
Reviewed-by: NConor Mcloughlin <conor.mcloughlin@intel.com>
Tested-by: NSergey Portnoy <sergey.portnoy@intel.com>
Signed-off-by: NShant KumarX Sonnad <shant.kumarx.sonnad@intel.com>
Signed-off-by: NGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 93322498
......@@ -222,6 +222,9 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash,
return -EFAULT;
offset = round_up(qat_get_inter_state_size(ctx->qat_hash_alg), 8);
if (offset < 0)
return -EFAULT;
hash_state_out = (__be32 *)(hash->sha.state1 + offset);
hash512_state_out = (__be64 *)hash_state_out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册