Add missing trailing newlines to the dlen fprintf messages in the EC sign/verify checks, and collapse the temporary variable in ecx_keygen_set_pkey to a direct return. No behavioural change. Use %zu to log the size_t outsize in uadk_asym_cipher_rsa_encrypt instead of %d, which read only half the value on 64-bit. Also update the provider async retry checks to use PROV_SEND_MAX_CNT from the shared provider header instead of ENGINE_SEND_MAX_CNT, since the ENGINE_ prefix is misleading for provider code. The ENGINE_SEND_MAX_CNT macro itself is unchanged and still used by the engine side. Signed-off-by: Weili Qian <qianweili@huawei.com> --- src/uadk_ec.c | 4 ++-- src/uadk_ecx.c | 4 +--- src/uadk_prov_aead.c | 2 +- src/uadk_prov_digest.c | 2 +- src/uadk_prov_hmac.c | 2 +- src/uadk_prov_rsa_enc.c | 2 +- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/uadk_ec.c b/src/uadk_ec.c index 08ff7a3..1965461 100644 --- a/src/uadk_ec.c +++ b/src/uadk_ec.c @@ -297,7 +297,7 @@ static int ecdsa_do_sign_check(EC_KEY *eckey, } if (dlen <= 0) { - fprintf(stderr, "dlen error, dlen = %d", dlen); + fprintf(stderr, "dlen error, dlen = %d\n", dlen); return -1; } @@ -586,7 +586,7 @@ static int ecdsa_do_verify_check(EC_KEY *eckey, } if (dlen <= 0) { - fprintf(stderr, "digest len error, dlen = %d", dlen); + fprintf(stderr, "digest len error, dlen = %d\n", dlen); return -1; } diff --git a/src/uadk_ecx.c b/src/uadk_ecx.c index 3e79a54..fbab680 100644 --- a/src/uadk_ecx.c +++ b/src/uadk_ecx.c @@ -508,9 +508,7 @@ static int ecx_keygen_set_pkey(EVP_PKEY *pkey, struct ecx_ctx *ecx_ctx, ecx_key->privkey[X448_KEYLEN - 1] |= 0x80; } - ret = EVP_PKEY_assign(pkey, ecx_ctx->nid, ecx_key); - - return ret; + return EVP_PKEY_assign(pkey, ecx_ctx->nid, ecx_key); } static int openssl_do_derive(EVP_PKEY_CTX *ctx, unsigned char *key, diff --git a/src/uadk_prov_aead.c b/src/uadk_prov_aead.c index 88ec8e4..93929a0 100644 --- a/src/uadk_prov_aead.c +++ b/src/uadk_prov_aead.c @@ -537,7 +537,7 @@ static int uadk_do_aead_async_inner(struct aead_priv_ctx *priv, struct async_op if (unlikely(ret < 0)) { if (unlikely(ret != -EBUSY)) UADK_ERR("do aead async operation failed ret = %d.\n", ret); - else if (unlikely(cnt++ > ENGINE_SEND_MAX_CNT)) + else if (unlikely(cnt++ > PROV_SEND_MAX_CNT)) UADK_ERR("do aead async operation timeout.\n"); else continue; diff --git a/src/uadk_prov_digest.c b/src/uadk_prov_digest.c index 0f4cb87..0b24a26 100644 --- a/src/uadk_prov_digest.c +++ b/src/uadk_prov_digest.c @@ -628,7 +628,7 @@ static int uadk_do_digest_async(struct digest_priv_ctx *priv, struct async_op *o goto free_poll_task; } - if (unlikely(++cnt > ENGINE_SEND_MAX_CNT)) { + if (unlikely(++cnt > PROV_SEND_MAX_CNT)) { UADK_ERR("do digest async operation timeout.\n"); goto free_poll_task; } diff --git a/src/uadk_prov_hmac.c b/src/uadk_prov_hmac.c index 5a88fe4..ad1aa2e 100644 --- a/src/uadk_prov_hmac.c +++ b/src/uadk_prov_hmac.c @@ -599,7 +599,7 @@ static int uadk_do_hmac_async(struct hmac_priv_ctx *priv, struct async_op *op) goto free_poll_task; } - if (unlikely(++cnt > ENGINE_SEND_MAX_CNT)) { + if (unlikely(++cnt > PROV_SEND_MAX_CNT)) { UADK_ERR("do hmac async operation timeout.\n"); goto free_poll_task; } diff --git a/src/uadk_prov_rsa_enc.c b/src/uadk_prov_rsa_enc.c index 3b7ce40..80a40d5 100644 --- a/src/uadk_prov_rsa_enc.c +++ b/src/uadk_prov_rsa_enc.c @@ -491,7 +491,7 @@ static int uadk_asym_cipher_rsa_encrypt(void *vprsactx, unsigned char *out, } if (outsize < len) { - UADK_ERR("invalid: outsize %d is too small.\n", outsize); + UADK_ERR("invalid: outsize %zu is too small.\n", outsize); return UADK_P_FAIL; } -- 2.53.0.windows.2