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 fc9cc0df858c46cb68c121e7bf74140a97e7a508..ac74eb2fd317a3e1f0961a717979802bba3cf861 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 @@ -388,16 +388,13 @@ static HcfResult IsKeySizeMatchCipher(SymKeyImpl *keyImpl, HcfCipherAesGenerator static HcfResult EngineCipherInit(HcfCipherGeneratorSpi *self, enum HcfCryptoMode opMode, HcfKey *key, HcfParamsSpec *params) { - if ((self == NULL) || (key == NULL)) { /* params maybe is null */ + // params spec may be null, do not check + if ((self == NULL) || (key == NULL)) { LOGE("Invalid input parameter!"); return HCF_INVALID_PARAMS; } - if (!IsClassMatch((const HcfObjectBase *)self, GetAesGeneratorClass())) { - LOGE("Class is not match."); - return HCF_INVALID_PARAMS; - } - if (!IsClassMatch((const HcfObjectBase *)key, OPENSSL_SYM_KEY_CLASS)) { - LOGE("Class is not match."); + if ((!IsClassMatch((const HcfObjectBase *)self, GetAesGeneratorClass())) || + (!IsClassMatch((const HcfObjectBase *)key, OPENSSL_SYM_KEY_CLASS))) { return HCF_INVALID_PARAMS; } HcfCipherAesGeneratorSpiOpensslImpl *cipherImpl = (HcfCipherAesGeneratorSpiOpensslImpl *)self;