• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef STORAGE_DAEMON_CRYPTO_DELAY_HANDLER_H
17 #define STORAGE_DAEMON_CRYPTO_DELAY_HANDLER_H
18 
19 #include <mutex>
20 
21 #include "timer.h"
22 
23 #include "base_key.h"
24 #include "libfscrypt/key_control.h"
25 
26 namespace OHOS {
27 namespace StorageDaemon {
28 class DelayHandler {
29 public:
30     DelayHandler(uint32_t userId);
31     ~DelayHandler();
32     void StartDelayTask(const std::shared_ptr<BaseKey> &el4Key);
33     void CancelDelayTask();
34 
35 private:
36     uint32_t timerId_;
37     Utils::Timer timer_ {"DeativationEl3El4El5_Task_Timer"};
38 
39     std::atomic<bool> cancelled_;
40     std::shared_ptr<BaseKey> el4Key_;
41     uint32_t userId_;
42 
43     std::mutex handlerMutex_;
44 
45     void DeactiveEl3El4El5();
46     int64_t GetTickCount();
47 };
48 } // StorageDaemon
49 } // OHOS
50 
51 #endif // STORAGE_DAEMON_CRYPTO_DELAY_HANDLER_H
52