Add build config for decrypt support 74/5574/1
authorBaptiste DURAND <baptiste.durand@eurogiciel.fr>
Tue, 9 Jul 2013 14:45:57 +0000 (16:45 +0200)
committerBaptiste DURAND <baptiste.durand@eurogiciel.fr>
Tue, 9 Jul 2013 14:45:57 +0000 (16:45 +0200)
CMakeLists.txt
packaging/wrt-installer.spec
src/CMakeLists.txt
src/jobs/widget_install/job_widget_install.cpp
src/jobs/widget_install/task_encrypt_resource.cpp

index 423b6e4..feb46bb 100644 (file)
@@ -41,7 +41,10 @@ OPTION(MULTIPROCESS_SERVICE_SUPPORT_INLINE "Process per service - inline mode su
 OPTION(CSP_SUPPORT "Support for csp policy" ON)
 OPTION(ALLOW_NAVIGATION_SUPPORT "Support for allow-navigation" ON)
 OPTION(SMACK "Enable smack support" ON)
-
+OPTION(DECRYPT_SUPPORT "Enable appmanager capabilities" ON)
+IF(DECRYPT_SUPPORT)
+    ADD_DEFINITIONS("-DDECRYPT")
+ENDIF(DECRYPT_SUPPORT)
 ############################# compiler flags ##################################
 
 SET(CMAKE_C_FLAGS_PROFILING    "-O2")
index ca4c313..0957f7f 100644 (file)
@@ -1,4 +1,5 @@
 %bcond_with livebox
+%bcond_with decrypt
 Name:       wrt-installer
 Summary:    Installer for tizen Webruntime
 Version:    0.1.58.2
@@ -44,10 +45,12 @@ BuildRequires:  pkgconfig(app2sd)
 BuildRequires:  pkgconfig(web-provider)
 %endif
 BuildRequires:  pkgconfig(libprivilege-control)
+BuildRequires:  pkgconfig(libsmack)
+%if %{with decrypt}
 BuildRequires:  pkgconfig(osp-appfw)
 BuildRequires:  osp-appfw-internal-devel
-BuildRequires:  pkgconfig(libsmack)
 Requires: osp-appfw
+%endif
 Requires: xmlsec1
 
 %description
@@ -73,6 +76,11 @@ LDFLAGS="$LDFLAGS"
 %else
         -DLIVEBOX_SUPPORT=Off \
 %endif
+%if %{with decrypt}
+         -DDECRYPT_SUPPORT=On \
+%else
+         -DDECRYPT_SUPPORT=Off \
+%endif
         -DSMACK=Off \
         -DDPL_LOG=ON \
         -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \
index c823a36..d1efa08 100644 (file)
@@ -112,7 +112,7 @@ ENDIF(LB_SUPPORT)
 MESSAGE(STATUS "add -DSEP_INSTALLER")
 ADD_DEFINITIONS("-DSEP_INSTALLER")
 
-
+IF(DECRYPT_SUPPORT)
 PKG_CHECK_MODULES(INSTALLER_STATIC_DEP
     dpl-efl
     dpl-event-efl
@@ -129,6 +129,23 @@ PKG_CHECK_MODULES(INSTALLER_STATIC_DEP
     libsmack
     REQUIRED
 )
+ELSE(DECRYPT_SUPPORT)
+PKG_CHECK_MODULES(INSTALLER_STATIC_DEP
+    dpl-efl
+    dpl-event-efl
+    dpl-utils-efl
+    dpl-wrt-dao-ro
+    dpl-wrt-dao-rw
+    wrt-commons-custom-handler-dao-rw
+    wrt-commons-security-origin-dao
+    wrt-plugins-types
+    pkgmgr-installer
+    pkgmgr-parser
+    pkgmgr-info
+    libsmack
+    REQUIRED
+)
+ENDIF(DECRYPT_SUPPORT)
 
 IF(LIVEBOX_SUPPORT)
 PKG_CHECK_MODULES(web-provider)
@@ -181,7 +198,9 @@ TARGET_LINK_LIBRARIES(${TARGET_INSTALLER_STATIC}
     )
 
 #for encryption
+IF(DECRYPT_SUPPORT)
 TARGET_LINK_LIBRARIES(${TARGET_INSTALLER_STATIC} -L/usr/lib/osp -losp-appfw )
+ENDIF(DECRYPT_SUPPORT)
 
 ADD_SUBDIRECTORY(pkg-manager)
 ADD_SUBDIRECTORY(wrt-installer)
index 46d88b9..125d9d4 100644 (file)
@@ -325,6 +325,13 @@ ConfigureResult JobWidgetInstall::PrePareInstallation(
         setTizenId(configData);
         setApplicationType(configData);
         m_needEncryption = detectResourceEncryption(configData);
+#ifdef DECRYPT
+        if(m_needEncryption)
+        {
+            LogError("Encryption is not supported in this version. Please Enable DECRYPT_SUPPORT");
+            return ConfigureResult:Failed;
+        }
+#endif
         setInstallLocationType(configData);
 
         // Configure installation
index 0b47580..17ec0b4 100644 (file)
 #include <dpl/scoped_fclose.h>
 #include <dpl/wrt-dao-ro/global_config.h>
 #include <dpl/string.h>
+#ifdef DECRYPT
 #include <FBaseByteBuffer.h>
 #include <security/FSecCrypto_TrustZoneService.h>
-
+#endif
 #include <widget_install/job_widget_install.h>
 #include <widget_install/widget_install_context.h>
 #include <widget_install/widget_install_errors.h>
@@ -167,6 +168,7 @@ void writeBytes(unsigned char* buffer, std::size_t count, FILE* stream)
         }
     } while ((bytesWritten != bytesToWrite) && (EINTR == errno));
 }
+#ifdef DECRYPT
 
 /*
  * get encrypted string from trustzone
@@ -223,6 +225,7 @@ Tizen::Base::ByteBuffer* TEST_dec(
 
     return pInstance->_TrustZoneService::DecryptN(*appInfo, pBuf);
 }
+#endif
 }
 
 namespace Jobs {
@@ -231,8 +234,12 @@ TaskEncryptResource::TaskEncryptResource(InstallerContext& context) :
     DPL::TaskDecl<TaskEncryptResource>(this),
     m_context(context)
 {
+#ifdef DECRYPT
+
     AddStep(&TaskEncryptResource::StepEncryptResource);
+#endif
 }
+#ifdef DECRYPT
 
 void TaskEncryptResource::StepEncryptResource()
 {
@@ -401,6 +408,6 @@ void TaskEncryptResource::EncryptFile(const std::string &fileName)
 
     m_context.widgetConfig.encryptedFiles.insert(fileInfo);
 }
-
+#endif
 } //namespace WidgetInstall
 } //namespace Jobs