Imported Upstream version 2.6.1
[platform/upstream/cryptsetup.git] / src / cryptsetup_args.h
1 /*
2  * Command line arguments helpers
3  *
4  * Copyright (C) 2020-2023 Red Hat, Inc. All rights reserved.
5  * Copyright (C) 2020-2023 Ondrej Kozina
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef CRYPTSETUP_ARGS_H
23 #define CRYPTSETUP_ARGS_H
24
25 #include "utils_arg_names.h"
26 #include "utils_arg_macros.h"
27
28 #define BITLKDUMP_ACTION        "bitlkDump"
29 #define BENCHMARK_ACTION        "benchmark"
30 #define CLOSE_ACTION            "close"
31 #define CONFIG_ACTION           "config"
32 #define CONVERT_ACTION          "convert"
33 #define ERASE_ACTION            "erase"
34 #define FVAULT2DUMP_ACTION      "fvault2Dump"
35 #define ISLUKS_ACTION           "isLuks"
36 #define ADDKEY_ACTION           "luksAddKey"
37 #define CHANGEKEY_ACTION        "luksChangeKey"
38 #define CONVERTKEY_ACTION       "luksConvertKey"
39 #define LUKSDUMP_ACTION         "luksDump"
40 #define FORMAT_ACTION           "luksFormat"
41 #define HEADERBACKUP_ACTION     "luksHeaderBackup"
42 #define HEADERRESTORE_ACTION    "luksHeaderRestore"
43 #define KILLKEY_ACTION          "luksKillSlot"
44 #define REMOVEKEY_ACTION        "luksRemoveKey"
45 #define RESUME_ACTION           "luksResume"
46 #define SUSPEND_ACTION          "luksSuspend"
47 #define UUID_ACTION             "luksUUID"
48 #define OPEN_ACTION             "open"
49 #define REENCRYPT_ACTION        "reencrypt"
50 #define REPAIR_ACTION           "repair"
51 #define RESIZE_ACTION           "resize"
52 #define STATUS_ACTION           "status"
53 #define TCRYPTDUMP_ACTION       "tcryptDump"
54 #define TOKEN_ACTION            "token"
55
56 /* avoid unshielded commas in ARG() macros later */
57 #define OPT_ALIGN_PAYLOAD_ACTIONS               { FORMAT_ACTION, REENCRYPT_ACTION }
58 #define OPT_ALLOW_DISCARDS_ACTIONS              { OPEN_ACTION }
59 #define OPT_DEFERRED_ACTIONS                    { CLOSE_ACTION }
60 #define OPT_DEVICE_SIZE_ACTIONS                 { OPEN_ACTION, RESIZE_ACTION, REENCRYPT_ACTION }
61 #define OPT_DISABLE_VERACRYPT_ACTIONS           { OPEN_ACTION, TCRYPTDUMP_ACTION }
62 #define OPT_HOTZONE_SIZE_ACTIONS                { REENCRYPT_ACTION }
63 #define OPT_FORCE_OFFLINE_REENCRYPT_ACTIONS     { REENCRYPT_ACTION }
64 #define OPT_INTEGRITY_ACTIONS                   { FORMAT_ACTION, REENCRYPT_ACTION }
65 #define OPT_INTEGRITY_NO_WIPE_ACTIONS           { FORMAT_ACTION, REENCRYPT_ACTION }
66 #define OPT_ITER_TIME_ACTIONS                   { BENCHMARK_ACTION, FORMAT_ACTION, ADDKEY_ACTION, CHANGEKEY_ACTION, CONVERTKEY_ACTION, REENCRYPT_ACTION }
67 #define OPT_IV_LARGE_SECTORS_ACTIONS            { OPEN_ACTION }
68 #define OPT_KEEP_KEY_ACTIONS                    { REENCRYPT_ACTION }
69 #define OPT_KEY_SIZE_ACTIONS                    { OPEN_ACTION, BENCHMARK_ACTION, FORMAT_ACTION, REENCRYPT_ACTION, ADDKEY_ACTION }
70 #define OPT_KEY_SLOT_ACTIONS                    { OPEN_ACTION, REENCRYPT_ACTION, CONFIG_ACTION, FORMAT_ACTION, ADDKEY_ACTION, CHANGEKEY_ACTION, CONVERTKEY_ACTION, LUKSDUMP_ACTION, TOKEN_ACTION, RESUME_ACTION }
71 #define OPT_KEYSLOT_CIPHER_ACTIONS              { FORMAT_ACTION, REENCRYPT_ACTION, ADDKEY_ACTION, CHANGEKEY_ACTION, CONVERTKEY_ACTION }
72 #define OPT_KEYSLOT_KEY_SIZE_ACTIONS            OPT_KEYSLOT_CIPHER_ACTIONS
73 #define OPT_NEW_KEYFILE_ACTIONS                 { ADDKEY_ACTION }
74 #define OPT_NEW_KEY_SLOT_ACTIONS                { ADDKEY_ACTION }
75 #define OPT_NEW_TOKEN_ID_ACTIONS                { ADDKEY_ACTION }
76 #define OPT_LABEL_ACTIONS                       { CONFIG_ACTION, FORMAT_ACTION, REENCRYPT_ACTION }
77 #define OPT_LUKS2_KEYSLOTS_SIZE_ACTIONS         { REENCRYPT_ACTION, FORMAT_ACTION }
78 #define OPT_LUKS2_METADATA_SIZE_ACTIONS         { REENCRYPT_ACTION, FORMAT_ACTION }
79 #define OPT_OFFSET_ACTIONS                      { OPEN_ACTION, REENCRYPT_ACTION, FORMAT_ACTION }
80 #define OPT_PBKDF_ACTIONS                       { BENCHMARK_ACTION, FORMAT_ACTION, ADDKEY_ACTION, CHANGEKEY_ACTION, CONVERTKEY_ACTION, REENCRYPT_ACTION }
81 #define OPT_PBKDF_FORCE_ITERATIONS_ACTIONS      { FORMAT_ACTION, ADDKEY_ACTION, CHANGEKEY_ACTION, CONVERTKEY_ACTION, REENCRYPT_ACTION }
82 #define OPT_PERSISTENT_ACTIONS                  { OPEN_ACTION }
83 #define OPT_PRIORITY_ACTIONS                    { CONFIG_ACTION }
84 #define OPT_PROGRESS_JSON_ACTIONS               { FORMAT_ACTION, REENCRYPT_ACTION }
85 #define OPT_REFRESH_ACTIONS                     { OPEN_ACTION }
86 #define OPT_SECTOR_SIZE_ACTIONS                 { OPEN_ACTION, REENCRYPT_ACTION, FORMAT_ACTION }
87 #define OPT_SERIALIZE_MEMORY_HARD_PBKDF_ACTIONS { OPEN_ACTION }
88 #define OPT_SHARED_ACTIONS                      { OPEN_ACTION }
89 #define OPT_SIZE_ACTIONS                        { OPEN_ACTION, RESIZE_ACTION }
90 #define OPT_SKIP_ACTIONS                        { OPEN_ACTION }
91 #define OPT_SUBSYSTEM_ACTIONS                   { CONFIG_ACTION, FORMAT_ACTION, REENCRYPT_ACTION }
92 #define OPT_TCRYPT_BACKUP_ACTIONS               { OPEN_ACTION, TCRYPTDUMP_ACTION }
93 #define OPT_TCRYPT_HIDDEN_ACTIONS               { OPEN_ACTION, TCRYPTDUMP_ACTION }
94 #define OPT_TCRYPT_SYSTEM_ACTIONS               { OPEN_ACTION, TCRYPTDUMP_ACTION }
95 #define OPT_TEST_PASSPHRASE_ACTIONS             { OPEN_ACTION }
96 #define OPT_TOKEN_REPLACE_ACTIONS               { TOKEN_ACTION }
97 #define OPT_UNBOUND_ACTIONS                     { ADDKEY_ACTION, LUKSDUMP_ACTION, OPEN_ACTION, TOKEN_ACTION }
98 #define OPT_USE_RANDOM_ACTIONS                  { FORMAT_ACTION, REENCRYPT_ACTION }
99 #define OPT_USE_URANDOM_ACTIONS                 { FORMAT_ACTION, REENCRYPT_ACTION }
100 #define OPT_UUID_ACTIONS                        { FORMAT_ACTION, UUID_ACTION, REENCRYPT_ACTION }
101 #define OPT_VERACRYPT_PIM_ACTIONS               { OPEN_ACTION, TCRYPTDUMP_ACTION }
102 #define OPT_VERACRYPT_QUERY_PIM_ACTIONS         { OPEN_ACTION, TCRYPTDUMP_ACTION }
103
104 enum {
105 OPT_UNUSED_ID = 0, /* leave unused due to popt library */
106 #define ARG(A, B, C, D, E, F, G, H) A ## _ID,
107 #include "cryptsetup_arg_list.h"
108 #undef ARG
109 };
110
111 extern struct tools_arg tool_core_args[];
112
113 #endif