From: Lukasz Pawelczyk Date: Tue, 9 May 2017 10:44:56 +0000 (+0200) Subject: Extension API and its skeleton implementation X-Git-Tag: submit/tizen/20170724.061427~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50b6a245a786e38014647ee67aec56a665f1dd7b;p=platform%2Fcore%2Fsecurity%2Fode.git Extension API and its skeleton implementation This commit adds API for handling SD card formatted as an extension to an internal memory. It also adds the connection layer for the API between the library and the server as well as a skeleton implementation for the API based on the implementation of external-encryption. Change-Id: I1a852fa6a484bd884fed95d2965c0a6a5b2e3369 --- diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 24f3b26..5e2e94d 100755 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -22,9 +22,11 @@ SET(SOURCES client.cpp secure-erase.cpp internal-encryption.cpp external-encryption.cpp + extension-encryption.cpp ode/secure-erase.cpp ode/internal-encryption.cpp ode/external-encryption.cpp + ode/extension-encryption.cpp ) SET(CAPI_INCLUDE_FILES ode/common.h diff --git a/lib/extension-encryption.cpp b/lib/extension-encryption.cpp new file mode 100644 index 0000000..fce932c --- /dev/null +++ b/lib/extension-encryption.cpp @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ +#include "rmi/extension-encryption.h" + +namespace ode { + +ExtensionEncryption::ExtensionEncryption(ODEControlContext& ctx) : + context(ctx) +{ +} + +ExtensionEncryption::~ExtensionEncryption() +{ +} + +int ExtensionEncryption::mount(const std::string& password) +{ + try { + return context->methodCall("ExtensionEncryption::mount", password); + } catch (runtime::Exception& e) { + return -1; + } +} + +int ExtensionEncryption::umount() +{ + try { + return context->methodCall("ExtensionEncryption::umount"); + } catch (runtime::Exception& e) { + return -1; + } +} + +int ExtensionEncryption::format(const std::string& password) +{ + try { + return context->methodCall("ExtensionEncryption::format", password); + } catch (runtime::Exception& e) { + return -1; + } +} + +int ExtensionEncryption::isPasswordInitialized() +{ + try { + return context->methodCall("ExtensionEncryption::isPasswordInitialized"); + } catch (runtime::Exception& e) { + return -1; + } +} + +int ExtensionEncryption::initPassword(const std::string& password) +{ + try { + return context->methodCall("ExtensionEncryption::initPassword", + password); + } catch (runtime::Exception& e) { + return -1; + } +} + +int ExtensionEncryption::cleanPassword(const std::string& password) +{ + try { + return context->methodCall("ExtensionEncryption::cleanPassword", + password); + } catch (runtime::Exception& e) { + return -1; + } +} + +int ExtensionEncryption::changePassword(const std::string& oldPassword, + const std::string& newPassword) +{ + try { + return context->methodCall("ExtensionEncryption::changePassword", + oldPassword, newPassword); + } catch (runtime::Exception& e) { + return -1; + } +} + +int ExtensionEncryption::verifyPassword(const std::string& password) +{ + try { + return context->methodCall("ExtensionEncryption::verifyPassword", + password); + } catch (runtime::Exception& e) { + return -1; + } +} + +int ExtensionEncryption::getState() +{ + try { + return context->methodCall("ExtensionEncryption::getState"); + } catch (runtime::Exception& e) { + return -1; + } +} + +} // namespace ode diff --git a/lib/ode/extension-encryption.cpp b/lib/ode/extension-encryption.cpp new file mode 100644 index 0000000..9fc132d --- /dev/null +++ b/lib/ode/extension-encryption.cpp @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +#include "debug.h" +#include "extension-encryption.h" + +#include "client.h" +#include "rmi/extension-encryption.h" + +using namespace ode; + +int ode_extension_encryption_mount(const char* password) +{ + ODEContext client; + RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED); + ExtensionEncryption extension = client.createInterface(); + + return extension.mount(password); +} + +int ode_extension_encryption_umount() +{ + ODEContext client; + RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED); + ExtensionEncryption extension = client.createInterface(); + + return extension.umount(); +} + +int ode_extension_encryption_format(const char* password) +{ + RET_ON_FAILURE(password, ODE_ERROR_INVALID_PARAMETER); + + ODEContext client; + RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED); + ExtensionEncryption extension = client.createInterface(); + + return extension.format(password); +} + +int ode_extension_encryption_is_password_initialized(bool* result) +{ + RET_ON_FAILURE(result, ODE_ERROR_INVALID_PARAMETER); + + ODEContext client; + RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED); + ExtensionEncryption extension = client.createInterface(); + int ret = extension.isPasswordInitialized(); + + RET_ON_FAILURE(ret >= 0, ODE_ERROR_INVALID_PARAMETER); + + *result = ret; + return ODE_ERROR_NONE; +} + +int ode_extension_encryption_init_password(const char* password) +{ + RET_ON_FAILURE(password, ODE_ERROR_INVALID_PARAMETER); + + ODEContext client; + RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED); + ExtensionEncryption extension = client.createInterface(); + + return extension.initPassword(password); +} + +int ode_extension_encryption_clean_password(const char* password) +{ + RET_ON_FAILURE(password, ODE_ERROR_INVALID_PARAMETER); + + ODEContext client; + RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED); + ExtensionEncryption extension = client.createInterface(); + + return extension.cleanPassword(password); +} + +int ode_extension_encryption_change_password(const char* old_password, + const char* new_password) +{ + RET_ON_FAILURE(old_password, ODE_ERROR_INVALID_PARAMETER); + RET_ON_FAILURE(new_password, ODE_ERROR_INVALID_PARAMETER); + + ODEContext client; + RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED); + ExtensionEncryption extension = client.createInterface(); + + return extension.changePassword(old_password, new_password); +} + +int ode_extension_encryption_verify_password(const char* password, bool* result) +{ + RET_ON_FAILURE(password, ODE_ERROR_INVALID_PARAMETER); + RET_ON_FAILURE(result, ODE_ERROR_INVALID_PARAMETER); + + ODEContext client; + RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED); + ExtensionEncryption extension = client.createInterface(); + int ret = extension.verifyPassword(password); + + RET_ON_FAILURE(ret >= 0, ODE_ERROR_INVALID_PARAMETER); + + *result = ret; + return ODE_ERROR_NONE; +} + +int ode_extension_encryption_get_state(int* state) +{ + RET_ON_FAILURE(state, ODE_ERROR_INVALID_PARAMETER); + + ODEContext client; + RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED); + ExtensionEncryption extension = client.createInterface(); + int ret = extension.getState(); + + RET_ON_FAILURE(ret >= 0, ODE_ERROR_INVALID_PARAMETER); + + *state = ret; + return ODE_ERROR_NONE; +} + +static std::unique_ptr mountEventCallbackContext; + +int ode_extension_encryption_set_mount_event_cb(ode_mount_event_cb callback, void *user_data) +{ + RET_ON_FAILURE(callback, ODE_ERROR_INVALID_PARAMETER); + + mountEventCallbackContext.reset(new ODEContext); + RET_ON_FAILURE(mountEventCallbackContext->connect() == 0, ODE_ERROR_CONNECTION_REFUSED); + + int ret = mountEventCallbackContext->subscribeSignal("ExtensionEncryption::mount", callback, user_data); + RET_ON_FAILURE(ret >= 0, ODE_ERROR_INVALID_PARAMETER); + + return ODE_ERROR_NONE; +} + +int ode_extension_encryption_unset_mount_event_cb() +{ + mountEventCallbackContext.reset(); + + return ODE_ERROR_NONE; +} diff --git a/lib/ode/extension-encryption.h b/lib/ode/extension-encryption.h new file mode 100644 index 0000000..b86af25 --- /dev/null +++ b/lib/ode/extension-encryption.h @@ -0,0 +1,249 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +#ifndef __CAPI_ODE_EXTENSION_ENCRYPTION_H__ +#define __CAPI_ODE_EXTENSION_ENCRYPTION_H__ + +#include + +/** + * @file extension-encryption.h + * @brief This file provides APIs to manage the encryption of an external + * storage such as SD card, used as an extension of the internal + * memory. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Mount extension storage encrypted with a given password + * @details Administrator can use this API to mount encrypted extension + * storage. + * @since_tizen 4.0 + * @return #ODE_ERROR_NONE on success, otherwise a negative value + * @retval #ODE_ERROR_NONE Successful + * @retval #ODE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ODE_ERROR_TIMED_OUT Time out + * @retval #ODE_ERROR_KEY_REJECTED Password doesn't match + * @retval #ODE_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ODE_ERROR_PERMISSION_DENIED The application does not have + * the privilege to call this API + * @pre The password must match with what is set by + * ode_extension_encryption_init_password(). + * @see ode_extension_encryption_init_password() + * @see ode_extension_encryption_umount() + */ +ODE_API int ode_extension_encryption_mount(const char* password); + +/** + * @brief Umount extension storage + * @details Administrator can use this API to unmount extension storage. + * @since_tizen 4.0 + * @return #ODE_ERROR_NONE on success, otherwise a negative value + * @retval #ODE_ERROR_NONE Successful + * @retval #ODE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ODE_ERROR_TIMED_OUT Time out + * @retval #ODE_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ODE_ERROR_PERMISSION_DENIED The application does not have + * the privilege to call this API + * @see ode_extension_encryption_mount() + */ +ODE_API int ode_extension_encryption_umount(); + +/** + * @brief Formats and sets up encryption for extension storage with a + * given password + * @details Administrator can use this API to format and encrypt external + * storage that will be used as an extension to internal memory. + * @since_tizen 4.0 + * @param[in] password The password to encrypt extension storage + * @param[in] options Encryption options + * @return #ODE_ERROR_NONE on success, otherwise a negative value + * @retval #ODE_ERROR_NONE Successful + * @retval #ODE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ODE_ERROR_TIMED_OUT Time out + * @retval #ODE_ERROR_KEY_REJECTED Password doesn't match + * @retval #ODE_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ODE_ERROR_PERMISSION_DENIED The application does not have + * the privilege to call this API + * @pre The password must match with what is set by + * ode_extension_encryption_init_password(). + * @see ode_extension_encryption_init_password() + * @see ode_extension_encryption_mount() + */ +ODE_API int ode_extension_encryption_format(const char* password); + +/** + * @brief Checks whether the extension encryption password was created + * @details Administrator can use this API to check if the password that + will be used for extension storage encryption exists. + * @since_tizen 4.0 + * @param[out] result Whether encryption password was created + * @return #ODE_ERROR_NONE on success, otherwise a negative value + * @retval #ODE_ERROR_NONE Successful + * @retval #ODE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ODE_ERROR_TIMED_OUT Time out + * @retval #ODE_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ODE_ERROR_PERMISSION_DENIED The application does not have + * the privilege to call this API + * @see ode_extension_encryption_init_password() + * @see ode_extension_encryption_clean_password() + */ +ODE_API int ode_extension_encryption_is_password_initialized(bool* result); + +/** + * @brief Initialize extension encryption password to a given password + * @details Administrator can use this API to set a new password that will + * be used for extension storage encryption. + * @since_tizen 4.0 + * @param[in] password The password to set + * @return #ODE_ERROR_NONE on success, otherwise a negative value + * @retval #ODE_ERROR_NONE Successful + * @retval #ODE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ODE_ERROR_TIMED_OUT Time out + * @retval #ODE_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ODE_ERROR_PERMISSION_DENIED The application does not have + * the privilege to call this API + * @see ode_extension_encryption_change_password() + * @see ode_extension_encryption_clean_password() + * @see ode_extension_encryption_format() + * @see ode_extension_encryption_mount() + */ +ODE_API int ode_extension_encryption_init_password(const char* password); + +/** + * @brief Removes extension encryption password + * @details Administrator can use this API to delete password that was set + by ode_extension_encryption_init_password(). + * @since_tizen 4.0 + * @param[in] password The password to delete + * @return #ODE_ERROR_NONE on success, otherwise a negative value + * @retval #ODE_ERROR_NONE Successful + * @retval #ODE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ODE_ERROR_TIMED_OUT Time out + * @retval #ODE_ERROR_KEY_REJECTED old_password doesn't match + * @retval #ODE_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ODE_ERROR_PERMISSION_DENIED The application does not have + * the privilege to call this API + * @pre The password must match with what is set by + * ode_extension_encryption_init_password(). + * @see ode_extension_encryption_init_password() + */ +ODE_API int ode_extension_encryption_clean_password(const char* password); + +/** + * @brief Changes the password for extension storage + * @details Administrator can use this API to change password for extension + * storage. + * @since_tizen 4.0 + * @param[in] old_password Current password of extension storage + * @param[in] new_password The password to use newly for extension storage + * @return #ODE_ERROR_NONE on success, otherwise a negative value + * @retval #ODE_ERROR_NONE Successful + * @retval #ODE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ODE_ERROR_TIMED_OUT Time out + * @retval #ODE_ERROR_KEY_REJECTED old_password doesn't match + * @retval #ODE_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ODE_ERROR_PERMISSION_DENIED The application does not have + * the privilege to call this API + * @pre The password must match with what is set by + * ode_extension_encryption_init_password(). + * @see ode_extension_encryption_init_password() + * @see ode_extension_encryption_format() + */ +ODE_API int ode_extension_encryption_change_password(const char* old_password, + const char* new_password); + +/** + * @brief Verifies if the given password is extension encryption password + * @details Administrator can use this API to find if a password is used + by extension encryption. + * @since_tizen 4.0 + * @param[int] password The password to be verified + * @param[out] result The result of verification + * @return #ODE_ERROR_NONE on success, otherwise a negative value + * @retval #ODE_ERROR_NONE Successful + * @retval #ODE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ODE_ERROR_TIMED_OUT Time out + * @retval #ODE_ERROR_PERMISSION_DENIED The application does not have + * the privilege to call this API + * @pre The password must match with what is set by + * ode_extension_encryption_init_password(). + * @see ode_extension_encryption_init_password() + * @see ode_extension_encryption_format() + */ +ODE_API int ode_extension_encryption_verify_password(const char* password, bool* result); + +/** + * @brief Gets the current encryption state of extension storage + * @details Administrator can use this API to get current encryption state + * of extension storage. + * @since_tizen 4.0 + * @param[out] state The encryption state of extension storage + * @return #ODE_ERROR_NONE on success, otherwise a negative value + * @retval #ODE_ERROR_NONE Successful + * @retval #ODE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ODE_ERROR_TIMED_OUT Time out + * @retval #ODE_ERROR_PERMISSION_DENIED The application does not have + * the privilege to call this API + * @see ode_extension_encryption_format() + * @see #ode_state_e + */ +ODE_API int ode_extension_encryption_get_state(int* state); + +/** + * @brief Registers a callback to get mount event of extension storage + * @details Services can use this API to attach a callback to be called + * by mount event of extension storage with encryption. + * @since_tizen 4.0 + * @param[in] callback The mount event callback function + * @param[in] user_data The user data passed to the callback function + * @return #ODE_ERROR_NONE on success, otherwise a negative value + * @retval #ODE_ERROR_NONE Successful + * @retval #ODE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ODE_ERROR_TIMED_OUT Time out + * @post If the callback is not needed, + * ode_extension_encryption_unset_mount_event_cb() must be called. + * @see ode_extension_encryption_mount() + * @see ode_extension_encryption_unset_mount_event_cb() + */ +ODE_API int ode_extension_encryption_set_mount_event_cb(ode_mount_event_cb callback, void *user_data); + +/** + * @brief Unregisters a callback to get mount event of extension storage + * @details Services can use this API to detach a callback to be called + * by mount event of extension storage with encryption. + * @since_tizen 4.0 + * @return #ODE_ERROR_NONE on success, otherwise a negative value + * @retval #ODE_ERROR_NONE Successful + * @retval #ODE_ERROR_TIMED_OUT Time out + * the privilege to call this API + * @see ode_extension_encryption_mount() + * @see ode_extension_encryption_set_mount_event_cb() + */ +ODE_API int ode_extension_encryption_unset_mount_event_cb(); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __CAPI_ODE_EXTENSION_ENCRYPTION_H__ */ diff --git a/lib/ode/external-encryption.h b/lib/ode/external-encryption.h index 28a8548..d40fb5f 100644 --- a/lib/ode/external-encryption.h +++ b/lib/ode/external-encryption.h @@ -286,9 +286,9 @@ typedef enum { ODE_API int ode_external_encryption_get_supported_options(unsigned int* options); /** - * @brief Register a callback to get mount event of internal storage + * @brief Register a callback to get mount event of external storage * @details Services can use this API to attach a callback to be called - * by mount event of internal storage with encryption. + * by mount event of external storage with encryption. * @since_tizen 4.0 * @param[in] callback The mount event callback function * @param[in] user_data The user data passed to the callback function @@ -296,18 +296,17 @@ ODE_API int ode_external_encryption_get_supported_options(unsigned int* options) * @retval #ODE_ERROR_NONE Successful * @retval #ODE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #ODE_ERROR_TIMED_OUT Time out - * the privilege to call this API * @post If the callback is not needed, - * ode_external_encryption_set_mount_event_cb() must be called. + * ode_external_encryption_unset_mount_event_cb() must be called. * @see ode_external_encryption_mount() * @see ode_external_encryption_unset_mount_event_cb() */ ODE_API int ode_external_encryption_set_mount_event_cb(ode_mount_event_cb callback, void *user_data); /** - * @brief Unregister a callback to get mount event of internal storage + * @brief Unregister a callback to get mount event of external storage * @details Services can use this API to detach a callback to be called - * by mount event of internal storage with encryption. + * by mount event of external storage with encryption. * @since_tizen 4.0 * @return #ODE_ERROR_NONE on success, otherwise a negative value * @retval #ODE_ERROR_NONE Successful diff --git a/lib/ode/internal-encryption.h b/lib/ode/internal-encryption.h index 8fe1843..885b6b6 100644 --- a/lib/ode/internal-encryption.h +++ b/lib/ode/internal-encryption.h @@ -298,7 +298,7 @@ ODE_API int ode_internal_encryption_get_supported_options(unsigned int* options) * @retval #ODE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #ODE_ERROR_TIMED_OUT Time out * @post If the callback is not needed, - * ode_internal_encryption_set_mount_event_cb() must be called. + * ode_internal_encryption_unset_mount_event_cb() must be called. * @see ode_internal_encryption_mount() * @see ode_internal_encryption_unset_mount_event_cb() */ diff --git a/rmi/extension-encryption.h b/rmi/extension-encryption.h new file mode 100644 index 0000000..cdcb2ab --- /dev/null +++ b/rmi/extension-encryption.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +#ifndef __EXTENSION_ENCRYPTION_H__ +#define __EXTENSION_ENCRYPTION_H__ + +#include + +#include "context.h" + +namespace ode { + +/** + * This class provides APIs to manage the encryption of external storage + * such as SD card, used as an extension of the internal memory. + */ + +class ExtensionEncryption final { +public: + ExtensionEncryption(ODEControlContext& ctxt); + ~ExtensionEncryption(); + + int mount(const std::string& password); + int umount(); + + int format(const std::string& password); + + int isPasswordInitialized(); + int initPassword(const std::string& password); + int cleanPassword(const std::string& password); + int changePassword(const std::string& oldPW, const std::string& newPW); + int verifyPassword(const std::string& password); + + enum State { + Encrypted = 0x01, + Corrupted = 0x02, + }; + + int getState(); + +private: + ODEControlContext& context; +}; + +} // namespace ode + +#endif // __EXTENSION_ENCRYPTION_H__ diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index b4b0209..7c0ee26 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -25,6 +25,7 @@ SET(SERVER_SRCS main.cpp kernel-keyring.cpp internal-encryption.cpp external-encryption.cpp + extension-encryption.cpp engine/encryption/ext4-engine.cpp engine/encryption/dmcrypt-engine.cpp engine/encryption/ecryptfs-engine.cpp diff --git a/server/extension-encryption.cpp b/server/extension-encryption.cpp new file mode 100644 index 0000000..e430d5e --- /dev/null +++ b/server/extension-encryption.cpp @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +#include "rmi/extension-encryption.h" + +namespace ode { + +ExtensionEncryption::ExtensionEncryption(ODEControlContext &ctx) : + context(ctx) +{ +} + +ExtensionEncryption::~ExtensionEncryption() +{ +} + +int ExtensionEncryption::mount(const std::string& password) +{ + return -1; +} + +int ExtensionEncryption::umount() +{ + return -1; +} + +int ExtensionEncryption::format(const std::string &password) +{ + return -1; +} + +int ExtensionEncryption::isPasswordInitialized() +{ + return -1; +} + +int ExtensionEncryption::initPassword(const std::string& password) +{ + return -1; +} + +int ExtensionEncryption::cleanPassword(const std::string& password) +{ + return -1; +} + +int ExtensionEncryption::changePassword(const std::string &oldPassword, + const std::string &newPassword) +{ + return -1; +} + +int ExtensionEncryption::verifyPassword(const std::string& password) +{ + return -1; +} + +int ExtensionEncryption::getState() +{ + return -1; +} + +} // namespace ode diff --git a/server/server.cpp b/server/server.cpp index ed218be..4dada85 100644 --- a/server/server.cpp +++ b/server/server.cpp @@ -22,6 +22,7 @@ #include "rmi/secure-erase.h" #include "rmi/internal-encryption.h" #include "rmi/external-encryption.h" +#include "rmi/extension-encryption.h" #include "key-manager/key-generator.h" #include "server.h" @@ -35,6 +36,7 @@ const std::string ODE_MANAGER_ADDRESS = "/tmp/.ode.sock"; std::unique_ptr secureErase; std::unique_ptr internalEncryption; std::unique_ptr externalEncryption; +std::unique_ptr extensionEncryption; } // namespace @@ -53,6 +55,7 @@ Server::Server() secureErase.reset(new ode::SecureErase(*this)); internalEncryption.reset(new ode::InternalEncryption(*this)); externalEncryption.reset(new ode::ExternalEncryption(*this)); + extensionEncryption.reset(new ode::ExtensionEncryption(*this)); ode::KeyGenerator::init(); }