Group all string options variables together.

This commit is contained in:
Ondrej Kozina
2020-04-23 11:28:44 +02:00
committed by Milan Broz
parent 36f424ce71
commit 5345a73ca0
4 changed files with 52 additions and 55 deletions

View File

@@ -27,19 +27,40 @@
static const char *opt_cipher = NULL; static const char *opt_cipher = NULL;
static const char *opt_keyslot_cipher = NULL; static const char *opt_keyslot_cipher = NULL;
static const char *opt_hash = NULL; static const char *opt_hash = NULL;
static int opt_verify_passphrase = 0;
static const char *opt_json_file = NULL; static const char *opt_json_file = NULL;
static const char *opt_key_file = NULL; static const char *opt_key_file = NULL;
static const char *opt_keyfile_stdin = NULL; static const char *opt_keyfile_stdin = NULL;
static int opt_keyfiles_count = 0;
static const char *opt_keyfiles[MAX_KEYFILES]; static const char *opt_keyfiles[MAX_KEYFILES];
static const char *opt_master_key_file = NULL; static const char *opt_master_key_file = NULL;
static const char *opt_header_backup_file = NULL; static const char *opt_header_backup_file = NULL;
static const char *opt_uuid = NULL; static const char *opt_uuid = NULL;
static const char *opt_header_device = NULL; static const char *opt_header_device = NULL;
static const char *opt_type = "luks"; static const char *opt_type = "luks";
static const char *opt_pbkdf = NULL;
static const char *opt_priority = NULL; /* normal */
static const char *opt_integrity = NULL; /* none */
static const char *opt_key_description = NULL;
static const char *opt_label = NULL;
static const char *opt_subsystem = NULL;
static const char *opt_active_name = NULL;
static const char *opt_resilience_mode = "checksum"; // TODO: default resilience
static const char *opt_resilience_hash = "sha256"; // TODO: default checksum hash
/* helper strings converted to uint64_t later */
static const char *opt_reduce_size_str = NULL;
static const char *opt_hotzone_size_str = NULL;
static const char *opt_device_size_str = NULL;
static const char *opt_luks2_metadata_size_str = NULL;
static const char *opt_luks2_keyslots_size_str = NULL;
static uint64_t opt_reduce_size = 0;
static uint64_t opt_hotzone_size = 0;
static uint64_t opt_device_size = 0;
static uint64_t opt_luks2_metadata_size = 0;
static uint64_t opt_luks2_keyslots_size = 0;
static int opt_keyfiles_count = 0;
static int opt_verify_passphrase = 0;
static int opt_key_size = 0; static int opt_key_size = 0;
static int opt_keyslot_key_size = 0; static int opt_keyslot_key_size = 0;
static long opt_keyfile_size = 0; static long opt_keyfile_size = 0;
@@ -76,53 +97,30 @@ static int opt_veracrypt_query_pim = 0;
static int opt_deferred_remove = 0; static int opt_deferred_remove = 0;
static int opt_serialize_memory_hard_pbkdf = 0; static int opt_serialize_memory_hard_pbkdf = 0;
//FIXME: check uint32 overflow for long type //FIXME: check uint32 overflow for long type
static const char *opt_pbkdf = NULL;
static long opt_pbkdf_memory = DEFAULT_LUKS2_MEMORY_KB; static long opt_pbkdf_memory = DEFAULT_LUKS2_MEMORY_KB;
static long opt_pbkdf_parallel = DEFAULT_LUKS2_PARALLEL_THREADS; static long opt_pbkdf_parallel = DEFAULT_LUKS2_PARALLEL_THREADS;
static long opt_pbkdf_iterations = 0; static long opt_pbkdf_iterations = 0;
static int opt_iteration_time = 0; static int opt_iteration_time = 0;
static int opt_disable_locks = 0; static int opt_disable_locks = 0;
static int opt_disable_keyring = 0; static int opt_disable_keyring = 0;
static const char *opt_priority = NULL; /* normal */
static const char *opt_integrity = NULL; /* none */
static int opt_integrity_nojournal = 0; static int opt_integrity_nojournal = 0;
static int opt_integrity_no_wipe = 0; static int opt_integrity_no_wipe = 0;
static int opt_integrity_legacy_padding = 0; static int opt_integrity_legacy_padding = 0;
static const char *opt_key_description = NULL;
static int opt_sector_size = 0; static int opt_sector_size = 0;
static int opt_iv_large_sectors = 0; static int opt_iv_large_sectors = 0;
static int opt_persistent = 0; static int opt_persistent = 0;
static const char *opt_label = NULL;
static const char *opt_subsystem = NULL;
static int opt_unbound = 0; static int opt_unbound = 0;
static int opt_refresh = 0; static int opt_refresh = 0;
/* LUKS2 reencryption parameters */ /* LUKS2 reencryption parameters */
static const char *opt_active_name = NULL;
static const char *opt_resilience_mode = "checksum"; // TODO: default resilience
static const char *opt_resilience_hash = "sha256"; // TODO: default checksum hash
static int opt_encrypt = 0; static int opt_encrypt = 0;
static int opt_reencrypt_init_only = 0; static int opt_reencrypt_init_only = 0;
static int opt_reencrypt_resume_only = 0; static int opt_reencrypt_resume_only = 0;
static int opt_decrypt = 0; static int opt_decrypt = 0;
static const char *opt_reduce_size_str = NULL;
static uint64_t opt_reduce_size = 0;
static const char *opt_hotzone_size_str = NULL;
static uint64_t opt_hotzone_size = 0;
static const char *opt_device_size_str = NULL;
static uint64_t opt_device_size = 0;
/* do not set from command line, use helpers above */ /* do not set from command line, use helpers above */
static int64_t opt_data_shift; static int64_t opt_data_shift;
static const char *opt_luks2_metadata_size_str = NULL;
static uint64_t opt_luks2_metadata_size = 0;
static const char *opt_luks2_keyslots_size_str = NULL;
static uint64_t opt_luks2_keyslots_size = 0;
static const char **action_argv; static const char **action_argv;
static int action_argc; static int action_argc;
static const char *null_action_argv[] = {NULL, NULL}; static const char *null_action_argv[] = {NULL, NULL};

