2 * FVAULT2 (FileVault2-compatible) volume handling
4 * Copyright (C) 2021-2022 Pavel Tobias
6 * This file is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This file is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this file; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef _CRYPTSETUP_FVAULT2_H
22 #define _CRYPTSETUP_FVAULT2_H
27 #define FVAULT2_WRAPPED_KEY_SIZE 24
28 #define FVAULT2_PBKDF2_SALT_SIZE 16
29 #define FVAULT2_UUID_LEN 37
34 struct fvault2_params {
36 const char *cipher_mode;
38 uint32_t pbkdf2_iters;
39 char pbkdf2_salt[FVAULT2_PBKDF2_SALT_SIZE];
40 char wrapped_kek[FVAULT2_WRAPPED_KEY_SIZE];
41 char wrapped_vk[FVAULT2_WRAPPED_KEY_SIZE];
42 char family_uuid[FVAULT2_UUID_LEN];
43 char ph_vol_uuid[FVAULT2_UUID_LEN];
45 uint64_t log_vol_size;
48 int FVAULT2_read_metadata(
49 struct crypt_device *cd,
50 struct fvault2_params *params);
52 int FVAULT2_get_volume_key(
53 struct crypt_device *cd,
54 const char *passphrase,
55 size_t passphrase_len,
56 const struct fvault2_params *params,
57 struct volume_key **vol_key);
60 struct crypt_device *cd,
61 struct device *device,
62 const struct fvault2_params *params);
64 int FVAULT2_activate_by_passphrase(
65 struct crypt_device *cd,
67 const char *passphrase,
68 size_t passphrase_len,
69 const struct fvault2_params *params,
72 int FVAULT2_activate_by_volume_key(
73 struct crypt_device *cd,
77 const struct fvault2_params *params,