namespace {
const std::size_t ENCRYPTION_CHUNK_MAX_SIZE = 8192; // bytes
const std::size_t ENCRYPTION_DEC_CHUNK_SIZE = 4; // bytes
-static bool initWebApp = false;
std::set<std::string>& getSupportedForEncryption()
{
} while ((bytesWritten != bytesToWrite) && (EINTR == errno));
}
+int ssmEncrypt(InstallMode::RootPath rootPath, std::string pkgId, const char*
+ inChunk, int inBytes, char** outChunk, int *outBytes)
+{
+ if (rootPath == InstallMode::RootPath::RO) {
+ return ssm_encrypt_preloaded_application(inChunk, inBytes,
+ outChunk, outBytes);
+ } else {
+ return ssm_encrypt(pkgId.c_str(), pkgId.length(),
+ inChunk, inBytes,
+ outChunk, outBytes);
+ }
+}
}
namespace Jobs {
std::unique_ptr<unsigned char[]> inChunk(new unsigned char[chunkSize]);
std::size_t bytesRead = 0;
- std::string appid = DPL::ToUTF8String(m_context.widgetConfig.tzAppid);
+ /* TODO : pkgId should change to appId after wrt-client label changed. */
+ std::string pkgId = DPL::ToUTF8String(m_context.widgetConfig.tzPkgid);
do
{
if (0 != bytesRead) {
int outDecSize = 0;
char *outChunk = NULL;
- if (0 != ssm_encrypt(appid.c_str(), appid.length(),
+ if (0 != ssmEncrypt(m_context.mode.rootPath, pkgId,
(char*)inChunk.get(), (int)bytesRead,
&outChunk, &outDecSize)) {
ThrowMsg(Exceptions::EncryptionFailed,