cryptsetup
2.4.3
About: cryptsetup is a utility used to conveniently setup disk encryption based on the dm-crypt kernel module. These include plain dm-crypt volumes, LUKS volumes, loop-AES and TrueCrypt compatible format.
![]() ![]() |
#include <stdint.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <fcntl.h>
#include "nls.h"
#include "bitops.h"
#include "utils_blkid.h"
#include "utils_crypt.h"
#include "utils_loop.h"
#include "utils_dm.h"
#include "utils_fips.h"
#include "utils_keyring.h"
#include "utils_io.h"
#include "crypto_backend/crypto_backend.h"
#include "utils_storage_wrappers.h"
#include "libcryptsetup.h"
#include "libcryptsetup_macros.h"
#include "libcryptsetup_symver.h"
Go to the source code of this file.
Data Structures | |
struct | volume_key |
Macros | |
#define | LOG_MAX_LEN 4096 |
#define | MAX_DM_DEPS 32 |
#define | CRYPT_SUBDEV "SUBDEV" /* prefix for sublayered devices underneath public crypt types */ |
#define | O_CLOEXEC 0 |
#define | log_dbg(c, x...) crypt_logf(c, CRYPT_LOG_DEBUG, x) |
#define | log_std(c, x...) crypt_logf(c, CRYPT_LOG_NORMAL, x) |
#define | log_verbose(c, x...) crypt_logf(c, CRYPT_LOG_VERBOSE, x) |
#define | log_err(c, x...) crypt_logf(c, CRYPT_LOG_ERROR, x) |
Enumerations | |
enum | devcheck { DEV_OK = 0 , DEV_EXCL = 1 } |
Functions | |
struct volume_key * | crypt_alloc_volume_key (size_t keylength, const char *key) |
struct volume_key * | crypt_generate_volume_key (struct crypt_device *cd, size_t keylength) |
void | crypt_free_volume_key (struct volume_key *vk) |
int | crypt_volume_key_set_description (struct volume_key *key, const char *key_description) |
void | crypt_volume_key_set_id (struct volume_key *vk, int id) |
int | crypt_volume_key_get_id (const struct volume_key *vk) |
void | crypt_volume_key_add_next (struct volume_key **vks, struct volume_key *vk) |
struct volume_key * | crypt_volume_key_next (struct volume_key *vk) |
struct volume_key * | crypt_volume_key_by_id (struct volume_key *vk, int id) |
struct crypt_pbkdf_type * | crypt_get_pbkdf (struct crypt_device *cd) |
int | init_pbkdf_type (struct crypt_device *cd, const struct crypt_pbkdf_type *pbkdf, const char *dev_type) |
int | verify_pbkdf_params (struct crypt_device *cd, const struct crypt_pbkdf_type *pbkdf) |
int | crypt_benchmark_pbkdf_internal (struct crypt_device *cd, struct crypt_pbkdf_type *pbkdf, size_t volume_key_size) |
const char * | crypt_get_cipher_spec (struct crypt_device *cd) |
int | device_alloc (struct crypt_device *cd, struct device **device, const char *path) |
int | device_alloc_no_check (struct device **device, const char *path) |
void | device_close (struct crypt_device *cd, struct device *device) |
void | device_free (struct crypt_device *cd, struct device *device) |
const char * | device_path (const struct device *device) |
const char * | device_dm_name (const struct device *device) |
const char * | device_block_path (const struct device *device) |
void | device_topology_alignment (struct crypt_device *cd, struct device *device, unsigned long *required_alignment, unsigned long *alignment_offset, unsigned long default_alignment) |
size_t | device_block_size (struct crypt_device *cd, struct device *device) |
int | device_read_ahead (struct device *device, uint32_t *read_ahead) |
int | device_size (struct device *device, uint64_t *size) |
int | device_open (struct crypt_device *cd, struct device *device, int flags) |
int | device_open_excl (struct crypt_device *cd, struct device *device, int flags) |
void | device_release_excl (struct crypt_device *cd, struct device *device) |
void | device_disable_direct_io (struct device *device) |
int | device_is_identical (struct device *device1, struct device *device2) |
int | device_is_rotational (struct device *device) |
size_t | device_alignment (struct device *device) |
int | device_direct_io (const struct device *device) |
int | device_fallocate (struct device *device, uint64_t size) |
void | device_sync (struct crypt_device *cd, struct device *device) |
int | device_check_size (struct crypt_device *cd, struct device *device, uint64_t req_offset, int falloc) |
void | device_set_block_size (struct device *device, size_t size) |
size_t | device_optimal_encryption_sector_size (struct crypt_device *cd, struct device *device) |
int | device_open_locked (struct crypt_device *cd, struct device *device, int flags) |
int | device_read_lock (struct crypt_device *cd, struct device *device) |
int | device_write_lock (struct crypt_device *cd, struct device *device) |
void | device_read_unlock (struct crypt_device *cd, struct device *device) |
void | device_write_unlock (struct crypt_device *cd, struct device *device) |
bool | device_is_locked (struct device *device) |
int | device_check_access (struct crypt_device *cd, struct device *device, enum devcheck device_check) |
int | device_block_adjust (struct crypt_device *cd, struct device *device, enum devcheck device_check, uint64_t device_offset, uint64_t *size, uint32_t *flags) |
size_t | size_round_up (size_t size, size_t block) |
int | create_or_reload_device (struct crypt_device *cd, const char *name, const char *type, struct crypt_dm_active_device *dmd) |
int | create_or_reload_device_with_integrity (struct crypt_device *cd, const char *name, const char *type, struct crypt_dm_active_device *dmd, struct crypt_dm_active_device *dmdi) |
struct device * | crypt_metadata_device (struct crypt_device *cd) |
struct device * | crypt_data_device (struct crypt_device *cd) |
int | crypt_confirm (struct crypt_device *cd, const char *msg) |
char * | crypt_lookup_dev (const char *dev_id) |
int | crypt_dev_is_rotational (int major, int minor) |
int | crypt_dev_is_partition (const char *dev_path) |
char * | crypt_get_partition_device (const char *dev_path, uint64_t offset, uint64_t size) |
char * | crypt_get_base_device (const char *dev_path) |
uint64_t | crypt_dev_partition_offset (const char *dev_path) |
int | lookup_by_disk_id (const char *dm_uuid) |
int | lookup_by_sysfs_uuid_field (const char *dm_uuid) |
int | crypt_uuid_cmp (const char *dm_uuid, const char *hdr_uuid) |
size_t | crypt_getpagesize (void) |
unsigned | crypt_cpusonline (void) |
uint64_t | crypt_getphysmemory_kb (void) |
int | init_crypto (struct crypt_device *ctx) |
int | crypt_get_debug_level (void) |
int | crypt_memlock_inc (struct crypt_device *ctx) |
int | crypt_memlock_dec (struct crypt_device *ctx) |
int | crypt_metadata_locking_enabled (void) |
int | crypt_random_init (struct crypt_device *ctx) |
int | crypt_random_get (struct crypt_device *ctx, char *buf, size_t len, int quality) |
void | crypt_random_exit (void) |
int | crypt_random_default_key_rng (void) |
int | crypt_plain_hash (struct crypt_device *cd, const char *hash_name, char *key, size_t key_size, const char *passphrase, size_t passphrase_size) |
int | PLAIN_activate (struct crypt_device *cd, const char *name, struct volume_key *vk, uint64_t size, uint32_t flags) |
void * | crypt_get_hdr (struct crypt_device *cd, const char *type) |
void | crypt_set_luks2_reencrypt (struct crypt_device *cd, struct luks2_reencrypt *rh) |
struct luks2_reencrypt * | crypt_get_luks2_reencrypt (struct crypt_device *cd) |
int | onlyLUKS2 (struct crypt_device *cd) |
int | onlyLUKS2mask (struct crypt_device *cd, uint32_t mask) |
int | crypt_wipe_device (struct crypt_device *cd, struct device *device, crypt_wipe_pattern pattern, uint64_t offset, uint64_t length, size_t wipe_block_size, int(*progress)(uint64_t size, uint64_t offset, void *usrptr), void *usrptr) |
const char * | crypt_get_integrity (struct crypt_device *cd) |
int | crypt_get_integrity_key_size (struct crypt_device *cd) |
int | crypt_get_integrity_tag_size (struct crypt_device *cd) |
int | crypt_key_in_keyring (struct crypt_device *cd) |
void | crypt_set_key_in_keyring (struct crypt_device *cd, unsigned key_in_keyring) |
int | crypt_volume_key_load_in_keyring (struct crypt_device *cd, struct volume_key *vk) |
int | crypt_use_keyring_for_vk (struct crypt_device *cd) |
void | crypt_drop_keyring_key_by_description (struct crypt_device *cd, const char *key_description, key_type_t ktype) |
void | crypt_drop_keyring_key (struct crypt_device *cd, struct volume_key *vks) |
static uint64_t | compact_version (uint16_t major, uint16_t minor, uint16_t patch, uint16_t release) |
int | kernel_version (uint64_t *kversion) |
int | crypt_serialize_lock (struct crypt_device *cd) |
void | crypt_serialize_unlock (struct crypt_device *cd) |
bool | crypt_string_in (const char *str, char **list, size_t list_size) |
int | crypt_strcmp (const char *a, const char *b) |
int | crypt_compare_dm_devices (struct crypt_device *cd, const struct crypt_dm_active_device *src, const struct crypt_dm_active_device *tgt) |
static void * | crypt_zalloc (size_t size) |
static bool | uint64_mult_overflow (uint64_t *u, uint64_t b, size_t size) |
#define CRYPT_SUBDEV "SUBDEV" /* prefix for sublayered devices underneath public crypt types */ |
Definition at line 55 of file internal.h.
#define log_dbg | ( | c, | |
x... | |||
) | crypt_logf(c, CRYPT_LOG_DEBUG, x) |
Definition at line 174 of file internal.h.
#define log_err | ( | c, | |
x... | |||
) | crypt_logf(c, CRYPT_LOG_ERROR, x) |
Definition at line 177 of file internal.h.
#define LOG_MAX_LEN 4096 |
Definition at line 52 of file internal.h.
#define log_std | ( | c, | |
x... | |||
) | crypt_logf(c, CRYPT_LOG_NORMAL, x) |
Definition at line 175 of file internal.h.
#define log_verbose | ( | c, | |
x... | |||
) | crypt_logf(c, CRYPT_LOG_VERBOSE, x) |
Definition at line 176 of file internal.h.
#define MAX_DM_DEPS 32 |
Definition at line 53 of file internal.h.
#define O_CLOEXEC 0 |
Definition at line 58 of file internal.h.
enum devcheck |
Enumerator | |
---|---|
DEV_OK | |
DEV_EXCL |
Definition at line 133 of file internal.h.
|
inlinestatic |
Definition at line 229 of file internal.h.
Referenced by dmcrypt_keyring_bug(), and kernel_version().
int create_or_reload_device | ( | struct crypt_device * | cd, |
const char * | name, | ||
const char * | type, | ||
struct crypt_dm_active_device * | dmd | ||
) |
Definition at line 3893 of file setup.c.
References _reload_device(), check_devices(), dm_target::crypt, CRYPT_ACTIVATE_REFRESH, CRYPT_ACTIVATE_SHARED, dm_target::data_device, DEV_EXCL, DEV_OK, device_block_adjust(), device_check(), dm_create_device(), DM_CRYPT, crypt_dm_active_device::flags, name, NULL, dm_target::offset, crypt_dm_active_device::segment, single_segment(), dm_target::size, crypt_dm_active_device::size, dm_target::type, and dm_target::u.
Referenced by LUKS1_activate(), LUKS2_activate(), and PLAIN_activate().
int create_or_reload_device_with_integrity | ( | struct crypt_device * | cd, |
const char * | name, | ||
const char * | type, | ||
struct crypt_dm_active_device * | dmd, | ||
struct crypt_dm_active_device * | dmdi | ||
) |
Definition at line 3928 of file setup.c.
References _create_device_with_integrity(), _reload_device_with_integrity(), check_devices(), CRYPT_ACTIVATE_REFRESH, dm_get_dir(), crypt_dm_active_device::flags, name, NULL, and dm_target::type.
Referenced by LUKS2_activate().
struct volume_key * crypt_alloc_volume_key | ( | size_t | keylength, |
const char * | key | ||
) |
Definition at line 29 of file volumekey.c.
References crypt_safe_memzero(), volume_key::id, volume_key::key, volume_key::key_description, volume_key::keylength, volume_key::next, and NULL.
Referenced by _crypt_format_integrity(), _crypt_format_luks1(), _crypt_format_luks2(), _crypt_format_plain(), _crypt_load_integrity(), _dm_target_query_crypt(), _dm_target_query_integrity(), _keyslot_repair(), _open_and_verify(), _reload_device(), _reload_device_with_integrity(), BITLK_activate_by_volume_key(), bitlk_kdf(), BITLK_read_sb(), crypt_activate_by_volume_key(), crypt_generate_volume_key(), crypt_keyslot_add_by_key(), crypt_keyslot_add_by_keyfile_device_offset(), crypt_keyslot_add_by_passphrase(), crypt_keyslot_add_by_volume_key(), crypt_resume_by_volume_key(), crypt_volume_key_verify(), decrypt_key(), get_recovery_key(), hash_keys(), INTEGRITY_format(), luks2_keyslot_get_key(), luks2_keyslot_set_key(), LUKS_check_cipher(), LUKS_open_key(), LUKS_set_key(), parse_external_key_entry(), parse_vmk_entry(), process_key(), reencrypt_assembly_verification_data(), resume_by_volume_key(), TCRYPT_activate(), TCRYPT_get_volume_key(), and verify_and_update_segment_digest().
int crypt_benchmark_pbkdf_internal | ( | struct crypt_device * | cd, |
struct crypt_pbkdf_type * | pbkdf, | ||
size_t | volume_key_size | ||
) |
Definition at line 150 of file utils_benchmark.c.
References _, AT_LEAST, benchmark_callback(), benchmark_usrptr::cd, crypt_benchmark_pbkdf(), CRYPT_KDF_PBKDF2, crypt_pbkdf_get_limits(), CRYPT_PBKDF_NO_BENCHMARK, crypt_pbkdf_type::flags, crypt_pbkdf_type::hash, crypt_pbkdf_type::iterations, log_dbg, log_err, crypt_pbkdf_type::max_memory_kb, crypt_pbkdf_limits::min_iterations, crypt_pbkdf_type::parallel_threads, crypt_device::pbkdf, benchmark_usrptr::pbkdf, crypt_pbkdf_type::time_ms, and crypt_pbkdf_type::type.
Referenced by luks2_keyslot_update_json(), LUKS_generate_phdr(), LUKS_set_key(), and PBKDF2_digest_store().
int crypt_compare_dm_devices | ( | struct crypt_device * | cd, |
const struct crypt_dm_active_device * | src, | ||
const struct crypt_dm_active_device * | tgt | ||
) |
Definition at line 2544 of file setup.c.
References _compare_crypt_devices(), _compare_device_types(), _compare_integrity_devices(), DM_CRYPT, DM_INTEGRITY, DM_LINEAR, dm_target::linear, log_dbg, dm_target::next, dm_target::offset, crypt_dm_active_device::segment, dm_target::type, and dm_target::u.
Referenced by _reload_device(), and _reload_device_with_integrity().
int crypt_confirm | ( | struct crypt_device * | cd, |
const char * | msg | ||
) |
Definition at line 539 of file setup.c.
References crypt_device::confirm, and crypt_device::confirm_usrptr.
Referenced by crypt_set_uuid(), LUKS2_hdr_restore(), and LUKS_hdr_restore().
unsigned crypt_cpusonline | ( | void | ) |
Definition at line 39 of file utils.c.
Referenced by init_pbkdf_type().
struct device * crypt_data_device | ( | struct crypt_device * | cd | ) |
Definition at line 214 of file setup.c.
References crypt_device::device.
Referenced by _activate(), _check_header_data_overlap(), _crypt_format_luks1(), _crypt_format_luks2(), _crypt_format_plain(), _crypt_format_verity(), _crypt_load_bitlk(), _crypt_load_luks(), _crypt_set_data_device(), BITLK_read_sb(), crypt_dump(), crypt_header_is_detached(), crypt_resize(), crypt_wipe(), INTEGRITY_create_dmd_device(), INTEGRITY_format(), LOOPAES_activate(), LUKS1_activate(), LUKS2_activate(), LUKS2_assembly_multisegment_dmd(), LUKS2_reencrypt_check_device_size(), LUKS2_reencrypt_free(), PLAIN_activate(), TCRYPT_activate(), TCRYPT_get_data_offset(), TCRYPT_get_iv_offset(), VERITY_activate(), VERITY_create_or_verify_hash(), and VERITY_FEC_process().
int crypt_dev_is_partition | ( | const char * | dev_path | ) |
Definition at line 223 of file utils_devpath.c.
References _sysfs_get_uint64().
Referenced by crypt_dev_partition_offset(), crypt_get_base_device(), TCRYPT_activate(), TCRYPT_get_data_offset(), and TCRYPT_read_phdr().
int crypt_dev_is_rotational | ( | int | major, |
int | minor | ||
) |
Definition at line 213 of file utils_devpath.c.
References _sysfs_get_uint64().
Referenced by device_is_rotational().
uint64_t crypt_dev_partition_offset | ( | const char * | dev_path | ) |
Definition at line 241 of file utils_devpath.c.
References _sysfs_get_uint64(), and crypt_dev_is_partition().
Referenced by TCRYPT_get_iv_offset().
void crypt_drop_keyring_key | ( | struct crypt_device * | cd, |
struct volume_key * | vks | ||
) |
Definition at line 6162 of file setup.c.
References crypt_drop_keyring_key_by_description(), crypt_volume_key_next(), volume_key::key_description, and LOGON_KEY.
Referenced by _activate_by_passphrase(), _open_and_activate(), crypt_activate_by_volume_key(), LUKS2_reencrypt_free(), LUKS2_token_open_and_activate(), reencrypt_init_by_passphrase(), and resume_by_volume_key().
void crypt_drop_keyring_key_by_description | ( | struct crypt_device * | cd, |
const char * | key_description, | ||
key_type_t | ktype | ||
) |
Definition at line 6145 of file setup.c.
References crypt_set_key_in_keyring(), volume_key::key_description, key_type_name(), keyring_revoke_and_unlink_key(), and log_dbg.
Referenced by crypt_activate_by_signed_key(), crypt_drop_keyring_key(), crypt_suspend(), and LUKS2_deactivate().
void crypt_free_volume_key | ( | struct volume_key * | vk | ) |
Definition at line 118 of file volumekey.c.
References CONST_CAST, crypt_safe_memzero(), volume_key::key, volume_key::key_description, volume_key::keylength, and volume_key::next.
Referenced by _activate_by_passphrase(), _activate_loopaes(), _crypt_format(), _crypt_format_integrity(), _dm_target_free_query_path(), _dm_target_query_crypt(), _dm_target_query_integrity(), _keyslot_repair(), _open_and_activate(), _open_and_verify(), _reload_device(), _reload_device_with_integrity(), BITLK_activate_by_passphrase(), BITLK_activate_by_volume_key(), BITLK_bitlk_fvek_free(), BITLK_bitlk_vmk_free(), BITLK_get_volume_key(), crypt_activate_by_volume_key(), crypt_free(), crypt_free_type(), crypt_generate_volume_key(), crypt_keyslot_add_by_key(), crypt_keyslot_add_by_keyfile_device_offset(), crypt_keyslot_add_by_passphrase(), crypt_keyslot_add_by_volume_key(), crypt_keyslot_change_by_passphrase(), crypt_resume_by_keyfile_device_offset(), crypt_resume_by_passphrase(), crypt_resume_by_volume_key(), crypt_volume_key_get(), crypt_volume_key_verify(), hash_keys(), INTEGRITY_format(), luks2_keyslot_get_key(), LUKS2_keyslot_open_all_segments(), LUKS2_keyslot_reencrypt_digest_create(), luks2_keyslot_set_key(), LUKS2_reencrypt_digest_verify(), LUKS2_reencrypt_free(), LUKS2_token_open_and_activate(), LUKS_check_cipher(), LUKS_open_key(), LUKS_set_key(), process_key(), reencrypt_assembly_verification_data(), reencrypt_init_by_passphrase(), resume_by_volume_key(), TCRYPT_activate(), and verify_and_update_segment_digest().
struct volume_key * crypt_generate_volume_key | ( | struct crypt_device * | cd, |
size_t | keylength | ||
) |
Definition at line 132 of file volumekey.c.
References crypt_alloc_volume_key(), crypt_free_volume_key(), crypt_random_get(), CRYPT_RND_KEY, volume_key::key, volume_key::keylength, and NULL.
Referenced by _crypt_format_luks1(), _crypt_format_luks2(), and crypt_keyslot_add_by_key().
char * crypt_get_base_device | ( | const char * | dev_path | ) |
Definition at line 336 of file utils_devpath.c.
References crypt_dev_is_partition(), dm_is_dm_kernel_name(), and NULL.
Referenced by TCRYPT_read_phdr().
const char * crypt_get_cipher_spec | ( | struct crypt_device * | cd | ) |
Definition at line 5052 of file setup.c.
References _init_by_name_crypt_none(), crypt_device::bitlk, crypt_device::cipher_spec, CRYPT_DEFAULT_SEGMENT, crypt_device::hdr, isBITLK(), isLOOPAES(), isLUKS1(), isLUKS2(), isPLAIN(), crypt_device::loopaes, crypt_device::luks1, crypt_device::luks2, LUKS2_get_cipher(), crypt_device::none, NULL, crypt_device::plain, crypt_device::type, and crypt_device::u.
Referenced by _activate(), crypt_resize(), LUKS1_activate(), LUKS2_activate(), PLAIN_activate(), and resume_by_volume_key().
int crypt_get_debug_level | ( | void | ) |
Definition at line 154 of file setup.c.
References _debug_level.
void * crypt_get_hdr | ( | struct crypt_device * | cd, |
const char * | type | ||
) |
Definition at line 5670 of file setup.c.
References crypt_device::hdr, isLOOPAES(), isLUKS1(), isLUKS2(), isPLAIN(), isTCRYPT(), isVERITY(), crypt_device::loopaes, crypt_device::luks1, crypt_device::luks2, NULL, crypt_device::plain, crypt_device::tcrypt, crypt_device::type, crypt_device::u, and crypt_device::verity.
Referenced by _reload_custom_multi(), crypt_deactivate_by_name(), crypt_reencrypt_run(), hdr_dump_keyslots(), keyring_open(), LUKS2_activate(), LUKS2_activate_multi(), LUKS2_digest_handler(), luks2_keyslot_alloc(), luks2_keyslot_dump(), LUKS2_keyslot_handler(), luks2_keyslot_open(), LUKS2_keyslot_open(), LUKS2_keyslot_open_all_segments(), luks2_keyslot_store(), luks2_keyslot_update(), luks2_keyslot_wipe(), LUKS2_reload(), LUKS2_token_dump(), LUKS2_token_handler(), PBKDF2_digest_dump(), PBKDF2_digest_store(), PBKDF2_digest_verify(), placeholder_keyslot_alloc(), reenc_keyslot_dump(), reenc_keyslot_store(), reenc_keyslot_wipe(), and reencrypt_init_by_passphrase().
const char * crypt_get_integrity | ( | struct crypt_device * | cd | ) |
Definition at line 5139 of file setup.c.
References CRYPT_DEFAULT_SEGMENT, crypt_device::hdr, crypt_device::integrity, isINTEGRITY(), isLUKS2(), crypt_device::luks2, LUKS2_get_integrity(), NULL, crypt_device::params, crypt_device::type, and crypt_device::u.
Referenced by crypt_get_integrity_key_size(), crypt_get_integrity_tag_size(), crypt_resize(), LOOPAES_activate(), LUKS1_activate(), LUKS2_activate(), PLAIN_activate(), and TCRYPT_activate().
int crypt_get_integrity_key_size | ( | struct crypt_device * | cd | ) |
Definition at line 5154 of file setup.c.
References crypt_get_integrity(), INTEGRITY_key_size(), isINTEGRITY(), isLUKS2(), and crypt_device::type.
Referenced by crypt_get_integrity_info().
int crypt_get_integrity_tag_size | ( | struct crypt_device * | cd | ) |
Definition at line 5166 of file setup.c.
References crypt_get_cipher(), crypt_get_cipher_mode(), crypt_get_integrity(), crypt_device::integrity, INTEGRITY_tag_size(), isINTEGRITY(), isLUKS2(), crypt_device::params, crypt_device::type, and crypt_device::u.
Referenced by _crypt_format_luks2(), crypt_get_active_device(), crypt_resize(), INTEGRITY_create_dmd_device(), INTEGRITY_format(), LOOPAES_activate(), LUKS1_activate(), LUKS2_activate(), LUKS2_deactivate(), LUKS2_keyslot_cipher_incompatible(), LUKS2_reload(), PLAIN_activate(), and TCRYPT_activate().
struct luks2_reencrypt * crypt_get_luks2_reencrypt | ( | struct crypt_device * | cd | ) |
Definition at line 5698 of file setup.c.
References crypt_device::luks2, crypt_device::rh, and crypt_device::u.
Referenced by crypt_reencrypt_run(), crypt_set_data_device(), and LUKS2_device_write_lock().
char * crypt_get_partition_device | ( | const char * | dev_path, |
uint64_t | offset, | ||
uint64_t | size | ||
) |
Definition at line 260 of file utils_devpath.c.
References _path_get_uint64(), dm_is_dm_kernel_name(), and NULL.
Referenced by TCRYPT_activate().
struct crypt_pbkdf_type * crypt_get_pbkdf | ( | struct crypt_device * | cd | ) |
Definition at line 696 of file setup.c.
References crypt_device::pbkdf.
Referenced by crypt_get_pbkdf_type(), crypt_set_iteration_time(), crypt_set_pbkdf_type(), init_pbkdf_type(), LUKS_generate_phdr(), LUKS_set_key(), and PBKDF2_digest_store().
size_t crypt_getpagesize | ( | void | ) |
Definition at line 33 of file utils.c.
References DEFAULT_MEM_ALIGNMENT.
Referenced by blk_do_wipe(), crypt_benchmark(), device_block_size_fd(), device_fs_block_size_fd(), LUKS2_hdr_backup(), LUKS_hdr_backup(), luksmeta_header_present(), move_keyslot_areas(), TCRYPT_init_hdr(), and VERITY_create().
uint64_t crypt_getphysmemory_kb | ( | void | ) |
int crypt_key_in_keyring | ( | struct crypt_device * | cd | ) |
Definition at line 6130 of file setup.c.
References crypt_device::key_in_keyring.
Referenced by crypt_resize().
char * crypt_lookup_dev | ( | const char * | dev_id | ) |
Definition at line 126 of file utils_devpath.c.
References dm_device_path(), dm_is_dm_kernel_name(), lookup_dev_old(), and NULL.
Referenced by _dm_target_query_crypt(), _dm_target_query_integrity(), _dm_target_query_linear(), and _dm_target_query_verity().
int crypt_memlock_dec | ( | struct crypt_device * | ctx | ) |
Definition at line 89 of file utils.c.
References _, _memlock_count, _priority, log_dbg, and log_err.
Referenced by crypt_memory_lock().
int crypt_memlock_inc | ( | struct crypt_device * | ctx | ) |
Definition at line 69 of file utils.c.
References _, _memlock_count, _priority, DEFAULT_PROCESS_PRIORITY, log_dbg, and log_err.
Referenced by crypt_memory_lock().
struct device * crypt_metadata_device | ( | struct crypt_device * | cd | ) |
Definition at line 209 of file setup.c.
References crypt_device::device, and crypt_device::metadata_device.
Referenced by _check_header_data_overlap(), _crypt_format_integrity(), _crypt_format_loopaes(), _crypt_format_luks1(), _crypt_format_luks2(), _crypt_format_verity(), _init_by_name_crypt(), BITLK_read_sb(), crypt_header_is_detached(), crypt_load(), crypt_repair(), INTEGRITY_create_dmd_device(), INTEGRITY_format(), INTEGRITY_read_sb(), luks2_decrypt_from_storage(), LUKS2_disk_hdr_write(), luks2_encrypt_to_storage(), LUKS2_generate_hdr(), LUKS2_hdr_backup(), LUKS2_hdr_read(), LUKS2_hdr_restore(), LUKS2_hdr_version_unlocked(), LUKS2_hdr_write(), LUKS2_hdr_write_force(), luks2_keyslot_store(), LUKS2_keyslot_wipe(), LUKS2_luks1_to_luks2(), LUKS2_luks2_to_luks1(), LUKS2_wipe_header_areas(), LUKS_check_device_size(), LUKS_decrypt_from_storage(), LUKS_del_key(), LUKS_encrypt_to_storage(), LUKS_endec_template(), LUKS_hdr_backup(), LUKS_hdr_restore(), LUKS_read_phdr(), LUKS_wipe_header_areas(), LUKS_write_phdr(), luksmeta_header_present(), move_keyslot_areas(), reenc_keyslot_store(), reenc_keyslot_store_data(), reencrypt_init_by_passphrase(), TCRYPT_dump(), TCRYPT_get_data_offset(), TCRYPT_read_phdr(), VERITY_activate(), VERITY_create_or_verify_hash(), VERITY_FEC_blocks(), VERITY_FEC_process(), VERITY_read_sb(), and VERITY_write_sb().
int crypt_metadata_locking_enabled | ( | void | ) |
Definition at line 5878 of file setup.c.
References _metadata_locking.
Referenced by crypt_reencrypt_run(), device_open_locked(), device_read_lock(), device_read_unlock(), device_write_lock(), device_write_unlock(), LUKS2_disk_hdr_read(), and reencrypt_lock_internal().
int crypt_plain_hash | ( | struct crypt_device * | cd, |
const char * | hash_name, | ||
char * | key, | ||
size_t | key_size, | ||
const char * | passphrase, | ||
size_t | passphrase_size | ||
) |
Definition at line 67 of file crypt_plain.c.
References hash(), log_dbg, and PLAIN_HASH_LEN_MAX.
Referenced by process_key().
int crypt_random_default_key_rng | ( | void | ) |
Definition at line 233 of file random.c.
References CRYPT_RNG_RANDOM, CRYPT_RNG_URANDOM, RANDOM_DEVICE, and URANDOM_DEVICE.
Referenced by crypt_init(), and crypt_random_get().
void crypt_random_exit | ( | void | ) |
Definition at line 218 of file random.c.
References random_fd, random_initialised, and urandom_fd.
Referenced by crypt_random_init(), and libcryptsetup_exit().
int crypt_random_get | ( | struct crypt_device * | ctx, |
char * | buf, | ||
size_t | len, | ||
int | quality | ||
) |
Definition at line 175 of file random.c.
References _, _get_random(), _get_urandom(), crypt_backend_rng(), crypt_fips_mode(), crypt_get_rng_type(), crypt_random_default_key_rng(), CRYPT_RND_KEY, CRYPT_RND_NORMAL, CRYPT_RND_SALT, CRYPT_RNG_RANDOM, CRYPT_RNG_URANDOM, and log_err.
Referenced by _crypt_format_verity(), AF_split(), crypt_benchmark(), crypt_generate_volume_key(), crypt_wipe_special(), LUKS2_disk_hdr_read(), LUKS2_generate_hdr(), luks2_keyslot_update_json(), LUKS2_luks1_to_luks2(), LUKS_check_cipher(), LUKS_generate_phdr(), LUKS_set_key(), PBKDF2_digest_store(), and wipe_block().
int crypt_random_init | ( | struct crypt_device * | ctx | ) |
Definition at line 147 of file random.c.
References _, crypt_fips_mode(), crypt_random_exit(), log_err, log_verbose, O_CLOEXEC, RANDOM_DEVICE, random_fd, random_initialised, URANDOM_DEVICE, and urandom_fd.
Referenced by init_crypto().
int crypt_serialize_lock | ( | struct crypt_device * | cd | ) |
Definition at line 6216 of file setup.c.
References _, crypt_write_lock(), log_dbg, log_err, crypt_device::memory_hard_pbkdf_lock_enabled, NULL, and crypt_device::pbkdf_memory_hard_lock.
Referenced by luks2_keyslot_get_key().
void crypt_serialize_unlock | ( | struct crypt_device * | cd | ) |
Definition at line 6231 of file setup.c.
References crypt_unlock_internal(), crypt_device::memory_hard_pbkdf_lock_enabled, NULL, and crypt_device::pbkdf_memory_hard_lock.
Referenced by luks2_keyslot_get_key().
void crypt_set_key_in_keyring | ( | struct crypt_device * | cd, |
unsigned | key_in_keyring | ||
) |
Definition at line 6136 of file setup.c.
References crypt_device::key_in_keyring.
Referenced by crypt_drop_keyring_key_by_description(), and crypt_volume_key_load_in_keyring().
void crypt_set_luks2_reencrypt | ( | struct crypt_device * | cd, |
struct luks2_reencrypt * | rh | ||
) |
Definition at line 5704 of file setup.c.
References crypt_device::luks2, crypt_device::rh, and crypt_device::u.
int crypt_strcmp | ( | const char * | a, |
const char * | b | ||
) |
Definition at line 337 of file utils.c.
Referenced by _compare_crypt_devices(), and _compare_integrity_devices().
bool crypt_string_in | ( | const char * | str, |
char ** | list, | ||
size_t | list_size | ||
) |
Definition at line 325 of file utils.c.
Referenced by _init_by_name_crypt(), and _process_deps().
int crypt_use_keyring_for_vk | ( | struct crypt_device * | cd | ) |
Definition at line 6080 of file setup.c.
References _vk_via_keyring, DM_CRYPT, dm_flags(), DM_KERNEL_KEYRING_SUPPORTED, dmcrypt_keyring_bug(), isLUKS2(), kernel_keyring_support(), and crypt_device::type.
Referenced by _activate_by_passphrase(), _open_and_activate(), crypt_activate_by_keyfile_device_offset(), crypt_activate_by_token_pin(), crypt_activate_by_volume_key(), LUKS2_token_open_and_activate(), and resume_by_volume_key().
int crypt_uuid_cmp | ( | const char * | dm_uuid, |
const char * | hdr_uuid | ||
) |
Definition at line 449 of file setup.c.
Referenced by _compare_device_types(), _init_by_name_crypt(), LUKS2_deactivate(), and LUKS2_reencrypt_lock_by_dm_uuid().
void crypt_volume_key_add_next | ( | struct volume_key ** | vks, |
struct volume_key * | vk | ||
) |
Definition at line 93 of file volumekey.c.
References volume_key::next.
Referenced by LUKS2_keyslot_open_all_segments(), and parse_vmk_entry().
struct volume_key * crypt_volume_key_by_id | ( | struct volume_key * | vk, |
int | id | ||
) |
Definition at line 80 of file volumekey.c.
References volume_key::id, volume_key::next, and NULL.
Referenced by LUKS2_assembly_multisegment_dmd(), and reencrypt_assembly_verification_data().
int crypt_volume_key_get_id | ( | const struct volume_key * | vk | ) |
Definition at line 75 of file volumekey.c.
References volume_key::id.
int crypt_volume_key_load_in_keyring | ( | struct crypt_device * | cd, |
struct volume_key * | vk | ||
) |
Definition at line 6104 of file setup.c.
References _, crypt_set_key_in_keyring(), volume_key::key, volume_key::key_description, key_type_name(), volume_key::keylength, keyring_add_key_in_thread_keyring(), log_dbg, log_err, and LOGON_KEY.
Referenced by crypt_activate_by_volume_key(), LUKS2_volume_key_load_in_keyring_by_digest(), and LUKS2_volume_key_load_in_keyring_by_keyslot().
struct volume_key * crypt_volume_key_next | ( | struct volume_key * | vk | ) |
Definition at line 113 of file volumekey.c.
References volume_key::next, and NULL.
Referenced by crypt_drop_keyring_key().
int crypt_volume_key_set_description | ( | struct volume_key * | key, |
const char * | key_description | ||
) |
Definition at line 56 of file volumekey.c.
References CONST_CAST, volume_key::key_description, and NULL.
Referenced by _dm_target_query_crypt(), _reload_device(), _reload_device_with_integrity(), LUKS2_key_description_by_segment(), LUKS2_volume_key_load_in_keyring_by_digest(), and LUKS2_volume_key_load_in_keyring_by_keyslot().
void crypt_volume_key_set_id | ( | struct volume_key * | vk, |
int | id | ||
) |
Definition at line 69 of file volumekey.c.
References volume_key::id.
Referenced by _open_and_verify().
int crypt_wipe_device | ( | struct crypt_device * | cd, |
struct device * | device, | ||
crypt_wipe_pattern | pattern, | ||
uint64_t | offset, | ||
uint64_t | length, | ||
size_t | wipe_block_size, | ||
int(*)(uint64_t size, uint64_t offset, void *usrptr) | progress, | ||
void * | usrptr | ||
) |
Definition at line 132 of file utils_wipe.c.
References _, alignment(), CRYPT_WIPE_RANDOM, CRYPT_WIPE_SPECIAL, device_alignment(), device_block_size(), device_is_locked(), device_is_rotational(), device_open(), device_open_locked(), device_size(), device_sync(), log_dbg, log_err, MISALIGNED_512, NULL, and wipe_block().
Referenced by _crypt_format_integrity(), _crypt_format_luks2(), crypt_wipe(), LUKS2_keyslot_wipe(), LUKS2_luks2_to_luks1(), LUKS2_wipe_header_areas(), LUKS_del_key(), and LUKS_wipe_header_areas().
|
inlinestatic |
Definition at line 244 of file internal.h.
Referenced by _dm_target_query_verity(), dm_targets_allocate(), and LUKS2_disk_hdr_write().
size_t device_alignment | ( | struct device * | device | ) |
Definition at line 986 of file utils_device.c.
References device::alignment, device_alignment_fd(), and device_path().
Referenced by BITLK_read_sb(), crypt_storage_wrapper_init(), crypt_wipe_device(), hdr_read_disk(), hdr_write_disk(), INTEGRITY_read_superblock(), LUKS2_check_sequence_id(), luks2_decrypt_from_storage(), luks2_encrypt_to_storage(), LUKS2_hdr_backup(), LUKS2_hdr_restore(), LUKS2_hdr_version_unlocked(), LUKS_decrypt_from_storage(), LUKS_encrypt_to_storage(), LUKS_endec_template(), LUKS_hdr_backup(), LUKS_hdr_restore(), LUKS_read_phdr(), LUKS_write_phdr(), luksmeta_header_present(), move_keyslot_areas(), reenc_keyslot_store_data(), TCRYPT_read_phdr(), VERITY_read_sb(), and VERITY_write_sb().
int device_alloc | ( | struct crypt_device * | cd, |
struct device ** | device, | ||
const char * | path | ||
) |
Definition at line 421 of file utils_device.c.
References device_alloc_no_check(), device_ready(), device::init_done, and device::path.
Referenced by _create_device_with_integrity(), _crypt_format_luks1(), _crypt_format_luks2(), _crypt_format_verity(), _crypt_load_verity(), _crypt_set_data_device(), _dm_target_query_crypt(), _dm_target_query_integrity(), _dm_target_query_linear(), _dm_target_query_verity(), _reload_device_with_integrity(), crypt_init(), LUKS2_hdr_restore(), LUKS2_hdr_version_unlocked(), TCRYPT_activate(), and TCRYPT_read_phdr().
int device_alloc_no_check | ( | struct device ** | device, |
const char * | path | ||
) |
Definition at line 392 of file utils_device.c.
References device::dev_fd, device::dev_fd_excl, device::loop_fd, NULL, device::o_direct, device::path, and device::ro_dev_fd.
Referenced by crypt_wipe(), and device_alloc().
int device_block_adjust | ( | struct crypt_device * | cd, |
struct device * | device, | ||
enum devcheck | device_check, | ||
uint64_t | device_offset, | ||
uint64_t * | size, | ||
uint32_t * | flags | ||
) |
Definition at line 868 of file utils_device.c.
References _, CRYPT_ACTIVATE_READONLY, device_check(), device_info(), device_internal_prepare(), device_path(), log_dbg, log_err, and device::path.
Referenced by _activate(), _create_device_with_integrity(), _reload_device(), _reload_device_with_integrity(), create_or_reload_device(), crypt_resize(), crypt_storage_dmcrypt_init(), INTEGRITY_activate_dmd_device(), INTEGRITY_format(), LOOPAES_activate(), LUKS2_assembly_multisegment_dmd(), LUKS_endec_template(), TCRYPT_activate(), and VERITY_activate().
const char * device_block_path | ( | const struct device * | device | ) |
Definition at line 472 of file utils_device.c.
References device::init_done, NULL, and device::path.
Referenced by crypt_get_device_name(), crypt_get_metadata_device_name(), get_dm_crypt_params(), get_dm_integrity_params(), get_dm_linear_params(), and get_dm_verity_params().
size_t device_block_size | ( | struct crypt_device * | cd, |
struct device * | device | ||
) |
Definition at line 574 of file utils_device.c.
References device::block_size, device_block_size_fd(), device_path(), device::file_path, log_dbg, NULL, and device::path.
Referenced by BITLK_read_sb(), crypt_resize(), crypt_storage_wrapper_init(), crypt_wipe_device(), hdr_read_disk(), hdr_write_disk(), INTEGRITY_read_superblock(), LUKS2_check_sequence_id(), luks2_decrypt_from_storage(), luks2_encrypt_to_storage(), LUKS2_hdr_backup(), LUKS2_hdr_restore(), LUKS2_hdr_version_unlocked(), LUKS_decrypt_from_storage(), LUKS_encrypt_to_storage(), LUKS_endec_template(), LUKS_hdr_backup(), LUKS_hdr_restore(), LUKS_read_phdr(), LUKS_write_phdr(), luksmeta_header_present(), move_keyslot_areas(), PLAIN_activate(), reenc_keyslot_store_data(), TCRYPT_read_phdr(), VERITY_read_sb(), VERITY_write_sb(), and wipe_block().
int device_check_access | ( | struct crypt_device * | cd, |
struct device * | device, | ||
enum devcheck | device_check | ||
) |
Definition at line 815 of file utils_device.c.
References device_check(), device_info(), and NULL.
Referenced by _crypt_format_integrity(), _crypt_format_luks1(), _crypt_format_luks2(), and LUKS2_reencrypt_check_device_size().
int device_check_size | ( | struct crypt_device * | cd, |
struct device * | device, | ||
uint64_t | req_offset, | ||
int | falloc | ||
) |
Definition at line 702 of file utils_device.c.
References _, device_fallocate(), device_path(), device_size(), log_dbg, and log_err.
Referenced by LUKS2_disk_hdr_read(), LUKS2_disk_hdr_write(), and LUKS2_reencrypt_check_device_size().
void device_close | ( | struct crypt_device * | cd, |
struct device * | device | ||
) |
Definition at line 1061 of file utils_device.c.
References device::dev_fd, device_path(), log_dbg, and device::ro_dev_fd.
Referenced by _init_by_name_crypt(), and device_free().
int device_direct_io | ( | const struct device * | device | ) |
Definition at line 934 of file utils_device.c.
References device::o_direct.
Referenced by LUKS2_hdr_version_unlocked().
void device_disable_direct_io | ( | struct device * | device | ) |
Definition at line 928 of file utils_device.c.
References device::o_direct.
Referenced by crypt_wipe(), LUKS_read_phdr(), and VERITY_write_sb().
const char * device_dm_name | ( | const struct device * | device | ) |
Definition at line 481 of file utils_device.c.
References dm_get_dir(), device::init_done, NULL, and device::path.
Referenced by _init_by_name_crypt(), crypt_get_active_device(), and LUKS2_deactivate().
int device_fallocate | ( | struct device * | device, |
uint64_t | size | ||
) |
Definition at line 679 of file utils_device.c.
References crypt_loop_resize(), device_path(), device::file_path, and device::path.
Referenced by device_check_size(), LUKS2_generate_hdr(), LUKS2_luks1_to_luks2(), and LUKS_check_device_size().
void device_free | ( | struct crypt_device * | cd, |
struct device * | device | ||
) |
Definition at line 447 of file utils_device.c.
References device::dev_fd_excl, device_close(), device_locked(), device_path(), device::file_path, device::lh, log_dbg, device::loop_fd, and device::path.
Referenced by _create_device_with_integrity(), _crypt_format_luks1(), _crypt_format_luks2(), _crypt_format_verity(), _crypt_set_data_device(), _dm_target_free_query_path(), _dm_target_query_crypt(), _dm_target_query_integrity(), _dm_target_query_linear(), _dm_target_query_verity(), _init_by_name_crypt(), _reload_device_with_integrity(), crypt_free(), crypt_free_type(), crypt_wipe(), LUKS2_hdr_restore(), LUKS2_hdr_version_unlocked(), TCRYPT_activate(), TCRYPT_read_phdr(), and TCRYPT_status_one().
Definition at line 956 of file utils_device.c.
References device_compare_path(), and device_path().
Referenced by _check_header_data_overlap(), _compare_crypt_devices(), _compare_integrity_devices(), _crypt_format_verity(), crypt_header_is_detached(), and VERITY_FEC_blocks().
bool device_is_locked | ( | struct device * | device | ) |
Definition at line 1056 of file utils_device.c.
References device_locked(), and device::lh.
Referenced by crypt_wipe_device(), LUKS_decrypt_from_storage(), and LUKS_encrypt_to_storage().
int device_is_rotational | ( | struct device * | device | ) |
Definition at line 970 of file utils_device.c.
References crypt_dev_is_rotational(), and device_path().
Referenced by crypt_wipe_device().
int device_open | ( | struct crypt_device * | cd, |
struct device * | device, | ||
int | flags | ||
) |
Definition at line 325 of file utils_device.c.
References device_locked(), device_open_internal(), and device::lh.
Referenced by BITLK_read_sb(), crypt_storage_wrapper_init(), crypt_wipe_device(), INTEGRITY_read_superblock(), LUKS_decrypt_from_storage(), LUKS_encrypt_to_storage(), LUKS_hdr_backup(), LUKS_hdr_restore(), LUKS_read_phdr(), LUKS_write_phdr(), luksmeta_header_present(), move_keyslot_areas(), TCRYPT_read_phdr(), VERITY_read_sb(), and VERITY_write_sb().
int device_open_excl | ( | struct crypt_device * | cd, |
struct device * | device, | ||
int | flags | ||
) |
Definition at line 334 of file utils_device.c.
References device::dev_fd_excl, device_locked(), device_open_internal(), device_path(), device::lh, and log_dbg.
int device_open_locked | ( | struct crypt_device * | cd, |
struct device * | device, | ||
int | flags | ||
) |
Definition at line 382 of file utils_device.c.
References crypt_metadata_locking_enabled(), device_locked(), device_open_internal(), and device::lh.
Referenced by crypt_wipe_device(), hdr_read_disk(), hdr_write_disk(), LUKS2_check_sequence_id(), luks2_decrypt_from_storage(), luks2_encrypt_to_storage(), LUKS2_hdr_backup(), LUKS2_hdr_restore(), LUKS_decrypt_from_storage(), LUKS_encrypt_to_storage(), and reenc_keyslot_store_data().
size_t device_optimal_encryption_sector_size | ( | struct crypt_device * | cd, |
struct device * | device | ||
) |
Definition at line 596 of file utils_device.c.
References device::block_size, device_block_phys_size_fd(), device_block_size_fd(), device_path(), device::file_path, log_dbg, MAX_SECTOR_SIZE, MISALIGNED, NULL, device::path, and SECTOR_SIZE.
Referenced by _crypt_format_luks2().
const char * device_path | ( | const struct device * | device | ) |
Definition at line 496 of file utils_device.c.
References device::file_path, NULL, and device::path.
Referenced by _activate(), _crypt_format_luks2(), _init_by_name_crypt(), _open_locked(), acquire_and_verify(), acquire_lock_handle(), BITLK_dump(), BITLK_read_sb(), crypt_check_data_device_size(), crypt_get_device_name(), crypt_get_metadata_device_name(), crypt_get_verity_info(), crypt_init_by_name_and_header(), crypt_storage_dmcrypt_init(), crypt_wipe(), data_device_path(), device_alignment(), device_block_adjust(), device_block_size(), device_check_size(), device_close(), device_fallocate(), device_free(), device_info(), device_is_identical(), device_is_rotational(), device_open_excl(), device_open_internal(), device_optimal_encryption_sector_size(), device_read_lock_internal(), device_ready(), device_release_excl(), device_sync(), device_unlock_internal(), device_write_lock_internal(), FEC_process_inputs(), INTEGRITY_activate_dmd_device(), INTEGRITY_dump(), INTEGRITY_format(), INTEGRITY_read_superblock(), luks2_decrypt_from_storage(), LUKS2_device_write_lock(), LUKS2_disk_hdr_read(), LUKS2_hdr_backup(), LUKS2_hdr_read(), LUKS2_hdr_restore(), LUKS2_hdr_version_unlocked(), LUKS2_keyslot_wipe(), LUKS2_reencrypt_check_device_size(), LUKS_check_device_size(), LUKS_decrypt_from_storage(), LUKS_del_key(), LUKS_encrypt_to_storage(), LUKS_endec_template(), LUKS_hdr_backup(), LUKS_hdr_restore(), LUKS_read_phdr(), LUKS_write_phdr(), mdata_device_path(), TCRYPT_activate(), TCRYPT_dump(), TCRYPT_get_data_offset(), TCRYPT_get_iv_offset(), TCRYPT_read_phdr(), VERITY_create_or_verify_hash(), VERITY_FEC_blocks(), VERITY_FEC_process(), VERITY_read_sb(), and VERITY_write_sb().
int device_read_ahead | ( | struct device * | device, |
uint32_t * | read_ahead | ||
) |
Definition at line 632 of file utils_device.c.
References device::path.
Referenced by _dm_create_device(), and _dm_reload_device().
int device_read_lock | ( | struct crypt_device * | cd, |
struct device * | device | ||
) |
Definition at line 1015 of file utils_device.c.
References crypt_metadata_locking_enabled(), and device_read_lock_internal().
Referenced by luks2_decrypt_from_storage(), LUKS2_hdr_backup(), LUKS2_hdr_read(), and LUKS2_hdr_restore().
void device_read_unlock | ( | struct crypt_device * | cd, |
struct device * | device | ||
) |
Definition at line 1036 of file utils_device.c.
References crypt_metadata_locking_enabled(), device_locked(), device_unlock_internal(), and device::lh.
Referenced by luks2_decrypt_from_storage(), LUKS2_hdr_backup(), LUKS2_hdr_read(), and LUKS2_hdr_restore().
void device_release_excl | ( | struct crypt_device * | cd, |
struct device * | device | ||
) |
Definition at line 370 of file utils_device.c.
References device::dev_fd_excl, device_path(), and log_dbg.
Referenced by LUKS2_reencrypt_free().
void device_set_block_size | ( | struct device * | device, |
size_t | size | ||
) |
Definition at line 1081 of file utils_device.c.
References device::loop_block_size.
Referenced by _crypt_format_luks2(), _crypt_format_plain(), _crypt_load_bitlk(), _crypt_load_luks(), and _crypt_set_data_device().
int device_size | ( | struct device * | device, |
uint64_t * | size | ||
) |
Definition at line 653 of file utils_device.c.
References device::path.
Referenced by _crypt_format_luks1(), _crypt_format_luks2(), _crypt_format_plain(), _crypt_format_verity(), _reload_custom_multi(), crypt_check_data_device_size(), crypt_wipe_device(), device_check_size(), LUKS2_activate_multi(), LUKS2_generate_hdr(), LUKS2_luks1_to_luks2(), LUKS2_reencrypt_check_device_size(), LUKS2_reload(), LUKS_check_device_size(), TCRYPT_get_data_offset(), tools_time_progress(), VERITY_create_or_verify_hash(), and VERITY_FEC_blocks().
void device_sync | ( | struct crypt_device * | cd, |
struct device * | device | ||
) |
Definition at line 268 of file utils_device.c.
References device::dev_fd, device_path(), and log_dbg.
Referenced by crypt_wipe_device(), hdr_write_disk(), luks2_encrypt_to_storage(), LUKS2_hdr_restore(), LUKS_encrypt_to_storage(), LUKS_hdr_restore(), LUKS_write_phdr(), move_keyslot_areas(), and VERITY_write_sb().
void device_topology_alignment | ( | struct crypt_device * | cd, |
struct device * | device, | ||
unsigned long * | required_alignment, | ||
unsigned long * | alignment_offset, | ||
unsigned long | default_alignment | ||
) |
Definition at line 514 of file utils_device.c.
References _, BLKALIGNOFF, BLKIOMIN, BLKIOOPT, log_dbg, log_err, MISALIGNED_4K, and device::path.
Referenced by _crypt_format_luks1(), and _crypt_format_luks2().
int device_write_lock | ( | struct crypt_device * | cd, |
struct device * | device | ||
) |
Definition at line 1026 of file utils_device.c.
References crypt_metadata_locking_enabled(), device_locked(), device_locked_readonly(), device_write_lock_internal(), and device::lh.
Referenced by LUKS2_device_write_lock(), LUKS2_disk_hdr_write(), LUKS2_hdr_read(), and LUKS2_hdr_restore().
void device_write_unlock | ( | struct crypt_device * | cd, |
struct device * | device | ||
) |
Definition at line 1046 of file utils_device.c.
References crypt_metadata_locking_enabled(), device_locked(), device_locked_readonly(), device_unlock_internal(), and device::lh.
Referenced by LUKS2_device_write_lock(), LUKS2_disk_hdr_write(), LUKS2_hdr_read(), LUKS2_hdr_restore(), luks2_keyslot_store(), LUKS2_keyslot_wipe(), reenc_keyslot_store(), and reencrypt_init_by_passphrase().
int init_crypto | ( | struct crypt_device * | ctx | ) |
Definition at line 219 of file setup.c.
References _, _crypto_logged, crypt_backend_init(), crypt_backend_version(), crypt_fips_mode(), crypt_random_init(), log_dbg, and log_err.
Referenced by _crypt_format(), _crypt_load_bitlk(), _crypt_load_integrity(), _crypt_load_luks(), _crypt_load_tcrypt(), _crypt_load_verity(), crypt_benchmark(), crypt_benchmark_pbkdf(), crypt_header_restore(), and verify_pbkdf_params().
int init_pbkdf_type | ( | struct crypt_device * | cd, |
const struct crypt_pbkdf_type * | pbkdf, | ||
const char * | dev_type | ||
) |
Definition at line 171 of file utils_pbkdf.c.
References _, adjusted_phys_memory(), CONST_CAST, crypt_cpusonline(), crypt_fips_mode(), crypt_get_pbkdf(), crypt_get_pbkdf_type_params(), CRYPT_KDF_PBKDF2, CRYPT_LUKS2, crypt_pbkdf_get_limits(), CRYPT_PBKDF_ITER_TIME_SET, CRYPT_PBKDF_NO_BENCHMARK, crypt_pbkdf_type::flags, crypt_pbkdf_type::hash, hash, crypt_pbkdf_type::iterations, log_dbg, log_err, crypt_pbkdf_type::max_memory_kb, crypt_pbkdf_limits::max_parallel, NULL, crypt_pbkdf_type::parallel_threads, crypt_pbkdf_type::time_ms, crypt_pbkdf_type::type, and verify_pbkdf_params().
Referenced by _crypt_format_luks1(), _crypt_format_luks2(), _crypt_load_luks(), _crypt_load_luks2(), and crypt_set_pbkdf_type().
int kernel_version | ( | uint64_t * | kversion | ) |
Definition at line 301 of file utils.c.
References compact_version().
Referenced by dmcrypt_keyring_bug().
int lookup_by_disk_id | ( | const char * | dm_uuid | ) |
Definition at line 376 of file utils_devpath.c.
Referenced by lookup_dm_dev_by_uuid().
int lookup_by_sysfs_uuid_field | ( | const char * | dm_uuid | ) |
Definition at line 411 of file utils_devpath.c.
References DM_UUID_LEN, O_CLOEXEC, and read_buffer().
Referenced by lookup_dm_dev_by_uuid().
int onlyLUKS2 | ( | struct crypt_device * | cd | ) |
Definition at line 376 of file setup.c.
References _onlyLUKS2().
Referenced by crypt_keyslot_add_by_key(), crypt_keyslot_set_priority(), crypt_persistent_flags_set(), crypt_set_label(), crypt_token_assign_keyslot(), crypt_token_json_set(), crypt_token_luks2_keyring_set(), and crypt_token_unassign_keyslot().
int onlyLUKS2mask | ( | struct crypt_device * | cd, |
uint32_t | mask | ||
) |
Definition at line 382 of file setup.c.
References _onlyLUKS2().
Referenced by crypt_reencrypt_init_by_keyring(), crypt_reencrypt_init_by_passphrase(), and crypt_reencrypt_run().
int PLAIN_activate | ( | struct crypt_device * | cd, |
const char * | name, | ||
struct volume_key * | vk, | ||
uint64_t | size, | ||
uint32_t | flags | ||
) |
Definition at line 506 of file setup.c.
References _, create_or_reload_device(), crypt_data_device(), crypt_get_cipher_spec(), crypt_get_data_offset(), crypt_get_integrity(), crypt_get_integrity_tag_size(), crypt_get_iv_offset(), crypt_get_sector_size(), CRYPT_PLAIN, device_block_size(), dm_crypt_target_set(), dm_targets_free(), crypt_dm_active_device::flags, log_dbg, log_err, MISALIGNED, name, SECTOR_SHIFT, crypt_dm_active_device::segment, and crypt_dm_active_device::size.
Referenced by _activate_by_passphrase(), and crypt_activate_by_volume_key().
size_t size_round_up | ( | size_t | size, |
size_t | block | ||
) |
Definition at line 922 of file utils_device.c.
Referenced by get_area_size(), keyslot_LUKS1_compatible(), LUKS2_find_area_max_gap(), LUKS2_generate_hdr(), LUKS2_hdr_backup(), LUKS2_luks1_to_luks2(), LUKS_endec_template(), LUKS_generate_phdr(), and LUKS_hdr_backup().
|
inlinestatic |
Definition at line 246 of file internal.h.
Referenced by create_or_verify(), and VERITY_create_or_verify_hash().
int verify_pbkdf_params | ( | struct crypt_device * | cd, |
const struct crypt_pbkdf_type * | pbkdf | ||
) |
Definition at line 84 of file utils_pbkdf.c.
References _, crypt_get_type(), crypt_hash_size(), CRYPT_KDF_PBKDF2, CRYPT_LUKS1, crypt_parse_pbkdf(), crypt_pbkdf_get_limits(), CRYPT_PBKDF_NO_BENCHMARK, crypt_pbkdf_type::flags, crypt_pbkdf_type::hash, init_crypto(), crypt_pbkdf_type::iterations, log_err, crypt_pbkdf_limits::max_memory, crypt_pbkdf_type::max_memory_kb, crypt_pbkdf_limits::min_iterations, crypt_pbkdf_limits::min_memory, crypt_pbkdf_type::parallel_threads, crypt_pbkdf_type::time_ms, and crypt_pbkdf_type::type.
Referenced by _crypt_format_luks1(), _crypt_format_luks2(), _crypt_load_luks(), _crypt_load_luks2(), crypt_set_iteration_time(), and init_pbkdf_type().