If the length of the input data does not reach to hardware computing threshold, directly switch to soft cipher.
Signed-off-by: taoqi taoqi10@huawei.com --- src/uadk_cipher.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/src/uadk_cipher.c b/src/uadk_cipher.c index 0a7518b..c769ec7 100644 --- a/src/uadk_cipher.c +++ b/src/uadk_cipher.c @@ -938,6 +938,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;