From: Zhushuai Yin <yinzhushuai@huawei.com> Currently, when the input size of the AEAD algorithm is 0 or greater than 65535, the software algorithm is used only in synchronous mode. In asynchronous mode, the algorithm fails to be switched to the software algorithm. This modification supports asynchronous switching to the software algorithm. Signed-off-by: Zhushuai Yin <yinzhushuai@huawei.com> --- src/uadk_prov_aead.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/uadk_prov_aead.c b/src/uadk_prov_aead.c index efaf447..26eeb66 100644 --- a/src/uadk_prov_aead.c +++ b/src/uadk_prov_aead.c @@ -574,13 +574,8 @@ static int uadk_prov_do_aes_gcm_first(struct aead_priv_ctx *priv, unsigned char { int ret; - if (inlen > MAX_AAD_LEN) { - if (priv->mode != ASYNC_MODE) - goto soft; - - UADK_ERR("the aad len is out of range, aad len = %zu.\n", inlen); - return UADK_AEAD_FAIL; - } + if (inlen > MAX_AAD_LEN || !inlen) + goto soft; priv->req.assoc_bytes = inlen; @@ -590,9 +585,6 @@ static int uadk_prov_do_aes_gcm_first(struct aead_priv_ctx *priv, unsigned char return UADK_AEAD_SUCCESS; } - if (!priv->req.assoc_bytes) - goto soft; - ret = uadk_do_aead_sync_inner(priv, out, in, inlen, AEAD_MSG_FIRST); if (unlikely(ret < 0)) goto soft; @@ -858,9 +850,6 @@ static int uadk_prov_aead_init(struct aead_priv_ctx *priv, const unsigned char * ret = uadk_prov_aead_dev_init(priv); if (unlikely(ret < 0)) { - if (ASYNC_get_current_job()) - return UADK_OSSL_FAIL; - UADK_ERR("aead switch to soft init.!\n"); return uadk_prov_aead_soft_init(priv, key, iv, params); } -- 2.43.0