From: Qi Tao taoqi10@huawei.com
Can not convert ‘size_t*’ {‘long unsigned int*’} to ‘int*’, which may cause data loss or other problems.
Signed-off-by: Qi Tao taoqi10@huawei.com Signed-off-by: JiangShui Yang yangjiangshui@h-partners.com --- src/uadk_prov_cipher.c | 24 ++++++++++++------------ src/uadk_prov_digest.c | 3 +++ src/uadk_prov_init.c | 4 ---- 3 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/src/uadk_prov_cipher.c b/src/uadk_prov_cipher.c index 7847c12..92a9e79 100644 --- a/src/uadk_prov_cipher.c +++ b/src/uadk_prov_cipher.c @@ -329,9 +329,9 @@ static int uadk_prov_cipher_soft_work(struct cipher_priv_ctx *priv, unsigned cha }
static int uadk_prov_cipher_soft_final(struct cipher_priv_ctx *priv, unsigned char *out, - size_t *outl) + int *outl) { - size_t sw_final_len = 0; + int sw_final_len = 0;
if (priv->sw_cipher == NULL) return UADK_E_FAIL; @@ -684,7 +684,7 @@ static int ossl_cipher_unpadblock(unsigned char *buf, size_t *buflen, size_t blo }
static int uadk_prov_hw_cipher(struct cipher_priv_ctx *priv, unsigned char *out, - size_t *outl, size_t outsize, + int *outl, size_t outsize, const unsigned char *in, size_t inlen) { size_t blksz = priv->blksize; @@ -732,7 +732,7 @@ static int uadk_prov_hw_cipher(struct cipher_priv_ctx *priv, unsigned char *out, }
static int uadk_prov_do_cipher(struct cipher_priv_ctx *priv, unsigned char *out, - size_t *outl, size_t outsize, + int *outl, size_t outsize, const unsigned char *in, size_t inlen) { size_t blksz = priv->blksize; @@ -834,7 +834,7 @@ static OSSL_FUNC_cipher_gettable_ctx_params_fn uadk_prov_cipher_gettable_ctx_par static OSSL_FUNC_cipher_set_ctx_params_fn uadk_prov_cipher_set_ctx_params; static OSSL_FUNC_cipher_settable_ctx_params_fn uadk_prov_cipher_settable_ctx_params;
-static int uadk_prov_cipher_cipher(void *vctx, unsigned char *out, size_t *outl, +static int uadk_prov_cipher_cipher(void *vctx, unsigned char *out, int *outl, size_t outsize, const unsigned char *in, size_t inl) { @@ -864,9 +864,9 @@ static int uadk_prov_cipher_cipher(void *vctx, unsigned char *out, size_t *outl, }
static int uadk_prov_cipher_block_encrypto(struct cipher_priv_ctx *priv, - unsigned char *out, size_t *outl, size_t outsize) + unsigned char *out, int *outl, size_t outsize) { - size_t blksz = priv->blksize; + int blksz = priv->blksize; int ret;
if (priv->pad) { @@ -896,7 +896,7 @@ static int uadk_prov_cipher_block_encrypto(struct cipher_priv_ctx *priv, }
static int uadk_prov_cipher_block_decrypto(struct cipher_priv_ctx *priv, - unsigned char *out, size_t *outl, size_t outsize) + unsigned char *out, int *outl, size_t outsize) { size_t blksz = priv->blksize; int ret; @@ -935,7 +935,7 @@ static int uadk_prov_cipher_block_decrypto(struct cipher_priv_ctx *priv, }
static int uadk_prov_cipher_block_final(void *vctx, unsigned char *out, - size_t *outl, size_t outsize) + int *outl, size_t outsize) { struct cipher_priv_ctx *priv = (struct cipher_priv_ctx *)vctx; int ret; @@ -955,7 +955,7 @@ static int uadk_prov_cipher_block_final(void *vctx, unsigned char *out, }
static int uadk_prov_cipher_block_update(void *vctx, unsigned char *out, - size_t *outl, size_t outsize, + int *outl, size_t outsize, const unsigned char *in, size_t inl) { struct cipher_priv_ctx *priv = (struct cipher_priv_ctx *)vctx; @@ -977,7 +977,7 @@ static int uadk_prov_cipher_block_update(void *vctx, unsigned char *out, }
static int uadk_prov_cipher_stream_update(void *vctx, unsigned char *out, - size_t *outl, size_t outsize, + int *outl, size_t outsize, const unsigned char *in, size_t inl) { struct cipher_priv_ctx *priv = (struct cipher_priv_ctx *)vctx; @@ -1027,7 +1027,7 @@ do_soft: }
static int uadk_prov_cipher_stream_final(void *vctx, unsigned char *out, - size_t *outl, size_t outsize) + int *outl, size_t outsize) { struct cipher_priv_ctx *priv = (struct cipher_priv_ctx *)vctx;
diff --git a/src/uadk_prov_digest.c b/src/uadk_prov_digest.c index eddca1a..c442700 100644 --- a/src/uadk_prov_digest.c +++ b/src/uadk_prov_digest.c @@ -630,6 +630,9 @@ static void uadk_digest_cleanup(struct digest_priv_ctx *priv)
if (priv->data) OPENSSL_free(priv->data); + + if (priv->soft_ctx) + OPENSSL_free(priv->soft_ctx); }
/* some params related code is copied from OpenSSL v3.0 prov/digestcommon.h */ diff --git a/src/uadk_prov_init.c b/src/uadk_prov_init.c index d4adb20..010c87b 100644 --- a/src/uadk_prov_init.c +++ b/src/uadk_prov_init.c @@ -39,10 +39,6 @@ static OSSL_FUNC_core_gettable_params_fn *c_gettable_params; static OSSL_FUNC_core_get_params_fn *c_get_params; static OSSL_FUNC_core_get_libctx_fn *c_get_libctx;
-/* Functions provided by the core */ -static OSSL_FUNC_core_get_params_fn *c_get_params; -static OSSL_FUNC_core_get_libctx_fn *c_get_libctx; - struct uadk_provider_params { char *enable_sw_offload; } uadk_params;