From: Soyoung Kim Date: Tue, 5 Feb 2013 04:11:42 +0000 (+0900) Subject: Modify to get encryption key requested by osp security team X-Git-Tag: 2.1b_release~6^2~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b0a2b27c6e2f80fd63878cecfc891cfc21c40afa;p=framework%2Fweb%2Fwrt-commons.git Modify to get encryption key requested by osp security team [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] fixed to get device unique key from libcal to libcryptsvc. requested by osp security team [SCMRequest] N/A Change-Id: I05270eaf8a78796ff59770005dba4f932ea453f0 --- diff --git a/build/encryption/CMakeLists.txt b/build/encryption/CMakeLists.txt index bf38cae..7949864 100644 --- a/build/encryption/CMakeLists.txt +++ b/build/encryption/CMakeLists.txt @@ -54,7 +54,8 @@ TARGET_LINK_LIBRARIES(${TARGET_DPL_ENCRYPTION} ${TARGET_DPL_EFL} ) -TARGET_LINK_LIBRARIES(${TARGET_DPL_ENCRYPTION} -L./libs -lcal) +TARGET_LINK_LIBRARIES(${TARGET_DPL_ENCRYPTION} "-ldukgenerator" ) +TARGET_LINK_LIBRARIES(${TARGET_DPL_ENCRYPTION} "-lcryptsvc" ) # Target library properties SET_TARGET_PROPERTIES(${TARGET_DPL_ENCRYPTION} PROPERTIES diff --git a/build/encryption/libs/libcal.a b/build/encryption/libs/libcal.a deleted file mode 100755 index 8400c5f..0000000 Binary files a/build/encryption/libs/libcal.a and /dev/null differ diff --git a/build/encryption/libs/libcal.arm.a b/build/encryption/libs/libcal.arm.a deleted file mode 100755 index f1d622b..0000000 Binary files a/build/encryption/libs/libcal.arm.a and /dev/null differ diff --git a/build/encryption/libs/libcal.i586.a b/build/encryption/libs/libcal.i586.a deleted file mode 100755 index b02e413..0000000 Binary files a/build/encryption/libs/libcal.i586.a and /dev/null differ diff --git a/modules/encryption/src/resource_decryption.cpp b/modules/encryption/src/resource_decryption.cpp index 2ec612e..c599e64 100644 --- a/modules/encryption/src/resource_decryption.cpp +++ b/modules/encryption/src/resource_decryption.cpp @@ -26,6 +26,7 @@ #include #include #include +#include namespace { #define BITS_SIZE 128 @@ -52,9 +53,10 @@ void ResourceDecryptor::SetDecryptionKey(std::string userKey) return; } - char **duk = calculate(const_cast(userKey.c_str()), - userKey.size(), KEY_SIZE); - unsigned char *key = reinterpret_cast(*duk); + char* pKey = GetDeviceUniqueKey(const_cast(userKey.c_str()), + userKey.size(), KEY_SIZE); + + unsigned char *key = reinterpret_cast(pKey); if (0 > AES_set_decrypt_key(key, BITS_SIZE, &m_decKey)) { ThrowMsg(ResourceDecryptor::Exception::GetDecKeyFailed, diff --git a/modules/encryption/src/resource_encryption.cpp b/modules/encryption/src/resource_encryption.cpp index 96e90b7..8dc5284 100644 --- a/modules/encryption/src/resource_encryption.cpp +++ b/modules/encryption/src/resource_encryption.cpp @@ -24,6 +24,7 @@ #include #include +#include namespace { #define BITS_SIZE 128 @@ -54,9 +55,9 @@ void ResourceEncryptor::CreateEncryptionKey(std::string userKey) return; } - char **duk = calculate(const_cast(userKey.c_str()), - userKey.size(), KEY_SIZE); - unsigned char *key = reinterpret_cast(*duk); + char* pKey = GetDeviceUniqueKey(const_cast(userKey.c_str()), + userKey.size(), KEY_SIZE); + unsigned char *key = reinterpret_cast(pKey); if (0 > AES_set_encrypt_key(key, BITS_SIZE, &m_encKey)) { ThrowMsg(ResourceEncryptor::Exception::CreateEncKeyFailed, diff --git a/packaging/wrt-commons.spec b/packaging/wrt-commons.spec index a5a3dd2..b2d8bff 100644 --- a/packaging/wrt-commons.spec +++ b/packaging/wrt-commons.spec @@ -23,6 +23,9 @@ BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(libiri) BuildRequires: pkgconfig(libidn) +BuildRequires: libcryptsvc-devel +BuildRequires: dukgenerator +Requires: libcryptsvc %description Wrt common library @@ -45,12 +48,6 @@ Wrt common library development headers %build -%ifarch %{ix86} -cp build/encryption/libs/libcal.i586.a build/encryption/libs/libcal.a -%else -cp build/encryption/libs/libcal.arm.a build/encryption/libs/libcal.a -%endif - export LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--hash-style=both -Wl,--as-needed" cmake . -DVERSION=%{version} \