cryptsetup API
Public cryptsetup API
Loading...
Searching...
No Matches
libcryptsetup.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * libcryptsetup - cryptsetup library
4 *
5 * Copyright (C) 2004 Jana Saout <jana@saout.de>
6 * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
7 * Copyright (C) 2009-2025 Red Hat, Inc. All rights reserved.
8 * Copyright (C) 2009-2025 Milan Broz
9 */
10
19#ifndef _LIBCRYPTSETUP_H
20#define _LIBCRYPTSETUP_H
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#include <stddef.h>
26#include <stdint.h>
27
35struct crypt_device; /* crypt device handle */
36struct crypt_keyslot_context;
37
53int crypt_init(struct crypt_device **cd, const char *device);
54
68int crypt_init_data_device(struct crypt_device **cd,
69 const char *device,
70 const char *data_device);
71
91int crypt_init_by_name_and_header(struct crypt_device **cd,
92 const char *name,
93 const char *header_device);
94
101int crypt_init_by_name(struct crypt_device **cd, const char *name);
102
108void crypt_free(struct crypt_device *cd);
109
128void crypt_set_confirm_callback(struct crypt_device *cd,
129 int (*confirm)(const char *msg, void *usrptr),
130 void *usrptr);
131
142int crypt_set_data_device(struct crypt_device *cd, const char *device);
143
161int crypt_set_data_offset(struct crypt_device *cd, uint64_t data_offset);
162
174#define CRYPT_LOG_NORMAL 0
176#define CRYPT_LOG_ERROR 1
178#define CRYPT_LOG_VERBOSE 2
180#define CRYPT_LOG_DEBUG -1
182#define CRYPT_LOG_DEBUG_JSON -2
183
194void crypt_set_log_callback(struct crypt_device *cd,
195 void (*log)(int level, const char *msg, void *usrptr),
196 void *usrptr);
197
207void crypt_log(struct crypt_device *cd, int level, const char *msg);
208
216void crypt_logf(struct crypt_device *cd, int level, const char *format, ...);
226#define CRYPT_RNG_URANDOM 0
228#define CRYPT_RNG_RANDOM 1
229
237void crypt_set_rng_type(struct crypt_device *cd, int rng_type);
238
246int crypt_get_rng_type(struct crypt_device *cd);
247
252 const char *type;
253 const char *hash;
254 uint32_t time_ms;
255 uint32_t iterations;
256 uint32_t max_memory_kb;
258 uint32_t flags;
259};
260
262#define CRYPT_PBKDF_ITER_TIME_SET (UINT32_C(1) << 0)
264#define CRYPT_PBKDF_NO_BENCHMARK (UINT32_C(1) << 1)
265
267#define CRYPT_KDF_PBKDF2 "pbkdf2"
269#define CRYPT_KDF_ARGON2I "argon2i"
271#define CRYPT_KDF_ARGON2ID "argon2id"
272
285int crypt_set_pbkdf_type(struct crypt_device *cd,
286 const struct crypt_pbkdf_type *pbkdf);
287
296const struct crypt_pbkdf_type *crypt_get_pbkdf_type_params(const char *pbkdf_type);
297
308
318const struct crypt_pbkdf_type *crypt_get_pbkdf_type(struct crypt_device *cd);
319
331void crypt_set_iteration_time(struct crypt_device *cd, uint64_t iteration_time_ms);
332
345int crypt_memory_lock(struct crypt_device *cd, int lock) __attribute__((deprecated));
346
359int crypt_metadata_locking(struct crypt_device *cd, int enable);
360
375int crypt_set_metadata_size(struct crypt_device *cd,
376 uint64_t metadata_size,
377 uint64_t keyslots_size);
378
389int crypt_get_metadata_size(struct crypt_device *cd,
390 uint64_t *metadata_size,
391 uint64_t *keyslots_size);
392
404#define CRYPT_PLAIN "PLAIN"
406#define CRYPT_LUKS1 "LUKS1"
408#define CRYPT_LUKS2 "LUKS2"
410#define CRYPT_LOOPAES "LOOPAES"
412#define CRYPT_VERITY "VERITY"
414#define CRYPT_TCRYPT "TCRYPT"
416#define CRYPT_INTEGRITY "INTEGRITY"
418#define CRYPT_BITLK "BITLK"
420#define CRYPT_FVAULT2 "FVAULT2"
421
423#define CRYPT_LUKS NULL
424
431const char *crypt_get_type(struct crypt_device *cd);
432
438const char *crypt_get_default_type(void);
439
446#define CRYPT_SW_ONLY INT16_C(0)
448#define CRYPT_OPAL_HW_ONLY INT16_C(1)
450#define CRYPT_SW_AND_OPAL_HW INT16_C(2)
459int crypt_get_hw_encryption_type(struct crypt_device *cd);
460
466int crypt_get_hw_encryption_key_size(struct crypt_device *cd);
467
475 const char *hash;
476 uint64_t offset;
477 uint64_t skip;
478 uint64_t size;
479 uint32_t sector_size;
480};
481
492 const char *hash;
494 const char *data_device;
495};
496
505 const char *hash;
506 uint64_t offset;
507 uint64_t skip;
508};
509
518 const char *hash_name;
519 const char *data_device;
520 const char *hash_device;
521 const char *fec_device;
522 const char *salt;
523 uint32_t salt_size;
524 uint32_t hash_type;
527 uint64_t data_size;
530 uint32_t fec_roots;
531 uint32_t flags;
532};
533
535#define CRYPT_VERITY_NO_HEADER (UINT32_C(1) << 0)
537#define CRYPT_VERITY_CHECK_HASH (UINT32_C(1) << 1)
539#define CRYPT_VERITY_CREATE_HASH (UINT32_C(1) << 2)
541#define CRYPT_VERITY_ROOT_HASH_SIGNATURE (UINT32_C(1) << 3)
542
551 const char *passphrase;
553 const char **keyfiles;
554 unsigned int keyfiles_count;
555 const char *hash_name;
556 const char *cipher;
557 const char *mode;
558 size_t key_size;
559 uint32_t flags;
560 uint32_t veracrypt_pim;
561};
562
564#define CRYPT_TCRYPT_LEGACY_MODES (UINT32_C(1) << 0)
566#define CRYPT_TCRYPT_HIDDEN_HEADER (UINT32_C(1) << 1)
568#define CRYPT_TCRYPT_BACKUP_HEADER (UINT32_C(1) << 2)
570#define CRYPT_TCRYPT_SYSTEM_HEADER (UINT32_C(1) << 3)
575#define CRYPT_TCRYPT_VERA_MODES (UINT32_C(1) << 4)
576
607
618 const struct crypt_pbkdf_type *pbkdf;
619 const char *integrity;
622 const char *data_device;
623 uint32_t sector_size;
624 const char *label;
625 const char *subsystem;
626};
627
635 const char *admin_key;
638};
669int crypt_format(struct crypt_device *cd,
670 const char *type,
671 const char *cipher,
672 const char *cipher_mode,
673 const char *uuid,
674 const char *volume_key,
675 size_t volume_key_size,
676 void *params);
677
697int crypt_format_luks2_opal(struct crypt_device *cd,
698 const char *cipher,
699 const char *cipher_mode,
700 const char *uuid,
701 const char *volume_keys,
702 size_t volume_keys_size,
703 struct crypt_params_luks2 *params,
704 struct crypt_params_hw_opal *opal_params);
705
726int crypt_format_inline(struct crypt_device *cd,
727 const char *type,
728 const char *cipher,
729 const char *cipher_mode,
730 const char *uuid,
731 const char *volume_key,
732 size_t volume_key_size,
733 void *params);
734
741void crypt_set_compatibility(struct crypt_device *cd, uint32_t flags);
742
750uint32_t crypt_get_compatibility(struct crypt_device *cd);
751
753#define CRYPT_COMPAT_LEGACY_INTEGRITY_PADDING (UINT32_C(1) << 0)
755#define CRYPT_COMPAT_LEGACY_INTEGRITY_HMAC (UINT32_C(1) << 1)
757#define CRYPT_COMPAT_LEGACY_INTEGRITY_RECALC (UINT32_C(1) << 2)
758
777int crypt_convert(struct crypt_device *cd,
778 const char *type,
779 void *params);
780
791int crypt_set_uuid(struct crypt_device *cd,
792 const char *uuid);
793
805int crypt_set_label(struct crypt_device *cd,
806 const char *label,
807 const char *subsystem);
808
816const char *crypt_get_label(struct crypt_device *cd);
817
825const char *crypt_get_subsystem(struct crypt_device *cd);
826
844int crypt_volume_key_keyring(struct crypt_device *cd, int enable);
845
862int crypt_load(struct crypt_device *cd,
863 const char *requested_type,
864 void *params);
865
881int crypt_repair(struct crypt_device *cd,
882 const char *requested_type,
883 void *params);
884
902int crypt_resize(struct crypt_device *cd,
903 const char *name,
904 uint64_t new_size);
905
917int crypt_suspend(struct crypt_device *cd,
918 const char *name);
919
934int crypt_resume_by_passphrase(struct crypt_device *cd,
935 const char *name,
936 int keyslot,
937 const char *passphrase,
938 size_t passphrase_size);
939
952int crypt_resume_by_keyfile_device_offset(struct crypt_device *cd,
953 const char *name,
954 int keyslot,
955 const char *keyfile,
956 size_t keyfile_size,
957 uint64_t keyfile_offset);
958
962int crypt_resume_by_keyfile_offset(struct crypt_device *cd,
963 const char *name,
964 int keyslot,
965 const char *keyfile,
966 size_t keyfile_size,
967 size_t keyfile_offset);
968
972int crypt_resume_by_keyfile(struct crypt_device *cd,
973 const char *name,
974 int keyslot,
975 const char *keyfile,
976 size_t keyfile_size);
987int crypt_resume_by_volume_key(struct crypt_device *cd,
988 const char *name,
989 const char *volume_key,
990 size_t volume_key_size);
1021int crypt_resume_by_token_pin(struct crypt_device *cd,
1022 const char *name,
1023 const char *type,
1024 int token,
1025 const char *pin,
1026 size_t pin_size,
1027 void *usrptr);
1028
1041int crypt_resume_by_keyslot_context(struct crypt_device *cd,
1042 const char *name,
1043 int keyslot,
1044 struct crypt_keyslot_context *kc);
1054#define CRYPT_ANY_SLOT -1
1055
1070int crypt_keyslot_add_by_passphrase(struct crypt_device *cd,
1071 int keyslot,
1072 const char *passphrase,
1073 size_t passphrase_size,
1074 const char *new_passphrase,
1075 size_t new_passphrase_size);
1076
1092int crypt_keyslot_change_by_passphrase(struct crypt_device *cd,
1093 int keyslot_old,
1094 int keyslot_new,
1095 const char *passphrase,
1096 size_t passphrase_size,
1097 const char *new_passphrase,
1098 size_t new_passphrase_size);
1099
1117 int keyslot,
1118 const char *keyfile,
1119 size_t keyfile_size,
1120 uint64_t keyfile_offset,
1121 const char *new_keyfile,
1122 size_t new_keyfile_size,
1123 uint64_t new_keyfile_offset);
1124
1128int crypt_keyslot_add_by_keyfile_offset(struct crypt_device *cd,
1129 int keyslot,
1130 const char *keyfile,
1131 size_t keyfile_size,
1132 size_t keyfile_offset,
1133 const char *new_keyfile,
1134 size_t new_keyfile_size,
1135 size_t new_keyfile_offset);
1136
1140int crypt_keyslot_add_by_keyfile(struct crypt_device *cd,
1141 int keyslot,
1142 const char *keyfile,
1143 size_t keyfile_size,
1144 const char *new_keyfile,
1145 size_t new_keyfile_size);
1146
1161int crypt_keyslot_add_by_volume_key(struct crypt_device *cd,
1162 int keyslot,
1163 const char *volume_key,
1164 size_t volume_key_size,
1165 const char *passphrase,
1166 size_t passphrase_size);
1167
1169#define CRYPT_VOLUME_KEY_NO_SEGMENT (UINT32_C(1) << 0)
1170
1172#define CRYPT_VOLUME_KEY_SET (UINT32_C(1) << 1)
1173
1175#define CRYPT_VOLUME_KEY_DIGEST_REUSE (UINT32_C(1) << 2)
1176
1206int crypt_keyslot_add_by_key(struct crypt_device *cd,
1207 int keyslot,
1208 const char *volume_key,
1209 size_t volume_key_size,
1210 const char *passphrase,
1211 size_t passphrase_size,
1212 uint32_t flags);
1213
1225void crypt_keyslot_context_free(struct crypt_keyslot_context *kc);
1226
1242 const char *passphrase,
1243 size_t passphrase_size,
1244 struct crypt_keyslot_context **kc);
1245
1258int crypt_keyslot_context_init_by_keyfile(struct crypt_device *cd,
1259 const char *keyfile,
1260 size_t keyfile_size,
1261 uint64_t keyfile_offset,
1262 struct crypt_keyslot_context **kc);
1263
1278int crypt_keyslot_context_init_by_token(struct crypt_device *cd,
1279 int token,
1280 const char *type,
1281 const char *pin, size_t pin_size,
1282 void *usrptr,
1283 struct crypt_keyslot_context **kc);
1284
1298 const char *volume_key,
1299 size_t volume_key_size,
1300 struct crypt_keyslot_context **kc);
1301
1318 const char *volume_key,
1319 size_t volume_key_size,
1320 const char *signature,
1321 size_t signature_size,
1322 struct crypt_keyslot_context **kc);
1323
1335int crypt_keyslot_context_init_by_keyring(struct crypt_device *cd,
1336 const char *key_description,
1337 struct crypt_keyslot_context **kc);
1338
1352 const char *key_description,
1353 struct crypt_keyslot_context **kc);
1354
1365int crypt_keyslot_context_get_error(struct crypt_keyslot_context *kc);
1366
1381int crypt_keyslot_context_set_pin(struct crypt_device *cd,
1382 const char *pin, size_t pin_size,
1383 struct crypt_keyslot_context *kc);
1384
1391#define CRYPT_KC_TYPE_PASSPHRASE INT16_C(1)
1393#define CRYPT_KC_TYPE_KEYFILE INT16_C(2)
1395#define CRYPT_KC_TYPE_TOKEN INT16_C(3)
1397#define CRYPT_KC_TYPE_KEY INT16_C(4)
1401#define CRYPT_KC_TYPE_KEYRING INT16_C(5)
1405#define CRYPT_KC_TYPE_VK_KEYRING INT16_C(6)
1407#define CRYPT_KC_TYPE_SIGNED_KEY INT16_C(7)
1417int crypt_keyslot_context_get_type(const struct crypt_keyslot_context *kc);
1455int crypt_keyslot_add_by_keyslot_context(struct crypt_device *cd,
1456 int keyslot_existing,
1457 struct crypt_keyslot_context *kc,
1458 int keyslot_new,
1459 struct crypt_keyslot_context *new_kc,
1460 uint32_t flags);
1461
1474int crypt_keyslot_destroy(struct crypt_device *cd, int keyslot);
1485#define CRYPT_ACTIVATE_READONLY (UINT32_C(1) << 0)
1487#define CRYPT_ACTIVATE_NO_UUID (UINT32_C(1) << 1)
1489#define CRYPT_ACTIVATE_SHARED (UINT32_C(1) << 2)
1491#define CRYPT_ACTIVATE_ALLOW_DISCARDS (UINT32_C(1) << 3)
1493#define CRYPT_ACTIVATE_PRIVATE (UINT32_C(1) << 4)
1495#define CRYPT_ACTIVATE_CORRUPTED (UINT32_C(1) << 5)
1497#define CRYPT_ACTIVATE_SAME_CPU_CRYPT (UINT32_C(1) << 6)
1499#define CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS (UINT32_C(1) << 7)
1501#define CRYPT_ACTIVATE_IGNORE_CORRUPTION (UINT32_C(1) << 8)
1503#define CRYPT_ACTIVATE_RESTART_ON_CORRUPTION (UINT32_C(1) << 9)
1505#define CRYPT_ACTIVATE_IGNORE_ZERO_BLOCKS (UINT32_C(1) << 10)
1507#define CRYPT_ACTIVATE_KEYRING_KEY (UINT32_C(1) << 11)
1509#define CRYPT_ACTIVATE_NO_JOURNAL (UINT32_C(1) << 12)
1511#define CRYPT_ACTIVATE_RECOVERY (UINT32_C(1) << 13)
1513#define CRYPT_ACTIVATE_IGNORE_PERSISTENT (UINT32_C(1) << 14)
1515#define CRYPT_ACTIVATE_CHECK_AT_MOST_ONCE (UINT32_C(1) << 15)
1517#define CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY (UINT32_C(1) << 16)
1519#define CRYPT_ACTIVATE_RECALCULATE (UINT32_C(1) << 17)
1521#define CRYPT_ACTIVATE_REFRESH (UINT32_C(1) << 18)
1523#define CRYPT_ACTIVATE_SERIALIZE_MEMORY_HARD_PBKDF (UINT32_C(1) << 19)
1525#define CRYPT_ACTIVATE_NO_JOURNAL_BITMAP (UINT32_C(1) << 20)
1527#define CRYPT_ACTIVATE_SUSPENDED (UINT32_C(1) << 21)
1529#define CRYPT_ACTIVATE_IV_LARGE_SECTORS (UINT32_C(1) << 22)
1531#define CRYPT_ACTIVATE_PANIC_ON_CORRUPTION (UINT32_C(1) << 23)
1533#define CRYPT_ACTIVATE_NO_READ_WORKQUEUE (UINT32_C(1) << 24)
1535#define CRYPT_ACTIVATE_NO_WRITE_WORKQUEUE (UINT32_C(1) << 25)
1537#define CRYPT_ACTIVATE_RECALCULATE_RESET (UINT32_C(1) << 26)
1539#define CRYPT_ACTIVATE_TASKLETS (UINT32_C(1) << 27)
1541#define CRYPT_ACTIVATE_HIGH_PRIORITY (UINT32_C(1) << 28)
1543#define CRYPT_ACTIVATE_ERROR_AS_CORRUPTION (UINT32_C(1) << 29)
1545#define CRYPT_ACTIVATE_INLINE_MODE (UINT32_C(1) << 30)
1546
1551 uint64_t offset;
1552 uint64_t iv_offset;
1553 uint64_t size;
1554 uint32_t flags;
1555};
1556
1567int crypt_get_active_device(struct crypt_device *cd,
1568 const char *name,
1569 struct crypt_active_device *cad);
1570
1580uint64_t crypt_get_active_integrity_failures(struct crypt_device *cd,
1581 const char *name);
1594#define CRYPT_REQUIREMENT_OFFLINE_REENCRYPT (UINT32_C(1) << 0)
1596#define CRYPT_REQUIREMENT_ONLINE_REENCRYPT (UINT32_C(1) << 1)
1598#define CRYPT_REQUIREMENT_OPAL (UINT32_C(1) << 2)
1600#define CRYPT_REQUIREMENT_INLINE_HW_TAGS (UINT32_C(1) << 3)
1602#define CRYPT_REQUIREMENT_UNKNOWN (UINT32_C(1) << 31)
1603
1611
1632int crypt_persistent_flags_set(struct crypt_device *cd,
1633 crypt_flags_type type,
1634 uint32_t flags);
1635
1645int crypt_persistent_flags_get(struct crypt_device *cd,
1646 crypt_flags_type type,
1647 uint32_t *flags);
1681int crypt_activate_by_keyslot_context(struct crypt_device *cd,
1682 const char *name,
1683 int keyslot,
1684 struct crypt_keyslot_context *kc,
1685 int additional_keyslot,
1686 struct crypt_keyslot_context *additional_kc,
1687 uint32_t flags);
1688
1701int crypt_activate_by_passphrase(struct crypt_device *cd,
1702 const char *name,
1703 int keyslot,
1704 const char *passphrase,
1705 size_t passphrase_size,
1706 uint32_t flags);
1707
1722 const char *name,
1723 int keyslot,
1724 const char *keyfile,
1725 size_t keyfile_size,
1726 uint64_t keyfile_offset,
1727 uint32_t flags);
1728
1732int crypt_activate_by_keyfile_offset(struct crypt_device *cd,
1733 const char *name,
1734 int keyslot,
1735 const char *keyfile,
1736 size_t keyfile_size,
1737 size_t keyfile_offset,
1738 uint32_t flags);
1739
1743int crypt_activate_by_keyfile(struct crypt_device *cd,
1744 const char *name,
1745 int keyslot,
1746 const char *keyfile,
1747 size_t keyfile_size,
1748 uint32_t flags);
1749
1773int crypt_activate_by_volume_key(struct crypt_device *cd,
1774 const char *name,
1775 const char *volume_key,
1776 size_t volume_key_size,
1777 uint32_t flags);
1778
1796int crypt_activate_by_signed_key(struct crypt_device *cd,
1797 const char *name,
1798 const char *volume_key,
1799 size_t volume_key_size,
1800 const char *signature,
1801 size_t signature_size,
1802 uint32_t flags);
1803
1820int crypt_activate_by_keyring(struct crypt_device *cd,
1821 const char *name,
1822 const char *key_description,
1823 int keyslot,
1824 uint32_t flags);
1825
1827#define CRYPT_DEACTIVATE_DEFERRED (UINT32_C(1) << 0)
1829#define CRYPT_DEACTIVATE_FORCE (UINT32_C(1) << 1)
1831#define CRYPT_DEACTIVATE_DEFERRED_CANCEL (UINT32_C(1) << 2)
1832
1845int crypt_deactivate_by_name(struct crypt_device *cd,
1846 const char *name,
1847 uint32_t flags);
1848
1852int crypt_deactivate(struct crypt_device *cd, const char *name);
1881int crypt_volume_key_get(struct crypt_device *cd,
1882 int keyslot,
1883 char *volume_key,
1884 size_t *volume_key_size,
1885 const char *passphrase,
1886 size_t passphrase_size);
1887
1918 int keyslot,
1919 char *volume_key,
1920 size_t *volume_key_size,
1921 struct crypt_keyslot_context *kc);
1922
1936int crypt_volume_key_verify(struct crypt_device *cd,
1937 const char *volume_key,
1938 size_t volume_key_size);
1956
1966crypt_status_info crypt_status(struct crypt_device *cd, const char *name);
1967
1975int crypt_dump(struct crypt_device *cd);
1976
1986int crypt_dump_json(struct crypt_device *cd, const char **json, uint32_t flags);
1987
1996const char *crypt_get_cipher(struct crypt_device *cd);
1997
2006const char *crypt_get_cipher_mode(struct crypt_device *cd);
2007
2016const char *crypt_get_uuid(struct crypt_device *cd);
2017
2026const char *crypt_get_device_name(struct crypt_device *cd);
2027
2036const char *crypt_get_metadata_device_name(struct crypt_device *cd);
2037
2046uint64_t crypt_get_data_offset(struct crypt_device *cd);
2047
2056uint64_t crypt_get_iv_offset(struct crypt_device *cd);
2057
2068int crypt_get_volume_key_size(struct crypt_device *cd);
2069
2081int crypt_get_old_volume_key_size(struct crypt_device *cd);
2082
2091int crypt_get_sector_size(struct crypt_device *cd);
2092
2106int crypt_header_is_detached(struct crypt_device *cd);
2107
2117int crypt_get_verity_info(struct crypt_device *cd,
2118 struct crypt_params_verity *vp);
2119
2129int crypt_get_integrity_info(struct crypt_device *cd,
2130 struct crypt_params_integrity *ip);
2157int crypt_benchmark(struct crypt_device *cd,
2158 const char *cipher,
2159 const char *cipher_mode,
2160 size_t volume_key_size,
2161 size_t iv_size,
2162 size_t buffer_size,
2163 double *encryption_mbs,
2164 double *decryption_mbs);
2165
2181int crypt_benchmark_pbkdf(struct crypt_device *cd,
2182 struct crypt_pbkdf_type *pbkdf,
2183 const char *password,
2184 size_t password_size,
2185 const char *salt,
2186 size_t salt_size,
2187 size_t volume_key_size,
2188 int (*progress)(uint32_t time_ms, void *usrptr),
2189 void *usrptr);
2209
2219crypt_keyslot_info crypt_keyslot_status(struct crypt_device *cd, int keyslot);
2220
2230
2239crypt_keyslot_priority crypt_keyslot_get_priority(struct crypt_device *cd, int keyslot);
2240
2250int crypt_keyslot_set_priority(struct crypt_device *cd, int keyslot, crypt_keyslot_priority priority);
2251
2260int crypt_keyslot_max(const char *type);
2261
2273int crypt_keyslot_area(struct crypt_device *cd,
2274 int keyslot,
2275 uint64_t *offset,
2276 uint64_t *length);
2277
2288int crypt_keyslot_get_key_size(struct crypt_device *cd, int keyslot);
2289
2303const char *crypt_keyslot_get_encryption(struct crypt_device *cd, int keyslot, size_t *key_size);
2304
2314int crypt_keyslot_get_pbkdf(struct crypt_device *cd, int keyslot, struct crypt_pbkdf_type *pbkdf);
2315
2330int crypt_keyslot_set_encryption(struct crypt_device *cd,
2331 const char *cipher,
2332 size_t key_size);
2333
2339const char *crypt_get_dir(void);
2340
2358int crypt_header_backup(struct crypt_device *cd,
2359 const char *requested_type,
2360 const char *backup_file);
2361
2372int crypt_header_restore(struct crypt_device *cd,
2373 const char *requested_type,
2374 const char *backup_file);
2385#define CRYPT_DEBUG_ALL -1
2387#define CRYPT_DEBUG_JSON -2
2389#define CRYPT_DEBUG_NONE 0
2390
2422int crypt_keyfile_device_read(struct crypt_device *cd,
2423 const char *keyfile,
2424 char **key, size_t *key_size_read,
2425 uint64_t keyfile_offset,
2426 size_t key_size,
2427 uint32_t flags);
2428
2432int crypt_keyfile_read(struct crypt_device *cd,
2433 const char *keyfile,
2434 char **key, size_t *key_size_read,
2435 size_t keyfile_offset,
2436 size_t key_size,
2437 uint32_t flags);
2438
2440#define CRYPT_KEYFILE_STOP_EOL (UINT32_C(1) << 0)
2457
2478int crypt_wipe(struct crypt_device *cd,
2479 const char *dev_path, /* if null, use data device */
2480 crypt_wipe_pattern pattern,
2481 uint64_t offset,
2482 uint64_t length,
2483 size_t wipe_block_size,
2484 uint32_t flags,
2485 int (*progress)(uint64_t size, uint64_t offset, void *usrptr),
2486 void *usrptr
2487);
2488
2490#define CRYPT_WIPE_NO_DIRECT_IO (UINT32_C(1) << 0)
2491
2492enum {
2493 CRYPT_LUKS2_SEGMENT = -2,
2494 CRYPT_NO_SEGMENT = -1,
2495};
2496
2514int crypt_wipe_hw_opal(struct crypt_device *cd,
2515 int segment, /* 0..8, CRYPT_LUKS2_SEGMENT -2, CRYPT_NO_SEGMENT -1 */
2516 const char *password, /* Admin1 PIN or PSID */
2517 size_t password_size,
2518 uint32_t flags /* currently unused */
2519);
2520
2546int crypt_token_max(const char *type);
2547
2549#define CRYPT_ANY_TOKEN -1
2550
2560int crypt_token_json_get(struct crypt_device *cd,
2561 int token,
2562 const char **json);
2563
2577int crypt_token_json_set(struct crypt_device *cd,
2578 int token,
2579 const char *json);
2580
2592
2607crypt_token_info crypt_token_status(struct crypt_device *cd, int token, const char **type);
2608
2618
2629int crypt_token_luks2_keyring_set(struct crypt_device *cd,
2630 int token,
2631 const struct crypt_token_params_luks2_keyring *params);
2632
2645int crypt_token_luks2_keyring_get(struct crypt_device *cd,
2646 int token,
2647 struct crypt_token_params_luks2_keyring *params);
2648
2660int crypt_token_assign_keyslot(struct crypt_device *cd,
2661 int token,
2662 int keyslot);
2663
2675int crypt_token_unassign_keyslot(struct crypt_device *cd,
2676 int token,
2677 int keyslot);
2678
2690int crypt_token_is_assigned(struct crypt_device *cd,
2691 int token,
2692 int keyslot);
2693
2716 struct crypt_device *cd,
2717 int token,
2718 char **buffer,
2719 size_t *buffer_len,
2720 void *usrptr);
2721
2746 struct crypt_device *cd,
2747 int token,
2748 const char *pin,
2749 size_t pin_size,
2750 char **buffer,
2751 size_t *buffer_len,
2752 void *usrptr);
2753
2763typedef void (*crypt_token_buffer_free_func) (void *buffer, size_t buffer_len);
2764
2776typedef int (*crypt_token_validate_func) (struct crypt_device *cd, const char *json);
2777
2789typedef void (*crypt_token_dump_func) (struct crypt_device *cd, const char *json);
2790
2799typedef const char * (*crypt_token_version_func) (void);
2800
2811
2820
2827
2837int crypt_token_set_external_path(const char *path);
2838
2844
2846#define CRYPT_TOKEN_ABI_VERSION1 "CRYPTSETUP_TOKEN_1.0"
2847
2849#define CRYPT_TOKEN_ABI_OPEN "cryptsetup_token_open"
2851#define CRYPT_TOKEN_ABI_OPEN_PIN "cryptsetup_token_open_pin"
2853#define CRYPT_TOKEN_ABI_BUFFER_FREE "cryptsetup_token_buffer_free"
2855#define CRYPT_TOKEN_ABI_VALIDATE "cryptsetup_token_validate"
2857#define CRYPT_TOKEN_ABI_DUMP "cryptsetup_token_dump"
2859#define CRYPT_TOKEN_ABI_VERSION "cryptsetup_token_version"
2860
2890int crypt_activate_by_token(struct crypt_device *cd,
2891 const char *name,
2892 int token,
2893 void *usrptr,
2894 uint32_t flags);
2895
2928int crypt_activate_by_token_pin(struct crypt_device *cd,
2929 const char *name,
2930 const char *type,
2931 int token,
2932 const char *pin,
2933 size_t pin_size,
2934 void *usrptr,
2935 uint32_t flags);
2948#define CRYPT_REENCRYPT_INITIALIZE_ONLY (UINT32_C(1) << 0)
2951#define CRYPT_REENCRYPT_MOVE_FIRST_SEGMENT (UINT32_C(1) << 1)
2953#define CRYPT_REENCRYPT_RESUME_ONLY (UINT32_C(1) << 2)
2955#define CRYPT_REENCRYPT_RECOVERY (UINT32_C(1) << 3)
2957#define CRYPT_REENCRYPT_REPAIR_NEEDED (UINT32_C(1) << 4)
2963#define CRYPT_REENCRYPT_CREATE_NEW_DIGEST (UINT32_C(1) << 5)
2964
2972
2981
3001
3022int crypt_reencrypt_init_by_passphrase(struct crypt_device *cd,
3023 const char *name,
3024 const char *passphrase,
3025 size_t passphrase_size,
3026 int keyslot_old,
3027 int keyslot_new,
3028 const char *cipher,
3029 const char *cipher_mode,
3030 const struct crypt_params_reencrypt *params);
3031
3051int crypt_reencrypt_init_by_keyring(struct crypt_device *cd,
3052 const char *name,
3053 const char *key_description,
3054 int keyslot_old,
3055 int keyslot_new,
3056 const char *cipher,
3057 const char *cipher_mode,
3058 const struct crypt_params_reencrypt *params);
3059
3116 const char *name,
3117 struct crypt_keyslot_context *kc_old,
3118 struct crypt_keyslot_context *kc_new,
3119 int keyslot_old,
3120 int keyslot_new,
3121 const char *cipher,
3122 const char *cipher_mode,
3123 const struct crypt_params_reencrypt *params);
3124
3136int crypt_reencrypt(struct crypt_device *cd,
3137 int (*progress)(uint64_t size, uint64_t offset, void *usrptr))
3138__attribute__((deprecated));
3139
3152int crypt_reencrypt_run(struct crypt_device *cd,
3153 int (*progress)(uint64_t size, uint64_t offset, void *usrptr),
3154 void *usrptr);
3155
3165
3175 struct crypt_params_reencrypt *params);
3191void *crypt_safe_alloc(size_t size);
3192
3199void crypt_safe_free(void *data);
3200
3209void *crypt_safe_realloc(void *data, size_t size);
3210
3217void crypt_safe_memzero(void *data, size_t size);
3218
3226void *crypt_safe_memcpy(void *dst, const void *src, size_t size);
3227
3271int crypt_set_keyring_to_link(struct crypt_device* cd,
3272 const char* key_description,
3273 const char* old_key_description,
3274 const char* key_type_desc,
3275 const char* keyring_to_link_vk);
3276
3279#ifdef __cplusplus
3280}
3281#endif
3282#endif /* _LIBCRYPTSETUP_H */
int crypt_suspend(struct crypt_device *cd, const char *name)
int crypt_resume_by_keyslot_context(struct crypt_device *cd, const char *name, int keyslot, struct crypt_keyslot_context *kc)
int crypt_resize(struct crypt_device *cd, const char *name, uint64_t new_size)
void crypt_set_compatibility(struct crypt_device *cd, uint32_t flags)
int crypt_set_uuid(struct crypt_device *cd, const char *uuid)
int crypt_resume_by_keyfile_device_offset(struct crypt_device *cd, const char *name, int keyslot, const char *keyfile, size_t keyfile_size, uint64_t keyfile_offset)
int crypt_resume_by_token_pin(struct crypt_device *cd, const char *name, const char *type, int token, const char *pin, size_t pin_size, void *usrptr)
int crypt_resume_by_volume_key(struct crypt_device *cd, const char *name, const char *volume_key, size_t volume_key_size)
int crypt_format_luks2_opal(struct crypt_device *cd, const char *cipher, const char *cipher_mode, const char *uuid, const char *volume_keys, size_t volume_keys_size, struct crypt_params_luks2 *params, struct crypt_params_hw_opal *opal_params)
const char * crypt_get_label(struct crypt_device *cd)
int crypt_volume_key_keyring(struct crypt_device *cd, int enable)
int crypt_format(struct crypt_device *cd, const char *type, const char *cipher, const char *cipher_mode, const char *uuid, const char *volume_key, size_t volume_key_size, void *params)
int crypt_load(struct crypt_device *cd, const char *requested_type, void *params)
const char * crypt_get_subsystem(struct crypt_device *cd)
int crypt_resume_by_keyfile_offset(struct crypt_device *cd, const char *name, int keyslot, const char *keyfile, size_t keyfile_size, size_t keyfile_offset)
int crypt_repair(struct crypt_device *cd, const char *requested_type, void *params)
uint32_t crypt_get_compatibility(struct crypt_device *cd)
int crypt_format_inline(struct crypt_device *cd, const char *type, const char *cipher, const char *cipher_mode, const char *uuid, const char *volume_key, size_t volume_key_size, void *params)
int crypt_convert(struct crypt_device *cd, const char *type, void *params)
int crypt_resume_by_passphrase(struct crypt_device *cd, const char *name, int keyslot, const char *passphrase, size_t passphrase_size)
int crypt_set_label(struct crypt_device *cd, const char *label, const char *subsystem)
int crypt_resume_by_keyfile(struct crypt_device *cd, const char *name, int keyslot, const char *keyfile, size_t keyfile_size)
int crypt_deactivate_by_name(struct crypt_device *cd, const char *name, uint32_t flags)
int crypt_activate_by_passphrase(struct crypt_device *cd, const char *name, int keyslot, const char *passphrase, size_t passphrase_size, uint32_t flags)
int crypt_activate_by_signed_key(struct crypt_device *cd, const char *name, const char *volume_key, size_t volume_key_size, const char *signature, size_t signature_size, uint32_t flags)
int crypt_deactivate(struct crypt_device *cd, const char *name)
int crypt_activate_by_keyfile_device_offset(struct crypt_device *cd, const char *name, int keyslot, const char *keyfile, size_t keyfile_size, uint64_t keyfile_offset, uint32_t flags)
int crypt_activate_by_volume_key(struct crypt_device *cd, const char *name, const char *volume_key, size_t volume_key_size, uint32_t flags)
int crypt_activate_by_keyfile_offset(struct crypt_device *cd, const char *name, int keyslot, const char *keyfile, size_t keyfile_size, size_t keyfile_offset, uint32_t flags)
int crypt_activate_by_keyfile(struct crypt_device *cd, const char *name, int keyslot, const char *keyfile, size_t keyfile_size, uint32_t flags)
int crypt_activate_by_keyslot_context(struct crypt_device *cd, const char *name, int keyslot, struct crypt_keyslot_context *kc, int additional_keyslot, struct crypt_keyslot_context *additional_kc, uint32_t flags)
int crypt_activate_by_keyring(struct crypt_device *cd, const char *name, const char *key_description, int keyslot, uint32_t flags)
uint64_t crypt_get_active_integrity_failures(struct crypt_device *cd, const char *name)
int crypt_get_active_device(struct crypt_device *cd, const char *name, struct crypt_active_device *cad)
int crypt_header_backup(struct crypt_device *cd, const char *requested_type, const char *backup_file)
int crypt_header_restore(struct crypt_device *cd, const char *requested_type, const char *backup_file)
int crypt_benchmark(struct crypt_device *cd, const char *cipher, const char *cipher_mode, size_t volume_key_size, size_t iv_size, size_t buffer_size, double *encryption_mbs, double *decryption_mbs)
int crypt_benchmark_pbkdf(struct crypt_device *cd, struct crypt_pbkdf_type *pbkdf, const char *password, size_t password_size, const char *salt, size_t salt_size, size_t volume_key_size, int(*progress)(uint32_t time_ms, void *usrptr), void *usrptr)
void crypt_set_debug_level(int level)
int crypt_dump(struct crypt_device *cd)
const char * crypt_get_cipher_mode(struct crypt_device *cd)
int crypt_get_verity_info(struct crypt_device *cd, struct crypt_params_verity *vp)
int crypt_header_is_detached(struct crypt_device *cd)
uint64_t crypt_get_data_offset(struct crypt_device *cd)
int crypt_get_volume_key_size(struct crypt_device *cd)
int crypt_dump_json(struct crypt_device *cd, const char **json, uint32_t flags)
int crypt_get_sector_size(struct crypt_device *cd)
crypt_status_info
Definition libcryptsetup.h:1950
uint64_t crypt_get_iv_offset(struct crypt_device *cd)
const char * crypt_get_metadata_device_name(struct crypt_device *cd)
const char * crypt_get_device_name(struct crypt_device *cd)
crypt_status_info crypt_status(struct crypt_device *cd, const char *name)
const char * crypt_get_uuid(struct crypt_device *cd)
int crypt_get_integrity_info(struct crypt_device *cd, struct crypt_params_integrity *ip)
int crypt_get_old_volume_key_size(struct crypt_device *cd)
const char * crypt_get_cipher(struct crypt_device *cd)
@ CRYPT_INVALID
Definition libcryptsetup.h:1951
@ CRYPT_ACTIVE
Definition libcryptsetup.h:1953
@ CRYPT_INACTIVE
Definition libcryptsetup.h:1952
@ CRYPT_BUSY
Definition libcryptsetup.h:1954
int crypt_init_by_name(struct crypt_device **cd, const char *name)
void crypt_free(struct crypt_device *cd)
int crypt_init_data_device(struct crypt_device **cd, const char *device, const char *data_device)
int crypt_set_data_offset(struct crypt_device *cd, uint64_t data_offset)
int crypt_init_by_name_and_header(struct crypt_device **cd, const char *name, const char *header_device)
int crypt_init(struct crypt_device **cd, const char *device)
void crypt_set_confirm_callback(struct crypt_device *cd, int(*confirm)(const char *msg, void *usrptr), void *usrptr)
int crypt_set_data_device(struct crypt_device *cd, const char *device)
int crypt_volume_key_verify(struct crypt_device *cd, const char *volume_key, size_t volume_key_size)
int crypt_volume_key_get_by_keyslot_context(struct crypt_device *cd, int keyslot, char *volume_key, size_t *volume_key_size, struct crypt_keyslot_context *kc)
int crypt_volume_key_get(struct crypt_device *cd, int keyslot, char *volume_key, size_t *volume_key_size, const char *passphrase, size_t passphrase_size)
int crypt_keyfile_device_read(struct crypt_device *cd, const char *keyfile, char **key, size_t *key_size_read, uint64_t keyfile_offset, size_t key_size, uint32_t flags)
int crypt_keyfile_read(struct crypt_device *cd, const char *keyfile, char **key, size_t *key_size_read, size_t keyfile_offset, size_t key_size, uint32_t flags)
int crypt_set_keyring_to_link(struct crypt_device *cd, const char *key_description, const char *old_key_description, const char *key_type_desc, const char *keyring_to_link_vk)
int crypt_keyslot_context_init_by_signed_key(struct crypt_device *cd, const char *volume_key, size_t volume_key_size, const char *signature, size_t signature_size, struct crypt_keyslot_context **kc)
int crypt_keyslot_context_init_by_keyring(struct crypt_device *cd, const char *key_description, struct crypt_keyslot_context **kc)
int crypt_keyslot_context_set_pin(struct crypt_device *cd, const char *pin, size_t pin_size, struct crypt_keyslot_context *kc)
int crypt_keyslot_context_init_by_keyfile(struct crypt_device *cd, const char *keyfile, size_t keyfile_size, uint64_t keyfile_offset, struct crypt_keyslot_context **kc)
int crypt_keyslot_context_init_by_passphrase(struct crypt_device *cd, const char *passphrase, size_t passphrase_size, struct crypt_keyslot_context **kc)
int crypt_keyslot_context_init_by_vk_in_keyring(struct crypt_device *cd, const char *key_description, struct crypt_keyslot_context **kc)
int crypt_keyslot_context_init_by_token(struct crypt_device *cd, int token, const char *type, const char *pin, size_t pin_size, void *usrptr, struct crypt_keyslot_context **kc)
int crypt_keyslot_context_get_type(const struct crypt_keyslot_context *kc)
int crypt_keyslot_context_get_error(struct crypt_keyslot_context *kc)
int crypt_keyslot_context_init_by_volume_key(struct crypt_device *cd, const char *volume_key, size_t volume_key_size, struct crypt_keyslot_context **kc)
void crypt_keyslot_context_free(struct crypt_keyslot_context *kc)
int crypt_keyslot_add_by_keyslot_context(struct crypt_device *cd, int keyslot_existing, struct crypt_keyslot_context *kc, int keyslot_new, struct crypt_keyslot_context *new_kc, uint32_t flags)
crypt_keyslot_info
Definition libcryptsetup.h:2200
int crypt_keyslot_area(struct crypt_device *cd, int keyslot, uint64_t *offset, uint64_t *length)
int crypt_keyslot_set_encryption(struct crypt_device *cd, const char *cipher, size_t key_size)
int crypt_keyslot_add_by_keyfile(struct crypt_device *cd, int keyslot, const char *keyfile, size_t keyfile_size, const char *new_keyfile, size_t new_keyfile_size)
crypt_keyslot_priority
Definition libcryptsetup.h:2224
int crypt_keyslot_add_by_passphrase(struct crypt_device *cd, int keyslot, const char *passphrase, size_t passphrase_size, const char *new_passphrase, size_t new_passphrase_size)
int crypt_keyslot_change_by_passphrase(struct crypt_device *cd, int keyslot_old, int keyslot_new, const char *passphrase, size_t passphrase_size, const char *new_passphrase, size_t new_passphrase_size)
int crypt_keyslot_add_by_keyfile_device_offset(struct crypt_device *cd, int keyslot, const char *keyfile, size_t keyfile_size, uint64_t keyfile_offset, const char *new_keyfile, size_t new_keyfile_size, uint64_t new_keyfile_offset)
const char * crypt_get_dir(void)
int crypt_keyslot_add_by_key(struct crypt_device *cd, int keyslot, const char *volume_key, size_t volume_key_size, const char *passphrase, size_t passphrase_size, uint32_t flags)
int crypt_keyslot_set_priority(struct crypt_device *cd, int keyslot, crypt_keyslot_priority priority)
int crypt_keyslot_add_by_keyfile_offset(struct crypt_device *cd, int keyslot, const char *keyfile, size_t keyfile_size, size_t keyfile_offset, const char *new_keyfile, size_t new_keyfile_size, size_t new_keyfile_offset)
int crypt_keyslot_add_by_volume_key(struct crypt_device *cd, int keyslot, const char *volume_key, size_t volume_key_size, const char *passphrase, size_t passphrase_size)
int crypt_keyslot_destroy(struct crypt_device *cd, int keyslot)
int crypt_keyslot_get_pbkdf(struct crypt_device *cd, int keyslot, struct crypt_pbkdf_type *pbkdf)
crypt_keyslot_priority crypt_keyslot_get_priority(struct crypt_device *cd, int keyslot)
crypt_keyslot_info crypt_keyslot_status(struct crypt_device *cd, int keyslot)
const char * crypt_keyslot_get_encryption(struct crypt_device *cd, int keyslot, size_t *key_size)
int crypt_keyslot_max(const char *type)
int crypt_keyslot_get_key_size(struct crypt_device *cd, int keyslot)
@ CRYPT_SLOT_UNBOUND
Definition libcryptsetup.h:2206
@ CRYPT_SLOT_ACTIVE_LAST
Definition libcryptsetup.h:2204
@ CRYPT_SLOT_INACTIVE
Definition libcryptsetup.h:2202
@ CRYPT_SLOT_ACTIVE
Definition libcryptsetup.h:2203
@ CRYPT_SLOT_INVALID
Definition libcryptsetup.h:2201
@ CRYPT_SLOT_PRIORITY_IGNORE
Definition libcryptsetup.h:2226
@ CRYPT_SLOT_PRIORITY_INVALID
Definition libcryptsetup.h:2225
@ CRYPT_SLOT_PRIORITY_NORMAL
Definition libcryptsetup.h:2227
@ CRYPT_SLOT_PRIORITY_PREFER
Definition libcryptsetup.h:2228
void crypt_logf(struct crypt_device *cd, int level, const char *format,...)
void crypt_set_log_callback(struct crypt_device *cd, void(*log)(int level, const char *msg, void *usrptr), void *usrptr)
void crypt_log(struct crypt_device *cd, int level, const char *msg)
void crypt_safe_free(void *data)
void crypt_safe_memzero(void *data, size_t size)
void * crypt_safe_alloc(size_t size)
void * crypt_safe_memcpy(void *dst, const void *src, size_t size)
void * crypt_safe_realloc(void *data, size_t size)
int crypt_persistent_flags_get(struct crypt_device *cd, crypt_flags_type type, uint32_t *flags)
crypt_flags_type
Definition libcryptsetup.h:1607
int crypt_persistent_flags_set(struct crypt_device *cd, crypt_flags_type type, uint32_t flags)
@ CRYPT_FLAGS_REQUIREMENTS
Definition libcryptsetup.h:1609
@ CRYPT_FLAGS_ACTIVATION
Definition libcryptsetup.h:1608
int crypt_reencrypt_init_by_keyring(struct crypt_device *cd, const char *name, const char *key_description, int keyslot_old, int keyslot_new, const char *cipher, const char *cipher_mode, const struct crypt_params_reencrypt *params)
crypt_reencrypt_mode_info
Definition libcryptsetup.h:2976
int crypt_reencrypt_init_by_keyslot_context(struct crypt_device *cd, const char *name, struct crypt_keyslot_context *kc_old, struct crypt_keyslot_context *kc_new, int keyslot_old, int keyslot_new, const char *cipher, const char *cipher_mode, const struct crypt_params_reencrypt *params)
int crypt_reencrypt_run(struct crypt_device *cd, int(*progress)(uint64_t size, uint64_t offset, void *usrptr), void *usrptr)
crypt_reencrypt_info
Definition libcryptsetup.h:3159
int crypt_reencrypt_init_by_passphrase(struct crypt_device *cd, const char *name, const char *passphrase, size_t passphrase_size, int keyslot_old, int keyslot_new, const char *cipher, const char *cipher_mode, const struct crypt_params_reencrypt *params)
crypt_reencrypt_info crypt_reencrypt_status(struct crypt_device *cd, struct crypt_params_reencrypt *params)
int crypt_reencrypt(struct crypt_device *cd, int(*progress)(uint64_t size, uint64_t offset, void *usrptr)) __attribute__((deprecated))
crypt_reencrypt_direction_info
Definition libcryptsetup.h:2968
@ CRYPT_REENCRYPT_ENCRYPT
Definition libcryptsetup.h:2978
@ CRYPT_REENCRYPT_DECRYPT
Definition libcryptsetup.h:2979
@ CRYPT_REENCRYPT_REENCRYPT
Definition libcryptsetup.h:2977
@ CRYPT_REENCRYPT_INVALID
Definition libcryptsetup.h:3163
@ CRYPT_REENCRYPT_NONE
Definition libcryptsetup.h:3160
@ CRYPT_REENCRYPT_CLEAN
Definition libcryptsetup.h:3161
@ CRYPT_REENCRYPT_CRASH
Definition libcryptsetup.h:3162
@ CRYPT_REENCRYPT_BACKWARD
Definition libcryptsetup.h:2970
@ CRYPT_REENCRYPT_FORWARD
Definition libcryptsetup.h:2969
const struct crypt_pbkdf_type * crypt_get_pbkdf_type_params(const char *pbkdf_type)
int crypt_memory_lock(struct crypt_device *cd, int lock) __attribute__((deprecated))
int crypt_get_metadata_size(struct crypt_device *cd, uint64_t *metadata_size, uint64_t *keyslots_size)
const struct crypt_pbkdf_type * crypt_get_pbkdf_default(const char *type)
void crypt_set_rng_type(struct crypt_device *cd, int rng_type)
void crypt_set_iteration_time(struct crypt_device *cd, uint64_t iteration_time_ms)
int crypt_metadata_locking(struct crypt_device *cd, int enable)
const struct crypt_pbkdf_type * crypt_get_pbkdf_type(struct crypt_device *cd)
int crypt_set_metadata_size(struct crypt_device *cd, uint64_t metadata_size, uint64_t keyslots_size)
int crypt_get_rng_type(struct crypt_device *cd)
int crypt_set_pbkdf_type(struct crypt_device *cd, const struct crypt_pbkdf_type *pbkdf)
int(* crypt_token_open_func)(struct crypt_device *cd, int token, char **buffer, size_t *buffer_len, void *usrptr)
Definition libcryptsetup.h:2715
int crypt_token_assign_keyslot(struct crypt_device *cd, int token, int keyslot)
void(* crypt_token_dump_func)(struct crypt_device *cd, const char *json)
Definition libcryptsetup.h:2789
int crypt_token_luks2_keyring_set(struct crypt_device *cd, int token, const struct crypt_token_params_luks2_keyring *params)
const char * crypt_token_external_path(void)
void crypt_token_external_disable(void)
int crypt_token_json_set(struct crypt_device *cd, int token, const char *json)
int crypt_token_luks2_keyring_get(struct crypt_device *cd, int token, struct crypt_token_params_luks2_keyring *params)
crypt_token_info
Definition libcryptsetup.h:2584
int crypt_token_unassign_keyslot(struct crypt_device *cd, int token, int keyslot)
int crypt_token_register(const crypt_token_handler *handler)
int crypt_token_max(const char *type)
int(* crypt_token_open_pin_func)(struct crypt_device *cd, int token, const char *pin, size_t pin_size, char **buffer, size_t *buffer_len, void *usrptr)
Definition libcryptsetup.h:2745
crypt_token_info crypt_token_status(struct crypt_device *cd, int token, const char **type)
int crypt_token_is_assigned(struct crypt_device *cd, int token, int keyslot)
int crypt_token_set_external_path(const char *path)
int(* crypt_token_validate_func)(struct crypt_device *cd, const char *json)
Definition libcryptsetup.h:2776
int crypt_token_json_get(struct crypt_device *cd, int token, const char **json)
int crypt_activate_by_token_pin(struct crypt_device *cd, const char *name, const char *type, int token, const char *pin, size_t pin_size, void *usrptr, uint32_t flags)
void(* crypt_token_buffer_free_func)(void *buffer, size_t buffer_len)
Definition libcryptsetup.h:2763
int crypt_activate_by_token(struct crypt_device *cd, const char *name, int token, void *usrptr, uint32_t flags)
@ CRYPT_TOKEN_INTERNAL_UNKNOWN
Definition libcryptsetup.h:2588
@ CRYPT_TOKEN_EXTERNAL_UNKNOWN
Definition libcryptsetup.h:2590
@ CRYPT_TOKEN_EXTERNAL
Definition libcryptsetup.h:2589
@ CRYPT_TOKEN_INACTIVE
Definition libcryptsetup.h:2586
@ CRYPT_TOKEN_INTERNAL
Definition libcryptsetup.h:2587
@ CRYPT_TOKEN_INVALID
Definition libcryptsetup.h:2585
const char * crypt_get_default_type(void)
int crypt_get_hw_encryption_type(struct crypt_device *cd)
const char * crypt_get_type(struct crypt_device *cd)
int crypt_get_hw_encryption_key_size(struct crypt_device *cd)
int crypt_wipe_hw_opal(struct crypt_device *cd, int segment, const char *password, size_t password_size, uint32_t flags)
int crypt_wipe(struct crypt_device *cd, const char *dev_path, crypt_wipe_pattern pattern, uint64_t offset, uint64_t length, size_t wipe_block_size, uint32_t flags, int(*progress)(uint64_t size, uint64_t offset, void *usrptr), void *usrptr)
crypt_wipe_pattern
Definition libcryptsetup.h:2451
@ CRYPT_WIPE_ZERO
Definition libcryptsetup.h:2452
@ CRYPT_WIPE_RANDOM
Definition libcryptsetup.h:2453
@ CRYPT_WIPE_SPECIAL
Definition libcryptsetup.h:2455
@ CRYPT_WIPE_ENCRYPTED_ZERO
Definition libcryptsetup.h:2454
Definition libcryptsetup.h:1550
uint64_t offset
Definition libcryptsetup.h:1551
uint64_t iv_offset
Definition libcryptsetup.h:1552
uint64_t size
Definition libcryptsetup.h:1553
uint32_t flags
Definition libcryptsetup.h:1554
Definition libcryptsetup.h:634
size_t user_key_size
Definition libcryptsetup.h:637
const char * admin_key
Definition libcryptsetup.h:635
size_t admin_key_size
Definition libcryptsetup.h:636
Definition libcryptsetup.h:588
uint32_t sector_size
Definition libcryptsetup.h:594
uint32_t journal_integrity_key_size
Definition libcryptsetup.h:601
unsigned int journal_commit_time
Definition libcryptsetup.h:591
uint32_t journal_crypt_key_size
Definition libcryptsetup.h:605
uint32_t integrity_key_size
Definition libcryptsetup.h:597
uint32_t interleave_sectors
Definition libcryptsetup.h:592
const char * journal_integrity
Definition libcryptsetup.h:599
uint64_t journal_size
Definition libcryptsetup.h:589
const char * integrity
Definition libcryptsetup.h:596
const char * journal_crypt_key
Definition libcryptsetup.h:604
const char * journal_crypt
Definition libcryptsetup.h:603
uint32_t buffer_sectors
Definition libcryptsetup.h:595
unsigned int journal_watermark
Definition libcryptsetup.h:590
const char * journal_integrity_key
Definition libcryptsetup.h:600
uint32_t tag_size
Definition libcryptsetup.h:593
Definition libcryptsetup.h:504
uint64_t skip
Definition libcryptsetup.h:507
const char * hash
Definition libcryptsetup.h:505
uint64_t offset
Definition libcryptsetup.h:506
Definition libcryptsetup.h:491
const char * hash
Definition libcryptsetup.h:492
const char * data_device
Definition libcryptsetup.h:494
size_t data_alignment
Definition libcryptsetup.h:493
Definition libcryptsetup.h:617
const struct crypt_params_integrity * integrity_params
Definition libcryptsetup.h:620
const char * label
Definition libcryptsetup.h:624
size_t data_alignment
Definition libcryptsetup.h:621
const struct crypt_pbkdf_type * pbkdf
Definition libcryptsetup.h:618
const char * subsystem
Definition libcryptsetup.h:625
uint32_t sector_size
Definition libcryptsetup.h:623
const char * data_device
Definition libcryptsetup.h:622
const char * integrity
Definition libcryptsetup.h:619
Definition libcryptsetup.h:474
uint32_t sector_size
Definition libcryptsetup.h:479
uint64_t offset
Definition libcryptsetup.h:476
const char * hash
Definition libcryptsetup.h:475
uint64_t size
Definition libcryptsetup.h:478
uint64_t skip
Definition libcryptsetup.h:477
Definition libcryptsetup.h:2985
const char * hash
Definition libcryptsetup.h:2992
crypt_reencrypt_direction_info direction
Definition libcryptsetup.h:2987
const char * resilience
Definition libcryptsetup.h:2988
uint64_t data_shift
Definition libcryptsetup.h:2993
uint64_t max_hotzone_size
Definition libcryptsetup.h:2995
crypt_reencrypt_mode_info mode
Definition libcryptsetup.h:2986
uint64_t device_size
Definition libcryptsetup.h:2997
const struct crypt_params_luks2 * luks2
Definition libcryptsetup.h:2998
uint32_t flags
Definition libcryptsetup.h:2999
Definition libcryptsetup.h:550
const char ** keyfiles
Definition libcryptsetup.h:553
const char * passphrase
Definition libcryptsetup.h:551
size_t key_size
Definition libcryptsetup.h:558
const char * mode
Definition libcryptsetup.h:557
unsigned int keyfiles_count
Definition libcryptsetup.h:554
uint32_t flags
Definition libcryptsetup.h:559
const char * hash_name
Definition libcryptsetup.h:555
size_t passphrase_size
Definition libcryptsetup.h:552
const char * cipher
Definition libcryptsetup.h:556
uint32_t veracrypt_pim
Definition libcryptsetup.h:560
Definition libcryptsetup.h:517
uint32_t fec_roots
Definition libcryptsetup.h:530
const char * data_device
Definition libcryptsetup.h:519
uint64_t data_size
Definition libcryptsetup.h:527
const char * fec_device
Definition libcryptsetup.h:521
const char * hash_name
Definition libcryptsetup.h:518
uint32_t flags
Definition libcryptsetup.h:531
uint32_t data_block_size
Definition libcryptsetup.h:525
uint32_t salt_size
Definition libcryptsetup.h:523
uint32_t hash_type
Definition libcryptsetup.h:524
uint64_t hash_area_offset
Definition libcryptsetup.h:528
const char * salt
Definition libcryptsetup.h:522
uint32_t hash_block_size
Definition libcryptsetup.h:526
const char * hash_device
Definition libcryptsetup.h:520
uint64_t fec_area_offset
Definition libcryptsetup.h:529
Definition libcryptsetup.h:251
const char * type
Definition libcryptsetup.h:252
uint32_t time_ms
Definition libcryptsetup.h:254
const char * hash
Definition libcryptsetup.h:253
uint32_t flags
Definition libcryptsetup.h:258
uint32_t max_memory_kb
Definition libcryptsetup.h:256
uint32_t iterations
Definition libcryptsetup.h:255
uint32_t parallel_threads
Definition libcryptsetup.h:257
Definition libcryptsetup.h:2804
crypt_token_dump_func dump
Definition libcryptsetup.h:2809
crypt_token_validate_func validate
Definition libcryptsetup.h:2808
const char * name
Definition libcryptsetup.h:2805
crypt_token_buffer_free_func buffer_free
Definition libcryptsetup.h:2807
crypt_token_open_func open
Definition libcryptsetup.h:2806
Definition libcryptsetup.h:2615
const char * key_description
Definition libcryptsetup.h:2616