diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:49:52 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:49:52 +0000 |
commit | 55944e5e40b1be2afc4855d8d2baf4b73d1876b5 (patch) | |
tree | 33f869f55a1b149e9b7c2b7e201867ca5dd52992 /src/shared/cryptsetup-fido2.h | |
parent | Initial commit. (diff) | |
download | systemd-55944e5e40b1be2afc4855d8d2baf4b73d1876b5.tar.xz systemd-55944e5e40b1be2afc4855d8d2baf4b73d1876b5.zip |
Adding upstream version 255.4.upstream/255.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/shared/cryptsetup-fido2.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/shared/cryptsetup-fido2.h b/src/shared/cryptsetup-fido2.h new file mode 100644 index 0000000..d96bb40 --- /dev/null +++ b/src/shared/cryptsetup-fido2.h @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +#pragma once + +#include <sys/types.h> + +#include "cryptsetup-util.h" +#include "libfido2-util.h" +#include "log.h" +#include "time-util.h" + +#if HAVE_LIBFIDO2 + +int acquire_fido2_key( + const char *volume_name, + const char *friendly_name, + const char *device, + const char *rp_id, + const void *cid, + size_t cid_size, + const char *key_file, + size_t key_file_size, + uint64_t key_file_offset, + const void *key_data, + size_t key_data_size, + usec_t until, + bool headless, + Fido2EnrollFlags required, + void **ret_decrypted_key, + size_t *ret_decrypted_key_size, + AskPasswordFlags ask_password_flags); + +int acquire_fido2_key_auto( + struct crypt_device *cd, + const char *name, + const char *friendly_name, + const char *fido2_device, + usec_t until, + bool headless, + void **ret_decrypted_key, + size_t *ret_decrypted_key_size, + AskPasswordFlags ask_password_flags); + +#else + +static inline int acquire_fido2_key( + const char *volume_name, + const char *friendly_name, + const char *device, + const char *rp_id, + const void *cid, + size_t cid_size, + const char *key_file, + size_t key_file_size, + uint64_t key_file_offset, + const void *key_data, + size_t key_data_size, + usec_t until, + bool headless, + Fido2EnrollFlags required, + void **ret_decrypted_key, + size_t *ret_decrypted_key_size, + AskPasswordFlags ask_password_flags) { + + return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), + "FIDO2 token support not available."); +} + +static inline int acquire_fido2_key_auto( + struct crypt_device *cd, + const char *name, + const char *friendly_name, + const char *fido2_device, + usec_t until, + bool headless, + void **ret_decrypted_key, + size_t *ret_decrypted_key_size, + AskPasswordFlags ask_password_flags) { + + return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), + "FIDO2 token support not available."); +} +#endif |