diff --git a/frameworks/adapter/v1.0/inc/x509_cert_chain_openssl_ex.h b/frameworks/adapter/v1.0/inc/x509_cert_chain_openssl_ex.h index 300c395..2fc0279 100644 --- a/frameworks/adapter/v1.0/inc/x509_cert_chain_openssl_ex.h +++ b/frameworks/adapter/v1.0/inc/x509_cert_chain_openssl_ex.h @@ -34,8 +34,8 @@ extern "C" { #endif const char *GetX509CertChainClass(void); -CfResult ToString(HcfX509CertChainSpi *self, CfBlob *out); -CfResult HashCode(HcfX509CertChainSpi *self, CfBlob *out); +CfResult CfToString(HcfX509CertChainSpi *self, CfBlob *out); +CfResult CfHashCode(HcfX509CertChainSpi *self, CfBlob *out); #ifdef __cplusplus } diff --git a/frameworks/adapter/v1.0/src/x509_cert_chain_openssl.c b/frameworks/adapter/v1.0/src/x509_cert_chain_openssl.c index 013f413..915b1aa 100644 --- a/frameworks/adapter/v1.0/src/x509_cert_chain_openssl.c +++ b/frameworks/adapter/v1.0/src/x509_cert_chain_openssl.c @@ -96,7 +96,7 @@ static CfResult ConvertOpensslErrorMsg(int32_t errCode) static void DestroyX509CertChain(CfObjectBase *self) { - if (self == NULL || !IsClassMatch(self, GetX509CertChainClass())) { + if (self == NULL || !CfIsClassMatch(self, GetX509CertChainClass())) { LOGE("Invalid params!"); return; } @@ -143,7 +143,7 @@ static CfResult GetCertlist(HcfX509CertChainSpi *self, HcfX509CertificateArray * LOGE("[GetCertlist openssl] The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertChainClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertChainClass())) { LOGE("[GetCertlist openssl] Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -188,12 +188,12 @@ static CfResult GetCertlist(HcfX509CertChainSpi *self, HcfX509CertificateArray * static X509 *GetX509FromHcfX509Certificate(const HcfCertificate *cert) { - if (!IsClassMatch((CfObjectBase *)cert, HCF_X509_CERTIFICATE_CLASS)) { + if (!CfIsClassMatch((CfObjectBase *)cert, HCF_X509_CERTIFICATE_CLASS)) { LOGE("Input wrong openssl class type!"); return NULL; } HcfX509CertificateImpl *impl = (HcfX509CertificateImpl *)cert; - if (!IsClassMatch((CfObjectBase *)(impl->spiObj), X509_CERT_OPENSSL_CLASS)) { + if (!CfIsClassMatch((CfObjectBase *)(impl->spiObj), X509_CERT_OPENSSL_CLASS)) { LOGE("Input wrong openssl class type!"); return NULL; } @@ -770,7 +770,7 @@ static const char *GetDpUrl(DIST_POINT *dp) } if (gtype == GEN_URI && ASN1_STRING_length(url) > GEN_URI) { const char *uptr = (const char *)ASN1_STRING_get0_data(url); - if (IsHttp(uptr)) { + if (CfIsHttp(uptr)) { // can/should not use HTTPS here return uptr; } @@ -806,7 +806,7 @@ static X509_CRL *GetCrlFromCert(const HcfX509CertChainValidateParams *params, X5 if (params->revocationCheckParam->crlDownloadURI != NULL && params->revocationCheckParam->crlDownloadURI->data != NULL) { char *url = (char *)params->revocationCheckParam->crlDownloadURI->data; - if (IsUrlValid(url)) { + if (CfIsUrlValid(url)) { return X509_CRL_load_http(url, NULL, NULL, HTTP_TIMEOUT); } } @@ -1043,7 +1043,7 @@ static CfResult GetOcspUrl(GetOcspUrlParams *params) } } char *urlValiable = (url == NULL) ? (char *)(params->revo->ocspResponderURI->data) : url; - if (!IsUrlValid(urlValiable)) { + if (!CfIsUrlValid(urlValiable)) { LOGE("Invalid url."); return CF_INVALID_PARAMS; } @@ -1536,7 +1536,7 @@ static CfResult Validate( LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertChainClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertChainClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -1785,8 +1785,8 @@ CfResult HcfX509CertChainByEncSpiCreate(const CfEncodingBlob *inStream, HcfX509C certChain->base.base.destroy = DestroyX509CertChain; certChain->base.engineGetCertList = GetCertlist; certChain->base.engineValidate = Validate; - certChain->base.engineToString = ToString; - certChain->base.engineHashCode = HashCode; + certChain->base.engineToString = CfToString; + certChain->base.engineHashCode = CfHashCode; *spi = (HcfX509CertChainSpi *)certChain; return CF_SUCCESS; } @@ -1861,8 +1861,8 @@ CfResult HcfX509CertChainByArrSpiCreate(const HcfX509CertificateArray *inCerts, certChain->base.base.destroy = DestroyX509CertChain; certChain->base.engineGetCertList = GetCertlist; certChain->base.engineValidate = Validate; - certChain->base.engineToString = ToString; - certChain->base.engineHashCode = HashCode; + certChain->base.engineToString = CfToString; + certChain->base.engineHashCode = CfHashCode; *spi = (HcfX509CertChainSpi *)certChain; return CF_SUCCESS; diff --git a/frameworks/adapter/v1.0/src/x509_cert_chain_openssl_ex.c b/frameworks/adapter/v1.0/src/x509_cert_chain_openssl_ex.c index 709826d..5b19b7b 100644 --- a/frameworks/adapter/v1.0/src/x509_cert_chain_openssl_ex.c +++ b/frameworks/adapter/v1.0/src/x509_cert_chain_openssl_ex.c @@ -31,13 +31,13 @@ const char *GetX509CertChainClass(void) return X509_CERT_CHAIN_OPENSSL_CLASS; } -CfResult ToString(HcfX509CertChainSpi *self, CfBlob *out) +CfResult CfToString(HcfX509CertChainSpi *self, CfBlob *out) { if ((self == NULL) || (out == NULL)) { LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertChainClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertChainClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -72,13 +72,13 @@ CfResult ToString(HcfX509CertChainSpi *self, CfBlob *out) return CF_ERR_CRYPTO_OPERATION; } -CfResult HashCode(HcfX509CertChainSpi *self, CfBlob *out) +CfResult CfHashCode(HcfX509CertChainSpi *self, CfBlob *out) { if ((self == NULL) || (out == NULL)) { LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertChainClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertChainClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } diff --git a/frameworks/adapter/v1.0/src/x509_cert_chain_validator_openssl.c b/frameworks/adapter/v1.0/src/x509_cert_chain_validator_openssl.c index 4440691..9cb0e59 100644 --- a/frameworks/adapter/v1.0/src/x509_cert_chain_validator_openssl.c +++ b/frameworks/adapter/v1.0/src/x509_cert_chain_validator_openssl.c @@ -77,7 +77,7 @@ static void DestroyX509CertChainValidator(CfObjectBase *self) LOGE("Invalid params!"); return; } - if (!IsClassMatch(self, GetX509CertChainValidatorClass())) { + if (!CfIsClassMatch(self, GetX509CertChainValidatorClass())) { LOGE("Class is not match."); return; } @@ -206,7 +206,7 @@ static CfResult Validate(HcfCertChainValidatorSpi *self, const CfArray *certsLis LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertChainValidatorClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertChainValidatorClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } diff --git a/frameworks/adapter/v1.0/src/x509_certificate_openssl.c b/frameworks/adapter/v1.0/src/x509_certificate_openssl.c index c865e33..49c86db 100644 --- a/frameworks/adapter/v1.0/src/x509_certificate_openssl.c +++ b/frameworks/adapter/v1.0/src/x509_certificate_openssl.c @@ -63,7 +63,7 @@ static void DestroyX509Openssl(CfObjectBase *self) if (self == NULL) { return; } - if (!IsClassMatch(self, GetX509CertClass())) { + if (!CfIsClassMatch(self, GetX509CertClass())) { LOGE("Input wrong class type!"); return; } @@ -83,7 +83,7 @@ static void DestroyX509PubKeyOpenssl(HcfObjectBase *self) if (self == NULL) { return; } - if (!IsPubKeyClassMatch(self, GetX509CertPubKeyClass())) { + if (!CfIsPubKeyClassMatch(self, GetX509CertPubKeyClass())) { LOGE("Input wrong class type!"); return; } @@ -108,7 +108,7 @@ static HcfResult GetPubKeyEncoded(HcfKey *self, HcfBlob *returnBlob) LOGE("Input params is invalid."); return HCF_INVALID_PARAMS; } - if (!IsPubKeyClassMatch((HcfObjectBase *)self, GetX509CertPubKeyClass())) { + if (!CfIsPubKeyClassMatch((HcfObjectBase *)self, GetX509CertPubKeyClass())) { LOGE("Input wrong class type!"); return HCF_INVALID_PARAMS; } @@ -148,8 +148,8 @@ static CfResult VerifyX509Openssl(HcfX509CertificateSpi *self, HcfPubKey *key) LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass()) || - (!IsPubKeyClassMatch((HcfObjectBase *)key, GetX509CertPubKeyClass()))) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass()) || + (!CfIsPubKeyClassMatch((HcfObjectBase *)key, GetX509CertPubKeyClass()))) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -171,7 +171,7 @@ static CfResult GetEncodedX509Openssl(HcfX509CertificateSpi *self, CfEncodingBlo LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -204,7 +204,7 @@ static CfResult GetPublicKeyX509Openssl(HcfX509CertificateSpi *self, HcfPubKey * LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -375,7 +375,7 @@ static CfResult CheckValidityWithDateX509Openssl(HcfX509CertificateSpi *self, co LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -571,7 +571,7 @@ static long GetVersionX509Openssl(HcfX509CertificateSpi *self) LOGE("The input data is null!"); return INVALID_VERSION; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return INVALID_VERSION; } @@ -586,7 +586,7 @@ static CfResult GetSerialNumberX509Openssl(HcfX509CertificateSpi *self, CfBlob * LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -619,7 +619,7 @@ static CfResult GetIssuerDNX509Openssl(HcfX509CertificateSpi *self, CfBlob *out) LOGE("[Get issuerDN openssl] The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -659,7 +659,7 @@ static CfResult GetSubjectDNX509Openssl(HcfX509CertificateSpi *self, CfBlob *out LOGE("[Get subjectDN openssl]The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -726,7 +726,7 @@ static CfResult GetSubjectDNX509OpensslEx(HcfX509CertificateSpi *self, CfEncodin LOGE("[Get utf8 subjectDN openssl]The input data is null or encodingType is not utf8!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -769,7 +769,7 @@ static CfResult GetNotBeforeX509Openssl(HcfX509CertificateSpi *self, CfBlob *out LOGE("Get not before, input is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Get not before, input wrong class type!"); return CF_INVALID_PARAMS; } @@ -801,7 +801,7 @@ static CfResult GetNotAfterX509Openssl(HcfX509CertificateSpi *self, CfBlob *outD LOGE("Get not after, input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Get not after, input wrong class type!"); return CF_INVALID_PARAMS; } @@ -833,7 +833,7 @@ static CfResult GetSignatureX509Openssl(HcfX509CertificateSpi *self, CfBlob *sig LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -862,7 +862,7 @@ static CfResult GetSigAlgNameX509Openssl(HcfX509CertificateSpi *self, CfBlob *ou LOGE("[GetSigAlgName openssl] The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("[GetSigAlgName openssl] Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -893,7 +893,7 @@ static CfResult GetSigAlgOidX509Openssl(HcfX509CertificateSpi *self, CfBlob *out LOGE("[GetSigAlgOID openssl] The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("[GetSigAlgOID openssl] Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -920,7 +920,7 @@ static CfResult GetSigAlgParamsX509Openssl(HcfX509CertificateSpi *self, CfBlob * LOGE("[GetSigAlgParams openssl] The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("[GetSigAlgParams openssl] Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -985,7 +985,7 @@ static CfResult GetKeyUsageX509Openssl(HcfX509CertificateSpi *self, CfBlob *bool LOGE("[GetKeyUsage openssl] The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -1030,7 +1030,7 @@ static CfResult GetExtendedKeyUsageX509Openssl(HcfX509CertificateSpi *self, CfAr LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -1079,7 +1079,7 @@ static int32_t GetBasicConstraintsX509Openssl(HcfX509CertificateSpi *self) LOGE("The input data is null!"); return INVALID_CONSTRAINTS_LEN; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return INVALID_CONSTRAINTS_LEN; } @@ -1139,7 +1139,7 @@ static CfResult GetSubjectAltNamesX509Openssl(HcfX509CertificateSpi *self, CfArr LOGE("[GetSubjectAltNames openssl] The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -1189,7 +1189,7 @@ static CfResult GetIssuerAltNamesX509Openssl(HcfX509CertificateSpi *self, CfArra LOGE("[GetIssuerAltNames openssl] The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -1239,7 +1239,7 @@ static CfResult ToStringX509Openssl(HcfX509CertificateSpi *self, CfBlob *out) LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -1274,7 +1274,7 @@ static CfResult HashCodeX509Openssl(HcfX509CertificateSpi *self, CfBlob *out) LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -1305,7 +1305,7 @@ static CfResult GetExtensionsObjectX509Openssl(HcfX509CertificateSpi *self, CfBl LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -1853,7 +1853,7 @@ static CfResult MatchX509Openssl(HcfX509CertificateSpi *self, const HcfX509CertM LOGE("[GetIssuerAltNames openssl] The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -2027,7 +2027,7 @@ static CfResult GetCRLDistributionPointsURIX509Openssl(HcfX509CertificateSpi *se LOGE("[GetCRLDistributionPointsURI openssl] The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertClass())) { LOGE("[GetCRLDistributionPointsURI openssl] Input wrong class type!"); return CF_INVALID_PARAMS; } diff --git a/frameworks/adapter/v1.0/src/x509_crl_entry_openssl.c b/frameworks/adapter/v1.0/src/x509_crl_entry_openssl.c index 6b85081..d724f48 100644 --- a/frameworks/adapter/v1.0/src/x509_crl_entry_openssl.c +++ b/frameworks/adapter/v1.0/src/x509_crl_entry_openssl.c @@ -45,7 +45,7 @@ static const char *GetClass(void) static X509_REVOKED *GetSelfRev(const HcfX509CrlEntry *self) { - if (!IsClassMatch((CfObjectBase *)self, GetClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetClass())) { LOGE("Input wrong class type!"); return NULL; } @@ -127,12 +127,12 @@ static CfResult GetCertIssuer(HcfX509CrlEntry *self, CfBlob *encodedOut) LOGE("Invalid Paramas for calling GetCertIssuer!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } CfBlob *certIssuer = ((HcfX509CRLEntryOpensslImpl *)self)->certIssuer; - if (!IsBlobValid(certIssuer)) { + if (!CfIsBlobValid(certIssuer)) { LOGE("Get certIssuer fail! No certIssuer in CRL entry."); return CF_NOT_SUPPORT; } @@ -339,7 +339,7 @@ static void Destroy(CfObjectBase *self) LOGE("Invalid Paramas!"); return; } - if (!IsClassMatch((CfObjectBase *)self, GetClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetClass())) { LOGE("Input wrong class type!"); return; } diff --git a/frameworks/adapter/v1.0/src/x509_crl_openssl.c b/frameworks/adapter/v1.0/src/x509_crl_openssl.c index b6c9602..24aa4ff 100644 --- a/frameworks/adapter/v1.0/src/x509_crl_openssl.c +++ b/frameworks/adapter/v1.0/src/x509_crl_openssl.c @@ -62,7 +62,7 @@ static const char *GetType(HcfX509CrlSpi *self) LOGE("Invalid Paramas!"); return NULL; } - if (!IsClassMatch((CfObjectBase *)self, GetClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetClass())) { LOGE("Input wrong class type!"); return NULL; } @@ -71,7 +71,7 @@ static const char *GetType(HcfX509CrlSpi *self) static X509_CRL *GetCrl(HcfX509CrlSpi *self) { - if (!IsClassMatch((CfObjectBase *)self, GetClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetClass())) { LOGE("Input wrong class type!"); return NULL; } @@ -80,12 +80,12 @@ static X509_CRL *GetCrl(HcfX509CrlSpi *self) static X509 *GetX509FromCertificate(const HcfCertificate *cert) { - if (!IsClassMatch((CfObjectBase *)cert, HCF_X509_CERTIFICATE_CLASS)) { + if (!CfIsClassMatch((CfObjectBase *)cert, HCF_X509_CERTIFICATE_CLASS)) { LOGE("Input wrong openssl class type!"); return NULL; } HcfX509CertificateImpl *impl = (HcfX509CertificateImpl *)cert; - if (!IsClassMatch((CfObjectBase *)(impl->spiObj), X509_CERT_OPENSSL_CLASS)) { + if (!CfIsClassMatch((CfObjectBase *)(impl->spiObj), X509_CERT_OPENSSL_CLASS)) { LOGE("Input wrong openssl class type!"); return NULL; } @@ -99,7 +99,7 @@ static bool IsRevoked(HcfX509CrlSpi *self, const HcfCertificate *cert) LOGE("Invalid Paramas!"); return false; } - if (!IsClassMatch((CfObjectBase *)self, GetClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetClass())) { LOGE("Input wrong class type!"); return false; } @@ -124,7 +124,7 @@ static CfResult GetEncoded(HcfX509CrlSpi *self, CfEncodingBlob *encodedOut) LOGE("Invalid Paramas!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -159,8 +159,8 @@ static CfResult Verify(HcfX509CrlSpi *self, HcfPubKey *key) LOGE("Invalid Paramas!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetClass()) || - (!IsPubKeyClassMatch((HcfObjectBase *)key, OPENSSL_RSA_PUBKEY_CLASS))) { + if (!CfIsClassMatch((CfObjectBase *)self, GetClass()) || + (!CfIsPubKeyClassMatch((HcfObjectBase *)key, OPENSSL_RSA_PUBKEY_CLASS))) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -211,7 +211,7 @@ static long GetVersion(HcfX509CrlSpi *self) LOGE("Invalid Paramas!"); return OPENSSL_INVALID_VERSION; } - if (!IsClassMatch((CfObjectBase *)self, GetClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetClass())) { LOGE("Input wrong class type!"); return OPENSSL_INVALID_VERSION; } @@ -390,7 +390,7 @@ static CfResult GetRevokedCertWithCert(HcfX509CrlSpi *self, HcfX509Certificate * LOGE("Invalid Paramas!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -629,7 +629,7 @@ static CfResult GetSignatureAlgName(HcfX509CrlSpi *self, CfBlob *algNameOut) LOGE("Invalid Paramas!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -743,7 +743,7 @@ static CfResult ToString(HcfX509CrlSpi *self, CfBlob *out) LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -781,7 +781,7 @@ static CfResult HashCode(HcfX509CrlSpi *self, CfBlob *out) LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -815,7 +815,7 @@ static CfResult GetExtensionsObject(HcfX509CrlSpi *self, CfBlob *out) LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -1027,7 +1027,7 @@ static CfResult MatchX509CRLOpenssl(HcfX509CrlSpi *self, const HcfX509CrlMatchPa LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -1061,7 +1061,7 @@ static void Destroy(CfObjectBase *self) if (self == NULL) { return; } - if (!IsClassMatch(self, GetClass())) { + if (!CfIsClassMatch(self, GetClass())) { LOGE("Input wrong class type!"); return; } diff --git a/frameworks/adapter/v1.0/src/x509_distinguished_name_openssl.c b/frameworks/adapter/v1.0/src/x509_distinguished_name_openssl.c index 1d02e68..18f0f52 100644 --- a/frameworks/adapter/v1.0/src/x509_distinguished_name_openssl.c +++ b/frameworks/adapter/v1.0/src/x509_distinguished_name_openssl.c @@ -48,7 +48,7 @@ static void DestroyX509DistinguishedNameOpenssl(CfObjectBase *self) if (self == NULL) { return; } - if (!IsClassMatch(self, GetX509DistinguishedNameClass())) { + if (!CfIsClassMatch(self, GetX509DistinguishedNameClass())) { LOGE("Input wrong class type!"); return; } @@ -64,7 +64,7 @@ static CfResult GetEncodeOpenssl(HcfX509DistinguishedNameSpi *self, CfEncodingBl LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509DistinguishedNameClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509DistinguishedNameClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } @@ -179,7 +179,7 @@ static CfResult GetNameOpenssl(HcfX509DistinguishedNameSpi *self, CfBlob *type, LOGE("The input data is null!"); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509DistinguishedNameClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509DistinguishedNameClass())) { LOGE("Input wrong class type!"); return CF_INVALID_PARAMS; } diff --git a/frameworks/common/v1.0/inc/utils.h b/frameworks/common/v1.0/inc/utils.h index d06053a..412264e 100644 --- a/frameworks/common/v1.0/inc/utils.h +++ b/frameworks/common/v1.0/inc/utils.h @@ -27,12 +27,12 @@ extern "C" { #endif -bool IsStrValid(const char *str, uint32_t maxLen); -bool IsBlobValid(const CfBlob *blob); -bool IsClassMatch(const CfObjectBase *obj, const char *className); -bool IsPubKeyClassMatch(const HcfObjectBase *obj, const char *className); -bool IsUrlValid(const char *url); -bool IsHttp(const char *url); +bool CfIsStrValid(const char *str, uint32_t maxLen); +bool CfIsBlobValid(const CfBlob *blob); +bool CfIsClassMatch(const CfObjectBase *obj, const char *className); +bool CfIsPubKeyClassMatch(const HcfObjectBase *obj, const char *className); +bool CfIsUrlValid(const char *url); +bool CfIsHttp(const char *url); #ifdef __cplusplus } diff --git a/frameworks/common/v1.0/src/utils.c b/frameworks/common/v1.0/src/utils.c index a3a37f5..29984c8 100644 --- a/frameworks/common/v1.0/src/utils.c +++ b/frameworks/common/v1.0/src/utils.c @@ -24,7 +24,7 @@ #define HTTP_URL_LEN 7 #define HTTPS_URL_LEN 8 -bool IsStrValid(const char *str, uint32_t maxLen) +bool CfIsStrValid(const char *str, uint32_t maxLen) { if (str == NULL) { LOGE("input string is NULL ptr"); @@ -38,12 +38,12 @@ bool IsStrValid(const char *str, uint32_t maxLen) return true; } -bool IsBlobValid(const CfBlob *blob) +bool CfIsBlobValid(const CfBlob *blob) { return ((blob != NULL) && (blob->data != NULL) && (blob->size > 0)); } -bool IsClassMatch(const CfObjectBase *obj, const char *className) +bool CfIsClassMatch(const CfObjectBase *obj, const char *className) { if ((obj == NULL) || (obj->getClass() == NULL) || (className == NULL)) { return false; @@ -56,7 +56,7 @@ bool IsClassMatch(const CfObjectBase *obj, const char *className) } } -bool IsPubKeyClassMatch(const HcfObjectBase *obj, const char *className) +bool CfIsPubKeyClassMatch(const HcfObjectBase *obj, const char *className) { if ((obj == NULL) || (obj->getClass() == NULL) || (className == NULL)) { return false; @@ -69,7 +69,7 @@ bool IsPubKeyClassMatch(const HcfObjectBase *obj, const char *className) } } -bool IsUrlValid(const char *url) +bool CfIsUrlValid(const char *url) { if (url == NULL) { return false; @@ -107,7 +107,7 @@ bool IsUrlValid(const char *url) return false; } -bool IsHttp(const char *url) +bool CfIsHttp(const char *url) { if (url != NULL && strncmp(url, "http://", strlen("http://")) == 0) { return true; diff --git a/frameworks/core/v1.0/certificate/cert_chain_validator.c b/frameworks/core/v1.0/certificate/cert_chain_validator.c index 41f5718..6f1460c 100644 --- a/frameworks/core/v1.0/certificate/cert_chain_validator.c +++ b/frameworks/core/v1.0/certificate/cert_chain_validator.c @@ -73,7 +73,7 @@ static void DestroyCertChainValidator(CfObjectBase *self) LOGE("Invalid input parameter."); return; } - if (!IsClassMatch(self, GetCertChainValidatorClass())) { + if (!CfIsClassMatch(self, GetCertChainValidatorClass())) { LOGE("Class is not match."); return; } @@ -130,7 +130,7 @@ static CfResult Validate(HcfCertChainValidator *self, const HcfCertChainData *ce LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetCertChainValidatorClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetCertChainValidatorClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -161,7 +161,7 @@ static const char *GetAlgorithm(HcfCertChainValidator *self) LOGE("Invalid input parameter."); return NULL; } - if (!IsClassMatch((CfObjectBase *)self, GetCertChainValidatorClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetCertChainValidatorClass())) { LOGE("Class is not match."); return NULL; } @@ -173,7 +173,7 @@ static const char *GetAlgorithm(HcfCertChainValidator *self) CfResult HcfCertChainValidatorCreate(const char *algorithm, HcfCertChainValidator **pathValidator) { CF_LOG_I("enter"); - if (!IsStrValid(algorithm, HCF_MAX_STR_LEN) || (pathValidator == NULL)) { + if (!CfIsStrValid(algorithm, HCF_MAX_STR_LEN) || (pathValidator == NULL)) { return CF_INVALID_PARAMS; } const HcfCertChainValidatorFuncSet *func = FindAbility(algorithm); diff --git a/frameworks/core/v1.0/certificate/cert_crl_collection.c b/frameworks/core/v1.0/certificate/cert_crl_collection.c index 4217564..5d39d2d 100644 --- a/frameworks/core/v1.0/certificate/cert_crl_collection.c +++ b/frameworks/core/v1.0/certificate/cert_crl_collection.c @@ -45,7 +45,7 @@ static void DestroyCertCrlCollection(CfObjectBase *self) LOGE("Invalid input parameter."); return; } - if (!IsClassMatch(self, GetCertCrlCollectionClass())) { + if (!CfIsClassMatch(self, GetCertCrlCollectionClass())) { LOGE("Class is not match."); return; } @@ -165,7 +165,7 @@ static CfResult SelectCerts( LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetCertCrlCollectionClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetCertCrlCollectionClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -189,7 +189,7 @@ static CfResult SelectCRLs( LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetCertCrlCollectionClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetCertCrlCollectionClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -212,7 +212,7 @@ static CfResult GetCRLs(HcfCertCrlCollection *self, HcfX509CrlArray **retCrls) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetCertCrlCollectionClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetCertCrlCollectionClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } diff --git a/frameworks/core/v1.0/certificate/x509_cert_chain.c b/frameworks/core/v1.0/certificate/x509_cert_chain.c index 537c336..093c71e 100644 --- a/frameworks/core/v1.0/certificate/x509_cert_chain.c +++ b/frameworks/core/v1.0/certificate/x509_cert_chain.c @@ -86,7 +86,7 @@ static void DestroyCertChain(CfObjectBase *self) LOGE("Invalid input parameter."); return; } - if (!IsClassMatch(self, GetCertChainClass())) { + if (!CfIsClassMatch(self, GetCertChainClass())) { LOGE("Class is not match."); return; } @@ -101,7 +101,7 @@ static CfResult GetCertList(HcfCertChain *self, HcfX509CertificateArray *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetCertChainClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetCertChainClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -115,7 +115,7 @@ static CfResult ToString(HcfCertChain *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetCertChainClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetCertChainClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -129,7 +129,7 @@ static CfResult HashCode(HcfCertChain *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetCertChainClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetCertChainClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -144,7 +144,7 @@ static CfResult Validate( LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetCertChainClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetCertChainClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } diff --git a/frameworks/core/v1.0/certificate/x509_certificate.c b/frameworks/core/v1.0/certificate/x509_certificate.c index 481e44a..78f027e 100644 --- a/frameworks/core/v1.0/certificate/x509_certificate.c +++ b/frameworks/core/v1.0/certificate/x509_certificate.c @@ -66,7 +66,7 @@ static void DestroyX509Certificate(CfObjectBase *self) LOGE("Invalid input parameter."); return; } - if (!IsClassMatch(self, GetX509CertificateClass())) { + if (!CfIsClassMatch(self, GetX509CertificateClass())) { LOGE("Class is not match."); return; } @@ -81,7 +81,7 @@ static CfResult Verify(HcfCertificate *self, void *key) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -95,7 +95,7 @@ static CfResult GetEncoded(HcfCertificate *self, CfEncodingBlob *encodedByte) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -109,7 +109,7 @@ static CfResult GetPublicKey(HcfCertificate *self, void **keyOut) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -123,7 +123,7 @@ static CfResult CheckValidityWithDate(HcfX509Certificate *self, const char *date LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -137,7 +137,7 @@ static long GetVersion(HcfX509Certificate *self) LOGE("Invalid input parameter."); return INVALID_VERSION; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return INVALID_VERSION; } @@ -151,7 +151,7 @@ static CfResult GetSerialNumber(HcfX509Certificate *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -165,7 +165,7 @@ static CfResult GetIssuerName(HcfX509Certificate *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -179,7 +179,7 @@ static CfResult GetSubjectName(HcfX509Certificate *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -193,7 +193,7 @@ static CfResult GetSubjectNameEx(HcfX509Certificate *self, CfEncodinigType encod LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -207,7 +207,7 @@ static CfResult GetNotBeforeTime(HcfX509Certificate *self, CfBlob *outDate) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -221,7 +221,7 @@ static CfResult GetNotAfterTime(HcfX509Certificate *self, CfBlob *outDate) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -235,7 +235,7 @@ static CfResult GetSignature(HcfX509Certificate *self, CfBlob *sigOut) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -249,7 +249,7 @@ static CfResult GetSignatureAlgName(HcfX509Certificate *self, CfBlob *outName) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -263,7 +263,7 @@ static CfResult GetSignatureAlgOid(HcfX509Certificate *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -277,7 +277,7 @@ static CfResult GetSignatureAlgParams(HcfX509Certificate *self, CfBlob *sigAlgPa LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -291,7 +291,7 @@ static CfResult GetKeyUsage(HcfX509Certificate *self, CfBlob *boolArr) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -305,7 +305,7 @@ static CfResult GetExtKeyUsage(HcfX509Certificate *self, CfArray *keyUsageOut) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -319,7 +319,7 @@ static int32_t GetBasicConstraints(HcfX509Certificate *self) LOGE("Invalid input parameter."); return INVALID_CONSTRAINTS_LEN; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return INVALID_CONSTRAINTS_LEN; } @@ -333,7 +333,7 @@ static CfResult GetSubjectAltNames(HcfX509Certificate *self, CfArray *outName) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -347,7 +347,7 @@ static CfResult GetIssuerAltNames(HcfX509Certificate *self, CfArray *outName) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -361,7 +361,7 @@ static CfResult GetCRLDistributionPointsURI(HcfX509Certificate *self, CfArray *o LOGE("crl dp invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("crl dp class is not match."); return CF_INVALID_PARAMS; } @@ -375,7 +375,7 @@ static CfResult Match(HcfX509Certificate *self, const HcfX509CertMatchParams *ma LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -389,7 +389,7 @@ static CfResult ToString(HcfX509Certificate *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -403,7 +403,7 @@ static CfResult HashCode(HcfX509Certificate *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -417,7 +417,7 @@ static CfResult GetExtensionsObject(HcfX509Certificate *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CertificateClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } diff --git a/frameworks/core/v1.0/certificate/x509_crl.c b/frameworks/core/v1.0/certificate/x509_crl.c index 90e9565..3e8a624 100644 --- a/frameworks/core/v1.0/certificate/x509_crl.c +++ b/frameworks/core/v1.0/certificate/x509_crl.c @@ -76,7 +76,7 @@ static void DestroyX509Crl(CfObjectBase *self) LOGE("Invalid input parameter."); return; } - if (!IsClassMatch(self, GetX509CrlClass())) { + if (!CfIsClassMatch(self, GetX509CrlClass())) { LOGE("Class is not match."); return; } @@ -91,7 +91,7 @@ static const char *GetType(HcfCrl *self) LOGE("Invalid input parameter."); return NULL; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return NULL; } @@ -105,7 +105,7 @@ static bool IsRevoked(HcfCrl *self, const HcfCertificate *cert) LOGE("Invalid input parameter."); return false; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return false; } @@ -119,7 +119,7 @@ static CfResult Verify(HcfX509Crl *self, void *key) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -133,7 +133,7 @@ static CfResult GetEncoded(HcfX509Crl *self, CfEncodingBlob *encodedByte) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -147,7 +147,7 @@ static long GetVersion(HcfX509Crl *self) LOGE("Invalid input parameter."); return OPENSSL_INVALID_VERSION; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return OPENSSL_INVALID_VERSION; } @@ -161,7 +161,7 @@ static CfResult GetIssuerName(HcfX509Crl *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -175,7 +175,7 @@ static CfResult GetLastUpdate(HcfX509Crl *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -189,7 +189,7 @@ static CfResult GetNextUpdate(HcfX509Crl *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -203,7 +203,7 @@ static CfResult GetRevokedCert(HcfX509Crl *self, const CfBlob *serialNumber, Hcf LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -217,7 +217,7 @@ static CfResult GetRevokedCertWithCert(HcfX509Crl *self, HcfX509Certificate *cer LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -231,7 +231,7 @@ static CfResult GetRevokedCerts(HcfX509Crl *self, CfArray *entrysOut) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -245,7 +245,7 @@ static CfResult GetTbsInfo(HcfX509Crl *self, CfBlob *tbsCertListOut) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -259,7 +259,7 @@ static CfResult GetSignature(HcfX509Crl *self, CfBlob *signature) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -273,7 +273,7 @@ static CfResult GetSignatureAlgName(HcfX509Crl *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -287,7 +287,7 @@ static CfResult GetSignatureAlgOid(HcfX509Crl *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -301,7 +301,7 @@ static CfResult GetSignatureAlgParams(HcfX509Crl *self, CfBlob *sigAlgParamOut) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -315,7 +315,7 @@ static CfResult GetExtensions(HcfX509Crl *self, CfBlob *outBlob) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -329,7 +329,7 @@ static CfResult ToString(HcfX509Crl *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -343,7 +343,7 @@ static CfResult HashCode(HcfX509Crl *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -357,7 +357,7 @@ static CfResult GetExtensionsOjbect(HcfX509Crl *self, CfBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -371,7 +371,7 @@ static CfResult Match(HcfX509Crl *self, const HcfX509CrlMatchParams *matchParams LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509CrlClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } diff --git a/frameworks/core/v1.0/certificate/x509_distinguished_name.c b/frameworks/core/v1.0/certificate/x509_distinguished_name.c index 22b1c99..3ac5ef0 100644 --- a/frameworks/core/v1.0/certificate/x509_distinguished_name.c +++ b/frameworks/core/v1.0/certificate/x509_distinguished_name.c @@ -72,7 +72,7 @@ static void DestroyX509DistinguishedName(CfObjectBase *self) LOGE("Invalid input parameter."); return; } - if (!IsClassMatch(self, GetX509DistinguishedNameClass())) { + if (!CfIsClassMatch(self, GetX509DistinguishedNameClass())) { LOGE("Class is not match."); return; } @@ -87,7 +87,7 @@ static CfResult GetEncoded(HcfX509DistinguishedName *self, CfEncodingBlob *out) LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509DistinguishedNameClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509DistinguishedNameClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } @@ -101,7 +101,7 @@ static CfResult GetName(HcfX509DistinguishedName *self, CfBlob *type, CfBlob *ou LOGE("Invalid input parameter."); return CF_INVALID_PARAMS; } - if (!IsClassMatch((CfObjectBase *)self, GetX509DistinguishedNameClass())) { + if (!CfIsClassMatch((CfObjectBase *)self, GetX509DistinguishedNameClass())) { LOGE("Class is not match."); return CF_INVALID_PARAMS; } diff --git a/test/unittest/cf_adapter_test/src/cf_common_test.cpp b/test/unittest/cf_adapter_test/src/cf_common_test.cpp index e49f06b..06f6e6a 100644 --- a/test/unittest/cf_adapter_test/src/cf_common_test.cpp +++ b/test/unittest/cf_adapter_test/src/cf_common_test.cpp @@ -369,7 +369,7 @@ HWTEST_F(CfCommonTest, CfMemTest004, TestSize.Level0) */ HWTEST_F(CfCommonTest, IsStrValid001, TestSize.Level0) { - bool checkRes = IsStrValid(nullptr, 0); + bool checkRes = CfIsStrValid(nullptr, 0); EXPECT_EQ(checkRes, false); } @@ -382,7 +382,7 @@ HWTEST_F(CfCommonTest, IsStrValid001, TestSize.Level0) HWTEST_F(CfCommonTest, IsStrValid002, TestSize.Level0) { char str[] = "this is test for beyond max length."; - bool checkRes = IsStrValid(str, TEST_DEFAULT_SIZE); + bool checkRes = CfIsStrValid(str, TEST_DEFAULT_SIZE); EXPECT_EQ(checkRes, false); } @@ -395,7 +395,7 @@ HWTEST_F(CfCommonTest, IsStrValid002, TestSize.Level0) HWTEST_F(CfCommonTest, IsStrValid003, TestSize.Level0) { char str[] = "123456789"; - bool checkRes = IsStrValid(str, TEST_DEFAULT_SIZE); + bool checkRes = CfIsStrValid(str, TEST_DEFAULT_SIZE); EXPECT_EQ(checkRes, true); } @@ -409,7 +409,7 @@ HWTEST_F(CfCommonTest, IsBlobValid001, TestSize.Level0) { uint8_t blobData[] = "normal case"; CfBlob blob = { sizeof(blobData), blobData }; - bool checkRes = IsBlobValid(&blob); + bool checkRes = CfIsBlobValid(&blob); EXPECT_EQ(checkRes, true); } @@ -421,7 +421,7 @@ HWTEST_F(CfCommonTest, IsBlobValid001, TestSize.Level0) */ HWTEST_F(CfCommonTest, IsBlobValid002, TestSize.Level0) { - bool checkRes = IsBlobValid(nullptr); + bool checkRes = CfIsBlobValid(nullptr); EXPECT_EQ(checkRes, false); } @@ -434,7 +434,7 @@ HWTEST_F(CfCommonTest, IsBlobValid002, TestSize.Level0) HWTEST_F(CfCommonTest, IsBlobValid003, TestSize.Level0) { CfBlob blob = { TEST_DEFAULT_SIZE, nullptr }; - bool checkRes = IsBlobValid(&blob); + bool checkRes = CfIsBlobValid(&blob); EXPECT_EQ(checkRes, false); } @@ -448,7 +448,7 @@ HWTEST_F(CfCommonTest, IsBlobValid004, TestSize.Level0) { uint8_t blobData[] = "invalid blob size is 0"; CfBlob blob = { 0, blobData }; - bool checkRes = IsBlobValid(&blob); + bool checkRes = CfIsBlobValid(&blob); EXPECT_EQ(checkRes, false); } @@ -470,7 +470,7 @@ static const char *GetClassNull(void) */ HWTEST_F(CfCommonTest, IsClassMatch001, TestSize.Level0) { - bool checkRes = IsClassMatch(nullptr, "TEST_FOR_GET_CLASS"); + bool checkRes = CfIsClassMatch(nullptr, "TEST_FOR_GET_CLASS"); EXPECT_EQ(checkRes, false); } @@ -483,7 +483,7 @@ HWTEST_F(CfCommonTest, IsClassMatch001, TestSize.Level0) HWTEST_F(CfCommonTest, IsClassMatch002, TestSize.Level0) { CfObjectBase obj = { GetClassNull, nullptr }; - bool checkRes = IsClassMatch(&obj, "TEST_FOR_GET_CLASS"); + bool checkRes = CfIsClassMatch(&obj, "TEST_FOR_GET_CLASS"); EXPECT_EQ(checkRes, false); } @@ -496,7 +496,7 @@ HWTEST_F(CfCommonTest, IsClassMatch002, TestSize.Level0) HWTEST_F(CfCommonTest, IsClassMatch003, TestSize.Level0) { CfObjectBase obj = { GetClass, nullptr }; - bool checkRes = IsClassMatch(&obj, nullptr); + bool checkRes = CfIsClassMatch(&obj, nullptr); EXPECT_EQ(checkRes, false); } @@ -509,7 +509,7 @@ HWTEST_F(CfCommonTest, IsClassMatch003, TestSize.Level0) HWTEST_F(CfCommonTest, IsClassMatch004, TestSize.Level0) { CfObjectBase obj = { GetClass, nullptr }; - bool checkRes = IsClassMatch(&obj, "TEST_FOR_GET_CLASS"); + bool checkRes = CfIsClassMatch(&obj, "TEST_FOR_GET_CLASS"); EXPECT_EQ(checkRes, true); } @@ -522,7 +522,7 @@ HWTEST_F(CfCommonTest, IsClassMatch004, TestSize.Level0) HWTEST_F(CfCommonTest, IsClassMatch005, TestSize.Level0) { CfObjectBase obj = { GetClass, nullptr }; - bool checkRes = IsClassMatch(&obj, "TEST_FOR_GET_CLASS123"); + bool checkRes = CfIsClassMatch(&obj, "TEST_FOR_GET_CLASS123"); EXPECT_EQ(checkRes, false); } @@ -535,7 +535,7 @@ HWTEST_F(CfCommonTest, IsClassMatch005, TestSize.Level0) HWTEST_F(CfCommonTest, IsPubKeyClassMatch001, TestSize.Level0) { HcfObjectBase obj = { GetClass, nullptr }; - bool checkRes = IsPubKeyClassMatch(&obj, "TEST_FOR_GET_CLASS"); + bool checkRes = CfIsPubKeyClassMatch(&obj, "TEST_FOR_GET_CLASS"); EXPECT_EQ(checkRes, true); } @@ -548,7 +548,7 @@ HWTEST_F(CfCommonTest, IsPubKeyClassMatch001, TestSize.Level0) HWTEST_F(CfCommonTest, IsPubKeyClassMatch002, TestSize.Level0) { HcfObjectBase obj = { GetClass, nullptr }; - bool checkRes = IsPubKeyClassMatch(&obj, "TEST_FOR_GET_CLASS000"); + bool checkRes = CfIsPubKeyClassMatch(&obj, "TEST_FOR_GET_CLASS000"); EXPECT_EQ(checkRes, false); } @@ -560,7 +560,7 @@ HWTEST_F(CfCommonTest, IsPubKeyClassMatch002, TestSize.Level0) */ HWTEST_F(CfCommonTest, IsPubKeyClassMatch003, TestSize.Level0) { - bool checkRes = IsPubKeyClassMatch(nullptr, "TEST_FOR_GET_CLASS"); + bool checkRes = CfIsPubKeyClassMatch(nullptr, "TEST_FOR_GET_CLASS"); EXPECT_EQ(checkRes, false); } @@ -573,7 +573,7 @@ HWTEST_F(CfCommonTest, IsPubKeyClassMatch003, TestSize.Level0) HWTEST_F(CfCommonTest, IsPubKeyClassMatch004, TestSize.Level0) { HcfObjectBase obj = { GetClassNull, nullptr }; - bool checkRes = IsPubKeyClassMatch(&obj, "TEST_FOR_GET_CLASS"); + bool checkRes = CfIsPubKeyClassMatch(&obj, "TEST_FOR_GET_CLASS"); EXPECT_EQ(checkRes, false); } @@ -586,7 +586,7 @@ HWTEST_F(CfCommonTest, IsPubKeyClassMatch004, TestSize.Level0) HWTEST_F(CfCommonTest, IsPubKeyClassMatch005, TestSize.Level0) { HcfObjectBase obj = { GetClass, nullptr }; - bool checkRes = IsPubKeyClassMatch(&obj, nullptr); + bool checkRes = CfIsPubKeyClassMatch(&obj, nullptr); EXPECT_EQ(checkRes, false); } } // end of namespace