From b95d5371a05a90d3d1a2617fae2aa3996529b9aa Mon Sep 17 00:00:00 2001 From: KyungwooNoh Date: Mon, 24 Jun 2013 14:42:11 +0900 Subject: [PATCH] remove _TrustZoneService class Change-Id: I44d3c7c5e1eb5a71e32333153a5d54d2a21892c2 Signed-off-by: KyungwooNoh --- src/security/CMakeLists.txt | 2 - .../crypto/FSecCrypto_TrustZoneService.cpp | 171 --------------------- .../crypto/FSecCrypto_TrustZoneServiceMessage.cpp | 45 ------ src/security/inc/FSecCrypto_TrustZoneService.h | 100 ------------ .../inc/FSecCrypto_TrustZoneServiceMessage.h | 24 --- 5 files changed, 342 deletions(-) delete mode 100755 src/security/crypto/FSecCrypto_TrustZoneService.cpp delete mode 100644 src/security/crypto/FSecCrypto_TrustZoneServiceMessage.cpp delete mode 100755 src/security/inc/FSecCrypto_TrustZoneService.h delete mode 100755 src/security/inc/FSecCrypto_TrustZoneServiceMessage.h diff --git a/src/security/CMakeLists.txt b/src/security/CMakeLists.txt index abdbc2d..b62ccfd 100755 --- a/src/security/CMakeLists.txt +++ b/src/security/CMakeLists.txt @@ -37,8 +37,6 @@ SET (${this_target}_SOURCE_FILES crypto/FSecCryptoSkipJackCipher.cpp crypto/FSecCryptoRsaCipher.cpp crypto/FSecCryptoRsaSignature.cpp - crypto/FSecCrypto_TrustZoneService.cpp - crypto/FSecCrypto_TrustZoneServiceMessage.cpp pkcs/FSecPkcsAlgorithmIdentifier.cpp pkcs/FSecPkcs_AlgorithmIdentifierImpl.cpp pkcs/FSecPkcsInitialVector.cpp diff --git a/src/security/crypto/FSecCrypto_TrustZoneService.cpp b/src/security/crypto/FSecCrypto_TrustZoneService.cpp deleted file mode 100755 index f0681cf..0000000 --- a/src/security/crypto/FSecCrypto_TrustZoneService.cpp +++ /dev/null @@ -1,171 +0,0 @@ -// -// Copyright (c) 2013 Samsung Electronics Co., Ltd. -// -// 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. -// - -/** - * @file FSec_TrustZoneService.cpp - * @brief This is the implementation for the _AccessController class. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "FSecCrypto_TrustZoneService.h" -#include "FSecCrypto_TrustZoneServiceMessage.h" - - -using namespace Tizen::Io; -using namespace Tizen::Base; -using namespace Tizen::Security; - -namespace Tizen { namespace Security { namespace Crypto -{ - -_TrustZoneService* _TrustZoneService::__pTrustZoneService = null; -_IpcClient* _TrustZoneService::__pIpcClient = null; -unsigned int _TrustZoneService::__refCount = 0; - -_TrustZoneService::_TrustZoneService(void) -{ - -} - -_TrustZoneService::~_TrustZoneService(void) -{ - -} - -_TrustZoneService* -_TrustZoneService::GetInstance(void) -{ - static pthread_once_t once_block = PTHREAD_ONCE_INIT; - if(!__pTrustZoneService) - { - pthread_once(&once_block, Initialize); - } - - if(!__pIpcClient && __refCount == 0) - { - std::unique_ptr<_IpcClient> pIpcClient(new (std::nothrow) _IpcClient()); - SysTryReturn(NID_SEC_CRYPTO, pIpcClient != null, null, E_OUT_OF_MEMORY, "The memory is insufficient."); - - __pIpcClient = pIpcClient.release(); - - result r = __pIpcClient->Construct("osp.security.ipcserver.trustzoneservice"); - SysTryReturn(NID_SEC_CRYPTO, r == E_SUCCESS, null, E_SYSTEM, "Failed to construct the instance of IPC."); - } - __refCount++; - - return __pTrustZoneService; -} - -ByteBuffer* -_TrustZoneService::EncryptN(const ByteBuffer& appInfo, const ByteBuffer& plainBuffer) -{ - - result ret = E_SUCCESS; - std::unique_ptr pMessage(null); - ByteBuffer* pEncryptedBuffer = null; - - _IpcBuffer ipcBuffer; - ipcBuffer.size = 0; - ipcBuffer.pBuffer = null; - - pMessage.reset(new (std::nothrow) TrustZoneService_Encrypt(appInfo, plainBuffer, &ipcBuffer, &ret)); - TryReturnResult(pMessage != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); - - result r = __pIpcClient->SendRequest(pMessage.get()); - TryReturnResult(r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Failed to send IPC message."); - TryReturnResult(ret == E_SUCCESS, null, ret, "[%s] Failed to encrypt", GetErrorMessage(ret)); - - byte* pBuffer = static_cast(ipcBuffer.pBuffer); - TryReturnResult(pBuffer != null && ipcBuffer.size != 0, null, E_SYSTEM, "[E_SYSTEM] Failed to get encrypted data(%d).", ipcBuffer.size); - - pEncryptedBuffer = new (std::nothrow) ByteBuffer(); - TryReturnResult(pEncryptedBuffer != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); - - r = pEncryptedBuffer->Construct(ipcBuffer.size); - r = pEncryptedBuffer->SetArray(pBuffer, 0, ipcBuffer.size); - TryReturnResult(r == E_SUCCESS, null, r, "[%s] propagating.", r); - pEncryptedBuffer->Flip(); - - free(pBuffer); - - return pEncryptedBuffer; -} - -ByteBuffer* -_TrustZoneService::DecryptN(const ByteBuffer& appInfo, const ByteBuffer& encryptedBuffer) -{ - - result ret = E_SUCCESS; - std::unique_ptr pMessage(null); - ByteBuffer* pPlainBuffer = null; - - _IpcBuffer ipcBuffer; - ipcBuffer.size = 0; - ipcBuffer.pBuffer = null; - - pMessage.reset(new (std::nothrow) TrustZoneService_Decrypt(appInfo, encryptedBuffer, &ipcBuffer, &ret)); - TryReturnResult(pMessage != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); - - result r = __pIpcClient->SendRequest(pMessage.get()); - TryReturnResult(r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Failed to send IPC message."); - TryReturnResult(ret == E_SUCCESS, null, ret, "[%s] Failed to Decrypt", GetErrorMessage(ret)); - - byte* pBuffer = static_cast(ipcBuffer.pBuffer); - TryReturnResult(pBuffer != null && ipcBuffer.size != 0, null, E_SYSTEM, "[E_SYSTEM] Failed to Decrtype"); - - pPlainBuffer = new (std::nothrow) ByteBuffer(); - TryReturnResult(pPlainBuffer != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); - - r = pPlainBuffer->Construct(ipcBuffer.size); - r = pPlainBuffer->SetArray(pBuffer, 0, ipcBuffer.size); - TryReturnResult(r == E_SUCCESS, null, r, "[%s] propagating.", r); - pPlainBuffer->Flip(); - - free(pBuffer); - - return pPlainBuffer; -} - - -void -_TrustZoneService::Initialize(void) -{ - - static _TrustZoneService trustZoneService; - _TrustZoneService::__pTrustZoneService = &trustZoneService; - -} - -void -_TrustZoneService::Release() -{ - if(--(__refCount) == 0) - { - SysLog(NID_SEC_CRYPTO, "Close IPC connection"); - delete __pIpcClient; - __pIpcClient = null; - } -} - -}}} // Tizen::Security::Crypto diff --git a/src/security/crypto/FSecCrypto_TrustZoneServiceMessage.cpp b/src/security/crypto/FSecCrypto_TrustZoneServiceMessage.cpp deleted file mode 100644 index f021de8..0000000 --- a/src/security/crypto/FSecCrypto_TrustZoneServiceMessage.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// -// Copyright (c) 2012 Samsung Electronics Co., Ltd. -// -// 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. -// - -/** - * @file FSec_TrustZoneService.cpp - * @brief This is the message type of the IPC communication of _TrustZoneService daemon. - */ - -#define IPC_MESSAGE_IMPL -#include "FSecCrypto_TrustZoneServiceMessage.h" - -// Generate constructors. -#include -#include "FSecCrypto_TrustZoneServiceMessage.h" -// Generate destructors. - -#include -#include "FSecCrypto_TrustZoneServiceMessage.h" - -// Generate param traits write methods. -#include -namespace IPC -{ -#include "FSecCrypto_TrustZoneServiceMessage.h" -} // namespace IPC - -// Generate param traits read methods. -#include -namespace IPC -{ -#include "FSecCrypto_TrustZoneServiceMessage.h" -} // namespace IPC diff --git a/src/security/inc/FSecCrypto_TrustZoneService.h b/src/security/inc/FSecCrypto_TrustZoneService.h deleted file mode 100755 index a47cfda..0000000 --- a/src/security/inc/FSecCrypto_TrustZoneService.h +++ /dev/null @@ -1,100 +0,0 @@ -// -// Copyright (c) 2012 Samsung Electronics Co., Ltd. -// -// 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. -// - -/** - * @file FSecCrypto_TrustZoneService.h - * @brief This is the header file for the _TrustZoneService class. - * - * This file contains the declarations of _TrustZoneService. - */ - -#ifndef _FSEC_CRTYPTO_INTERNAL_TRUST_ZONE_SERVICE_H_ -#define _FSEC_CRTYPTO_INTERNAL_TRUST_ZONE_SERVICE_H_ - -#include -#include -#include - -namespace Tizen { namespace Io -{ -class _IpcClient; -} } - -namespace Tizen { namespace Base { namespace Runtime -{ -class Mutex; -} } } - -namespace Tizen { namespace Security { namespace Crypto -{ - -/** - * @class _TrustZoneService - * @brief This class is provide IPC API for TrustZone Management. - * @since 2.1 - * ///// - * The %_TrustZoneService class is used for to provide TrustZone Management's IPC API. - * ///// - * For more information on the class features, see Certificates. - * - */ -class _OSP_EXPORT_ _TrustZoneService -{ - -public: - /** - * Creates and intialize the instance of _TrustZoneService class. - * - * @since 2.1 - * @return An error code. - * @exception E_SUCCESS The method is successful. - * @exception E_OUT_OF_MEMORY The memory is insufficient. - * @exception E_SYSTEM A system error has occurred. - * - IPC operation failed. - */ - static _TrustZoneService* GetInstance(void); - - Tizen::Base::ByteBuffer* EncryptN(const Tizen::Base::ByteBuffer& appInfo, const Tizen::Base::ByteBuffer& plainBuffer); - Tizen::Base::ByteBuffer* DecryptN(const Tizen::Base::ByteBuffer& appInfo, const Tizen::Base::ByteBuffer& EncryptedBuffer); - - static void Release(void); - -private: - // This default constructor is intentionally declared as private to - // implement the Singleton semantic. - _TrustZoneService(void); - - // This destructor is intentionally declared as private to - // implement the Singleton semantic. - ~_TrustZoneService(void); - - _TrustZoneService(const _TrustZoneService& rhs); - - _TrustZoneService& operator =(const _TrustZoneService& rhs); - - //This construct function initialises the _TrustZoneService instance - static void Construct(void); - static void Initialize(void); - -private: - static Tizen::Io::_IpcClient* __pIpcClient; - static _TrustZoneService* __pTrustZoneService; - static unsigned int __refCount; -}; // _TrustZoneService - - -}}} // Tizen::Security::TrustZoneService -#endif //_FSEC_CRTYPTO_INTERNAL_TRUST_ZONE_SERVICE_H_ diff --git a/src/security/inc/FSecCrypto_TrustZoneServiceMessage.h b/src/security/inc/FSecCrypto_TrustZoneServiceMessage.h deleted file mode 100755 index 935fbf5..0000000 --- a/src/security/inc/FSecCrypto_TrustZoneServiceMessage.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// Copyright (c) 2012 Samsung Electronics Co., Ltd. -// -// 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 -#include -#include - -#define IPC_MESSAGE_START TrustZoneServiceStart - -IPC_SYNC_MESSAGE_CONTROL2_2(TrustZoneService_Encrypt, Tizen::Base::ByteBuffer, Tizen::Base::ByteBuffer, Tizen::Io::_IpcBuffer, result); -IPC_SYNC_MESSAGE_CONTROL2_2(TrustZoneService_Decrypt, Tizen::Base::ByteBuffer, Tizen::Base::ByteBuffer, Tizen::Io::_IpcBuffer, result); - -- 2.7.4