diff --git a/build/config.gni b/build/config.gni index 36eb12d2eeea3e34c89bd00aeab5ee638e4d3153..4f217106e848ed64dd50f3a871ae0aa4d84177dd 100644 --- a/build/config.gni +++ b/build/config.gni @@ -1,15 +1,12 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - \ No newline at end of file +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/common/BUILD.gn b/common/BUILD.gn index 3d8e2c0d753cc29c52d5b18f719e2e55c1216e06..6602b7574319f6ec6d6a8f43842d995687ec8b3d 100644 --- a/common/BUILD.gn +++ b/common/BUILD.gn @@ -11,32 +11,29 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/ohos.gni") import("//base/security/crypto_framework/common/common.gni") +import("//build/ohos.gni") ohos_static_library("crypto_plugin_common") { - subsystem_name = "security" - part_name = "crypto_framework" - include_dirs = [ - "//utils/native/base/include", - "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", - ] - include_dirs += crypto_framwork_common_inc_path - - sources = crypto_framwork_common_files + subsystem_name = "security" + part_name = "crypto_framework" + include_dirs = [ + "//commonlibrary/c_utils/base/include", + "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", + ] + include_dirs += crypto_framwork_common_inc_path - defines = [ "HILOG_ENABLE" ] - cflags = [ - "-DHILOG_ENABLE", - "-fPIC", - "-Wall", - ] + sources = crypto_framwork_common_files - deps = [ - "//utils/native/base:utils", - ] + defines = [ "HILOG_ENABLE" ] + cflags = [ + "-DHILOG_ENABLE", + "-fPIC", + "-Wall", + ] - external_deps = [ + external_deps = [ + "c_utils:utils", "hiviewdfx_hilog_native:libhilog", ] } diff --git a/common/common.gni b/common/common.gni index 247823ab83f667814f69dbb4becc96586309e18a..ceb413924fb86cf30c900a9fbd4d9a59bc751c63 100644 --- a/common/common.gni +++ b/common/common.gni @@ -26,4 +26,4 @@ framework_common_util_files = [ "//base/security/crypto_framework/common/src/params_parser.c", ] -crypto_framwork_common_files = framework_common_util_files \ No newline at end of file +crypto_framwork_common_files = framework_common_util_files diff --git a/frameworks/BUILD.gn b/frameworks/BUILD.gn index bcdbaf96053d10901ec530f27ce998facab2ef7c..293f7d48aa68512ff43a7d9439c198a08638c55e 100644 --- a/frameworks/BUILD.gn +++ b/frameworks/BUILD.gn @@ -11,9 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/ohos.gni") -import("//base/security/crypto_framework/frameworks/frameworks.gni") import("//base/security/crypto_framework/common/common.gni") +import("//base/security/crypto_framework/frameworks/frameworks.gni") +import("//build/ohos.gni") config("framework_config") { include_dirs = [ @@ -27,27 +27,26 @@ config("framework_config") { } ohos_shared_library("crypto_framework_lib") { - subsystem_name = "security" - part_name = "crypto_framework" - public_configs = [ ":framework_config" ] - include_dirs = [ - "//utils/native/base/include", - ] - include_dirs += framework_inc_path + crypto_framwork_common_inc_path + subsystem_name = "security" + part_name = "crypto_framework" + public_configs = [ ":framework_config" ] + include_dirs = [ "//commonlibrary/c_utils/base/include" ] + include_dirs += framework_inc_path + crypto_framwork_common_inc_path + + sources = framework_files - sources = framework_files + cflags = [ + "-fPIC", + "-Wall", + ] - cflags = [ - "-fPIC", - "-Wall", - ] + deps = [ + "//base/security/crypto_framework:crypto_openssl_plugin_lib", + "//base/security/crypto_framework/common:crypto_plugin_common", + "//third_party/openssl:libcrypto_shared", + ] - deps = [ - "//utils/native/base:utils", - "//third_party/openssl:libcrypto_shared", - "//base/security/crypto_framework:crypto_openssl_plugin_lib", - "//base/security/crypto_framework/common:crypto_plugin_common", - ] + external_deps = [ "c_utils:utils" ] } ohos_shared_library("cryptoframework_napi") { @@ -57,7 +56,7 @@ ohos_shared_library("cryptoframework_napi") { include_dirs = [ "//base/security/crypto_framework/interfaces/kits/js", "//third_party/bounds_checking_function/include", - "//utils/native/base/include", + "//commonlibrary/c_utils/base/include", "//base/security/crypto_framework/frameworks/js/napi/inc", ] include_dirs += framework_inc_path @@ -68,26 +67,26 @@ ohos_shared_library("cryptoframework_napi") { ] sources = [ + "js/napi/src/napi_asy_key_generator.cpp", + "js/napi/src/napi_cert_chain_validator.cpp", + "js/napi/src/napi_cipher.cpp", "js/napi/src/napi_init.cpp", - "js/napi/src/napi_utils.cpp", + "js/napi/src/napi_key.cpp", + "js/napi/src/napi_key_agreement.cpp", "js/napi/src/napi_key_pair.cpp", + "js/napi/src/napi_mac.cpp", + "js/napi/src/napi_md.cpp", "js/napi/src/napi_pri_key.cpp", "js/napi/src/napi_pub_key.cpp", - "js/napi/src/napi_asy_key_generator.cpp", + "js/napi/src/napi_rand.cpp", "js/napi/src/napi_sign.cpp", + "js/napi/src/napi_sym_key.cpp", + "js/napi/src/napi_sym_key_generator.cpp", + "js/napi/src/napi_utils.cpp", "js/napi/src/napi_verify.cpp", - "js/napi/src/napi_key_agreement.cpp", "js/napi/src/napi_x509_certificate.cpp", - "js/napi/src/napi_mac.cpp", - "js/napi/src/napi_md.cpp", - "js/napi/src/napi_rand.cpp", "js/napi/src/napi_x509_crl.cpp", "js/napi/src/napi_x509_crl_entry.cpp", - "js/napi/src/napi_sym_key_generator.cpp", - "js/napi/src/napi_cipher.cpp", - "js/napi/src/napi_key.cpp", - "js/napi/src/napi_sym_key.cpp", - "js/napi/src/napi_cert_chain_validator.cpp", ] deps = [ @@ -95,7 +94,5 @@ ohos_shared_library("cryptoframework_napi") { "//third_party/bounds_checking_function:libsec_static", ] - external_deps = [ - "napi:ace_napi", - ] + external_deps = [ "napi:ace_napi" ] } diff --git a/frameworks/crypto_operation/cipher.c b/frameworks/crypto_operation/cipher.c index 50cd65ec8791247a328ce9861919f6563cb13fc3..8fa701b9e99828324e963122e8424d7604d760aa 100644 --- a/frameworks/crypto_operation/cipher.c +++ b/frameworks/crypto_operation/cipher.c @@ -131,7 +131,7 @@ static HcfResult OnSetParameter(const HcfParaConfig *config, void *cipher) return ret; } -static const char *GetCipherGeneratorClass() +static const char *GetCipherGeneratorClass(void) { return "OH_HCF_CipherGenerator"; } diff --git a/frameworks/frameworks.gni b/frameworks/frameworks.gni index 5332e6274d684a1a4b3c59a834a5b1aec200ee30..bb71e2712629f3d2ea3b8cec6db3b50a7662671a 100644 --- a/frameworks/frameworks.gni +++ b/frameworks/frameworks.gni @@ -44,35 +44,25 @@ framework_certificate_files = [ "${framework_path}/certificate/x509_crl.c", ] -framework_cipher_files = [ - "${framework_path}/crypto_operation/cipher.c", -] +framework_cipher_files = [ "${framework_path}/crypto_operation/cipher.c" ] -framework_signature_files = [ - "${framework_path}/crypto_operation/signature.c", -] +framework_signature_files = [ "${framework_path}/crypto_operation/signature.c" ] -framework_key_agreement_files = [ - "${framework_path}/crypto_operation/key_agreement.c", -] +framework_key_agreement_files = + [ "${framework_path}/crypto_operation/key_agreement.c" ] framework_key_files = [ "${framework_path}/key/asy_key_generator.c", "${framework_path}/key/sym_key_generator.c", ] -framework_mac_files = [ - "${framework_path}/crypto_operation/mac.c", -] +framework_mac_files = [ "${framework_path}/crypto_operation/mac.c" ] -framework_rand_files = [ - "${framework_path}/rand/rand.c", -] +framework_rand_files = [ "${framework_path}/rand/rand.c" ] -framework_md_files = [ - "${framework_path}/crypto_operation/md.c", -] +framework_md_files = [ "${framework_path}/crypto_operation/md.c" ] -framework_files = framework_certificate_files + framework_key_agreement_files + - framework_signature_files + framework_cipher_files + framework_key_files + framework_mac_files + - framework_rand_files + framework_md_files +framework_files = + framework_certificate_files + framework_key_agreement_files + + framework_signature_files + framework_cipher_files + framework_key_files + + framework_mac_files + framework_rand_files + framework_md_files diff --git a/frameworks/js/napi/inc/napi_cipher.h b/frameworks/js/napi/inc/napi_cipher.h index 3c9952d6b0dc9662cb283fd97bb8af1f90ef4368..14e0773f00ae9dd9daeeb6fd76e6bcf691524aea 100644 --- a/frameworks/js/napi/inc/napi_cipher.h +++ b/frameworks/js/napi/inc/napi_cipher.h @@ -25,7 +25,6 @@ namespace OHOS { namespace CryptoFramework { - class NapiCipher { public: NapiCipher(HcfCipher *cipher); @@ -45,7 +44,6 @@ public: private: HcfCipher *cipher_; }; - } // namespace CryptoFramework } // namespace OHOS -#endif +#endif \ No newline at end of file diff --git a/frameworks/js/napi/inc/napi_utils.h b/frameworks/js/napi/inc/napi_utils.h index 82b3710a6420c07b10271a36bc6404a403ab00e3..16abc513d5e169337da4b3fb23b228ea86a374f9 100644 --- a/frameworks/js/napi/inc/napi_utils.h +++ b/frameworks/js/napi/inc/napi_utils.h @@ -46,7 +46,7 @@ inline void AddUint32Property(napi_env env, napi_value object, const char *name, } HcfBlob *GetBlobFromNapiValue(napi_env env, napi_value arg); -bool GetParamsSpecFormNapiValue(napi_env env, napi_value arg, HcfCryptoMode opMode, HcfParamsSpec **paramsSpec); +bool GetParamsSpecFromNapiValue(napi_env env, napi_value arg, HcfCryptoMode opMode, HcfParamsSpec **paramsSpec); napi_value ConvertBlobToNapiValue(napi_env env, HcfBlob *blob); bool GetStringFromJSParams(napi_env env, napi_value arg, std::string &returnStr); diff --git a/frameworks/js/napi/src/napi_cipher.cpp b/frameworks/js/napi/src/napi_cipher.cpp index ad02ab9ff39e75dc922bf08fe565a436d5805ca1..b3c8724913f000fc5618064bd15e11336b7e95d1 100644 --- a/frameworks/js/napi/src/napi_cipher.cpp +++ b/frameworks/js/napi/src/napi_cipher.cpp @@ -28,7 +28,6 @@ namespace OHOS { namespace CryptoFramework { - thread_local napi_ref NapiCipher::classRef_ = nullptr; struct CipherFwkCtxT { @@ -169,9 +168,9 @@ bool BuildContextForInit(napi_env env, napi_callback_info info, CipherFwkCtx con napi_valuetype valueType; napi_typeof(env, argv[index], &valueType); if (valueType != napi_null) { - if (!GetParamsSpecFormNapiValue(env, argv[index], context->opMode, &context->paramsSpec)) { + if (!GetParamsSpecFromNapiValue(env, argv[index], context->opMode, &context->paramsSpec)) { napi_throw(env, GenerateBusinessError(env, HCF_INVALID_PARAMS, "failed to get valid params spec!")); - LOGE("GetParamsSpecFormNapiValue failed!"); + LOGE("GetParamsSpecFromNapiValue failed!"); return false; } } @@ -667,6 +666,5 @@ void NapiCipher::DefineCipherJSClass(napi_env env, napi_value exports) sizeof(classDesc) / sizeof(classDesc[0]), classDesc, &constructor); napi_create_reference(env, constructor, 1, &classRef_); } - } // CryptoFramework -} // OHOS +} // OHOS \ No newline at end of file diff --git a/frameworks/js/napi/src/napi_key.cpp b/frameworks/js/napi/src/napi_key.cpp index f4fdeec1f73fda1eb35d6369071d2353b9fe5101..aec899a39c24a03e07fb79feff4aa0e5fdc61f39 100644 --- a/frameworks/js/napi/src/napi_key.cpp +++ b/frameworks/js/napi/src/napi_key.cpp @@ -18,13 +18,11 @@ #include "securec.h" #include "log.h" #include "memory.h" - #include "napi_utils.h" #include "napi_crypto_framework_defines.h" namespace OHOS { namespace CryptoFramework { - thread_local napi_ref NapiKey::classRef_ = nullptr; NapiKey::NapiKey(HcfKey *hcfKey) @@ -120,6 +118,5 @@ void NapiKey::DefineHcfKeyJSClass(napi_env env) sizeof(classDesc) / sizeof(classDesc[0]), classDesc, &constructor); napi_create_reference(env, constructor, 1, &classRef_); } - } // CryptoFramework -} // OHOS +} // OHOS \ No newline at end of file diff --git a/frameworks/js/napi/src/napi_sym_key.cpp b/frameworks/js/napi/src/napi_sym_key.cpp index d3a137ca0b303dc7e1d86474771d934aa8596756..fa4efe36d4cf87939893dc3b10d59e7bdbab706e 100644 --- a/frameworks/js/napi/src/napi_sym_key.cpp +++ b/frameworks/js/napi/src/napi_sym_key.cpp @@ -18,7 +18,6 @@ #include "securec.h" #include "log.h" #include "memory.h" - #include "napi_utils.h" #include "napi_crypto_framework_defines.h" diff --git a/frameworks/js/napi/src/napi_sym_key_generator.cpp b/frameworks/js/napi/src/napi_sym_key_generator.cpp index 5355bd43f96a8756f08d9162620c09e50def1a02..67047bee6210a663516c669ecfb2dd6b005e4652 100644 --- a/frameworks/js/napi/src/napi_sym_key_generator.cpp +++ b/frameworks/js/napi/src/napi_sym_key_generator.cpp @@ -24,7 +24,6 @@ namespace OHOS { namespace CryptoFramework { - thread_local napi_ref NapiSymKeyGenerator::classRef_ = nullptr; struct SymKeyGeneratorFwkCtxT { @@ -456,6 +455,5 @@ void NapiSymKeyGenerator::DefineSymKeyGeneratorJSClass(napi_env env, napi_value nullptr, sizeof(classDesc) / sizeof(classDesc[0]), classDesc, &constructor); napi_create_reference(env, constructor, 1, &classRef_); } - } // CryptoFramework -} // OHOS +} // OHOS \ No newline at end of file diff --git a/frameworks/js/napi/src/napi_utils.cpp b/frameworks/js/napi/src/napi_utils.cpp index 7ba163f16a1619d34934f5ab367ab0fe190a8e83..eb26f62bfbfeaa8b15ff03d2b276df44c4a660d3 100644 --- a/frameworks/js/napi/src/napi_utils.cpp +++ b/frameworks/js/napi/src/napi_utils.cpp @@ -422,7 +422,7 @@ clearup: return ret; } -bool GetParamsSpecFormNapiValue(napi_env env, napi_value arg, HcfCryptoMode opMode, HcfParamsSpec **paramsSpec) +bool GetParamsSpecFromNapiValue(napi_env env, napi_value arg, HcfCryptoMode opMode, HcfParamsSpec **paramsSpec) { napi_value data = nullptr; if ((env == nullptr) || (arg == nullptr) || (paramsSpec == nullptr)) { diff --git a/frameworks/key/sym_key_generator.c b/frameworks/key/sym_key_generator.c index af8f3167490269f3e6554de886a866521ed63333..b28aeb93bac193bb576172bdb44d728049bce403 100644 --- a/frameworks/key/sym_key_generator.c +++ b/frameworks/key/sym_key_generator.c @@ -110,7 +110,7 @@ static HcfResult OnSetSymKeyParameter(const HcfParaConfig* config, void *attr) return ret; } -static const char *GetSymKeyGeneratorClass() +static const char *GetSymKeyGeneratorClass(void) { return "HcfSymKeyGenerator"; } diff --git a/frameworks/rand/rand.c b/frameworks/rand/rand.c index 36ca734e721b01736b753a4b0c8651f672080e38..b4a1d97bdf5f49c7c9960cf3780b1b575e8ed5ca 100644 --- a/frameworks/rand/rand.c +++ b/frameworks/rand/rand.c @@ -60,7 +60,7 @@ static HcfRandSpiCreateFunc FindAbility(const char *algoName) static HcfResult GenerateRandom(HcfRand *self, int32_t numBytes, HcfBlob *random) { - if ((self == NULL) || (numBytes <= 0) || (random == NULL)) { + if ((self == NULL) || (numBytes <= 0) || (numBytes > HCF_MAX_BUFFER_LEN) || (random == NULL)) { LOGE("Invalid params!"); return HCF_INVALID_PARAMS; } diff --git a/plugin/BUILD.gn b/plugin/BUILD.gn index d41e6651a4a04561b4290fd7163e14dc050353d4..a53f079ca8626cd4c3f153c490fa062e22ec3ad9 100644 --- a/plugin/BUILD.gn +++ b/plugin/BUILD.gn @@ -11,9 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/ohos.gni") -import("//base/security/crypto_framework/plugin/plugin.gni") import("//base/security/crypto_framework/common/common.gni") +import("//base/security/crypto_framework/plugin/plugin.gni") +import("//build/ohos.gni") config("plugin_config") { include_dirs = [ @@ -28,25 +28,26 @@ config("plugin_config") { } ohos_shared_library("crypto_openssl_plugin_lib") { - subsystem_name = "security" - part_name = "crypto_framework" - public_configs = [ ":plugin_config" ] - include_dirs = [ - "//utils/native/base/include", - "//third_party/openssl/include/", - ] - include_dirs += plugin_inc_path + crypto_framwork_common_inc_path + subsystem_name = "security" + part_name = "crypto_framework" + public_configs = [ ":plugin_config" ] + include_dirs = [ + "//commonlibrary/c_utils/base/include", + "//third_party/openssl/include/", + ] + include_dirs += plugin_inc_path + crypto_framwork_common_inc_path - sources = plugin_files + sources = plugin_files - cflags = [ - "-fPIC", - "-Wall", - ] + cflags = [ + "-fPIC", + "-Wall", + ] - deps = [ - "//utils/native/base:utils", - "//third_party/openssl:libcrypto_shared", - "//base/security/crypto_framework/common:crypto_plugin_common", - ] -} \ No newline at end of file + deps = [ + "//base/security/crypto_framework/common:crypto_plugin_common", + "//third_party/openssl:libcrypto_shared", + ] + + external_deps = [ "c_utils:utils" ] +} diff --git a/plugin/openssl_plugin/crypto_operation/aes/inc/aes_openssl.h b/plugin/openssl_plugin/crypto_operation/aes/inc/aes_openssl.h index 157e38be74c82a88fc79ea19f6b43bb7de88bf48..173a09bdc0af6232434bfa36d2a47c6d6c18602d 100644 --- a/plugin/openssl_plugin/crypto_operation/aes/inc/aes_openssl.h +++ b/plugin/openssl_plugin/crypto_operation/aes/inc/aes_openssl.h @@ -16,9 +16,9 @@ #define HCF_AES_OPENSSL_H #include +#include #include "params_parser.h" #include "cipher_factory_spi.h" -#include typedef struct { EVP_CIPHER_CTX *ctx; diff --git a/plugin/openssl_plugin/crypto_operation/aes/src/cipher_3des_openssl.c b/plugin/openssl_plugin/crypto_operation/aes/src/cipher_3des_openssl.c index bdab451eb4fcb0ac0bfed28e8c8a74b90fc23e85..c8fed98d3c79077623d163cb25280344e3c0ab3b 100644 --- a/plugin/openssl_plugin/crypto_operation/aes/src/cipher_3des_openssl.c +++ b/plugin/openssl_plugin/crypto_operation/aes/src/cipher_3des_openssl.c @@ -33,7 +33,7 @@ typedef struct { CipherData *cipherData; } HcfCipherDesGeneratorSpiOpensslImpl; -static const char *GetDesGeneratorClass() +static const char *GetDesGeneratorClass(void) { return OPENSSL_3DES_CIPHER_CLASS; } diff --git a/plugin/openssl_plugin/crypto_operation/aes/src/cipher_aes_openssl.c b/plugin/openssl_plugin/crypto_operation/aes/src/cipher_aes_openssl.c index 99fd586d2ab28e31dc47f2550b7f26bbab2192bc..a9b2b8d5d0a33211f774166086fd82617cca0091 100644 --- a/plugin/openssl_plugin/crypto_operation/aes/src/cipher_aes_openssl.c +++ b/plugin/openssl_plugin/crypto_operation/aes/src/cipher_aes_openssl.c @@ -38,7 +38,7 @@ typedef struct { CipherData *cipherData; } HcfCipherAesGeneratorSpiOpensslImpl; -static const char *GetAesGeneratorClass() +static const char *GetAesGeneratorClass(void) { return OPENSSL_AES_CIPHER_CLASS; } diff --git a/plugin/openssl_plugin/key/sym_key_generator/inc/sym_common_defines.h b/plugin/openssl_plugin/key/sym_key_generator/inc/sym_common_defines.h index 7c1b8d9effaeb94346b770348f8c7c41d4e4b864..71cd093a314b1b5c50d0367c6a4b9595169b3e3c 100644 --- a/plugin/openssl_plugin/key/sym_key_generator/inc/sym_common_defines.h +++ b/plugin/openssl_plugin/key/sym_key_generator/inc/sym_common_defines.h @@ -12,6 +12,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#ifndef HCF_SYM_COMMON_DEFINES_H +#define HCF_SYM_COMMON_DEFINES_H + #include "sym_key_factory_spi.h" #include "sym_key.h" #include "params_parser.h" @@ -36,4 +40,4 @@ HcfResult HcfSymKeyGeneratorSpiCreate(SymKeyAttr *attr, OH_HCF_SymKeyGeneratorSp #ifdef __cplusplus } #endif - +#endif \ No newline at end of file diff --git a/plugin/plugin.gni b/plugin/plugin.gni index 1db4d1ee6498c6ddad4715743ffe42b03df116da..245b7cf160234225f6483dff5e561acd612564d2 100644 --- a/plugin/plugin.gni +++ b/plugin/plugin.gni @@ -47,9 +47,7 @@ plugin_asy_key_generator_files = [ "${plugin_path}/openssl_plugin/key/asy_key_generator/src/rsa_asy_key_generator_openssl.c", ] -plugin_key_agreement_files = [ - "${plugin_path}/openssl_plugin/crypto_operation/key_agreement/src/ecdh_openssl.c", -] +plugin_key_agreement_files = [ "${plugin_path}/openssl_plugin/crypto_operation/key_agreement/src/ecdh_openssl.c" ] plugin_certificate_files = [ "${plugin_path}/openssl_plugin/certificate/src/x509_cert_chain_validator_openssl.c", @@ -69,18 +67,15 @@ plugin_cipher_files = [ "${plugin_path}/openssl_plugin/crypto_operation/aes/src/cipher_aes_common.c", ] -plugin_hmac_files = [ - "${plugin_path}/openssl_plugin/crypto_operation/hmac/src/mac_openssl.c", -] +plugin_hmac_files = + [ "${plugin_path}/openssl_plugin/crypto_operation/hmac/src/mac_openssl.c" ] -plugin_rand_files = [ - "${plugin_path}/openssl_plugin/rand/src/rand_openssl.c", -] +plugin_rand_files = [ "${plugin_path}/openssl_plugin/rand/src/rand_openssl.c" ] -plugin_md_files = [ - "${plugin_path}/openssl_plugin/crypto_operation/md/src/md_openssl.c", -] +plugin_md_files = + [ "${plugin_path}/openssl_plugin/crypto_operation/md/src/md_openssl.c" ] -plugin_files = plugin_certificate_files + plugin_asy_key_generator_files + plugin_key_agreement_files + - plugin_sym_key_files + plugin_cipher_files + plugin_hmac_files + plugin_rand_files + - plugin_md_files + plugin_signature_files + plugin_common_files +plugin_files = plugin_certificate_files + plugin_asy_key_generator_files + + plugin_key_agreement_files + plugin_sym_key_files + + plugin_cipher_files + plugin_hmac_files + plugin_rand_files + + plugin_md_files + plugin_signature_files + plugin_common_files diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index 3d502eee6c8ffd762ceeee2b4339d6bb69b1ea93..4cf3840bb6f0e4c92968fa7b5075b2016125aa24 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -23,7 +23,7 @@ ohos_unittest("crypto_framework_test") { include_dirs = [ "./include" ] include_dirs += [ - "//utils/native/base/include", + "//commonlibrary/c_utils/base/include", "//third_party/openssl/include/", ] include_dirs += framework_inc_path + plugin_inc_path @@ -57,10 +57,12 @@ ohos_unittest("crypto_framework_test") { "//base/security/crypto_framework:crypto_openssl_plugin_lib", "//third_party/bounds_checking_function:libsec_shared", "//third_party/openssl:libcrypto_shared", - "//utils/native/base:utils", ] defines = [ "HILOG_ENABLE" ] - external_deps = [ "hiviewdfx_hilog_native:libhilog" ] + external_deps = [ + "c_utils:utils", + "hiviewdfx_hilog_native:libhilog", + ] } diff --git a/test/unittest/src/crypto_3des_cipher_test.cpp b/test/unittest/src/crypto_3des_cipher_test.cpp index eda7f79e577323fab83f9347c8a057914b75850d..b0de68dae91d03d9d4a5c626cdeccadb31fcf02d 100644 --- a/test/unittest/src/crypto_3des_cipher_test.cpp +++ b/test/unittest/src/crypto_3des_cipher_test.cpp @@ -28,7 +28,8 @@ using namespace std; using namespace testing::ext; -class DesEncryptTest : public testing::Test { +namespace { +class Crypto3DesCipherTest : public testing::Test { public: static void SetUpTestCase(); static void TearDownTestCase(); @@ -36,14 +37,14 @@ public: void TearDown(); }; -void DesEncryptTest::SetUpTestCase() {} -void DesEncryptTest::TearDownTestCase() {} +void Crypto3DesCipherTest::SetUpTestCase() {} +void Crypto3DesCipherTest::TearDownTestCase() {} -void DesEncryptTest::SetUp() // add init here, this will be called before test. +void Crypto3DesCipherTest::SetUp() // add init here, this will be called before test. { } -void DesEncryptTest::TearDown() // add destroy here, this will be called when test case done. +void Crypto3DesCipherTest::TearDown() // add destroy here, this will be called when test case done. { } @@ -200,8 +201,7 @@ static int32_t DesNoUpdateDecrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSp return ret; } - -HWTEST_F(DesEncryptTest, DesEncryptTest001, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest001, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -248,7 +248,7 @@ clearup: EXPECT_NE(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest002, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest002, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -296,7 +296,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest003, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest003, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -344,7 +344,7 @@ clearup: } -HWTEST_F(DesEncryptTest, DesEncryptTest004, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest004, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -395,7 +395,7 @@ clearup: EXPECT_NE(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest005, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest005, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -445,7 +445,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest006, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest006, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -495,7 +495,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest007, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest007, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -547,7 +547,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest008, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest008, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -597,7 +597,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest009, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest009, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -649,7 +649,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest010, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest010, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -700,7 +700,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest011, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest011, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -751,7 +751,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest012, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest012, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -802,7 +802,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest013, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest013, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -849,7 +849,7 @@ clearup: EXPECT_NE(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest014, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest014, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -897,7 +897,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest015, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest015, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -945,7 +945,7 @@ clearup: } -HWTEST_F(DesEncryptTest, DesEncryptTest016, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest016, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -996,7 +996,7 @@ clearup: EXPECT_NE(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest017, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest017, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -1047,7 +1047,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest018, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest018, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -1098,7 +1098,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest019, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest019, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -1150,7 +1150,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest020, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest020, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -1201,7 +1201,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest021, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest021, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -1253,7 +1253,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest022, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest022, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -1304,7 +1304,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest023, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest023, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -1355,7 +1355,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(DesEncryptTest, DesEncryptTest024, TestSize.Level0) +HWTEST_F(Crypto3DesCipherTest, Crypto3DesCipherTest024, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -1404,4 +1404,5 @@ clearup: OH_HCF_ObjDestroy((HcfObjectBase *)cipher); OH_HCF_ObjDestroy((HcfObjectBase *)generator); EXPECT_EQ(ret, 0); +} } \ No newline at end of file diff --git a/test/unittest/src/crypto_aes_cipher_test.cpp b/test/unittest/src/crypto_aes_cipher_test.cpp index c50e70cf2d2d1031eff4f2568059b4403edea136..aff585a8ed6269778364ccd27f9673efb9eb8cc0 100644 --- a/test/unittest/src/crypto_aes_cipher_test.cpp +++ b/test/unittest/src/crypto_aes_cipher_test.cpp @@ -14,9 +14,9 @@ */ #include -#include "securec.h" #include #include +#include "securec.h" #include "sym_key_generator.h" #include "cipher.h" @@ -29,11 +29,13 @@ using namespace std; using namespace testing::ext; + +namespace { const int32_t FILE_BLOCK_SIZE = 1024; const int32_t RAND_MAX_NUM = 100; const bool IS_DEBUG = false; -class AesEncryptTest : public testing::Test { +class CryptoAesCipherTest : public testing::Test { public: static void SetUpTestCase(); static void TearDownTestCase(); @@ -41,15 +43,15 @@ public: void TearDown(); }; -void AesEncryptTest::SetUpTestCase() {} +void CryptoAesCipherTest::SetUpTestCase() {} -void AesEncryptTest::TearDownTestCase() {} +void CryptoAesCipherTest::TearDownTestCase() {} -void AesEncryptTest::SetUp() // add init here, this will be called before test. +void CryptoAesCipherTest::SetUp() // add init here, this will be called before test. { } -void AesEncryptTest::TearDown() // add destroy here, this will be called when test case done. +void CryptoAesCipherTest::TearDown() // add destroy here, this will be called when test case done. { } @@ -115,7 +117,7 @@ static int32_t GeneratorFile(const char *fileName, int32_t genFileSize) } uint8_t buffer[FILE_BLOCK_SIZE] = {0}; std::ifstream file(fileName); - + if (file.good()) { file.close(); return 0; @@ -429,8 +431,13 @@ static int32_t AesNoUpdateDecrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSp return ret; } - -HWTEST_F(AesEncryptTest, AesEncryptTest001, TestSize.Level0) +/** + * @tc.name: CryptoAesCipherTest.CryptoAesCipherTest001 + * @tc.desc: Verify whether the crypto framework is normal. + * @tc.type: FUNC + * @tc.require: I5QWEO + */ +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest001, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -476,7 +483,13 @@ clearup: EXPECT_NE(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest002, TestSize.Level0) +/** + * @tc.name: CryptoAesCipherTest.CryptoAesCipherTest002 + * @tc.desc: Verify AES128 cipher algorithm. + * @tc.type: FUNC + * @tc.require: I5QWEG + */ +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest002, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -521,7 +534,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest003, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest003, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -567,7 +580,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest004, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest004, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -618,7 +631,7 @@ clearup: EXPECT_NE(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest005, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest005, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -669,7 +682,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest006, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest006, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -720,7 +733,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest007, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest007, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -771,7 +784,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest008, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest008, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -822,7 +835,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest009, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest009, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -873,7 +886,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest010, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest010, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -924,7 +937,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest011, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest011, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -975,7 +988,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest012, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest012, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -1025,7 +1038,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest013, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest013, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -1076,7 +1089,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest014, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest014, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -1127,7 +1140,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest015, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest015, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -1179,7 +1192,7 @@ clearup: } -HWTEST_F(AesEncryptTest, AesEncryptTest016, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest016, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -1230,7 +1243,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest017, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest017, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -1281,7 +1294,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest018, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest018, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -1306,7 +1319,7 @@ HWTEST_F(AesEncryptTest, AesEncryptTest018, TestSize.Level0) LOGE("generateSymKey failed!"); } - ret = HcfCipherCreate("AES128|CFB1|PKCS7", &cipher);// CFB1/CFB8/CFB128 bit + ret = HcfCipherCreate("AES128|CFB1|PKCS7", &cipher); // CFB1/CFB8/CFB128 bit if (ret != 0) { LOGE("HcfCipherCreate failed!"); goto clearup; @@ -1331,7 +1344,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest019, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest019, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -1356,7 +1369,7 @@ HWTEST_F(AesEncryptTest, AesEncryptTest019, TestSize.Level0) LOGE("generateSymKey failed!"); } - ret = HcfCipherCreate("AES128|CFB8|NoPadding", &cipher);// CFB1/CFB8/CFB128 bit + ret = HcfCipherCreate("AES128|CFB8|NoPadding", &cipher); // CFB1/CFB8/CFB128 bit if (ret != 0) { LOGE("HcfCipherCreate failed!"); goto clearup; @@ -1381,7 +1394,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest020, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest020, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -1406,7 +1419,7 @@ HWTEST_F(AesEncryptTest, AesEncryptTest020, TestSize.Level0) LOGE("generateSymKey failed!"); } - ret = HcfCipherCreate("AES128|CFB8|PKCS5", &cipher);// CFB1/CFB8/CFB128 bit + ret = HcfCipherCreate("AES128|CFB8|PKCS5", &cipher); // CFB1/CFB8/CFB128 bit if (ret != 0) { LOGE("HcfCipherCreate failed!"); goto clearup; @@ -1431,7 +1444,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest021, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest021, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -1456,7 +1469,7 @@ HWTEST_F(AesEncryptTest, AesEncryptTest021, TestSize.Level0) LOGE("generateSymKey failed!"); } - ret = HcfCipherCreate("AES128|CFB8|PKCS7", &cipher);// CFB1/CFB8/CFB128 bit + ret = HcfCipherCreate("AES128|CFB8|PKCS7", &cipher); // CFB1/CFB8/CFB128 bit if (ret != 0) { LOGE("HcfCipherCreate failed!"); goto clearup; @@ -1481,7 +1494,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest022, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest022, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -1506,7 +1519,7 @@ HWTEST_F(AesEncryptTest, AesEncryptTest022, TestSize.Level0) LOGE("generateSymKey failed!"); } - ret = HcfCipherCreate("AES128|CFB128|NoPadding", &cipher);// CFB1/CFB8/CFB128 bit + ret = HcfCipherCreate("AES128|CFB128|NoPadding", &cipher); // CFB1/CFB8/CFB128 bit if (ret != 0) { LOGE("HcfCipherCreate failed!"); goto clearup; @@ -1531,7 +1544,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest023, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest023, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -1556,7 +1569,7 @@ HWTEST_F(AesEncryptTest, AesEncryptTest023, TestSize.Level0) LOGE("generateSymKey failed!"); } - ret = HcfCipherCreate("AES128|CFB128|PKCS5", &cipher);// CFB1/CFB8/CFB128 bit + ret = HcfCipherCreate("AES128|CFB128|PKCS5", &cipher); // CFB1/CFB8/CFB128 bit if (ret != 0) { LOGE("HcfCipherCreate failed!"); goto clearup; @@ -1581,7 +1594,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest024, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest024, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -1606,7 +1619,7 @@ HWTEST_F(AesEncryptTest, AesEncryptTest024, TestSize.Level0) LOGE("generateSymKey failed!"); } - ret = HcfCipherCreate("AES128|CFB128|PKCS7", &cipher);// CFB1/CFB8/CFB128 bit + ret = HcfCipherCreate("AES128|CFB128|PKCS7", &cipher); // CFB1/CFB8/CFB128 bit if (ret != 0) { LOGE("HcfCipherCreate failed!"); goto clearup; @@ -1631,7 +1644,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest025, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest025, TestSize.Level0) { int ret = 0; uint8_t aad[8] = {0}; @@ -1685,7 +1698,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest026, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest026, TestSize.Level0) { int ret = 0; uint8_t aad[8] = {0}; @@ -1739,7 +1752,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest027, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest027, TestSize.Level0) { int ret = 0; uint8_t aad[8] = {0}; @@ -1793,7 +1806,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest028, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest028, TestSize.Level0) { int ret = 0; uint8_t aad[8] = {0}; @@ -1846,7 +1859,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest029, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest029, TestSize.Level0) { int ret = 0; uint8_t aad[8] = {0}; @@ -1900,7 +1913,7 @@ clearup: } -HWTEST_F(AesEncryptTest, AesEncryptTest030, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest030, TestSize.Level0) { int ret = 0; uint8_t aad[8] = {0}; @@ -1953,7 +1966,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest031, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest031, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -2002,7 +2015,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest032, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest032, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -2048,7 +2061,7 @@ clearup: EXPECT_NE(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest033, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest033, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -2093,7 +2106,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest034, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest034, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -2139,7 +2152,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest035, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest035, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2190,7 +2203,7 @@ clearup: EXPECT_NE(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest036, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest036, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2241,7 +2254,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest037, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest037, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2292,7 +2305,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest038, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest038, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2343,7 +2356,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest039, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest039, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2394,7 +2407,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest040, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest040, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2445,7 +2458,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest041, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest041, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2496,7 +2509,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest042, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest042, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2547,7 +2560,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest043, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest043, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2597,7 +2610,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest044, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest044, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2648,7 +2661,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest045, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest045, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2699,7 +2712,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest046, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest046, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2751,7 +2764,7 @@ clearup: } -HWTEST_F(AesEncryptTest, AesEncryptTest047, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest047, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2802,7 +2815,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest048, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest048, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2853,7 +2866,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest049, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest049, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2878,7 +2891,7 @@ HWTEST_F(AesEncryptTest, AesEncryptTest049, TestSize.Level0) LOGE("generateSymKey failed!"); } - ret = HcfCipherCreate("AES128|CFB1|PKCS7", &cipher);// CFB1/CFB8/CFB128 bit + ret = HcfCipherCreate("AES128|CFB1|PKCS7", &cipher); // CFB1/CFB8/CFB128 bit if (ret != 0) { LOGE("HcfCipherCreate failed!"); goto clearup; @@ -2903,7 +2916,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest050, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest050, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2928,7 +2941,7 @@ HWTEST_F(AesEncryptTest, AesEncryptTest050, TestSize.Level0) LOGE("generateSymKey failed!"); } - ret = HcfCipherCreate("AES128|CFB8|NoPadding", &cipher);// CFB1/CFB8/CFB128 bit + ret = HcfCipherCreate("AES128|CFB8|NoPadding", &cipher); // CFB1/CFB8/CFB128 bit if (ret != 0) { LOGE("HcfCipherCreate failed!"); goto clearup; @@ -2953,7 +2966,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest051, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest051, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -2978,7 +2991,7 @@ HWTEST_F(AesEncryptTest, AesEncryptTest051, TestSize.Level0) LOGE("generateSymKey failed!"); } - ret = HcfCipherCreate("AES128|CFB8|PKCS5", &cipher);// CFB1/CFB8/CFB128 bit + ret = HcfCipherCreate("AES128|CFB8|PKCS5", &cipher); // CFB1/CFB8/CFB128 bit if (ret != 0) { LOGE("HcfCipherCreate failed!"); goto clearup; @@ -3003,7 +3016,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest052, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest052, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -3028,7 +3041,7 @@ HWTEST_F(AesEncryptTest, AesEncryptTest052, TestSize.Level0) LOGE("generateSymKey failed!"); } - ret = HcfCipherCreate("AES128|CFB8|PKCS7", &cipher);// CFB1/CFB8/CFB128 bit + ret = HcfCipherCreate("AES128|CFB8|PKCS7", &cipher); // CFB1/CFB8/CFB128 bit if (ret != 0) { LOGE("HcfCipherCreate failed!"); goto clearup; @@ -3052,7 +3065,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest053, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest053, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -3077,7 +3090,7 @@ HWTEST_F(AesEncryptTest, AesEncryptTest053, TestSize.Level0) LOGE("generateSymKey failed!"); } - ret = HcfCipherCreate("AES128|CFB128|NoPadding", &cipher);// CFB1/CFB8/CFB128 bit + ret = HcfCipherCreate("AES128|CFB128|NoPadding", &cipher); // CFB1/CFB8/CFB128 bit if (ret != 0) { LOGE("HcfCipherCreate failed!"); goto clearup; @@ -3101,7 +3114,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest054, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest054, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -3126,7 +3139,7 @@ HWTEST_F(AesEncryptTest, AesEncryptTest054, TestSize.Level0) LOGE("generateSymKey failed!"); } - ret = HcfCipherCreate("AES128|CFB128|PKCS5", &cipher);// CFB1/CFB8/CFB128 bit + ret = HcfCipherCreate("AES128|CFB128|PKCS5", &cipher); // CFB1/CFB8/CFB128 bit if (ret != 0) { LOGE("HcfCipherCreate failed!"); goto clearup; @@ -3150,7 +3163,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest055, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest055, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -3175,7 +3188,7 @@ HWTEST_F(AesEncryptTest, AesEncryptTest055, TestSize.Level0) LOGE("generateSymKey failed!"); } - ret = HcfCipherCreate("AES128|CFB128|PKCS7", &cipher);// CFB1/CFB8/CFB128 bit + ret = HcfCipherCreate("AES128|CFB128|PKCS7", &cipher); // CFB1/CFB8/CFB128 bit if (ret != 0) { LOGE("HcfCipherCreate failed!"); goto clearup; @@ -3199,7 +3212,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest056, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest056, TestSize.Level0) { int ret = 0; uint8_t aad[8] = {0}; @@ -3253,7 +3266,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest057, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest057, TestSize.Level0) { int ret = 0; uint8_t aad[8] = {0}; @@ -3307,7 +3320,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest058, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest058, TestSize.Level0) { int ret = 0; uint8_t aad[8] = {0}; @@ -3361,7 +3374,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest059, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest059, TestSize.Level0) { int ret = 0; uint8_t aad[8] = {0}; @@ -3414,7 +3427,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest060, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest060, TestSize.Level0) { int ret = 0; uint8_t aad[8] = {0}; @@ -3468,7 +3481,7 @@ clearup: } -HWTEST_F(AesEncryptTest, AesEncryptTest061, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest061, TestSize.Level0) { int ret = 0; uint8_t aad[8] = {0}; @@ -3521,7 +3534,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest062, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest062, TestSize.Level0) { int ret = 0; uint8_t cipherText[128] = {0}; @@ -3570,7 +3583,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest063, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest063, TestSize.Level0) { int ret = 0; HcfCipher *cipher = NULL; @@ -3616,7 +3629,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest064, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest064, TestSize.Level0) { int ret = 0; HcfIvParamsSpec ivSpec = {}; @@ -3668,7 +3681,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest065, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest065, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -3719,7 +3732,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest066, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest066, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -3770,7 +3783,7 @@ clearup: EXPECT_EQ(ret, 0); } -HWTEST_F(AesEncryptTest, AesEncryptTest067, TestSize.Level0) +HWTEST_F(CryptoAesCipherTest, CryptoAesCipherTest067, TestSize.Level0) { int ret = 0; uint8_t iv[16] = {0}; @@ -3820,3 +3833,4 @@ clearup: OH_HCF_ObjDestroy((HcfObjectBase *)cipher); EXPECT_EQ(ret, 0); } +} \ No newline at end of file diff --git a/test/unittest/src/crypto_ecc_asy_key_generator_test.cpp b/test/unittest/src/crypto_ecc_asy_key_generator_test.cpp index bf27a80e4106d51eb0f549dd01deb29ec2a4e256..7feabf49834f51c60fc54d71c1888c287bf9abcc 100644 --- a/test/unittest/src/crypto_ecc_asy_key_generator_test.cpp +++ b/test/unittest/src/crypto_ecc_asy_key_generator_test.cpp @@ -129,6 +129,12 @@ static HcfObjectBase obj = { .destroy = NULL }; +/** + * @tc.name: EccAsyKeyGeneratorTest.EccAsyKeyGeneratorTest001 + * @tc.desc: Verify that the creation of the ECC224 key pair generator is normal. + * @tc.type: FUNC + * @tc.require: I5QWEI + */ HWTEST_F(EccAsyKeyGeneratorTest, EccAsyKeyGeneratorTest001, TestSize.Level0) { HcfAsyKeyGenerator *generator = NULL; diff --git a/test/unittest/src/crypto_md_test.cpp b/test/unittest/src/crypto_md_test.cpp index 72ddd618441552404686228cfdc937fd83d40236..b15cf9101e9120a7a02404bd30c096fea85b7f92 100644 --- a/test/unittest/src/crypto_md_test.cpp +++ b/test/unittest/src/crypto_md_test.cpp @@ -66,6 +66,12 @@ static void PrintfBlobInHex(uint8_t *data, size_t dataLen) printf("\n"); } +/** + * @tc.name: CryptoFrameworkMdTest.CryptoFrameworkMdCreateTest001 + * @tc.desc: Verify that the creation of the SHA1 Md obj is normal. + * @tc.type: FUNC + * @tc.require: I5QWEM + */ HWTEST_F(CryptoFrameworkMdTest, CryptoFrameworkMdCreateTest001, TestSize.Level0) { int32_t ret = 0; diff --git a/test/unittest/src/crypto_rand_test.cpp b/test/unittest/src/crypto_rand_test.cpp index 53cc0d28cb75774838bfc61401e49a8b795a8cda..d4541df8d0b35bdcd386dc9715c1ee8b483e7667 100644 --- a/test/unittest/src/crypto_rand_test.cpp +++ b/test/unittest/src/crypto_rand_test.cpp @@ -43,6 +43,12 @@ void CryptoFrameworkRandTest::TearDown() // add destroy here, this will be calle { } +/** + * @tc.name: CryptoFrameworkRandTest.CryptoFrameworkRandCreateTest001 + * @tc.desc: Verify that the creation of the random obj is normal. + * @tc.type: FUNC + * @tc.require: I5QWEN + */ HWTEST_F(CryptoFrameworkRandTest, CryptoFrameworkRandCreateTest001, TestSize.Level0) { int32_t ret = 0; @@ -96,8 +102,8 @@ HWTEST_F(CryptoFrameworkRandTest, CryptoFrameworkRandGenerateTest003, TestSize.L ret = (int)HcfRandCreate(&randObj); EXPECT_EQ(ret, 0); // preset params - int32_t randomLen = 1000; - uint8_t randomBuf[1000] = {0}; + int32_t randomLen = 8192; + uint8_t randomBuf[8192] = {0}; // define randomBlob and seedBlob struct HcfBlob randomBlob = {.data = (uint8_t *)randomBuf, .len = 0}; // test generate random @@ -108,6 +114,25 @@ HWTEST_F(CryptoFrameworkRandTest, CryptoFrameworkRandGenerateTest003, TestSize.L OH_HCF_ObjDestroy(randObj); } +HWTEST_F(CryptoFrameworkRandTest, CryptoFrameworkRandGenerateTest004, TestSize.Level0) +{ + int32_t ret = 0; + // create a rand obj + HcfRand *randObj = nullptr; + ret = (int)HcfRandCreate(&randObj); + EXPECT_EQ(ret, 0); + // preset params + int32_t randomLen = 8193; + uint8_t randomBuf[8193] = {0}; + // define randomBlob and seedBlob + struct HcfBlob randomBlob = {.data = (uint8_t *)randomBuf, .len = 0}; + // test generate random + ret = randObj->generateRandom(randObj, randomLen, &randomBlob); + EXPECT_NE(ret, 0); + // destroy the API obj and blob data + OH_HCF_ObjDestroy(randObj); +} + HWTEST_F(CryptoFrameworkRandTest, CryptoFrameworkSetSeedTest001, TestSize.Level0) { int32_t ret = 0; diff --git a/test/unittest/src/crypto_x509_certificate_test.cpp b/test/unittest/src/crypto_x509_certificate_test.cpp index 3a3d17873da2978a521ac94df09797980f660565..625cb9fc22871ed69b0ecc14805864075a17c5f0 100644 --- a/test/unittest/src/crypto_x509_certificate_test.cpp +++ b/test/unittest/src/crypto_x509_certificate_test.cpp @@ -260,7 +260,12 @@ void X509CertTest::TearDown() { } -/* Valid PEM format. */ +/** + * @tc.name: X509CertTest.GenerateCert001 + * @tc.desc: Generate valid PEM format certificate. + * @tc.type: FUNC + * @tc.require: I5QDNN + */ HWTEST_F(X509CertTest, GenerateCert001, TestSize.Level0) { HcfX509Certificate *x509Cert = nullptr;