From 9fa67d9748d0e8b710bc8a0cdd3f289e3a1b2f8f Mon Sep 17 00:00:00 2001 From: taoqi Date: Tue, 20 Jun 2023 23:07:31 +0800 Subject: [PATCH 10/10] cipher: fix async hardware computing error If the length of the input data does not reach to hardware computing threshold, directly switch to soft cipher. Signed-off-by: taoqi --- src/uadk_cipher.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/uadk_cipher.c b/src/uadk_cipher.c index cc13823..940c26c 100644 --- a/src/uadk_cipher.c +++ b/src/uadk_cipher.c @@ -927,6 +927,14 @@ static int uadk_e_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (!ret) goto sync_err; } else { + /* + * If the length of the input data + * does not reach to hardware computing threshold, + * directly switch to soft cipher. + */ + if (priv->req.in_bytes <= priv->switch_threshold) + goto sync_err; + ret = do_cipher_async(priv, &op); if (!ret) goto out_notify; -- 2.25.1