When wd_cipher_set_key() failed, after the handle is released, the handle should be set to 0 to avoid reusing.
Signed-off-by: taoqi taoqi10@huawei.com --- src/uadk_cipher.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/src/uadk_cipher.c b/src/uadk_cipher.c index 1f8d8cb..2c1d87b 100644 --- a/src/uadk_cipher.c +++ b/src/uadk_cipher.c @@ -888,6 +888,7 @@ static void uadk_e_ctx_init(EVP_CIPHER_CTX *ctx, struct cipher_priv_ctx *priv) ret = wd_cipher_set_key(priv->sess, priv->key, EVP_CIPHER_CTX_key_length(ctx)); if (ret) { wd_cipher_free_sess(priv->sess); + priv->sess = 0; fprintf(stderr, "uadk failed to set key!\n"); return; }