StepWgtRecoverSignature 03/84603/2
authorTomasz Iwanek <t.iwanek@samsung.com>
Fri, 19 Aug 2016 10:46:58 +0000 (12:46 +0200)
committerTomasz Iwanek <t.iwanek@samsung.com>
Tue, 23 Aug 2016 07:46:01 +0000 (00:46 -0700)
To verify, run test:
 app_fw$ /usr/bin/wgt-backend-ut/smoke-test --gtest_filter=SmokeTest.RecoveryMode_ForUpdate

Requires:
 - https://review.tizen.org/gerrit/84596
 - https://review.tizen.org/gerrit/84598

Change-Id: I1046976f841a14c6b68d428e9604b29318b6bf80

src/hybrid/hybrid_installer.cc
src/wgt/CMakeLists.txt
src/wgt/step/security/step_wgt_recover_signature.cc [new file with mode: 0644]
src/wgt/step/security/step_wgt_recover_signature.h [new file with mode: 0644]
src/wgt/wgt_installer.cc

index 8d3060f..9099883 100644 (file)
@@ -66,6 +66,7 @@
 #include <tpk/step/filesystem/step_tpk_patch_icons.h>
 #include <tpk/step/filesystem/step_tpk_prepare_package_directory.h>
 #include <tpk/step/filesystem/step_tpk_update_package_directory.h>
+#include <tpk/step/security/step_tpk_recover_signature.h>
 
 #include "hybrid/hybrid_backend_data.h"
 #include "hybrid/step/configuration/step_merge_tpk_config.h"
@@ -261,13 +262,14 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<ci::configuration::StepParseManifest>(
           ci::configuration::StepParseManifest::ManifestLocation::RECOVERY,
           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
-      AddStep<ci::pkgmgr::StepRecoverApplication>();
       AddStep<ci::filesystem::StepRemoveTemporaryDirectory>();
       AddStep<ci::filesystem::StepRecoverIcons>();
       AddStep<ci::filesystem::StepRecoverManifest>();
       AddStep<ci::filesystem::StepRecoverExternalStorage>();
       AddStep<ci::filesystem::StepRecoverStorageDirectories>();
       AddStep<ci::filesystem::StepRecoverFiles>();
+      AddStep<tpk::security::StepTpkRecoverSignature>();
+      AddStep<ci::pkgmgr::StepRecoverApplication>();
       AddStep<ci::security::StepRecoverSecurity>();
       break;
     case ci::RequestType::Clear:
index 2e70267..fece9b1 100755 (executable)
@@ -19,6 +19,7 @@ SET(SRCS
   step/security/step_check_wgt_ime_privilege.cc
   step/security/step_direct_manifest_check_signature.cc
   step/security/step_check_extension_privileges.cc
+  step/security/step_wgt_recover_signature.cc
   wgt_app_query_interface.cc
   wgt_installer.cc
   extension_config_parser.cc
diff --git a/src/wgt/step/security/step_wgt_recover_signature.cc b/src/wgt/step/security/step_wgt_recover_signature.cc
new file mode 100644 (file)
index 0000000..d18d172
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include "wgt/step/security/step_wgt_recover_signature.h"
+
+namespace bf = boost::filesystem;
+
+namespace {
+
+const char kResWgt[] = "res/wgt";
+
+}  // namespace
+
+namespace wgt {
+namespace security {
+
+bf::path StepWgtRecoverSignature::GetSignatureRoot() {
+  return context_->pkg_path.get() / kResWgt;
+}
+
+}  // namespace security
+}  // namespace wgt
diff --git a/src/wgt/step/security/step_wgt_recover_signature.h b/src/wgt/step/security/step_wgt_recover_signature.h
new file mode 100644 (file)
index 0000000..66545d7
--- /dev/null
@@ -0,0 +1,27 @@
+// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef WGT_STEP_SECURITY_STEP_WGT_RECOVER_SIGNATURE_H_
+#define WGT_STEP_SECURITY_STEP_WGT_RECOVER_SIGNATURE_H_
+
+#include <common/step/security/step_recover_signature.h>
+
+#include <boost/filesystem/path.hpp>
+
+namespace wgt {
+namespace security {
+
+class StepWgtRecoverSignature
+    : public common_installer::security::StepRecoverSignature {
+ public:
+  using StepRecoverSignature::StepRecoverSignature;
+
+ private:
+  boost::filesystem::path GetSignatureRoot() override;
+};
+
+}  // namespace security
+}  // namespace wgt
+
+#endif  // WGT_STEP_SECURITY_STEP_WGT_RECOVER_SIGNATURE_H_
index 68d6775..ea96cf2 100755 (executable)
@@ -90,6 +90,7 @@
 #include "wgt/step/security/step_check_wgt_ime_privilege.h"
 #include "wgt/step/security/step_direct_manifest_check_signature.h"
 #include "wgt/step/security/step_check_extension_privileges.h"
+#include "wgt/step/security/step_wgt_recover_signature.h"
 
 namespace ci = common_installer;
 
@@ -283,13 +284,14 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::configuration::StepParseManifest>(
           ci::configuration::StepParseManifest::ManifestLocation::RECOVERY,
           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
-      AddStep<ci::pkgmgr::StepRecoverApplication>();
       AddStep<ci::filesystem::StepRemoveTemporaryDirectory>();
       AddStep<ci::filesystem::StepRecoverIcons>();
       AddStep<ci::filesystem::StepRecoverManifest>();
       AddStep<ci::filesystem::StepRecoverExternalStorage>();
       AddStep<ci::filesystem::StepRecoverStorageDirectories>();
       AddStep<ci::filesystem::StepRecoverFiles>();
+      AddStep<wgt::security::StepWgtRecoverSignature>();
+      AddStep<ci::pkgmgr::StepRecoverApplication>();
       AddStep<ci::security::StepRecoverSecurity>();
       break;
     }