crypto: hisilicon/hpre - return -EOVERFLOW for small ECDH output buffer

hpre_ecdh_msg_request_set() returns -EINVAL when the output buffer
is too small, after setting req->dst_len to the required size.
-EINVAL is misleading because the caller can retry with a larger
buffer. Return -EOVERFLOW as other kpp implementations do.

Fixes: 05e7b906aa ("crypto: hisilicon/hpre - add 'ECDH' algorithm")
Cc: stable@vger.kernel.org
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Weili Qian 2026-09-18 20:27:22 +08:00 committed by Herbert Xu
parent 5b87f619cc
commit 232804a5ed

View File

@ -1450,7 +1450,7 @@ static int hpre_ecdh_msg_request_set(struct hpre_ctx *ctx,
if (req->dst_len < ctx->key_sz << 1) {
req->dst_len = ctx->key_sz << 1;
return -EINVAL;
return -EOVERFLOW;
}
tmp = kpp_request_ctx(req);