From: Dariusz Michaluk Date: Wed, 17 Jun 2020 12:31:38 +0000 (+0200) Subject: Remove abstract_crypto_backend class X-Git-Tag: submit/tizen/20200728.071123~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F05%2F236505%2F2;p=platform%2Fcore%2Fsecurity%2Fdevice-certificate-manager-backend.git Remove abstract_crypto_backend class Change-Id: I0ccbf28b4a20ad4ef20f533774973199d5b76d17 --- diff --git a/src/abstractcryptobackend.cpp b/src/abstractcryptobackend.cpp deleted file mode 100644 index aa246e7..0000000 --- a/src/abstractcryptobackend.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/****************************************************************** - * - * Copyright 2017 - 2019 Samsung Electronics All Rights Reserved. - * - * Author: Jaroslaw Pelczar - * - * 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 "abstractcryptobackend.h" - -abstract_crypto_backend::abstract_crypto_backend() { -} - -abstract_crypto_backend::~abstract_crypto_backend() { -} diff --git a/src/abstractcryptobackend.h b/src/abstractcryptobackend.h deleted file mode 100644 index 3dbbea1..0000000 --- a/src/abstractcryptobackend.h +++ /dev/null @@ -1,42 +0,0 @@ -/****************************************************************** - * - * Copyright 2017 - 2019 Samsung Electronics All Rights Reserved. - * - * Author: Jaroslaw Pelczar - * - * 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 ABSTRACTCRYPTOBACKEND_H_ -#define ABSTRACTCRYPTOBACKEND_H_ - -#include -#include -#include - -#include - -class abstract_crypto_backend_context; - -class abstract_crypto_backend : public std::enable_shared_from_this, - public boost::noncopyable -{ -protected: - abstract_crypto_backend(); - -public: - virtual ~abstract_crypto_backend(); -}; - -#endif /* ABSTRACTCRYPTOBACKEND_H_ */ diff --git a/src/abstractcryptobackendcontext.cpp b/src/abstractcryptobackendcontext.cpp deleted file mode 100644 index a0b207e..0000000 --- a/src/abstractcryptobackendcontext.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/****************************************************************** - * - * Copyright 2017 - 2019 Samsung Electronics All Rights Reserved. - * - * Author: Jaroslaw Pelczar - * - * 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 "abstractcryptobackendcontext.h" - -abstract_crypto_backend_context::abstract_crypto_backend_context() { -} - -abstract_crypto_backend_context::~abstract_crypto_backend_context() { -} diff --git a/src/abstractcryptobackendcontext.h b/src/abstractcryptobackendcontext.h deleted file mode 100644 index 36b98aa..0000000 --- a/src/abstractcryptobackendcontext.h +++ /dev/null @@ -1,43 +0,0 @@ -/****************************************************************** - * - * Copyright 2017 - 2019 Samsung Electronics All Rights Reserved. - * - * Author: Jaroslaw Pelczar - * - * 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 ABSTRACTCRYPTOBACKENDCONTEXT_H_ -#define ABSTRACTCRYPTOBACKENDCONTEXT_H_ - -#include "abstractcryptobackend.h" - -class abstract_crypto_backend_context : public std::enable_shared_from_this { -protected: - abstract_crypto_backend_context(); - -public: - virtual ~abstract_crypto_backend_context(); - - virtual int request_certificate_chain(std::string& mutable_chain) = 0; - - virtual int sign_crypto_data(MessageDigestType digestType, const std::string& dataToSign, - std::string& digestResult) = 0; - - virtual CryptoKeyType key_type() = 0; - - virtual unsigned int key_length() = 0; -}; - -#endif /* ABSTRACTCRYPTOBACKENDCONTEXT_H_ */ diff --git a/src/dummy-backend/CMakeLists.txt b/src/dummy-backend/CMakeLists.txt index 4f3414c..8b1f3c9 100644 --- a/src/dummy-backend/CMakeLists.txt +++ b/src/dummy-backend/CMakeLists.txt @@ -74,9 +74,6 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_library(${DCM_BACKEND_API} SHARED dcm-backend-api-dummy.cpp - ../abstractcryptobackend.cpp - ../abstractcryptobackendcontext.cpp - dummycryptobackend.cpp dummycryptobackendcontext.cpp ../log.cpp ${CMAKE_CURRENT_BINARY_DIR}/rootCA_ecdsa_key.c diff --git a/src/dummy-backend/dcm-backend-api-dummy.cpp b/src/dummy-backend/dcm-backend-api-dummy.cpp index 28de132..2f4c876 100644 --- a/src/dummy-backend/dcm-backend-api-dummy.cpp +++ b/src/dummy-backend/dcm-backend-api-dummy.cpp @@ -18,8 +18,9 @@ * ******************************************************************/ -#include "dummycryptobackend.h" #include "dummycryptobackendcontext.h" +#include +#include void dcm_backend_create_key_context(dcm_backend_context& ctx, const std::string& keyType) { diff --git a/src/dummy-backend/dummycryptobackend.cpp b/src/dummy-backend/dummycryptobackend.cpp deleted file mode 100644 index 6ba286d..0000000 --- a/src/dummy-backend/dummycryptobackend.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/****************************************************************** - * - * Copyright 2017 - 2019 Samsung Electronics All Rights Reserved. - * - * Author: Jaroslaw Pelczar - * - * 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 "dummycryptobackend.h" -#include "dummycryptobackendcontext.h" -#include "log.h" - -dummy_crypto_backend::dummy_crypto_backend() { -} - -dummy_crypto_backend::~dummy_crypto_backend() { -} diff --git a/src/dummy-backend/dummycryptobackend.h b/src/dummy-backend/dummycryptobackend.h deleted file mode 100644 index c80e566..0000000 --- a/src/dummy-backend/dummycryptobackend.h +++ /dev/null @@ -1,32 +0,0 @@ -/****************************************************************** - * - * Copyright 2017 - 2019 Samsung Electronics All Rights Reserved. - * - * Author: Jaroslaw Pelczar - * - * 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 DUMMY_BACKEND_DUMMYCRYPTOBACKEND_H_ -#define DUMMY_BACKEND_DUMMYCRYPTOBACKEND_H_ - -#include "abstractcryptobackend.h" - -class dummy_crypto_backend final : public abstract_crypto_backend { -public: - dummy_crypto_backend(); - virtual ~dummy_crypto_backend(); -}; - -#endif /* DUMMY_BACKEND_DUMMYCRYPTOBACKEND_H_ */ diff --git a/src/dummy-backend/dummycryptobackendcontext.cpp b/src/dummy-backend/dummycryptobackendcontext.cpp index bdca8d7..11fa2f5 100644 --- a/src/dummy-backend/dummycryptobackendcontext.cpp +++ b/src/dummy-backend/dummycryptobackendcontext.cpp @@ -23,6 +23,7 @@ #include #include #include "log.h" +#include extern "C" { extern size_t dummy_rootca_rsa_key_size; diff --git a/src/dummy-backend/dummycryptobackendcontext.h b/src/dummy-backend/dummycryptobackendcontext.h index d152348..7061b0e 100644 --- a/src/dummy-backend/dummycryptobackendcontext.h +++ b/src/dummy-backend/dummycryptobackendcontext.h @@ -21,23 +21,24 @@ #ifndef DUMMY_BACKEND_DUMMYCRYPTOBACKENDCONTEXT_H_ #define DUMMY_BACKEND_DUMMYCRYPTOBACKENDCONTEXT_H_ -#include "abstractcryptobackendcontext.h" #include #include +#include +#include -class dummy_crypto_backend_context final : public abstract_crypto_backend_context { +class dummy_crypto_backend_context { public: dummy_crypto_backend_context(const std::string& keyType); - virtual ~dummy_crypto_backend_context(); + ~dummy_crypto_backend_context(); - virtual int request_certificate_chain(std::string& mutable_chain) override; + int request_certificate_chain(std::string& mutable_chain); - virtual int sign_crypto_data(MessageDigestType digestType, const std::string& dataToSign, - std::string& digestResult) override; + int sign_crypto_data(MessageDigestType digestType, const std::string& dataToSign, + std::string& digestResult); - virtual CryptoKeyType key_type() override; + CryptoKeyType key_type(); - virtual unsigned int key_length() override; + unsigned int key_length(); private: CryptoKeyType fKey; diff --git a/src/kse-backend/CMakeLists.txt b/src/kse-backend/CMakeLists.txt index 4cde8d4..59a027a 100644 --- a/src/kse-backend/CMakeLists.txt +++ b/src/kse-backend/CMakeLists.txt @@ -32,8 +32,6 @@ add_library(${DCM_BACKEND_API} SHARED dcm-backend-api-kse.cpp soresolver.cpp - ../abstractcryptobackend.cpp - ../abstractcryptobackendcontext.cpp ksebackend.cpp ksebackendcontext.cpp ../log.cpp diff --git a/src/kse-backend/dcm-backend-api-kse.cpp b/src/kse-backend/dcm-backend-api-kse.cpp index 21d3891..9f3c3ad 100644 --- a/src/kse-backend/dcm-backend-api-kse.cpp +++ b/src/kse-backend/dcm-backend-api-kse.cpp @@ -20,6 +20,7 @@ #include "ksebackend.h" #include "ksebackendcontext.h" +#include static std::shared_ptr backend(new kse_backend()); diff --git a/src/kse-backend/ksebackend.h b/src/kse-backend/ksebackend.h index 785999b..bb50c0f 100644 --- a/src/kse-backend/ksebackend.h +++ b/src/kse-backend/ksebackend.h @@ -22,16 +22,15 @@ #ifndef KSE_BACKEND_KSEBACKEND_H_ #define KSE_BACKEND_KSEBACKEND_H_ -#include "abstractcryptobackend.h" #include "soresolver.h" #include -class kse_backend: public abstract_crypto_backend +class kse_backend { public: kse_backend(); - virtual ~kse_backend(); + ~kse_backend(); inline so_resolver& get_so_resolver() { return fSoResolver; diff --git a/src/kse-backend/ksebackendcontext.h b/src/kse-backend/ksebackendcontext.h index 21047ea..de00c31 100644 --- a/src/kse-backend/ksebackendcontext.h +++ b/src/kse-backend/ksebackendcontext.h @@ -21,22 +21,23 @@ #ifndef KSE_BACKEND_KSEBACKENDCONTEXT_H_ #define KSE_BACKEND_KSEBACKENDCONTEXT_H_ -#include "abstractcryptobackendcontext.h" #include "ksebackend.h" +#include -class kse_backend_context final : public abstract_crypto_backend_context { +class kse_backend_context +{ public: kse_backend_context(std::shared_ptr backend, const std::string& keyType); - virtual ~kse_backend_context(); + ~kse_backend_context(); - virtual int request_certificate_chain(std::string& mutable_chain) override; + int request_certificate_chain(std::string& mutable_chain); - virtual int sign_crypto_data(MessageDigestType digestType, const std::string& dataToSign, - std::string& digestResult) override; + int sign_crypto_data(MessageDigestType digestType, const std::string& dataToSign, + std::string& digestResult); - virtual CryptoKeyType key_type() override; + CryptoKeyType key_type(); - virtual unsigned int key_length() override; + unsigned int key_length(); private: int get_certificate(unsigned int index, std::string& cert); diff --git a/src/kse-backend/soresolver.cpp b/src/kse-backend/soresolver.cpp index c236365..8e60e3b 100644 --- a/src/kse-backend/soresolver.cpp +++ b/src/kse-backend/soresolver.cpp @@ -21,6 +21,7 @@ #include "soresolver.h" #include "log.h" #include +#include so_resolver::so_resolver(const std::string& libraryName) : fLibraryName(libraryName),