View File

@@ -35,10 +35,19 @@ static const char *opt_key_file = NULL;
static const char *opt_master_key_file = NULL; static const char *opt_master_key_file = NULL;
static const char *opt_uuid = NULL; static const char *opt_uuid = NULL;
static const char *opt_type = "luks"; static const char *opt_type = "luks";
static const char *opt_pbkdf = NULL;
static const char *opt_header_device = NULL;
/* helper strings converted to uint64_t later */
static const char *opt_reduce_size_str = NULL;
static const char *opt_device_size_str = NULL;
static uint64_t opt_reduce_size = 0;
static uint64_t opt_device_size = 0;
static long opt_keyfile_size = 0; static long opt_keyfile_size = 0;
static long opt_keyfile_offset = 0; static long opt_keyfile_offset = 0;
static int opt_iteration_time = 0; static int opt_iteration_time = 0;
static const char *opt_pbkdf = NULL;
static long opt_pbkdf_memory = DEFAULT_LUKS2_MEMORY_KB; static long opt_pbkdf_memory = DEFAULT_LUKS2_MEMORY_KB;
static long opt_pbkdf_parallel = DEFAULT_LUKS2_PARALLEL_THREADS; static long opt_pbkdf_parallel = DEFAULT_LUKS2_PARALLEL_THREADS;
static long opt_pbkdf_iterations = 0; static long opt_pbkdf_iterations = 0;
@@ -54,13 +63,6 @@ static int opt_key_size = 0;
static int opt_new = 0; static int opt_new = 0;
static int opt_keep_key = 0; static int opt_keep_key = 0;
static int opt_decrypt = 0; static int opt_decrypt = 0;
static const char *opt_header_device = NULL;
static const char *opt_reduce_size_str = NULL;
static uint64_t opt_reduce_size = 0;
static const char *opt_device_size_str = NULL;
static uint64_t opt_device_size = 0;
static const char **action_argv; static const char **action_argv;

View File

