1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_BUNDLE_MANAGER_SERVICES_BUNDLEMGR_INCLUDE_QUICK_FIX_CHECKER_H 17 #define FOUNDATION_BUNDLE_MANAGER_SERVICES_BUNDLEMGR_INCLUDE_QUICK_FIX_CHECKER_H 18 19 #include <string> 20 #include <unordered_map> 21 #include <vector> 22 23 #include "appexecfwk_errors.h" 24 #include "bundle_info.h" 25 #include "bundle_verify_mgr.h" 26 #include "quick_fix/app_quick_fix.h" 27 28 namespace OHOS { 29 namespace AppExecFwk { 30 class QuickFixChecker { 31 public: 32 ErrCode CheckMultipleHqfsSignInfo( 33 const std::vector<std::string> &bundlePaths, 34 std::vector<Security::Verify::HapVerifyResult> &hapVerifyRes); 35 36 ErrCode CheckAppQuickFixInfos(const std::unordered_map<std::string, AppQuickFix> &infos); 37 38 ErrCode CheckMultiNativeSo( 39 std::unordered_map<std::string, AppQuickFix> &infos); 40 41 ErrCode CheckPatchWithInstalledBundle(const AppQuickFix &appQuickFix, const BundleInfo &bundleInfo, 42 const Security::Verify::ProvisionInfo &provisionInfo); 43 44 ErrCode CheckHotReloadWithInstalledBundle(const AppQuickFix &appQuickFix, const BundleInfo &bundleInfo); 45 46 ErrCode CheckSignatureInfo(const BundleInfo &bundleInfo, 47 const Security::Verify::ProvisionInfo &provisionInfo); 48 49 std::string GetAppDistributionType(const Security::Verify::AppDistType &type); 50 51 private: 52 ErrCode CheckCommonWithInstalledBundle(const AppQuickFix &appQuickFix, const BundleInfo &bundleInfo); 53 54 ErrCode CheckModuleNameExist(const BundleInfo &bundleInfo, 55 const std::unordered_map<std::string, AppQuickFix> &infos); 56 57 std::string GetAppProvisionType(const Security::Verify::ProvisionType &type); 58 59 ErrCode CheckPatchNativeSoWithInstalledBundle( 60 const BundleInfo &bundleInfo, const AppqfInfo &qfInfo); 61 62 static size_t QUICK_FIX_MAP_SIZE; 63 }; 64 } // AppExecFwk 65 } // OHOS 66 #endif // FOUNDATION_BUNDLE_MANAGER_SERVICES_BUNDLEMGR_INCLUDE_QUICK_FIX_CHECKER_H 67