Modify to get encryption key requested by osp security team
authorSoyoung Kim <sy037.kim@samsung.com>
Tue, 5 Feb 2013 04:11:42 +0000 (13:11 +0900)
committerGerrit Code Review <gerrit2@kim11>
Mon, 18 Feb 2013 07:25:05 +0000 (16:25 +0900)
[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

build/encryption/CMakeLists.txt
build/encryption/libs/libcal.a [deleted file]
build/encryption/libs/libcal.arm.a [deleted file]
build/encryption/libs/libcal.i586.a [deleted file]
modules/encryption/src/resource_decryption.cpp
modules/encryption/src/resource_encryption.cpp
packaging/wrt-commons.spec

index bf38cae..7949864 100644 (file)
@@ -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 (executable)
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 (executable)
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 (executable)
index b02e413..0000000
Binary files a/build/encryption/libs/libcal.i586.a and /dev/null differ
index 2ec612e..c599e64 100644 (file)
@@ -26,6 +26,7 @@
 #include <string>
 #include <dpl/log/log.h>
 #include <dpl/exception.h>
+#include <dukgen.h>
 
 namespace {
 #define BITS_SIZE 128
@@ -52,9 +53,10 @@ void ResourceDecryptor::SetDecryptionKey(std::string userKey)
         return;
     }
 
-    char **duk = calculate(const_cast<char*>(userKey.c_str()),
-                           userKey.size(), KEY_SIZE);
-    unsigned char *key = reinterpret_cast<unsigned char*>(*duk);
+    char* pKey = GetDeviceUniqueKey(const_cast<char*>(userKey.c_str()),
+            userKey.size(), KEY_SIZE);
+
+    unsigned char *key = reinterpret_cast<unsigned char*>(pKey);
 
     if (0 > AES_set_decrypt_key(key, BITS_SIZE, &m_decKey)) {
         ThrowMsg(ResourceDecryptor::Exception::GetDecKeyFailed,
index 96e90b7..8dc5284 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <fcntl.h>
 #include <dpl/log/log.h>
+#include <dukgen.h>
 
 namespace {
 #define BITS_SIZE 128
@@ -54,9 +55,9 @@ void ResourceEncryptor::CreateEncryptionKey(std::string userKey)
         return;
     }
 
-    char **duk = calculate(const_cast<char*>(userKey.c_str()),
-                           userKey.size(), KEY_SIZE);
-    unsigned char *key = reinterpret_cast<unsigned char*>(*duk);
+    char* pKey = GetDeviceUniqueKey(const_cast<char*>(userKey.c_str()),
+            userKey.size(), KEY_SIZE);
+    unsigned char *key = reinterpret_cast<unsigned char*>(pKey);
 
     if (0 > AES_set_encrypt_key(key, BITS_SIZE, &m_encKey)) {
         ThrowMsg(ResourceEncryptor::Exception::CreateEncKeyFailed,
index a5a3dd2..b2d8bff 100644 (file)
@@ -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} \