[Release] wrt-installer_0.1.55
[framework/web/wrt-installer.git] / src / jobs / widget_install / task_encrypt_resource.cpp
index bca5665..0b47580 100644 (file)
@@ -313,6 +313,10 @@ void TaskEncryptResource::EncryptFile(const std::string &fileName)
                 "[" << DPL::GetErrnoString(error) << "]");
     }
     const std::size_t fileSize = info.st_size;
+    if (0 == fileSize) {
+        LogDebug(fileName << " size is 0, so encryption is skiped");
+        return;
+    }
 
     DPL::ScopedFClose inFile(openFile(fileName, "r"));
     DPL::ScopedFClose outFile(openFile(encFile, "w"));
@@ -347,6 +351,10 @@ void TaskEncryptResource::EncryptFile(const std::string &fileName)
             ByteBuffer *getBuffer = EncryptChunkByTrustZone(
                     &appInfo,
                     inChunk.get(), bytesRead);
+            if (getBuffer == NULL) {
+                ThrowMsg(Exceptions::EncryptionFailed,
+                        "Encryption Failed using TrustZone");
+            }
             int decBufSize = getBuffer->GetRemaining();
 
             outChunk.reset(new unsigned char[decBufSize]);