• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025-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 SIGNATRUETOOLS_BLOCK_HEAD_H
17 #define SIGNATRUETOOLS_BLOCK_HEAD_H
18 
19 #include <vector>
20 #include <string>
21 
22 namespace OHOS {
23 namespace SignatureTools {
24 class BlockHead {
25 public:
26     static const int BLOCK_LEN = 8;
27     static const int ELF_BLOCK_LEN = 12;
28     static const int BIT_SIZE = 8;
29     static const int DOUBLE_BIT_SIZE = 16;
30     static const int TRIPLE_BIT_SIZE = 24;
31     static const int32_t SIGN_HEAD_LEN = 32;
32 
33 public:
34     static int GetBlockLen();
35     static int GetElfBlockLen();
36     static std::string GetBlockHead(const char type, const char tag, const short length, const int offset);
37     static std::vector<int8_t> GetBlockHeadLittleEndian(const char type, const char tag,
38                                                         const int length, const int offset);
39 };
40 } // namespace SignatureTools
41 } // namespace OHOS
42 #endif