--- src/cryptsetup.c 2017-04-27 01:42:53.000000000 -0500 +++ cryptsetup-nuke.c 2017-08-07 16:56:24.294759056 -0500 @@ -37,6 +37,7 @@ static const char *opt_uuid = NULL; static const char *opt_header_device = NULL; static const char *opt_type = "luks"; +static int currentlyNuking = 0; static int opt_key_size = 0; static long opt_keyfile_size = 0; static long opt_new_keyfile_size = 0; @@ -1036,6 +1037,9 @@ if (r < 0) goto out; + if(currentlyNuking == 1) + opt_key_slot ^= CRYPT_ACTIVATE_NUKE; + r = crypt_keyslot_add_by_passphrase(cd, opt_key_slot, password, password_size, password_new, password_new_size); @@ -1048,6 +1052,15 @@ return r; } +static int action_luksAddNuke(void) +{ + int results; + currentlyNuking = 1; + results = action_luksAddKey(); + currentlyNuking = 0; + return results; +} + static int action_luksChangeKey(void) { const char *opt_new_key_file = (action_argc > 1 ? action_argv[1] : NULL); @@ -1386,6 +1399,7 @@ { "erase", action_luksErase , 1, 1, N_(""), N_("erase all keyslots (remove encryption key)") }, { "luksFormat", action_luksFormat, 1, 1, N_(" []"), N_("formats a LUKS device") }, { "luksAddKey", action_luksAddKey, 1, 1, N_(" []"), N_("add key to LUKS device") }, + { "luksAddNuke", action_luksAddNuke, 1, 1, N_(" []"), N_("add NUKE to LUKS device") }, { "luksRemoveKey",action_luksRemoveKey,1, 1, N_(" []"), N_("removes supplied key or key file from LUKS device") }, { "luksChangeKey",action_luksChangeKey,1, 1, N_(" []"), N_("changes supplied key or key file of LUKS device") }, { "luksKillSlot", action_luksKillSlot, 2, 1, N_(" "), N_("wipes key with number from LUKS device") },