]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/home/homework-luks.h
home: add new systemd-homed service that can manage LUKS homes
[thirdparty/systemd.git] / src / home / homework-luks.h
CommitLineData
70a5db58
LP
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
8int home_prepare_luks(UserRecord *h, bool already_activated, const char *force_image_path, char ***pkcs11_decrypted_passwords, HomeSetup *setup, UserRecord **ret_luks_home);
9
10int home_activate_luks(UserRecord *h, char ***pkcs11_decrypted_passwords, UserRecord **ret_home);
11int home_deactivate_luks(UserRecord *h);
12
13int home_store_header_identity_luks(UserRecord *h, HomeSetup *setup, UserRecord *old_home);
14
15int home_create_luks(UserRecord *h, char **pkcs11_decrypted_passwords, char **effective_passwords, UserRecord **ret_home);
16
17int home_validate_update_luks(UserRecord *h, HomeSetup *setup);
18
19int home_resize_luks(UserRecord *h, bool already_activated, char ***pkcs11_decrypted_passwords, HomeSetup *setup, UserRecord **ret_home);
20
21int home_passwd_luks(UserRecord *h, HomeSetup *setup, char **pkcs11_decrypted_passwords, char **effective_passwords);
22
23int home_lock_luks(UserRecord *h);
24int home_unlock_luks(UserRecord *h, char ***pkcs11_decrypted_passwords);
25
26static 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}