Fix build error for aarch64
[platform/core/security/ode.git] / server / key-manager / luks.h
1 /*
2  *  Copyright (c) 2016 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 #ifndef __LUKS_H__
18 #define __LUKS_H__
19
20 #include <cstdint>
21
22 struct LUKSHeader final {
23         unsigned char magic[6];
24         uint16_t version;
25         char cipherName[32];
26         char cipherMode[32];
27         char hashSpec[32];
28         uint32_t payloadOffset;
29         uint32_t keyBytes;
30         char mkDigest[20];
31         char mkDigestSalt[32];
32         uint32_t mkDigestIteration;
33         char uuid[40];
34
35         struct {
36                 uint32_t active;
37                 uint32_t passwordIteration;
38                 char passwordSalt[32];
39                 uint32_t keyMaterialOffset;
40                 uint32_t stripes;
41         } keyslot[1];
42
43         char padding[256];
44
45         LUKSHeader() :
46                 magic{'L', 'U', 'K', 'S', 0xba, 0xbe}, version(1)
47         {
48                 for (auto &key : keyslot) {
49                         unsigned char *buf = (unsigned char*)&key.active;
50                         buf[0] = 0x0;
51                         buf[1] = 0x0;
52                         buf[2] = 0xDE;
53                         buf[3] = 0xAD;
54                 }
55         }
56 };
57
58 #endif // __LUKS_H__