diff options
author | Ondrej Kozina <okozina@redhat.com> | 2021-03-16 20:13:28 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-07-26 15:15:16 +0200 |
commit | d1ae38d85ae458ba8126465d25789e2721a75dba (patch) | |
tree | 6a94b4a55181e4577d1c0781a7a5c0342d5296d8 /src/cryptsetup/cryptsetup-tokens/cryptsetup-token-util.h | |
parent | Merge pull request #20276 from keszybz/rpm-restart-wip (diff) | |
download | systemd-d1ae38d85ae458ba8126465d25789e2721a75dba.tar.xz systemd-d1ae38d85ae458ba8126465d25789e2721a75dba.zip |
Add support for systemd-tpm2 libcryptsetup plugin.
Add support for systemd-tpm2 based LUKS2 device activation
via libcryptsetup plugin. This make the feature (tpm2 sealed
LUKS2 keyslot passphrase) usable from both systemd utilities
and cryptsetup cli.
The feature is configured via -Dlibcryptsetup-plugins combo
with default value set to 'auto'. It get's enabled automatically
when cryptsetup 2.4.0 or later is installed in build system.
Diffstat (limited to 'src/cryptsetup/cryptsetup-tokens/cryptsetup-token-util.h')
-rw-r--r-- | src/cryptsetup/cryptsetup-tokens/cryptsetup-token-util.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-util.h b/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-util.h new file mode 100644 index 0000000000..b8ea4c2422 --- /dev/null +++ b/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-util.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ + +#pragma once + +#include <stddef.h> + +/* crypt_dump() internal indentation magic */ +#define CRYPT_DUMP_LINE_SEP "\n\t " + +#define crypt_log_debug(cd, ...) crypt_logf(cd, CRYPT_LOG_DEBUG, __VA_ARGS__) +#define crypt_log_error(cd, ...) crypt_logf(cd, CRYPT_LOG_ERROR, __VA_ARGS__) +#define crypt_log(cd, ...) crypt_logf(cd, CRYPT_LOG_NORMAL, __VA_ARGS__) + +#define crypt_log_debug_errno(cd, e, ...) ({ \ + int _e = abs(e), _s = errno; \ + errno = _e; \ + crypt_logf(cd, CRYPT_LOG_DEBUG, __VA_ARGS__); \ + errno = _s; \ + -_e; \ +}) + +int crypt_dump_buffer_to_hex_string( + const char *buf, + size_t buf_size, + char **ret_dump_str); + +int crypt_dump_hex_string(const char *hex_str, char **ret_dump_str); |