From 6b35ec197b198976984cc489e26682c5f965d891 Mon Sep 17 00:00:00 2001 From: linxiangzhi Date: Thu, 14 Jul 2022 17:42:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=95=E5=85=A5=E7=9A=84?= =?UTF-8?q?=E5=A4=B4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: linxiangzhi Change-Id: Iabfa6ed9fcc407e7b12430a3cb586ec4cb8cea2b --- .../appverify/include/common/hap_byte_buffer.h | 2 +- .../common/hap_byte_buffer_data_source.h | 1 - .../include/common/hap_file_data_source.h | 1 - .../include/common/random_access_file.h | 3 ++- .../include/init/device_type_manager.h | 3 +-- .../appverify/include/init/hap_crl_manager.h | 7 ++----- .../appverify/include/interfaces/hap_verify.h | 3 +-- .../include/interfaces/hap_verify_result.h | 1 + .../appverify/include/ticket/ticket_verify.h | 4 ---- .../appverify/include/util/digest_parameter.h | 11 +++++++---- .../include/util/hap_signing_block_utils.h | 7 ++++--- .../include/util/hap_verify_openssl_utils.h | 11 +++++++---- .../appverify/src/common/hap_byte_buffer.cpp | 5 +++-- .../src/common/hap_byte_buffer_data_source.cpp | 3 +++ .../src/common/hap_file_data_source.cpp | 1 + .../appverify/src/common/random_access_file.cpp | 6 ++++-- .../appverify/src/init/hap_crl_manager.cpp | 7 +++++++ .../appverify/src/interfaces/hap_verify.cpp | 4 ++-- .../src/interfaces/hap_verify_result.cpp | 3 ++- .../appverify/src/ticket/ticket_verify.cpp | 10 ++++++++-- .../appverify/src/util/digest_parameter.cpp | 1 + .../src/util/hap_signing_block_utils.cpp | 14 +++++++++++--- .../src/util/hap_verify_openssl_utils.cpp | 17 ++++++++++++++--- 23 files changed, 82 insertions(+), 43 deletions(-) diff --git a/interfaces/innerkits/appverify/include/common/hap_byte_buffer.h b/interfaces/innerkits/appverify/include/common/hap_byte_buffer.h index fc8ea13..87a6183 100644 --- a/interfaces/innerkits/appverify/include/common/hap_byte_buffer.h +++ b/interfaces/innerkits/appverify/include/common/hap_byte_buffer.h @@ -16,9 +16,9 @@ #define HAP_BYTEBUFFER_H #include -#include #include "common/export_define.h" +#include "iosfwd" namespace OHOS { namespace Security { diff --git a/interfaces/innerkits/appverify/include/common/hap_byte_buffer_data_source.h b/interfaces/innerkits/appverify/include/common/hap_byte_buffer_data_source.h index 1d971f0..710f49e 100644 --- a/interfaces/innerkits/appverify/include/common/hap_byte_buffer_data_source.h +++ b/interfaces/innerkits/appverify/include/common/hap_byte_buffer_data_source.h @@ -17,7 +17,6 @@ #include "common/data_source.h" #include "common/export_define.h" -#include "common/random_access_file.h" namespace OHOS { namespace Security { diff --git a/interfaces/innerkits/appverify/include/common/hap_file_data_source.h b/interfaces/innerkits/appverify/include/common/hap_file_data_source.h index e5907ee..5c613dc 100644 --- a/interfaces/innerkits/appverify/include/common/hap_file_data_source.h +++ b/interfaces/innerkits/appverify/include/common/hap_file_data_source.h @@ -16,7 +16,6 @@ #define HAP_FILEDATASOURCE_H #include "common/data_source.h" -#include "common/random_access_file.h" namespace OHOS { namespace Security { diff --git a/interfaces/innerkits/appverify/include/common/random_access_file.h b/interfaces/innerkits/appverify/include/common/random_access_file.h index 78062b6..fcc06cf 100644 --- a/interfaces/innerkits/appverify/include/common/random_access_file.h +++ b/interfaces/innerkits/appverify/include/common/random_access_file.h @@ -17,7 +17,8 @@ #include "common/export_define.h" #include "common/hap_byte_buffer.h" -#include "util/hap_verify_openssl_utils.h" +#include "iosfwd" +#include "util/digest_parameter.h" namespace OHOS { namespace Security { diff --git a/interfaces/innerkits/appverify/include/init/device_type_manager.h b/interfaces/innerkits/appverify/include/init/device_type_manager.h index 6a3e88f..546daaf 100644 --- a/interfaces/innerkits/appverify/include/init/device_type_manager.h +++ b/interfaces/innerkits/appverify/include/init/device_type_manager.h @@ -16,10 +16,9 @@ #ifndef OHOS_DEVICE_TYPE_MANAGER_H #define OHOS_DEVICE_TYPE_MANAGER_H +#include "__mutex_base" #include "common/export_define.h" -#include - namespace OHOS { namespace Security { namespace Verify { diff --git a/interfaces/innerkits/appverify/include/init/hap_crl_manager.h b/interfaces/innerkits/appverify/include/init/hap_crl_manager.h index 27dd42c..5f9607d 100644 --- a/interfaces/innerkits/appverify/include/init/hap_crl_manager.h +++ b/interfaces/innerkits/appverify/include/init/hap_crl_manager.h @@ -16,14 +16,11 @@ #define HAP_CRL_MANAGER_H #include -#include -#include #include -#include "openssl/x509.h" - +#include "__mutex_base" #include "common/export_define.h" -#include "common/hap_byte_buffer.h" +#include "iosfwd" #include "util/pkcs7_context.h" namespace OHOS { diff --git a/interfaces/innerkits/appverify/include/interfaces/hap_verify.h b/interfaces/innerkits/appverify/include/interfaces/hap_verify.h index 8db68e1..d1ffc70 100644 --- a/interfaces/innerkits/appverify/include/interfaces/hap_verify.h +++ b/interfaces/innerkits/appverify/include/interfaces/hap_verify.h @@ -15,10 +15,9 @@ #ifndef HAP_VERIFY_H #define HAP_VERIFY_H -#include - #include "common/export_define.h" #include "interfaces/hap_verify_result.h" +#include "iosfwd" namespace OHOS { namespace Security { diff --git a/interfaces/innerkits/appverify/include/interfaces/hap_verify_result.h b/interfaces/innerkits/appverify/include/interfaces/hap_verify_result.h index a2d150e..dbaa167 100644 --- a/interfaces/innerkits/appverify/include/interfaces/hap_verify_result.h +++ b/interfaces/innerkits/appverify/include/interfaces/hap_verify_result.h @@ -20,6 +20,7 @@ #include "common/export_define.h" #include "common/hap_byte_buffer.h" +#include "iosfwd" #include "provision/provision_info.h" namespace OHOS { diff --git a/interfaces/innerkits/appverify/include/ticket/ticket_verify.h b/interfaces/innerkits/appverify/include/ticket/ticket_verify.h index dff2df4..7a4ea86 100644 --- a/interfaces/innerkits/appverify/include/ticket/ticket_verify.h +++ b/interfaces/innerkits/appverify/include/ticket/ticket_verify.h @@ -16,11 +16,7 @@ #define TICKET_VERIFY_H #include "common/export_define.h" -#include "common/hap_byte_buffer.h" -#include "common/random_access_file.h" - #include "provision/provision_info.h" -#include "provision/provision_verify.h" namespace OHOS { namespace Security { diff --git a/interfaces/innerkits/appverify/include/util/digest_parameter.h b/interfaces/innerkits/appverify/include/util/digest_parameter.h index 8277cdc..65510b6 100644 --- a/interfaces/innerkits/appverify/include/util/digest_parameter.h +++ b/interfaces/innerkits/appverify/include/util/digest_parameter.h @@ -16,11 +16,12 @@ #ifndef HOSP_DIGESTPARAMETER_H #define HOSP_DIGESTPARAMETER_H -#include "openssl/evp.h" - #include "common/export_define.h" +#include "openssl/ossl_typ.h" -namespace OHOS::Security::Verify { +namespace OHOS { +namespace Security { +namespace Verify { class DigestParameter { public: DLL_EXPORT DigestParameter(); @@ -34,5 +35,7 @@ public: const EVP_MD* md; EVP_MD_CTX* ptrCtx; }; -} // namespace OHOS::Security::Verify +} // namespace Verify +} // namespace Security +} // namespace OHOS #endif // HOSP_DIGESTPARAMETER_H diff --git a/interfaces/innerkits/appverify/include/util/hap_signing_block_utils.h b/interfaces/innerkits/appverify/include/util/hap_signing_block_utils.h index ec6f2e9..99991f4 100644 --- a/interfaces/innerkits/appverify/include/util/hap_signing_block_utils.h +++ b/interfaces/innerkits/appverify/include/util/hap_signing_block_utils.h @@ -15,16 +15,17 @@ #ifndef HAP_SIGNING_BLOCK_UTILS_H #define HAP_SIGNING_BLOCK_UTILS_H -#include #include -#include "openssl/evp.h" #include "common/data_source.h" #include "common/export_define.h" #include "common/hap_byte_buffer.h" #include "common/random_access_file.h" -#include "util/hap_verify_openssl_utils.h" +#include "interfaces/hap_verify_result.h" +#include "util/digest_parameter.h" +#include "util/pkcs7_context.h" #include "util/signature_info.h" +#include "utility" namespace OHOS { namespace Security { diff --git a/interfaces/innerkits/appverify/include/util/hap_verify_openssl_utils.h b/interfaces/innerkits/appverify/include/util/hap_verify_openssl_utils.h index 59868c1..8489d03 100644 --- a/interfaces/innerkits/appverify/include/util/hap_verify_openssl_utils.h +++ b/interfaces/innerkits/appverify/include/util/hap_verify_openssl_utils.h @@ -15,16 +15,19 @@ #ifndef HAP_VERIFY_OPENSSL_UTILS_H #define HAP_VERIFY_OPENSSL_UTILS_H -#include #include -#include "openssl/evp.h" - #include "common/export_define.h" -#include "common/hap_byte_buffer.h" +#include "common/random_access_file.h" #include "interfaces/hap_verify_result.h" +#include "iosfwd" +#include "openssl/evp.h" +#include "openssl/ossl_typ.h" +#include "openssl/pkcs7.h" +#include "openssl/safestack.h" #include "util/digest_parameter.h" #include "util/hap_cert_verify_openssl_utils.h" +#include "util/pkcs7_context.h" namespace OHOS { namespace Security { diff --git a/interfaces/innerkits/appverify/src/common/hap_byte_buffer.cpp b/interfaces/innerkits/appverify/src/common/hap_byte_buffer.cpp index 27899cc..6d18ddd 100644 --- a/interfaces/innerkits/appverify/src/common/hap_byte_buffer.cpp +++ b/interfaces/innerkits/appverify/src/common/hap_byte_buffer.cpp @@ -15,9 +15,10 @@ #include "common/hap_byte_buffer.h" -#include "securec.h" - #include "common/hap_verify_log.h" +#include "memory" +#include "securec.h" +#include "string" namespace OHOS { namespace Security { diff --git a/interfaces/innerkits/appverify/src/common/hap_byte_buffer_data_source.cpp b/interfaces/innerkits/appverify/src/common/hap_byte_buffer_data_source.cpp index 2dd4c32..cfcb1d1 100644 --- a/interfaces/innerkits/appverify/src/common/hap_byte_buffer_data_source.cpp +++ b/interfaces/innerkits/appverify/src/common/hap_byte_buffer_data_source.cpp @@ -15,6 +15,9 @@ #include "common/hap_byte_buffer_data_source.h" +#include "common/hap_byte_buffer.h" +#include "util/hap_verify_openssl_utils.h" + namespace OHOS { namespace Security { namespace Verify { diff --git a/interfaces/innerkits/appverify/src/common/hap_file_data_source.cpp b/interfaces/innerkits/appverify/src/common/hap_file_data_source.cpp index 1ab1082..d4942e2 100644 --- a/interfaces/innerkits/appverify/src/common/hap_file_data_source.cpp +++ b/interfaces/innerkits/appverify/src/common/hap_file_data_source.cpp @@ -16,6 +16,7 @@ #include "common/hap_file_data_source.h" #include "common/hap_verify_log.h" +#include "common/random_access_file.h" namespace OHOS { namespace Security { diff --git a/interfaces/innerkits/appverify/src/common/random_access_file.cpp b/interfaces/innerkits/appverify/src/common/random_access_file.cpp index 062c568..029e6b0 100644 --- a/interfaces/innerkits/appverify/src/common/random_access_file.cpp +++ b/interfaces/innerkits/appverify/src/common/random_access_file.cpp @@ -20,9 +20,11 @@ #include #include -#include "securec.h" - +#include "common/hap_byte_buffer.h" #include "common/hap_verify_log.h" +#include "securec.h" +#include "string" +#include "util/hap_verify_openssl_utils.h" namespace OHOS { namespace Security { diff --git a/interfaces/innerkits/appverify/src/init/hap_crl_manager.cpp b/interfaces/innerkits/appverify/src/init/hap_crl_manager.cpp index 3f129d0..926890a 100644 --- a/interfaces/innerkits/appverify/src/init/hap_crl_manager.cpp +++ b/interfaces/innerkits/appverify/src/init/hap_crl_manager.cpp @@ -17,9 +17,16 @@ #include +#include "common/hap_byte_buffer.h" #include "common/hap_verify_log.h" #include "common/random_access_file.h" +#include "openssl/asn1.h" +#include "openssl/x509.h" +#include "string" +#include "unordered_map" #include "util/hap_cert_verify_openssl_utils.h" +#include "util/pkcs7_context.h" +#include "utility" namespace OHOS { namespace Security { diff --git a/interfaces/innerkits/appverify/src/interfaces/hap_verify.cpp b/interfaces/innerkits/appverify/src/interfaces/hap_verify.cpp index e59038a..ba0b179 100644 --- a/interfaces/innerkits/appverify/src/interfaces/hap_verify.cpp +++ b/interfaces/innerkits/appverify/src/interfaces/hap_verify.cpp @@ -15,13 +15,13 @@ #include "interfaces/hap_verify.h" -#include - +#include "__mutex_base" #include "init/device_type_manager.h" #include "init/hap_crl_manager.h" #include "init/trusted_root_ca.h" #include "init/trusted_source_manager.h" #include "init/trusted_ticket_manager.h" +#include "interfaces/hap_verify_result.h" #include "verify/hap_verify_v2.h" namespace OHOS { diff --git a/interfaces/innerkits/appverify/src/interfaces/hap_verify_result.cpp b/interfaces/innerkits/appverify/src/interfaces/hap_verify_result.cpp index 7e07baa..047813b 100644 --- a/interfaces/innerkits/appverify/src/interfaces/hap_verify_result.cpp +++ b/interfaces/innerkits/appverify/src/interfaces/hap_verify_result.cpp @@ -15,8 +15,9 @@ #include "interfaces/hap_verify_result.h" +#include "string" #include "util/hap_signing_block_utils.h" -#include "util/hap_verify_openssl_utils.h" +#include "vector" namespace OHOS { namespace Security { diff --git a/interfaces/innerkits/appverify/src/ticket/ticket_verify.cpp b/interfaces/innerkits/appverify/src/ticket/ticket_verify.cpp index b8b3b03..1bcf193 100644 --- a/interfaces/innerkits/appverify/src/ticket/ticket_verify.cpp +++ b/interfaces/innerkits/appverify/src/ticket/ticket_verify.cpp @@ -16,10 +16,10 @@ #include "ticket/ticket_verify.h" #include +#include +#include #include -#include "nlohmann/json.hpp" - #ifndef STANDARD_SYSTEM #include "ohos_account_kits.h" #else @@ -30,10 +30,16 @@ #include "common/hap_byte_buffer.h" #include "common/hap_verify_log.h" #include "common/random_access_file.h" +#include "init/matching_result.h" #include "init/trusted_ticket_manager.h" +#include "iosfwd" +#include "provision/provision_info.h" +#include "provision/provision_verify.h" +#include "string" #include "util/hap_cert_verify_openssl_utils.h" #include "util/hap_verify_openssl_utils.h" #include "util/pkcs7_context.h" +#include "vector" namespace { const int MAXIMUM_DEVICES = 100; diff --git a/interfaces/innerkits/appverify/src/util/digest_parameter.cpp b/interfaces/innerkits/appverify/src/util/digest_parameter.cpp index ead2deb..b7819fe 100644 --- a/interfaces/innerkits/appverify/src/util/digest_parameter.cpp +++ b/interfaces/innerkits/appverify/src/util/digest_parameter.cpp @@ -14,6 +14,7 @@ */ #include "util/digest_parameter.h" +#include "openssl/evp.h" namespace OHOS::Security::Verify { DigestParameter::DigestParameter() : digestOutputSizeBytes(0), md(nullptr), ptrCtx(nullptr) diff --git a/interfaces/innerkits/appverify/src/util/hap_signing_block_utils.cpp b/interfaces/innerkits/appverify/src/util/hap_signing_block_utils.cpp index 5746006..3e8afea 100644 --- a/interfaces/innerkits/appverify/src/util/hap_signing_block_utils.cpp +++ b/interfaces/innerkits/appverify/src/util/hap_signing_block_utils.cpp @@ -16,13 +16,21 @@ #include "util/hap_signing_block_utils.h" #include -#include - -#include "securec.h" +#include "algorithm" +#include "common/data_source.h" +#include "common/hap_byte_buffer.h" #include "common/hap_byte_buffer_data_source.h" #include "common/hap_file_data_source.h" #include "common/hap_verify_log.h" +#include "common/random_access_file.h" +#include "interfaces/hap_verify_result.h" +#include "openssl/evp.h" +#include "securec.h" +#include "util/hap_cert_verify_openssl_utils.h" +#include "util/pkcs7_context.h" +#include "util/signature_info.h" +#include "vector" namespace OHOS { namespace Security { diff --git a/interfaces/innerkits/appverify/src/util/hap_verify_openssl_utils.cpp b/interfaces/innerkits/appverify/src/util/hap_verify_openssl_utils.cpp index 2f5ab58..3446bb7 100644 --- a/interfaces/innerkits/appverify/src/util/hap_verify_openssl_utils.cpp +++ b/interfaces/innerkits/appverify/src/util/hap_verify_openssl_utils.cpp @@ -15,10 +15,21 @@ #include "util/hap_verify_openssl_utils.h" -#include "openssl/err.h" -#include "openssl/pem.h" - +#include "common/hap_byte_buffer.h" #include "common/hap_verify_log.h" +#include "interfaces/hap_verify_result.h" +#include "memory" +#include "openssl/asn1.h" +#include "openssl/bio.h" +#include "openssl/crypto.h" +#include "openssl/err.h" +#include "openssl/obj_mac.h" +#include "openssl/objects.h" +#include "openssl/rsa.h" +#include "openssl/x509.h" +#include "string" +#include "util/digest_parameter.h" +#include "vector" namespace OHOS { namespace Security { -- Gitee