@@ -27,8 +27,19 @@
#define DEFAULT_ALG_NAME "crc32c" #define DEFAULT_ALG_NAME "crc32c"
#define MAX_KEY_SIZE 4096 #define MAX_KEY_SIZE 4096
static const char *opt_data_device = NULL;
static const char *opt_integrity = DEFAULT_ALG_NAME;
static const char *opt_integrity_key_file = NULL;
static const char *opt_journal_integrity = NULL; /* none */
static const char *opt_journal_integrity_key_file = NULL;
static const char *opt_journal_crypt = NULL; /* none */
static const char *opt_journal_crypt_key_file = NULL;
/* helper strings converted to uint64_t later */
static const char *opt_journal_size_str = NULL; static const char *opt_journal_size_str = NULL;
static uint64_t opt_journal_size = 0; static uint64_t opt_journal_size = 0;
static int opt_interleave_sectors = 0; static int opt_interleave_sectors = 0;
static int opt_journal_watermark = 0; static int opt_journal_watermark = 0;
static int opt_bitmap_sectors_per_bit = 0; static int opt_bitmap_sectors_per_bit = 0;
@@ -37,28 +48,14 @@ static int opt_bitmap_flush_time = 0;
static int opt_tag_size = 0; static int opt_tag_size = 0;
static int opt_sector_size = 0; static int opt_sector_size = 0;
static int opt_buffer_sectors = 0; static int opt_buffer_sectors = 0;
static int opt_no_wipe = 0; static int opt_no_wipe = 0;
static const char *opt_data_device = NULL;
static const char *opt_integrity = DEFAULT_ALG_NAME;
static const char *opt_integrity_key_file = NULL;
static int opt_integrity_key_size = 0; static int opt_integrity_key_size = 0;
static const char *opt_journal_integrity = NULL; /* none */
static const char *opt_journal_integrity_key_file = NULL;
static int opt_journal_integrity_key_size = 0; static int opt_journal_integrity_key_size = 0;
static const char *opt_journal_crypt = NULL; /* none */
static const char *opt_journal_crypt_key_file = NULL;
static int opt_journal_crypt_key_size = 0; static int opt_journal_crypt_key_size = 0;
static int opt_integrity_nojournal = 0; static int opt_integrity_nojournal = 0;
static int opt_integrity_recovery = 0; static int opt_integrity_recovery = 0;
static int opt_integrity_bitmap = 0; static int opt_integrity_bitmap = 0;
static int opt_integrity_legacy_padding = 0; static int opt_integrity_legacy_padding = 0;
static int opt_integrity_recalculate = 0; static int opt_integrity_recalculate = 0;
static int opt_allow_discards = 0; static int opt_allow_discards = 0;

View File

@@ -23,25 +23,25 @@
#define PACKAGE_VERITY "veritysetup" #define PACKAGE_VERITY "veritysetup"
static int opt_use_superblock = 1;
static const char *opt_fec_device = NULL; static const char *opt_fec_device = NULL;
static int opt_fec_roots = DEFAULT_VERITY_FEC_ROOTS;
static const char *opt_hash_algorithm = NULL; static const char *opt_hash_algorithm = NULL;
static const char *opt_salt = NULL;
static const char *opt_uuid = NULL;
static const char *opt_root_hash_signature = NULL;
static int opt_use_superblock = 1;
static int opt_fec_roots = DEFAULT_VERITY_FEC_ROOTS;
static int opt_hash_type = 1; static int opt_hash_type = 1;
static int opt_data_block_size = DEFAULT_VERITY_DATA_BLOCK; static int opt_data_block_size = DEFAULT_VERITY_DATA_BLOCK;
static int opt_hash_block_size = DEFAULT_VERITY_HASH_BLOCK; static int opt_hash_block_size = DEFAULT_VERITY_HASH_BLOCK;
static uint64_t data_blocks = 0; static uint64_t data_blocks = 0;
static const char *opt_salt = NULL;
static uint64_t hash_offset = 0; static uint64_t hash_offset = 0;
static uint64_t fec_offset = 0; static uint64_t fec_offset = 0;
static const char *opt_uuid = NULL;
static int opt_restart_on_corruption = 0; static int opt_restart_on_corruption = 0;
static int opt_panic_on_corruption = 0; static int opt_panic_on_corruption = 0;
static int opt_ignore_corruption = 0; static int opt_ignore_corruption = 0;
static int opt_ignore_zero_blocks = 0; static int opt_ignore_zero_blocks = 0;
static int opt_check_at_most_once = 0; static int opt_check_at_most_once = 0;
static const char *opt_root_hash_signature = NULL;
static const char **action_argv; static const char **action_argv;
static int action_argc; static int action_argc;