From 3e70bfc8641d7d292341958a21df6365a70b2efc Mon Sep 17 00:00:00 2001 From: Guodong Xu Date: Tue, 5 Sep 2023 15:47:43 +0800 Subject: [PATCH 35/48] uadk_prov_cipher: add handling of param padding Add handling of OSSL_CIPHER_PARAM_PADDING. Without this, openssl ./test/evp_test fails. Signed-off-by: Guodong Xu --- src/uadk_prov_cipher.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/uadk_prov_cipher.c b/src/uadk_prov_cipher.c index c0c52a3..1e4c40d 100644 --- a/src/uadk_prov_cipher.c +++ b/src/uadk_prov_cipher.c @@ -616,6 +616,17 @@ static int uadk_prov_cipher_set_ctx_params(void *vctx, const OSSL_PARAM params[] if (params == NULL) return 1; + p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_PADDING); + if (p != NULL) { + unsigned int pad; + + if (!OSSL_PARAM_get_uint(p, &pad)) { + ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER); + return 0; + } + EVP_CIPHER_CTX_set_padding(priv->sw_ctx, pad); + } + p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_KEYLEN); if (p != NULL) { size_t keylen; -- 2.25.1