From: Sungbae Yoo Date: Mon, 6 Feb 2017 08:23:33 +0000 (+0900) Subject: Add privileges to APIs X-Git-Tag: accepted/tizen/common/20170213.174442~4 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fsecurity%2Fode.git;a=commitdiff_plain;h=a352b252a32c26c18ed262a34b9da44a9029fae9 Add privileges to APIs Signed-off-by: Sungbae Yoo Change-Id: Iddbef3d16fd277ba6c4d5ea68298931ab7eff968 --- diff --git a/server/external-encryption.cpp b/server/external-encryption.cpp index bcca38c..85233e9 100644 --- a/server/external-encryption.cpp +++ b/server/external-encryption.cpp @@ -44,6 +44,8 @@ #define EXTERNAL_OPTION_ONLY_NEW_FILE_VCONF_KEY VCONFKEY_SDE_ENCRYPT_NEWFILE #define EXTERNAL_OPTION_EXCEPT_FOR_MEDIA_FILE_VCONF_KEY VCONFKEY_SDE_EXCLUDE_MEDIAFILE +#define PRIVILEGE_PLATFORM "http://tizen.org/privilege/internal/default/platform" + namespace ode { namespace { @@ -160,15 +162,15 @@ void setOptions(unsigned int options) ExternalEncryption::ExternalEncryption(ODEControlContext &ctx) : context(ctx) { - context.expose(this, "", (int)(ExternalEncryption::mount)(std::string)); - context.expose(this, "", (int)(ExternalEncryption::umount)()); - context.expose(this, "", (int)(ExternalEncryption::encrypt)(std::string, unsigned int)); - context.expose(this, "", (int)(ExternalEncryption::decrypt)(std::string)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(ExternalEncryption::mount)(std::string)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(ExternalEncryption::umount)()); + context.expose(this, PRIVILEGE_PLATFORM, (int)(ExternalEncryption::encrypt)(std::string, unsigned int)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(ExternalEncryption::decrypt)(std::string)); context.expose(this, "", (int)(ExternalEncryption::isPasswordInitialized)()); - context.expose(this, "", (int)(ExternalEncryption::initPassword)(std::string)); - context.expose(this, "", (int)(ExternalEncryption::cleanPassword)(std::string)); - context.expose(this, "", (int)(ExternalEncryption::changePassword)(std::string, std::string)); - context.expose(this, "", (int)(ExternalEncryption::verifyPassword)(std::string)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(ExternalEncryption::initPassword)(std::string)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(ExternalEncryption::cleanPassword)(std::string)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(ExternalEncryption::changePassword)(std::string, std::string)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(ExternalEncryption::verifyPassword)(std::string)); context.expose(this, "", (int)(ExternalEncryption::getState)()); context.expose(this, "", (unsigned int)(ExternalEncryption::getSupportedOptions)()); diff --git a/server/internal-encryption.cpp b/server/internal-encryption.cpp index e0439d1..70ade69 100644 --- a/server/internal-encryption.cpp +++ b/server/internal-encryption.cpp @@ -36,6 +36,8 @@ #define INTERNAL_STATE_VCONF_KEY VCONFKEY_ODE_CRYPTO_STATE #define INTERNAL_OPTION_ONLY_USED_REGION_VCONF_KEY VCONFKEY_ODE_FAST_ENCRYPTION +#define PRIVILEGE_PLATFORM "http://tizen.org/privilege/internal/default/platform" + namespace ode { namespace { @@ -116,15 +118,15 @@ void setOptions(unsigned int options) InternalEncryption::InternalEncryption(ODEControlContext& ctx) : context(ctx) { - context.expose(this, "", (int)(InternalEncryption::mount)(std::string)); - context.expose(this, "", (int)(InternalEncryption::umount)()); - context.expose(this, "", (int)(InternalEncryption::encrypt)(std::string, unsigned int)); - context.expose(this, "", (int)(InternalEncryption::decrypt)(std::string)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::mount)(std::string)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::umount)()); + context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::encrypt)(std::string, unsigned int)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::decrypt)(std::string)); context.expose(this, "", (int)(InternalEncryption::isPasswordInitialized)()); - context.expose(this, "", (int)(InternalEncryption::initPassword)(std::string)); - context.expose(this, "", (int)(InternalEncryption::cleanPassword)(std::string)); - context.expose(this, "", (int)(InternalEncryption::changePassword)(std::string, std::string)); - context.expose(this, "", (int)(InternalEncryption::verifyPassword)(std::string)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::initPassword)(std::string)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::cleanPassword)(std::string)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::changePassword)(std::string, std::string)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::verifyPassword)(std::string)); context.expose(this, "", (int)(InternalEncryption::getState)()); context.expose(this, "", (unsigned int)(InternalEncryption::getSupportedOptions)()); } diff --git a/server/secure-erase.cpp b/server/secure-erase.cpp index 368c62e..47eca6b 100644 --- a/server/secure-erase.cpp +++ b/server/secure-erase.cpp @@ -31,6 +31,8 @@ #include "block-device.h" #include "ext4-tool.h" +#define PRIVILEGE_PLATFORM "http://tizen.org/privilege/internal/default/platform" + namespace ode { namespace { @@ -70,8 +72,8 @@ static int getTotalFileCount(const std::string &name) SecureErase::SecureErase(ODEControlContext &ctx) : context(ctx), devicePath("") { - context.expose(this, "", (int)(SecureErase::erase)(std::string)); - context.expose(this, "", (int)(SecureErase::clean)(std::string)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(SecureErase::erase)(std::string)); + context.expose(this, PRIVILEGE_PLATFORM, (int)(SecureErase::clean)(std::string)); } SecureErase::~SecureErase()