From: Zhushuai Yin <yinzhushuai@huawei.com> In the prov scenario, when the cipher soft computing enable switch is disabled, there is a probabilistic segmentation fault because the ctx is not checked for null during padding. Signed-off-by: Zhushuai Yin <yinzhushuai@huawei.com> --- src/uadk_prov_cipher.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uadk_prov_cipher.c b/src/uadk_prov_cipher.c index ad617a1..198e0ac 100644 --- a/src/uadk_prov_cipher.c +++ b/src/uadk_prov_cipher.c @@ -1149,7 +1149,8 @@ static int uadk_prov_cipher_set_ctx_params(void *vctx, const OSSL_PARAM params[] return UADK_P_FAIL; } priv->pad = pad ? 1 : 0; - EVP_CIPHER_CTX_set_padding(priv->sw_ctx, pad); + if (priv->sw_ctx) + EVP_CIPHER_CTX_set_padding(priv->sw_ctx, pad); } p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_KEYLEN); -- 2.43.0