fixed wrong api called when install writable prealod app encrypted.
authorSoyoung Kim <sy037.kim@samsung.com>
Tue, 15 Oct 2013 06:19:50 +0000 (15:19 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Thu, 17 Oct 2013 07:25:15 +0000 (07:25 +0000)
[Issue#] N/A
[Problem] can't install writable preload app during building image.
[Cause] failed to encrypt resource because wrong api was called at encryption.
[Solution]
- There are encryption api separated with preload and download.
(ssm_encrypt_preloaded_application(), ssm_encrypt_application())
- So preload encryption api is called when installing writable preload app.
[SCMRequest] N/A

Change-Id: I67fa5721c317b5a5fb9a1c2d881bf3fa522d8a03

src/jobs/widget_install/task_encrypt_resource.cpp

index 32b0354..d3255fb 100644 (file)
@@ -167,10 +167,10 @@ void writeBytes(unsigned char* buffer, std::size_t count, FILE* stream)
     } while ((bytesWritten != bytesToWrite) && (EINTR == errno));
 }
 
-int ssmEncrypt(InstallMode::RootPath rootPath, std::string pkgId, const char*
+int ssmEncrypt(InstallMode::InstallTime time, std::string pkgId, const char*
         inChunk, int inBytes, char** outChunk, int *outBytes)
 {
-    if (rootPath == InstallMode::RootPath::RO) {
+    if (time == InstallMode::InstallTime::PRELOAD) {
         return ssm_encrypt_preloaded_application(inChunk, inBytes,
                 outChunk, outBytes);
     } else {
@@ -289,7 +289,7 @@ void TaskEncryptResource::EncryptFile(const std::string &fileName)
             if (0 != bytesRead) {
                 int outDecSize = 0;
                 char *outChunk = NULL;
-                if (0 != ssmEncrypt(m_context.mode.rootPath, pkgId,
+                if (0 != ssmEncrypt(m_context.mode.installTime, pkgId,
                             (char*)inChunk.get(), (int)bytesRead,
                             &outChunk, &outDecSize)) {
                     ThrowMsg(Exceptions::EncryptionFailed,