cryptsetup API
Public cryptsetup API
Loading...
Searching...
No Matches
libcryptsetup.h
Go to the documentation of this file.
1/*
2 * libcryptsetup - cryptsetup library
3 *
4 * Copyright (C) 2004 Jana Saout <jana@saout.de>
5 * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
6 * Copyright (C) 2009-2024 Red Hat, Inc. All rights reserved.
7 * Copyright (C) 2009-2024 Milan Broz
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 */
23
32#ifndef _LIBCRYPTSETUP_H
33#define _LIBCRYPTSETUP_H
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38#include <stddef.h>
39#include <stdint.h>
40
48struct crypt_device; /* crypt device handle */
49struct crypt_keyslot_context;
50
66int crypt_init(struct crypt_device **cd, const char *device);
67
81int crypt_init_data_device(struct crypt_device **cd,
82 const char *device,
83 const char *data_device);
84
104int crypt_init_by_name_and_header(struct crypt_device **cd,
105 const char *name,
106 const char *header_device);
107
114int crypt_init_by_name(struct crypt_device **cd, const char *name);
115
121void crypt_free(struct crypt_device *cd);
122
141void crypt_set_confirm_callback(struct crypt_device *cd,
142 int (*confirm)(const char *msg, void *usrptr),
143 void *usrptr);
144
155int crypt_set_data_device(struct crypt_device *cd, const char *device);
156
174int crypt_set_data_offset(struct crypt_device *cd, uint64_t data_offset);
175
187#define CRYPT_LOG_NORMAL 0
189#define CRYPT_LOG_ERROR 1
191#define CRYPT_LOG_VERBOSE 2
193#define CRYPT_LOG_DEBUG -1
195#define CRYPT_LOG_DEBUG_JSON -2
196
207void crypt_set_log_callback(struct crypt_device *cd,
208 void (*log)(int level, const char *msg, void *usrptr),
209 void *usrptr);
210
220void crypt_log(struct crypt_device *cd, int level, const char *msg);
221
229void crypt_logf(struct crypt_device *cd, int level, const char *format, ...);
239#define CRYPT_RNG_URANDOM 0
241#define CRYPT_RNG_RANDOM 1
242
250void crypt_set_rng_type(struct crypt_device *cd, int rng_type);
251
259int crypt_get_rng_type(struct crypt_device *cd);
260
265 const char *type;
266 const char *hash;
267 uint32_t time_ms;
268 uint32_t iterations;
269 uint32_t max_memory_kb;
271 uint32_t flags;
272};
273
275#define CRYPT_PBKDF_ITER_TIME_SET (UINT32_C(1) << 0)
277#define CRYPT_PBKDF_NO_BENCHMARK (UINT32_C(1) << 1)
278
280#define CRYPT_KDF_PBKDF2 "pbkdf2"
282#define CRYPT_KDF_ARGON2I "argon2i"
284#define CRYPT_KDF_ARGON2ID "argon2id"
285
298int crypt_set_pbkdf_type(struct crypt_device *cd,
299 const struct crypt_pbkdf_type *pbkdf);
300
309const struct crypt_pbkdf_type *crypt_get_pbkdf_type_params(const char *pbkdf_type);
310
321
331const struct crypt_pbkdf_type *crypt_get_pbkdf_type(struct crypt_device *cd);
332
344void crypt_set_iteration_time(struct crypt_device *cd, uint64_t iteration_time_ms);
345
358int crypt_memory_lock(struct crypt_device *cd, int lock) __attribute__((deprecated));
359
372int crypt_metadata_locking(struct crypt_device *cd, int enable);
373
388int crypt_set_metadata_size(struct crypt_device *cd,
389 uint64_t metadata_size,
390 uint64_t keyslots_size);
391
402int crypt_get_metadata_size(struct crypt_device *cd,
403 uint64_t *metadata_size,
404 uint64_t *keyslots_size);
405
417#define CRYPT_PLAIN "PLAIN"
419#define CRYPT_LUKS1 "LUKS1"
421#define CRYPT_LUKS2 "LUKS2"
423#define CRYPT_LOOPAES "LOOPAES"
425#define CRYPT_VERITY "VERITY"
427#define CRYPT_TCRYPT "TCRYPT"
429#define CRYPT_INTEGRITY "INTEGRITY"
431#define CRYPT_BITLK "BITLK"
433#define CRYPT_FVAULT2 "FVAULT2"
434
436#define CRYPT_LUKS NULL
437
444const char *crypt_get_type(struct crypt_device *cd);
445
451const char *crypt_get_default_type(void);
452
459#define CRYPT_SW_ONLY INT16_C(0)
461#define CRYPT_OPAL_HW_ONLY INT16_C(1)
463#define CRYPT_SW_AND_OPAL_HW INT16_C(2)
472int crypt_get_hw_encryption_type(struct crypt_device *cd);
473
479int crypt_get_hw_encryption_key_size(struct crypt_device *cd);
480
488 const char *hash;
489 uint64_t offset;
490 uint64_t skip;
491 uint64_t size;
492 uint32_t sector_size;
493};
494
505 const char *hash;
507 const char *data_device;
508};
509
518 const char *hash;
519 uint64_t offset;
520 uint64_t skip;
521};
522
531 const char *hash_name;
532 const char *data_device;
533 const char *hash_device;
534 const char *fec_device;
535 const char *salt;
536 uint32_t salt_size;
537 uint32_t hash_type;
540 uint64_t data_size;
543 uint32_t fec_roots;
544 uint32_t flags;
545};
546
548#define CRYPT_VERITY_NO_HEADER (UINT32_C(1) << 0)
550#define CRYPT_VERITY_CHECK_HASH (UINT32_C(1) << 1)
552#define CRYPT_VERITY_CREATE_HASH (UINT32_C(1) << 2)
554#define CRYPT_VERITY_ROOT_HASH_SIGNATURE (UINT32_C(1) << 3)
555
564 const char *passphrase;
566 const char **keyfiles;
567 unsigned int keyfiles_count;
568 const char *hash_name;
569 const char *cipher;
570 const char *mode;
571 size_t key_size;
572 uint32_t flags;
573 uint32_t veracrypt_pim;
574};
575
577#define CRYPT_TCRYPT_LEGACY_MODES (UINT32_C(1) << 0)
579#define CRYPT_TCRYPT_HIDDEN_HEADER (UINT32_C(1) << 1)
581#define CRYPT_TCRYPT_BACKUP_HEADER (UINT32_C(1) << 2)
583#define CRYPT_TCRYPT_SYSTEM_HEADER (UINT32_C(1) << 3)
588#define CRYPT_TCRYPT_VERA_MODES (UINT32_C(1) << 4)
589
620
631 const struct crypt_pbkdf_type *pbkdf;
632 const char *integrity;
635 const char *data_device;
636 uint32_t sector_size;
637 const char *label;
638 const char *subsystem;
639};
640
648 const char *admin_key;
651};
682int crypt_format(struct crypt_device *cd,
683 const char *type,
684 const char *cipher,
685 const char *cipher_mode,
686 const char *uuid,
687 const char *volume_key,
688 size_t volume_key_size,
689 void *params);
690
710int crypt_format_luks2_opal(struct crypt_device *cd,
711 const char *cipher,
712 const char *cipher_mode,
713 const char *uuid,
714 const char *volume_keys,
715 size_t volume_keys_size,
716 struct crypt_params_luks2 *params,
717 struct crypt_params_hw_opal *opal_params);
718
725void crypt_set_compatibility(struct crypt_device *cd, uint32_t flags);
726
734uint32_t crypt_get_compatibility(struct crypt_device *cd);
735
737#define CRYPT_COMPAT_LEGACY_INTEGRITY_PADDING (UINT32_C(1) << 0)
739#define CRYPT_COMPAT_LEGACY_INTEGRITY_HMAC (UINT32_C(1) << 1)
741#define CRYPT_COMPAT_LEGACY_INTEGRITY_RECALC (UINT32_C(1) << 2)
742
761int crypt_convert(struct crypt_device *cd,
762 const char *type,
763 void *params);
764
775int crypt_set_uuid(struct crypt_device *cd,
776 const char *uuid);
777
789int crypt_set_label(struct crypt_device *cd,
790 const char *label,
791 const char *subsystem);
792
800const char *crypt_get_label(struct crypt_device *cd);
801
809const char *crypt_get_subsystem(struct crypt_device *cd);
810
828int crypt_volume_key_keyring(struct crypt_device *cd, int enable);
829
846int crypt_load(struct crypt_device *cd,
847 const char *requested_type,
848 void *params);
849
865int crypt_repair(struct crypt_device *cd,
866 const char *requested_type,
867 void *params);
868
886int crypt_resize(struct crypt_device *cd,
887 const char *name,
888 uint64_t new_size);
889
901int crypt_suspend(struct crypt_device *cd,
902 const char *name);
903
918int crypt_resume_by_passphrase(struct crypt_device *cd,
919 const char *name,
920 int keyslot,
921 const char *passphrase,
922 size_t passphrase_size);
923
936int crypt_resume_by_keyfile_device_offset(struct crypt_device *cd,
937 const char *name,
938 int keyslot,
939 const char *keyfile,
940 size_t keyfile_size,
941 uint64_t keyfile_offset);
942
946int crypt_resume_by_keyfile_offset(struct crypt_device *cd,
947 const char *name,
948 int keyslot,
949 const char *keyfile,
950 size_t keyfile_size,
951 size_t keyfile_offset);
952
956int crypt_resume_by_keyfile(struct crypt_device *cd,
957 const char *name,
958 int keyslot,
959 const char *keyfile,
960 size_t keyfile_size);
971int crypt_resume_by_volume_key(struct crypt_device *cd,
972 const char *name,
973 const char *volume_key,
974 size_t volume_key_size);
1005int crypt_resume_by_token_pin(struct crypt_device *cd,
1006 const char *name,
1007 const char *type,
1008 int token,
1009 const char *pin,
1010 size_t pin_size,
1011 void *usrptr);
1012
1025int crypt_resume_by_keyslot_context(struct crypt_device *cd,
1026 const char *name,
1027 int keyslot,
1028 struct crypt_keyslot_context *kc);
1038#define CRYPT_ANY_SLOT -1
1039
1054int crypt_keyslot_add_by_passphrase(struct crypt_device *cd,
1055 int keyslot,
1056 const char *passphrase,
1057 size_t passphrase_size,
1058 const char *new_passphrase,
1059 size_t new_passphrase_size);
1060
1076int crypt_keyslot_change_by_passphrase(struct crypt_device *cd,
1077 int keyslot_old,
1078 int keyslot_new,
1079 const char *passphrase,
1080 size_t passphrase_size,
1081 const char *new_passphrase,
1082 size_t new_passphrase_size);
1083
1101 int keyslot,
1102 const char *keyfile,
1103 size_t keyfile_size,
1104 uint64_t keyfile_offset,
1105 const char *new_keyfile,
1106 size_t new_keyfile_size,
1107 uint64_t new_keyfile_offset);
1108
1112int crypt_keyslot_add_by_keyfile_offset(struct crypt_device *cd,
1113 int keyslot,
1114 const char *keyfile,
1115 size_t keyfile_size,
1116 size_t keyfile_offset,
1117 const char *new_keyfile,
1118 size_t new_keyfile_size,
1119 size_t new_keyfile_offset);
1120
1124int crypt_keyslot_add_by_keyfile(struct crypt_device *cd,
1125 int keyslot,
1126 const char *keyfile,
1127 size_t keyfile_size,
1128 const char *new_keyfile,
1129 size_t new_keyfile_size);
1130
1145int crypt_keyslot_add_by_volume_key(struct crypt_device *cd,
1146 int keyslot,
1147 const char *volume_key,
1148 size_t volume_key_size,
1149 const char *passphrase,
1150 size_t passphrase_size);
1151
1153#define CRYPT_VOLUME_KEY_NO_SEGMENT (UINT32_C(1) << 0)
1154
1156#define CRYPT_VOLUME_KEY_SET (UINT32_C(1) << 1)
1157
1159#define CRYPT_VOLUME_KEY_DIGEST_REUSE (UINT32_C(1) << 2)
1160
1190int crypt_keyslot_add_by_key(struct crypt_device *cd,
1191 int keyslot,
1192 const char *volume_key,
1193 size_t volume_key_size,
1194 const char *passphrase,
1195 size_t passphrase_size,
1196 uint32_t flags);
1197
1209void crypt_keyslot_context_free(struct crypt_keyslot_context *kc);
1210
1222 const char *passphrase,
1223 size_t passphrase_size,
1224 struct crypt_keyslot_context **kc);
1225
1238int crypt_keyslot_context_init_by_keyfile(struct crypt_device *cd,
1239 const char *keyfile,
1240 size_t keyfile_size,
1241 uint64_t keyfile_offset,
1242 struct crypt_keyslot_context **kc);
1243
1258int crypt_keyslot_context_init_by_token(struct crypt_device *cd,
1259 int token,
1260 const char *type,
1261 const char *pin, size_t pin_size,
1262 void *usrptr,
1263 struct crypt_keyslot_context **kc);
1264
1278 const char *volume_key,
1279 size_t volume_key_size,
1280 struct crypt_keyslot_context **kc);
1281
1298 const char *volume_key,
1299 size_t volume_key_size,
1300 const char *signature,
1301 size_t signature_size,
1302 struct crypt_keyslot_context **kc);
1303
1315int crypt_keyslot_context_init_by_keyring(struct crypt_device *cd,
1316 const char *key_description,
1317 struct crypt_keyslot_context **kc);
1318
1332 const char *key_description,
1333 struct crypt_keyslot_context **kc);
1334
1345int crypt_keyslot_context_get_error(struct crypt_keyslot_context *kc);
1346
1361int crypt_keyslot_context_set_pin(struct crypt_device *cd,
1362 const char *pin, size_t pin_size,
1363 struct crypt_keyslot_context *kc);
1364
1371#define CRYPT_KC_TYPE_PASSPHRASE INT16_C(1)
1373#define CRYPT_KC_TYPE_KEYFILE INT16_C(2)
1375#define CRYPT_KC_TYPE_TOKEN INT16_C(3)
1377#define CRYPT_KC_TYPE_KEY INT16_C(4)
1381#define CRYPT_KC_TYPE_KEYRING INT16_C(5)
1385#define CRYPT_KC_TYPE_VK_KEYRING INT16_C(6)
1387#define CRYPT_KC_TYPE_SIGNED_KEY INT16_C(7)
1397int crypt_keyslot_context_get_type(const struct crypt_keyslot_context *kc);
1435int crypt_keyslot_add_by_keyslot_context(struct crypt_device *cd,
1436 int keyslot_existing,
1437 struct crypt_keyslot_context *kc,
1438 int keyslot_new,
1439 struct crypt_keyslot_context *new_kc,
1440 uint32_t flags);
1441
1454int crypt_keyslot_destroy(struct crypt_device *cd, int keyslot);
1465#define CRYPT_ACTIVATE_READONLY (UINT32_C(1) << 0)
1467#define CRYPT_ACTIVATE_NO_UUID (UINT32_C(1) << 1)
1469#define CRYPT_ACTIVATE_SHARED (UINT32_C(1) << 2)
1471#define CRYPT_ACTIVATE_ALLOW_DISCARDS (UINT32_C(1) << 3)
1473#define CRYPT_ACTIVATE_PRIVATE (UINT32_C(1) << 4)
1475#define CRYPT_ACTIVATE_CORRUPTED (UINT32_C(1) << 5)
1477#define CRYPT_ACTIVATE_SAME_CPU_CRYPT (UINT32_C(1) << 6)
1479#define CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS (UINT32_C(1) << 7)
1481#define CRYPT_ACTIVATE_IGNORE_CORRUPTION (UINT32_C(1) << 8)
1483#define CRYPT_ACTIVATE_RESTART_ON_CORRUPTION (UINT32_C(1) << 9)
1485#define CRYPT_ACTIVATE_IGNORE_ZERO_BLOCKS (UINT32_C(1) << 10)
1487#define CRYPT_ACTIVATE_KEYRING_KEY (UINT32_C(1) << 11)
1489#define CRYPT_ACTIVATE_NO_JOURNAL (UINT32_C(1) << 12)
1491#define CRYPT_ACTIVATE_RECOVERY (UINT32_C(1) << 13)
1493#define CRYPT_ACTIVATE_IGNORE_PERSISTENT (UINT32_C(1) << 14)
1495#define CRYPT_ACTIVATE_CHECK_AT_MOST_ONCE (UINT32_C(1) << 15)
1497#define CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY (UINT32_C(1) << 16)
1499#define CRYPT_ACTIVATE_RECALCULATE (UINT32_C(1) << 17)
1501#define CRYPT_ACTIVATE_REFRESH (UINT32_C(1) << 18)
1503#define CRYPT_ACTIVATE_SERIALIZE_MEMORY_HARD_PBKDF (UINT32_C(1) << 19)
1505#define CRYPT_ACTIVATE_NO_JOURNAL_BITMAP (UINT32_C(1) << 20)
1507#define CRYPT_ACTIVATE_SUSPENDED (UINT32_C(1) << 21)
1509#define CRYPT_ACTIVATE_IV_LARGE_SECTORS (UINT32_C(1) << 22)
1511#define CRYPT_ACTIVATE_PANIC_ON_CORRUPTION (UINT32_C(1) << 23)
1513#define CRYPT_ACTIVATE_NO_READ_WORKQUEUE (UINT32_C(1) << 24)
1515#define CRYPT_ACTIVATE_NO_WRITE_WORKQUEUE (UINT32_C(1) << 25)
1517#define CRYPT_ACTIVATE_RECALCULATE_RESET (UINT32_C(1) << 26)
1519#define CRYPT_ACTIVATE_TASKLETS (UINT32_C(1) << 27)
1520
1525 uint64_t offset;
1526 uint64_t iv_offset;
1527 uint64_t size;
1528 uint32_t flags;
1529};
1530
1541int crypt_get_active_device(struct crypt_device *cd,
1542 const char *name,
1543 struct crypt_active_device *cad);
1544
1554uint64_t crypt_get_active_integrity_failures(struct crypt_device *cd,
1555 const char *name);
1568#define CRYPT_REQUIREMENT_OFFLINE_REENCRYPT (UINT32_C(1) << 0)
1570#define CRYPT_REQUIREMENT_ONLINE_REENCRYPT (UINT32_C(1) << 1)
1572#define CRYPT_REQUIREMENT_OPAL (UINT32_C(1) << 2)
1574#define CRYPT_REQUIREMENT_UNKNOWN (UINT32_C(1) << 31)
1575
1583
1602int crypt_persistent_flags_set(struct crypt_device *cd,
1603 crypt_flags_type type,
1604 uint32_t flags);
1605
1615int crypt_persistent_flags_get(struct crypt_device *cd,
1616 crypt_flags_type type,
1617 uint32_t *flags);
1651int crypt_activate_by_keyslot_context(struct crypt_device *cd,
1652 const char *name,
1653 int keyslot,
1654 struct crypt_keyslot_context *kc,
1655 int additional_keyslot,
1656 struct crypt_keyslot_context *additional_kc,
1657 uint32_t flags);
1658
1671int crypt_activate_by_passphrase(struct crypt_device *cd,
1672 const char *name,
1673 int keyslot,
1674 const char *passphrase,
1675 size_t passphrase_size,
1676 uint32_t flags);
1677
1692 const char *name,
1693 int keyslot,
1694 const char *keyfile,
1695 size_t keyfile_size,
1696 uint64_t keyfile_offset,
1697 uint32_t flags);
1698
1702int crypt_activate_by_keyfile_offset(struct crypt_device *cd,
1703 const char *name,
1704 int keyslot,
1705 const char *keyfile,
1706 size_t keyfile_size,
1707 size_t keyfile_offset,
1708 uint32_t flags);
1709
1713int crypt_activate_by_keyfile(struct crypt_device *cd,
1714 const char *name,
1715 int keyslot,
1716 const char *keyfile,
1717 size_t keyfile_size,
1718 uint32_t flags);
1719
1743int crypt_activate_by_volume_key(struct crypt_device *cd,
1744 const char *name,
1745 const char *volume_key,
1746 size_t volume_key_size,
1747 uint32_t flags);
1748
1766int crypt_activate_by_signed_key(struct crypt_device *cd,
1767 const char *name,
1768 const char *volume_key,
1769 size_t volume_key_size,
1770 const char *signature,
1771 size_t signature_size,
1772 uint32_t flags);
1773
1790int crypt_activate_by_keyring(struct crypt_device *cd,
1791 const char *name,
1792 const char *key_description,
1793 int keyslot,
1794 uint32_t flags);
1795
1797#define CRYPT_DEACTIVATE_DEFERRED (UINT32_C(1) << 0)
1799#define CRYPT_DEACTIVATE_FORCE (UINT32_C(1) << 1)
1801#define CRYPT_DEACTIVATE_DEFERRED_CANCEL (UINT32_C(1) << 2)
1802
1815int crypt_deactivate_by_name(struct crypt_device *cd,
1816 const char *name,
1817 uint32_t flags);
1818
1822int crypt_deactivate(struct crypt_device *cd, const char *name);
1851int crypt_volume_key_get(struct crypt_device *cd,
1852 int keyslot,
1853 char *volume_key,
1854 size_t *volume_key_size,
1855 const char *passphrase,
1856 size_t passphrase_size);
1857
1888 int keyslot,
1889 char *volume_key,
1890 size_t *volume_key_size,
1891 struct crypt_keyslot_context *kc);
1892
1906int crypt_volume_key_verify(struct crypt_device *cd,
1907 const char *volume_key,
1908 size_t volume_key_size);
1926
1936crypt_status_info crypt_status(struct crypt_device *cd, const char *name);
1937
1945int crypt_dump(struct crypt_device *cd);
1946
1956int crypt_dump_json(struct crypt_device *cd, const char **json, uint32_t flags);
1957
1966const char *crypt_get_cipher(struct crypt_device *cd);
1967
1976const char *crypt_get_cipher_mode(struct crypt_device *cd);
1977
1986const char *crypt_get_uuid(struct crypt_device *cd);
1987
1996const char *crypt_get_device_name(struct crypt_device *cd);
1997
2006const char *crypt_get_metadata_device_name(struct crypt_device *cd);
2007
2016uint64_t crypt_get_data_offset(struct crypt_device *cd);
2017
2026uint64_t crypt_get_iv_offset(struct crypt_device *cd);
2027
2038int crypt_get_volume_key_size(struct crypt_device *cd);
2039
2048int crypt_get_sector_size(struct crypt_device *cd);
2049
2063int crypt_header_is_detached(struct crypt_device *cd);
2064
2074int crypt_get_verity_info(struct crypt_device *cd,
2075 struct crypt_params_verity *vp);
2076
2086int crypt_get_integrity_info(struct crypt_device *cd,
2087 struct crypt_params_integrity *ip);
2114int crypt_benchmark(struct crypt_device *cd,
2115 const char *cipher,
2116 const char *cipher_mode,
2117 size_t volume_key_size,
2118 size_t iv_size,
2119 size_t buffer_size,
2120 double *encryption_mbs,
2121 double *decryption_mbs);
2122
2138int crypt_benchmark_pbkdf(struct crypt_device *cd,
2139 struct crypt_pbkdf_type *pbkdf,
2140 const char *password,
2141 size_t password_size,
2142 const char *salt,
2143 size_t salt_size,
2144 size_t volume_key_size,
2145 int (*progress)(uint32_t time_ms, void *usrptr),
2146 void *usrptr);
2166
2176crypt_keyslot_info crypt_keyslot_status(struct crypt_device *cd, int keyslot);
2177
2187
2196crypt_keyslot_priority crypt_keyslot_get_priority(struct crypt_device *cd, int keyslot);
2197
2207int crypt_keyslot_set_priority(struct crypt_device *cd, int keyslot, crypt_keyslot_priority priority);
2208
2217int crypt_keyslot_max(const char *type);
2218
2230int crypt_keyslot_area(struct crypt_device *cd,
2231 int keyslot,
2232 uint64_t *offset,
2233 uint64_t *length);
2234
2245int crypt_keyslot_get_key_size(struct crypt_device *cd, int keyslot);
2246
2260const char *crypt_keyslot_get_encryption(struct crypt_device *cd, int keyslot, size_t *key_size);
2261
2271int crypt_keyslot_get_pbkdf(struct crypt_device *cd, int keyslot, struct crypt_pbkdf_type *pbkdf);
2272
2287int crypt_keyslot_set_encryption(struct crypt_device *cd,
2288 const char *cipher,
2289 size_t key_size);
2290
2296const char *crypt_get_dir(void);
2297
2315int crypt_header_backup(struct crypt_device *cd,
2316 const char *requested_type,
2317 const char *backup_file);
2318
2329int crypt_header_restore(struct crypt_device *cd,
2330 const char *requested_type,
2331 const char *backup_file);
2342#define CRYPT_DEBUG_ALL -1
2344#define CRYPT_DEBUG_JSON -2
2346#define CRYPT_DEBUG_NONE 0
2347
2379int crypt_keyfile_device_read(struct crypt_device *cd,
2380 const char *keyfile,
2381 char **key, size_t *key_size_read,
2382 uint64_t keyfile_offset,
2383 size_t key_size,
2384 uint32_t flags);
2385
2389int crypt_keyfile_read(struct crypt_device *cd,
2390 const char *keyfile,
2391 char **key, size_t *key_size_read,
2392 size_t keyfile_offset,
2393 size_t key_size,
2394 uint32_t flags);
2395
2397#define CRYPT_KEYFILE_STOP_EOL (UINT32_C(1) << 0)
2414
2435int crypt_wipe(struct crypt_device *cd,
2436 const char *dev_path, /* if null, use data device */
2437 crypt_wipe_pattern pattern,
2438 uint64_t offset,
2439 uint64_t length,
2440 size_t wipe_block_size,
2441 uint32_t flags,
2442 int (*progress)(uint64_t size, uint64_t offset, void *usrptr),
2443 void *usrptr
2444);
2445
2447#define CRYPT_WIPE_NO_DIRECT_IO (UINT32_C(1) << 0)
2448
2449enum {
2450 CRYPT_LUKS2_SEGMENT = -2,
2451 CRYPT_NO_SEGMENT = -1,
2452};
2453
2471int crypt_wipe_hw_opal(struct crypt_device *cd,
2472 int segment, /* 0..8, CRYPT_LUKS2_SEGMENT -2, CRYPT_NO_SEGMENT -1 */
2473 const char *password, /* Admin1 PIN or PSID */
2474 size_t password_size,
2475 uint32_t flags /* currently unused */
2476);
2477
2503int crypt_token_max(const char *type);
2504
2506#define CRYPT_ANY_TOKEN -1
2507
2517int crypt_token_json_get(struct crypt_device *cd,
2518 int token,
2519 const char **json);
2520
2534int crypt_token_json_set(struct crypt_device *cd,
2535 int token,
2536 const char *json);
2537
2549
2564crypt_token_info crypt_token_status(struct crypt_device *cd, int token, const char **type);
2565
2575
2586int crypt_token_luks2_keyring_set(struct crypt_device *cd,
2587 int token,
2588 const struct crypt_token_params_luks2_keyring *params);
2589
2602int crypt_token_luks2_keyring_get(struct crypt_device *cd,
2603 int token,
2604 struct crypt_token_params_luks2_keyring *params);
2605
2617int crypt_token_assign_keyslot(struct crypt_device *cd,
2618 int token,
2619 int keyslot);
2620
2632int crypt_token_unassign_keyslot(struct crypt_device *cd,
2633 int token,
2634 int keyslot);
2635
2647int crypt_token_is_assigned(struct crypt_device *cd,
2648 int token,
2649 int keyslot);
2650
2673 struct crypt_device *cd,
2674 int token,
2675 char **buffer,
2676 size_t *buffer_len,
2677 void *usrptr);
2678
2703 struct crypt_device *cd,
2704 int token,
2705 const char *pin,
2706 size_t pin_size,
2707 char **buffer,
2708 size_t *buffer_len,
2709 void *usrptr);
2710
2720typedef void (*crypt_token_buffer_free_func) (void *buffer, size_t buffer_len);
2721
2733typedef int (*crypt_token_validate_func) (struct crypt_device *cd, const char *json);
2734
2746typedef void (*crypt_token_dump_func) (struct crypt_device *cd, const char *json);
2747
2756typedef const char * (*crypt_token_version_func) (void);
2757
2768
2777
2784
2794int crypt_token_set_external_path(const char *path);
2795
2801
2803#define CRYPT_TOKEN_ABI_VERSION1 "CRYPTSETUP_TOKEN_1.0"
2804
2806#define CRYPT_TOKEN_ABI_OPEN "cryptsetup_token_open"
2808#define CRYPT_TOKEN_ABI_OPEN_PIN "cryptsetup_token_open_pin"
2810#define CRYPT_TOKEN_ABI_BUFFER_FREE "cryptsetup_token_buffer_free"
2812#define CRYPT_TOKEN_ABI_VALIDATE "cryptsetup_token_validate"
2814#define CRYPT_TOKEN_ABI_DUMP "cryptsetup_token_dump"
2816#define CRYPT_TOKEN_ABI_VERSION "cryptsetup_token_version"
2817
2847int crypt_activate_by_token(struct crypt_device *cd,
2848 const char *name,
2849 int token,
2850 void *usrptr,
2851 uint32_t flags);
2852
2885int crypt_activate_by_token_pin(struct crypt_device *cd,
2886 const char *name,
2887 const char *type,
2888 int token,
2889 const char *pin,
2890 size_t pin_size,
2891 void *usrptr,
2892 uint32_t flags);
2905#define CRYPT_REENCRYPT_INITIALIZE_ONLY (UINT32_C(1) << 0)
2908#define CRYPT_REENCRYPT_MOVE_FIRST_SEGMENT (UINT32_C(1) << 1)
2910#define CRYPT_REENCRYPT_RESUME_ONLY (UINT32_C(1) << 2)
2912#define CRYPT_REENCRYPT_RECOVERY (UINT32_C(1) << 3)
2914#define CRYPT_REENCRYPT_REPAIR_NEEDED (UINT32_C(1) << 4)
2915
2923
2932
2952
2973int crypt_reencrypt_init_by_passphrase(struct crypt_device *cd,
2974 const char *name,
2975 const char *passphrase,
2976 size_t passphrase_size,
2977 int keyslot_old,
2978 int keyslot_new,
2979 const char *cipher,
2980 const char *cipher_mode,
2981 const struct crypt_params_reencrypt *params);
2982
3002int crypt_reencrypt_init_by_keyring(struct crypt_device *cd,
3003 const char *name,
3004 const char *key_description,
3005 int keyslot_old,
3006 int keyslot_new,
3007 const char *cipher,
3008 const char *cipher_mode,
3009 const struct crypt_params_reencrypt *params);
3010
3022int crypt_reencrypt(struct crypt_device *cd,
3023 int (*progress)(uint64_t size, uint64_t offset, void *usrptr))
3024__attribute__((deprecated));
3025
3036int crypt_reencrypt_run(struct crypt_device *cd,
3037 int (*progress)(uint64_t size, uint64_t offset, void *usrptr),
3038 void *usrptr);
3039
3049
3059 struct crypt_params_reencrypt *params);
3075void *crypt_safe_alloc(size_t size);
3076
3083void crypt_safe_free(void *data);
3084
3093void *crypt_safe_realloc(void *data, size_t size);
3094
3101void crypt_safe_memzero(void *data, size_t size);
3102
3146int crypt_set_keyring_to_link(struct crypt_device* cd,
3147 const char* key_description,
3148 const char* old_key_description,
3149 const char* key_type_desc,
3150 const char* keyring_to_link_vk);
3151
3154#ifdef __cplusplus
3155}
3156#endif
3157#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_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:1920
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)
const char * crypt_get_cipher(struct crypt_device *cd)
@ CRYPT_INVALID
Definition libcryptsetup.h:1921
@ CRYPT_ACTIVE
Definition libcryptsetup.h:1923
@ CRYPT_INACTIVE
Definition libcryptsetup.h:1922
@ CRYPT_BUSY
Definition libcryptsetup.h:1924
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:2157
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:2181
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:2163
@ CRYPT_SLOT_ACTIVE_LAST
Definition libcryptsetup.h:2161
@ CRYPT_SLOT_INACTIVE
Definition libcryptsetup.h:2159
@ CRYPT_SLOT_ACTIVE
Definition libcryptsetup.h:2160
@ CRYPT_SLOT_INVALID
Definition libcryptsetup.h:2158
@ CRYPT_SLOT_PRIORITY_IGNORE
Definition libcryptsetup.h:2183
@ CRYPT_SLOT_PRIORITY_INVALID
Definition libcryptsetup.h:2182
@ CRYPT_SLOT_PRIORITY_NORMAL
Definition libcryptsetup.h:2184
@ CRYPT_SLOT_PRIORITY_PREFER
Definition libcryptsetup.h:2185
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_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:1579
int crypt_persistent_flags_set(struct crypt_device *cd, crypt_flags_type type, uint32_t flags)
@ CRYPT_FLAGS_REQUIREMENTS
Definition libcryptsetup.h:1581
@ CRYPT_FLAGS_ACTIVATION
Definition libcryptsetup.h:1580
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:2927
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:3043
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:2919
@ CRYPT_REENCRYPT_ENCRYPT
Definition libcryptsetup.h:2929
@ CRYPT_REENCRYPT_DECRYPT
Definition libcryptsetup.h:2930
@ CRYPT_REENCRYPT_REENCRYPT
Definition libcryptsetup.h:2928
@ CRYPT_REENCRYPT_INVALID
Definition libcryptsetup.h:3047
@ CRYPT_REENCRYPT_NONE
Definition libcryptsetup.h:3044
@ CRYPT_REENCRYPT_CLEAN
Definition libcryptsetup.h:3045
@ CRYPT_REENCRYPT_CRASH
Definition libcryptsetup.h:3046
@ CRYPT_REENCRYPT_BACKWARD
Definition libcryptsetup.h:2921
@ CRYPT_REENCRYPT_FORWARD
Definition libcryptsetup.h:2920
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:2672
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:2746
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:2541
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:2702
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:2733
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:2720
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:2545
@ CRYPT_TOKEN_EXTERNAL_UNKNOWN
Definition libcryptsetup.h:2547
@ CRYPT_TOKEN_EXTERNAL
Definition libcryptsetup.h:2546
@ CRYPT_TOKEN_INACTIVE
Definition libcryptsetup.h:2543
@ CRYPT_TOKEN_INTERNAL
Definition libcryptsetup.h:2544
@ CRYPT_TOKEN_INVALID
Definition libcryptsetup.h:2542
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:2408
@ CRYPT_WIPE_ZERO
Definition libcryptsetup.h:2409
@ CRYPT_WIPE_RANDOM
Definition libcryptsetup.h:2410
@ CRYPT_WIPE_SPECIAL
Definition libcryptsetup.h:2412
@ CRYPT_WIPE_ENCRYPTED_ZERO
Definition libcryptsetup.h:2411
Definition libcryptsetup.h:1524
uint64_t offset
Definition libcryptsetup.h:1525
uint64_t iv_offset
Definition libcryptsetup.h:1526
uint64_t size
Definition libcryptsetup.h:1527
uint32_t flags
Definition libcryptsetup.h:1528
Definition libcryptsetup.h:647
size_t user_key_size
Definition libcryptsetup.h:650
const char * admin_key
Definition libcryptsetup.h:648
size_t admin_key_size
Definition libcryptsetup.h:649
Definition libcryptsetup.h:601
uint32_t sector_size
Definition libcryptsetup.h:607
uint32_t journal_integrity_key_size
Definition libcryptsetup.h:614
unsigned int journal_commit_time
Definition libcryptsetup.h:604
uint32_t journal_crypt_key_size
Definition libcryptsetup.h:618
uint32_t integrity_key_size
Definition libcryptsetup.h:610
uint32_t interleave_sectors
Definition libcryptsetup.h:605
const char * journal_integrity
Definition libcryptsetup.h:612
uint64_t journal_size
Definition libcryptsetup.h:602
const char * integrity
Definition libcryptsetup.h:609
const char * journal_crypt_key
Definition libcryptsetup.h:617
const char * journal_crypt
Definition libcryptsetup.h:616
uint32_t buffer_sectors
Definition libcryptsetup.h:608
unsigned int journal_watermark
Definition libcryptsetup.h:603
const char * journal_integrity_key
Definition libcryptsetup.h:613
uint32_t tag_size
Definition libcryptsetup.h:606
Definition libcryptsetup.h:517
uint64_t skip
Definition libcryptsetup.h:520
const char * hash
Definition libcryptsetup.h:518
uint64_t offset
Definition libcryptsetup.h:519
Definition libcryptsetup.h:504
const char * hash
Definition libcryptsetup.h:505
const char * data_device
Definition libcryptsetup.h:507
size_t data_alignment
Definition libcryptsetup.h:506
Definition libcryptsetup.h:630
const struct crypt_params_integrity * integrity_params
Definition libcryptsetup.h:633
const char * label
Definition libcryptsetup.h:637
size_t data_alignment
Definition libcryptsetup.h:634
const struct crypt_pbkdf_type * pbkdf
Definition libcryptsetup.h:631
const char * subsystem
Definition libcryptsetup.h:638
uint32_t sector_size
Definition libcryptsetup.h:636
const char * data_device
Definition libcryptsetup.h:635
const char * integrity
Definition libcryptsetup.h:632
Definition libcryptsetup.h:487
uint32_t sector_size
Definition libcryptsetup.h:492
uint64_t offset
Definition libcryptsetup.h:489
const char * hash
Definition libcryptsetup.h:488
uint64_t size
Definition libcryptsetup.h:491
uint64_t skip
Definition libcryptsetup.h:490
Definition libcryptsetup.h:2936
const char * hash
Definition libcryptsetup.h:2943
crypt_reencrypt_direction_info direction
Definition libcryptsetup.h:2938
const char * resilience
Definition libcryptsetup.h:2939
uint64_t data_shift
Definition libcryptsetup.h:2944
uint64_t max_hotzone_size
Definition libcryptsetup.h:2946
crypt_reencrypt_mode_info mode
Definition libcryptsetup.h:2937
uint64_t device_size
Definition libcryptsetup.h:2948
const struct crypt_params_luks2 * luks2
Definition libcryptsetup.h:2949
uint32_t flags
Definition libcryptsetup.h:2950
Definition libcryptsetup.h:563
const char ** keyfiles
Definition libcryptsetup.h:566
const char * passphrase
Definition libcryptsetup.h:564
size_t key_size
Definition libcryptsetup.h:571
const char * mode
Definition libcryptsetup.h:570
unsigned int keyfiles_count
Definition libcryptsetup.h:567
uint32_t flags
Definition libcryptsetup.h:572
const char * hash_name
Definition libcryptsetup.h:568
size_t passphrase_size
Definition libcryptsetup.h:565
const char * cipher
Definition libcryptsetup.h:569
uint32_t veracrypt_pim
Definition libcryptsetup.h:573
Definition libcryptsetup.h:530
uint32_t fec_roots
Definition libcryptsetup.h:543
const char * data_device
Definition libcryptsetup.h:532
uint64_t data_size
Definition libcryptsetup.h:540
const char * fec_device
Definition libcryptsetup.h:534
const char * hash_name
Definition libcryptsetup.h:531
uint32_t flags
Definition libcryptsetup.h:544
uint32_t data_block_size
Definition libcryptsetup.h:538
uint32_t salt_size
Definition libcryptsetup.h:536
uint32_t hash_type
Definition libcryptsetup.h:537
uint64_t hash_area_offset
Definition libcryptsetup.h:541
const char * salt
Definition libcryptsetup.h:535
uint32_t hash_block_size
Definition libcryptsetup.h:539
const char * hash_device
Definition libcryptsetup.h:533
uint64_t fec_area_offset
Definition libcryptsetup.h:542
Definition libcryptsetup.h:264
const char * type
Definition libcryptsetup.h:265
uint32_t time_ms
Definition libcryptsetup.h:267
const char * hash
Definition libcryptsetup.h:266
uint32_t flags
Definition libcryptsetup.h:271
uint32_t max_memory_kb
Definition libcryptsetup.h:269
uint32_t iterations
Definition libcryptsetup.h:268
uint32_t parallel_threads
Definition libcryptsetup.h:270
Definition libcryptsetup.h:2761
crypt_token_dump_func dump
Definition libcryptsetup.h:2766
crypt_token_validate_func validate
Definition libcryptsetup.h:2765
const char * name
Definition libcryptsetup.h:2762
crypt_token_buffer_free_func buffer_free
Definition libcryptsetup.h:2764
crypt_token_open_func open
Definition libcryptsetup.h:2763
Definition libcryptsetup.h:2572
const char * key_description
Definition libcryptsetup.h:2573