Remove dead code related to downloadable TA
[platform/core/security/tef-simulator.git] / simulatordaemon / inc / SecurityContext.h
1 /**
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16
17 /**
18  * @file
19  * @author Uladzislau Harbuz (u.harbuz@samsung.com)
20  * @brief  Security Context header file
21  */
22
23
24 #ifndef SECURITYCONTEXT_H
25 #define SECURITYCONTEXT_H
26
27 #include <string>
28 #include "log.h"
29 #include "config.h"
30 #include <cynara/cynara-client.h>
31
32 #define TA_LOCAL_PATH "/res/tee"
33
34 class SecurityContext {
35 private:
36         int connFd;
37
38         static constexpr const size_t CYNARA_CACHE_SIZE = 100U;
39
40         static cynara* initCynara();
41         static cynara* _cynara;
42
43         static constexpr const char* sysTaPaths[] = {
44                 TEE_TASTORE_ROOT,
45         };
46
47         std::string getCaFullPathFromPkgId(char*);
48
49 public:
50         SecurityContext();
51         SecurityContext(int connFd);
52         ~SecurityContext();
53
54 /**
55  * Check if client has Tizen permission for use TEE.
56  *
57  * @param privilege         Privilege to be checked for client.
58  * @return                  true if client has permission, otherwise false.
59  */
60         bool clientHasCynaraPermission(const std::string &privilege);
61 };
62
63 #endif /*SECURITYCONTEXT_H*/