From 34bf8b2b53b44d3223bb8f1cb404f0a2559e1194 Mon Sep 17 00:00:00 2001 From: wutiantian <1159609162@qq.com> Date: Tue, 20 Sep 2022 20:07:29 +0800 Subject: [PATCH] modify cppcheck Signed-off-by: wutiantian <1159609162@qq.com> --- .../crypto_operation/rsa/src/cipher_rsa_openssl.c | 1 - .../crypto_operation/signature/src/signature_rsa_openssl.c | 4 ++-- .../key/asy_key_generator/src/rsa_asy_key_generator_openssl.c | 4 ---- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/plugin/openssl_plugin/crypto_operation/rsa/src/cipher_rsa_openssl.c b/plugin/openssl_plugin/crypto_operation/rsa/src/cipher_rsa_openssl.c index f962461..b6b48d0 100644 --- a/plugin/openssl_plugin/crypto_operation/rsa/src/cipher_rsa_openssl.c +++ b/plugin/openssl_plugin/crypto_operation/rsa/src/cipher_rsa_openssl.c @@ -281,7 +281,6 @@ static void EngineDestroySpiImpl(HcfObjectBase *generator) EVP_PKEY_CTX_free(impl->ctx); impl->ctx = NULL; HcfFree(impl); - generator = NULL; } static const char *EngineGetClass(void) diff --git a/plugin/openssl_plugin/crypto_operation/signature/src/signature_rsa_openssl.c b/plugin/openssl_plugin/crypto_operation/signature/src/signature_rsa_openssl.c index b5dd5a7..9c282b3 100644 --- a/plugin/openssl_plugin/crypto_operation/signature/src/signature_rsa_openssl.c +++ b/plugin/openssl_plugin/crypto_operation/signature/src/signature_rsa_openssl.c @@ -322,7 +322,7 @@ static HcfResult EngineVerifyUpdate(HcfVerifySpi *self, HcfBlob *data) static HcfResult EngineSign(HcfSignSpi *self, HcfBlob *data, HcfBlob *returnSignatureData) { LOGI("EngineSign start"); - if (self == NULL || data == NULL || data->data == NULL || returnSignatureData == NULL) { + if (self == NULL || returnSignatureData == NULL) { LOGE("Invalid input params."); return HCF_INVALID_PARAMS; } @@ -373,7 +373,7 @@ static HcfResult EngineSign(HcfSignSpi *self, HcfBlob *data, HcfBlob *returnSign static bool EngineVerify(HcfVerifySpi *self, HcfBlob *data, HcfBlob *signatureData) { LOGI("EngineVerify start"); - if (self == NULL || data == NULL || data->data == NULL || signatureData == NULL || signatureData->data == NULL) { + if (self == NULL || signatureData == NULL || signatureData->data == NULL) { LOGE("Invalid input params"); return false; } diff --git a/plugin/openssl_plugin/key/asy_key_generator/src/rsa_asy_key_generator_openssl.c b/plugin/openssl_plugin/key/asy_key_generator/src/rsa_asy_key_generator_openssl.c index ee5fc52..a7b78be 100644 --- a/plugin/openssl_plugin/key/asy_key_generator/src/rsa_asy_key_generator_openssl.c +++ b/plugin/openssl_plugin/key/asy_key_generator/src/rsa_asy_key_generator_openssl.c @@ -160,7 +160,6 @@ static void DestroyPubKey(HcfObjectBase *self) RSA_free(impl->pk); impl->pk = NULL; HcfFree(self); - self = NULL; } static void DestroyPriKey(HcfObjectBase *self) @@ -179,7 +178,6 @@ static void DestroyPriKey(HcfObjectBase *self) impl->sk = NULL; } HcfFree(impl); - self = NULL; } static void DestroyKeyPair(HcfObjectBase *self) @@ -198,7 +196,6 @@ static void DestroyKeyPair(HcfObjectBase *self) OH_HCF_ObjDestroy((HcfObjectBase *)impl->base.pubKey); impl->base.pubKey = NULL; HcfFree(self); - self = NULL; } static HcfResult RsaSaveKeyMaterial(const RSA *rsa, const uint32_t keySize, HcfBlob *key, bool needPrivate) @@ -496,7 +493,6 @@ static void DestroyKeyGeneratorSpiImpl(HcfObjectBase *self) HcfFree(impl->params); impl->params = NULL; HcfFree(self); - self = NULL; LOGI("DestroyKeyGeneratorSpiImpl end."); } -- Gitee