From e2a068c55f35e25ede7b344dd814e9b8bf34d3a0 Mon Sep 17 00:00:00 2001 From: Soyoung Kim Date: Mon, 11 Mar 2013 19:26:55 +0900 Subject: [PATCH] Revert "Add encrypt/decrypt API from trust zone" This reverts commit 389e38f8c7060bb4d219818fa212970e85b39f72. --- CMakeLists.txt | 1 - build/encryption/CMakeLists.txt | 2 - .../include/dpl/encryption/resource_decryption.h | 10 +---- .../include/dpl/encryption/resource_encryption.h | 10 +---- modules/encryption/src/resource_decryption.cpp | 42 +-------------------- modules/encryption/src/resource_encryption.cpp | 43 +--------------------- packaging/wrt-commons.spec | 3 -- 7 files changed, 6 insertions(+), 105 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d36d0dc..45cc829 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,6 @@ ELSE(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling") ENDIF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling") OPTION(WITH_TESTS "Build tests" OFF) - ADD_DEFINITIONS("-DDPL_LOGS_ENABLED") #@@@@@@@@@@@@@ # Compiler flags SET(CMAKE_C_FLAGS_PROFILING "-O2") diff --git a/build/encryption/CMakeLists.txt b/build/encryption/CMakeLists.txt index e96b3dd..7949864 100644 --- a/build/encryption/CMakeLists.txt +++ b/build/encryption/CMakeLists.txt @@ -23,7 +23,6 @@ INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(SYS_ENCRYPTION dlog openssl - osp-appfw REQUIRED ) @@ -57,7 +56,6 @@ TARGET_LINK_LIBRARIES(${TARGET_DPL_ENCRYPTION} TARGET_LINK_LIBRARIES(${TARGET_DPL_ENCRYPTION} "-ldukgenerator" ) TARGET_LINK_LIBRARIES(${TARGET_DPL_ENCRYPTION} "-lcryptsvc" ) -TARGET_LINK_LIBRARIES(${TARGET_DPL_ENCRYPTION} -L/usr/lib/osp -losp-appfw ) # Target library properties SET_TARGET_PROPERTIES(${TARGET_DPL_ENCRYPTION} PROPERTIES diff --git a/modules/encryption/include/dpl/encryption/resource_decryption.h b/modules/encryption/include/dpl/encryption/resource_decryption.h index 1f10fdb..a6d7af0 100644 --- a/modules/encryption/include/dpl/encryption/resource_decryption.h +++ b/modules/encryption/include/dpl/encryption/resource_decryption.h @@ -28,6 +28,8 @@ #include #include +extern char** calculate(char*pappId, int idLen, int keyLen); + namespace WRTDecryptor { class ResourceDecryptor { @@ -49,17 +51,9 @@ class ResourceDecryptor unsigned char* decBuf, size_t chunkSize); - /* TrustZone */ - int DecryptChunkByTrustZone( - std::string pkgid, - const unsigned char *inBuffer, - int inBufSize); - void getDecryptStringByTrustZone(unsigned char *decBuffer); - private: AES_KEY* GetDecryptionKey(); AES_KEY m_decKey; - void *m_getBuffer; }; } //namespace WRTDecryptor diff --git a/modules/encryption/include/dpl/encryption/resource_encryption.h b/modules/encryption/include/dpl/encryption/resource_encryption.h index 32d7132..f2e4988 100644 --- a/modules/encryption/include/dpl/encryption/resource_encryption.h +++ b/modules/encryption/include/dpl/encryption/resource_encryption.h @@ -28,6 +28,8 @@ #include #include +extern char** calculate(char*pappId, int idLen, int keyLen); + namespace WRTEncryptor { class ResourceEncryptor { @@ -51,17 +53,9 @@ class ResourceEncryptor void EncryptChunk(unsigned char* inputBuf, unsigned char* encBuf, size_t chunkSize); - /* TrustZone */ - int EncryptChunkByTrustZone( - std::string pkgid, - const unsigned char *plainBuffer, - int pBufSize); - void getEncStringByTrustZone(unsigned char *encBuffer); - private: AES_KEY GetEncryptionkey(); AES_KEY m_encKey; - void *m_getBuffer; }; } //namespace WRTEncryptor diff --git a/modules/encryption/src/resource_decryption.cpp b/modules/encryption/src/resource_decryption.cpp index d51adfb..c599e64 100644 --- a/modules/encryption/src/resource_decryption.cpp +++ b/modules/encryption/src/resource_decryption.cpp @@ -27,16 +27,13 @@ #include #include #include -#include -#include namespace { #define BITS_SIZE 128 #define KEY_SIZE 16 } namespace WRTDecryptor { -ResourceDecryptor::ResourceDecryptor() : - m_getBuffer(NULL) +ResourceDecryptor::ResourceDecryptor() { LogDebug("Started Decryption"); } @@ -87,41 +84,4 @@ void ResourceDecryptor::GetDecryptedChunk(unsigned char* AES_cbc_encrypt(inBuf, decBuf, inBufSize, &m_decKey, ivec, AES_DECRYPT); LogDebug("Success decryption"); } - -int ResourceDecryptor::DecryptChunkByTrustZone( - std::string pkgid, const unsigned char* inBuffer, - int inBufSize) -{ - using namespace Tizen::Base; - - const byte *b_pkgid = reinterpret_cast(pkgid.c_str()); - ByteBuffer appInfo; - appInfo.Construct(pkgid.length()); - appInfo.SetArray(b_pkgid, 0, pkgid.length()); - appInfo.Flip(); - - Tizen::Security::Crypto::_TrustZoneService* pInstance; - pInstance = Tizen::Security::Crypto::_TrustZoneService::GetInstance(); - - ByteBuffer pBuf; - pBuf.Construct(inBufSize); - const byte *pByte = reinterpret_cast(inBuffer); - pBuf.SetArray(pByte, 0, inBufSize); - pBuf.Flip(); - - ByteBuffer *getBuffer = pInstance->_TrustZoneService::DecryptN(appInfo, pBuf); - - m_getBuffer = reinterpret_cast(getBuffer); - return getBuffer->GetRemaining(); -} - -void ResourceDecryptor::getDecryptStringByTrustZone(unsigned char *decBuffer) -{ - using namespace Tizen::Base; - LogDebug("Get decrypted string"); - ByteBuffer *buffer = reinterpret_cast(m_getBuffer); - memcpy(decBuffer, buffer->GetPointer(), buffer->GetRemaining()); - buffer->Reset(); -} - } //namespace WRTDecryptor diff --git a/modules/encryption/src/resource_encryption.cpp b/modules/encryption/src/resource_encryption.cpp index 67f9061..8dc5284 100644 --- a/modules/encryption/src/resource_encryption.cpp +++ b/modules/encryption/src/resource_encryption.cpp @@ -25,16 +25,13 @@ #include #include #include -#include -#include namespace { #define BITS_SIZE 128 #define KEY_SIZE 16 } namespace WRTEncryptor { -ResourceEncryptor::ResourceEncryptor() : - m_getBuffer(NULL) +ResourceEncryptor::ResourceEncryptor() { LogDebug("Started Encrytion"); } @@ -86,42 +83,4 @@ void ResourceEncryptor::EncryptChunk(unsigned char* AES_cbc_encrypt(inputBuf, encBuf, chunkSize, &m_encKey, ivec, AES_ENCRYPT); } - -int ResourceEncryptor::EncryptChunkByTrustZone( - std::string pkgid, - const unsigned char *plainBuffer, - int pBufSize) -{ - using namespace Tizen::Base; - - const byte *b_pkgid = reinterpret_cast(pkgid.c_str()); - ByteBuffer appInfo; - appInfo.Construct(pkgid.length()); - appInfo.SetArray(b_pkgid, 0, pkgid.length()); - appInfo.Flip(); - - Tizen::Security::Crypto::_TrustZoneService* pInstance; - pInstance = Tizen::Security::Crypto::_TrustZoneService::GetInstance(); - - ByteBuffer pBuf; - pBuf.Construct(pBufSize); - const byte *pByte = reinterpret_cast(plainBuffer); - pBuf.SetArray(pByte, 0, pBufSize); - pBuf.Flip(); - - ByteBuffer *getBuffer = - pInstance->_TrustZoneService::EncryptN(appInfo, pBuf); - m_getBuffer = reinterpret_cast(getBuffer); - - return getBuffer->GetRemaining(); -} - -void ResourceEncryptor::getEncStringByTrustZone(unsigned char *encBuffer) -{ - using namespace Tizen::Base; - LogDebug("Get encrypted String"); - ByteBuffer *buffer = reinterpret_cast(m_getBuffer); - memcpy(encBuffer, buffer->GetPointer(), buffer->GetRemaining()); - buffer->Reset(); -} } //namespace ResourceEnc diff --git a/packaging/wrt-commons.spec b/packaging/wrt-commons.spec index 77f4d1e..2ed0e5d 100644 --- a/packaging/wrt-commons.spec +++ b/packaging/wrt-commons.spec @@ -23,12 +23,9 @@ BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(libiri) BuildRequires: pkgconfig(libidn) -BuildRequires: pkgconfig(osp-appfw) BuildRequires: libcryptsvc-devel BuildRequires: dukgenerator-devel -BuildRequires: osp-appfw-internal-devel Requires: libcryptsvc -Requires: osp-appfw %description Wrt common library -- 2.7.4