]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/home/homework-luks.h
home: add new systemd-homed service that can manage LUKS homes
[thirdparty/systemd.git] / src / home / homework-luks.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #include "crypt-util.h"
5 #include "homework.h"
6 #include "user-record.h"
7
8 int home_prepare_luks(UserRecord *h, bool already_activated, const char *force_image_path, char ***pkcs11_decrypted_passwords, HomeSetup *setup, UserRecord **ret_luks_home);
9
10 int home_activate_luks(UserRecord *h, char ***pkcs11_decrypted_passwords, UserRecord **ret_home);
11 int home_deactivate_luks(UserRecord *h);
12
13 int home_store_header_identity_luks(UserRecord *h, HomeSetup *setup, UserRecord *old_home);
14
15 int home_create_luks(UserRecord *h, char **pkcs11_decrypted_passwords, char **effective_passwords, UserRecord **ret_home);
16
17 int home_validate_update_luks(UserRecord *h, HomeSetup *setup);
18
19 int home_resize_luks(UserRecord *h, bool already_activated, char ***pkcs11_decrypted_passwords, HomeSetup *setup, UserRecord **ret_home);
20
21 int home_passwd_luks(UserRecord *h, HomeSetup *setup, char **pkcs11_decrypted_passwords, char **effective_passwords);
22
23 int home_lock_luks(UserRecord *h);
24 int home_unlock_luks(UserRecord *h, char ***pkcs11_decrypted_passwords);
25
26 static inline uint64_t luks_volume_key_size_convert(struct crypt_device *cd) {
27 int k;
28
29 assert(cd);
30
31 /* Convert the "int" to uint64_t, which we usually use for byte sizes stored on disk. */
32
33 k = crypt_get_volume_key_size(cd);
34 if (k <= 0)
35 return UINT64_MAX;
36
37 return (uint64_t) k;
38 }