1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-13 19:28:56 +00:00
hashcat/src/modules/module_29523.c

451 lines
269 KiB
C
Raw Normal View History

2022-06-15 11:01:22 +00:00
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#include "common.h"
#include "types.h"
#include "modules.h"
#include "bitops.h"
#include "convert.h"
#include "shared.h"
#include "memory.h"
static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL;
static const u32 DGST_POS0 = 0;
static const u32 DGST_POS1 = 1;
static const u32 DGST_POS2 = 2;
static const u32 DGST_POS3 = 3;
static const u32 DGST_SIZE = DGST_SIZE_4_16;
static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE;
static const char *HASH_NAME = "LUKS v1 SHA-256 + Twofish";
2022-07-05 03:49:04 +00:00
static const u64 KERN_TYPE = 14623; // old kernel used here
2022-06-15 11:01:22 +00:00
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
static const u64 OPTS_TYPE = OPTS_TYPE_STOCK_MODULE
| OPTS_TYPE_PT_GENERATE_LE;
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
static const char *ST_PASS = "hashcat";
static const char *ST_HASH = "$luks$1$sha256$twofish$cbc-essiv:sha256$256$92561$3a9c59dc9aea663637ef9355a680e97c804dc77a890fe893c4393dd7341c2671$aa3bd63f68647c532575b809301677215cb539bf080f216d34e4dac26bdc0cceec1bacf2f149813b30b05b0fbc697296b1c2f121af20afd5ea5f9e75b003b0ab83ae27b8f58e45a6f68f438d2af9faaf93d341c43dafbf115fca41274616e2c7959781d5c42a478296482415623ec24ae36a7c9252d0a96d3362f925bcadf22fad8cd1b2526093d617b5654107edb981cd6764b68599e047e7ac1a9b12c43aebc1423835800ec4c99755b82b114806bc791488c1347246ed884815a3db2e944cc29045b848d7d1d87d56a2458a767519f466dde45b91e71ba0ea6259574482281a72995de4273920a368e6391635801b1661e892f16441785b8b48a3009c59b11ec1c0d7d14eed71eb7b4d7ebb9a9c6275e0b96236a8066d6923145d5b4a36d80d96ab321f894d0407385eca980ea1010513081cc9e12e70c8edb5a6f2532c97ab219b12968e7bb0310acd7d2f509537fbe2d422c509ea29c0c563d5f1832190ebb5932efda063940bab2cf57198be0c34a44fd957f4561aba2a3cb4fbdbf5d9ab327b6f4dfa6af410763b4be1c77d759bc1e8eaba744985a6fd2eb315ccfce7a84cdcce6128ee0e6cb16c07a83d671f82bc5895500d2d37991934c2c2afd72f7f72331a07f5fda9e9ce242ac9c072141e0f1ec971de3dad258b42824262bcc444117fd26fe5324df5906fb97858a6137df2ab6020ef17da9f13c34427edf22bfa4b8c6718587f0e2b6afe5550b051976e8f2775dd71b954de9cd446fc3a6ba77727e806f97103797308051b46e981d56c9748de697812ebf229d2bba9e2f92e7dafb6fdb0813c6ca8a341d4ad1996249d9e73a63a1eefab88cdff23050286c48829a698f51acede84709adfc06f299a0783464002734c6bd2ce9589ade32d7331d8cba35b7008b1b58acf45cedc3009322cbc621cc16da14b91f4ee0201ecb88571397e04f5f324e61290f6bf2041bc90856c65466337e2a13de6ab98462978835dd89755fda8d9b7fcb9547dee9b3d99bdc428d19b9a39c841f8f25fd9bc944beda9776474ce4bcb94041e168c5290a58ce08fa0ed4ffa69635646b8f80fcb3eca1cd41a6f84ac2209eb62cdb01b77f8e8b8b60ccce366599e4c1d180621f02be1d9bb66fea0d425d3dc4ee2a7eceae0ea897c8109dcd2b66dcf77dbce44715898540354b7d74e4a0d4629670589c7e4d24e2985bdc85fcbb3dddf4587e4b86dfb794a03ccc9ae59865727c4269c3589c08e245895077bc289cc7a8689893b2b8d4ae15139e83c6135dce6630b6dd7e02195b5b50a9455568f7206c01a47440b5c2a9c5ad1659e98e26ddc5195a6a31d51aae420609d249adeb237815eb0100862110746c9759dc50f719175481f6b54c53309dd8e63d36fb8a0b26abfb893422557730b636c12ae3056875adf305c67153f06f2f7313c148be6d2bdeaa6d9c8a6378dc519c97417035a1c48ef91ed4f7f5d1961c45485cc2827d6218e85088368494ffdab7285dd9945400e608d7a8361eb5aebc31b66abeab613282cc2d7b3a03b8b2e56093abff7bd727e6042c40e40a6f192be0d0652730768899a1dcd237265e979b7f338b6553819d14e9f6b34001b5466909df00f5f4eee02be33a7ffabc725e574581f339baf8e49348a62a04c726523c32b9af10109029366694de06d8d919a4ccab878c949bcc661cf0fbacaebef0a7e9028ad7b7fd8edbc01ba532abc51cdea0ae1569677321232a137a693ae68c58a261521aa9086bdfc261f5bde5c473b9cabf4373035019fed2de473d44cf647650e37db1f30c86e427eeead2016bc197245de75a6ef9868b3b899f1cef6c0cc9013c85b4fda67a8d6944d1936afb4520b5cc4b5a9fcde098f06d1f4469e907c11b3fa2d2443ece06da49788b8827da7e8890c9ed9f04940270a4eed6d6a763e538c96c524028b2c55ff2ae90c732cc32ba96f471c2cc029cf882c40b959321c70b1ec9a4beaebe463d47c41952e9bbf4e076c8125292e8e409a9bddabdff8b287731535db3d53ef8b6e433e3eb64a1c3e9fc897c5f5569c04fa68fd85037cf953f88652c5f8a46bd15da90a705347045ed030b61456e659cd77246fb8192f1772ba9b49eeacc408ffbe54c6001e76c4b05b5a0c8156704521ca7bc2cf9d83e8b1a85bbb520bb34a93b701a3bdb0ca93c05183a629d0e45c9338f69a586abfd6b5a95888f453ad7e1b5abf8bd1fd43d316039f09dc7d11e2981c0fc6d0d33d1e398464553d5de2fc00fb58e067b8bfe94f9de8263d627f669cf839f962ebdaca3ee5b009cbc0b313d55d42db599d7753f73718d22851858b2fe037c016d5a08ebbdc1e86496c9d5b668f5a9fec2557212d3cf6045d0c1ecf73b222333510aee8058a7144ebb6cae2e0be4855aafb6f1905aff837e2cc42f3292f32d2c0a6775c709ae3d074bb67b1137c636f0d133cf58f353edd84cc2c445391f514f46657a4c78138d63ebbd6a48e3aaa06cd33fc57c4d18ffe48a3eaec9a67b3a9f5c04c943b66f0a4e36f055d43d9e664561e422b5a100f181d6c194e742e5eebe1a3b1292fe7ca5f616cf75426975e0f390a3711427506d886ff56d7c2bdf69931487627d6900d83e507b12d575c26e8fef4c40e2e73a92b3bbf0e3bb2c69d24aa69306e2fc0619331f09c6313842e6da04390aff9929152263c8d010be57381f94ea3d1bad89b3f7c2b2d38aaba4553124b2008c8cae5f58e53a0093342076f300029bb20a64d454899078f827d31d2cf94dcec23e3b8dd29a1fbc2f81295a4ce788
u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; }
u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; }
u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; }
u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; }
u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; }
u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; }
u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; }
const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; }
u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; }
u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; }
u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; }
u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; }
const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; }
const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; }
2022-07-05 03:49:04 +00:00
#define LUKS_STRIPES ( 4000)
#define LUKS_SALT_LEN ( 32)
#define LUKS_SALT_HEX_LEN ( LUKS_SALT_LEN * 2)
#define LUKS_CT_LEN ( 512)
#define LUKS_CT_HEX_LEN ( LUKS_CT_LEN * 2)
#define LUKS_AF_MIN_LEN (HC_LUKS_KEY_SIZE_128 / 8 * LUKS_STRIPES)
#define LUKS_AF_MIN_HEX_LEN ( LUKS_AF_MIN_LEN * 2)
#define LUKS_AF_MAX_LEN (HC_LUKS_KEY_SIZE_512 / 8 * LUKS_STRIPES)
#define LUKS_AF_MAX_HEX_LEN ( LUKS_AF_MAX_LEN * 2)
2022-06-15 11:01:22 +00:00
typedef enum hc_luks_hash_type
{
HC_LUKS_HASH_TYPE_SHA1 = 1,
HC_LUKS_HASH_TYPE_SHA256 = 2,
HC_LUKS_HASH_TYPE_SHA512 = 3,
HC_LUKS_HASH_TYPE_RIPEMD160 = 4,
HC_LUKS_HASH_TYPE_WHIRLPOOL = 5,
} hc_luks_hash_type_t;
typedef enum hc_luks_key_size
{
HC_LUKS_KEY_SIZE_128 = 128,
HC_LUKS_KEY_SIZE_256 = 256,
HC_LUKS_KEY_SIZE_512 = 512,
} hc_luks_key_size_t;
typedef enum hc_luks_cipher_type
{
HC_LUKS_CIPHER_TYPE_AES = 1,
HC_LUKS_CIPHER_TYPE_SERPENT = 2,
HC_LUKS_CIPHER_TYPE_TWOFISH = 3,
} hc_luks_cipher_type_t;
typedef enum hc_luks_cipher_mode
{
HC_LUKS_CIPHER_MODE_CBC_ESSIV_SHA256 = 1,
HC_LUKS_CIPHER_MODE_CBC_PLAIN = 2,
HC_LUKS_CIPHER_MODE_CBC_PLAIN64 = 3,
HC_LUKS_CIPHER_MODE_XTS_PLAIN = 4,
HC_LUKS_CIPHER_MODE_XTS_PLAIN64 = 5,
} hc_luks_cipher_mode_t;
typedef struct luks
{
2022-07-05 03:49:04 +00:00
int hash_type; // hc_luks_hash_type_t
int key_size; // hc_luks_key_size_t
int cipher_type; // hc_luks_cipher_type_t
int cipher_mode; // hc_luks_cipher_mode_t
2022-06-15 11:01:22 +00:00
u32 ct_buf[LUKS_CT_LEN / 4];
u32 af_buf[LUKS_AF_MAX_LEN / 4];
u32 af_len;
} luks_t;
typedef struct luks_tmp
{
u32 ipad32[8];
u64 ipad64[8];
u32 opad32[8];
u64 opad64[8];
u32 dgst32[32];
u64 dgst64[16];
u32 out32[32];
u64 out64[16];
} luks_tmp_t;
static const char *SIGNATURE_LUKS = "$luks$1$sha256$twofish$";
u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
{
const u64 esalt_size = (const u64) sizeof (luks_t);
return esalt_size;
}
u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
{
const u64 tmp_size = (const u64) sizeof (luks_tmp_t);
return tmp_size;
}
u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
{
// this overrides the reductions of PW_MAX in case optimized kernel is selected
// IOW, even in optimized kernel mode it support length 256
const u32 pw_max = PW_MAX;
return pw_max;
}
int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len)
{
luks_t *luks = (luks_t *) esalt_buf;
hc_token_t token;
memset (&token, 0, sizeof (hc_token_t));
2022-06-15 11:01:22 +00:00
token.token_cnt = 7;
token.signatures_cnt = 1;
token.signatures_buf[0] = SIGNATURE_LUKS;
// signature with hash and cipher type
token.len[0] = 23;
token.attr[0] = TOKEN_ATTR_FIXED_LENGTH
| TOKEN_ATTR_VERIFY_SIGNATURE;
// cipher mode
token.sep[1] = '$';
token.len_min[1] = 9;
token.len_max[1] = 16;
token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH;
// key size
token.sep[2] = '$';
token.len[2] = 3;
token.attr[2] = TOKEN_ATTR_FIXED_LENGTH
2022-06-15 11:01:22 +00:00
| TOKEN_ATTR_VERIFY_DIGIT;
// iter
token.sep[3] = '$';
token.len_min[3] = 1;
token.len_max[3] = 10;
token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH
| TOKEN_ATTR_VERIFY_DIGIT;
// salt
token.sep[4] = '$';
token.len[4] = LUKS_SALT_HEX_LEN;
token.attr[4] = TOKEN_ATTR_FIXED_LENGTH
2022-06-15 11:01:22 +00:00
| TOKEN_ATTR_VERIFY_HEX;
// af
token.sep[5] = '$';
2022-07-05 03:49:04 +00:00
token.len_min[5] = LUKS_AF_MIN_HEX_LEN;
token.len_max[5] = LUKS_AF_MAX_HEX_LEN;
2022-06-15 11:01:22 +00:00
token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH
| TOKEN_ATTR_VERIFY_HEX;
// ct
token.sep[6] = '$';
token.len[6] = LUKS_CT_HEX_LEN;
token.attr[6] = TOKEN_ATTR_FIXED_LENGTH
2022-06-15 11:01:22 +00:00
| TOKEN_ATTR_VERIFY_HEX;
const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
// hash type
luks->hash_type = HC_LUKS_HASH_TYPE_SHA256;
// cipher type
luks->cipher_type = HC_LUKS_CIPHER_TYPE_TWOFISH;
// cipher mode
const u8 *cipher_mode_pos = token.buf[1];
2022-09-13 23:00:20 +00:00
const u32 cipher_mode_len = token.len[1];
2022-06-15 11:01:22 +00:00
2022-09-13 23:00:20 +00:00
if ((strncmp ((const char *) cipher_mode_pos, "cbc-essiv:sha256", 16) == 0) && (cipher_mode_len == 16))
2022-06-15 11:01:22 +00:00
{
luks->cipher_mode = HC_LUKS_CIPHER_MODE_CBC_ESSIV_SHA256;
}
2022-09-13 23:00:20 +00:00
else if ((strncmp ((const char *) cipher_mode_pos, "cbc-plain", 9) == 0) && (cipher_mode_len == 9))
2022-06-15 11:01:22 +00:00
{
luks->cipher_mode = HC_LUKS_CIPHER_MODE_CBC_PLAIN;
}
2022-09-13 23:00:20 +00:00
else if ((strncmp ((const char *) cipher_mode_pos, "cbc-plain64", 11) == 0) && (cipher_mode_len == 11))
2022-06-15 11:01:22 +00:00
{
luks->cipher_mode = HC_LUKS_CIPHER_MODE_CBC_PLAIN64;
}
2022-09-13 23:00:20 +00:00
else if ((strncmp ((const char *) cipher_mode_pos, "xts-plain", 9) == 0) && (cipher_mode_len == 9))
2022-06-15 11:01:22 +00:00
{
luks->cipher_mode = HC_LUKS_CIPHER_MODE_XTS_PLAIN;
}
2022-09-13 23:00:20 +00:00
else if ((strncmp ((const char *) cipher_mode_pos, "xts-plain64", 11) == 0) && (cipher_mode_len == 11))
2022-06-15 11:01:22 +00:00
{
luks->cipher_mode = HC_LUKS_CIPHER_MODE_XTS_PLAIN64;
}
else
{
return (PARSER_LUKS_CIPHER_MODE);
}
// key size
const u8 *key_size_pos = token.buf[2];
const u32 key_size = hc_strtoul ((const char *) key_size_pos, NULL, 10);
if (key_size == 128)
{
luks->key_size = HC_LUKS_KEY_SIZE_128;
}
else if (key_size == 256)
{
luks->key_size = HC_LUKS_KEY_SIZE_256;
}
else if (key_size == 512)
{
luks->key_size = HC_LUKS_KEY_SIZE_512;
}
else
{
return (PARSER_LUKS_KEY_SIZE);
}
// salt
const u8 *salt_pos = token.buf[4];
2022-07-05 03:49:04 +00:00
salt->salt_len = hex_decode (salt_pos, LUKS_SALT_HEX_LEN, (u8 *) salt->salt_buf);
2022-06-15 11:01:22 +00:00
// iter
const u8 *iter_pos = token.buf[3];
const u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10);
salt->salt_iter = iter - 1;
// af
u32 af_len = token.len[5] / 2;
if (af_len != (key_size / 8) * LUKS_STRIPES) return (PARSER_LUKS_FILE_SIZE);
const u8 *af_pos = token.buf[5];
2022-07-05 03:49:04 +00:00
luks->af_len = hex_decode (af_pos, token.len[5], (u8 *) luks->af_buf);
2022-06-15 11:01:22 +00:00
// ct
u32 ct_len = token.len[6] / 2;
if (ct_len != LUKS_CT_LEN) return (PARSER_LUKS_FILE_SIZE);
const u8 *ct_pos = token.buf[6];
2022-07-05 03:49:04 +00:00
hex_decode (ct_pos, LUKS_CT_HEX_LEN, (u8 *) luks->ct_buf);
2022-06-15 11:01:22 +00:00
return (PARSER_OK);
}
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size)
{
luks_t *luks = (luks_t *) esalt_buf;
// cipher mode
char *cipher_mode = "";
2022-06-15 11:01:22 +00:00
switch (luks->cipher_mode)
{
case HC_LUKS_CIPHER_MODE_CBC_ESSIV_SHA256: cipher_mode = "cbc-essiv:sha256"; break;
case HC_LUKS_CIPHER_MODE_CBC_PLAIN: cipher_mode = "cbc-plain"; break;
case HC_LUKS_CIPHER_MODE_CBC_PLAIN64: cipher_mode = "cbc-plain64"; break;
case HC_LUKS_CIPHER_MODE_XTS_PLAIN: cipher_mode = "xts-plain"; break;
case HC_LUKS_CIPHER_MODE_XTS_PLAIN64: cipher_mode = "xts-plain64"; break;
2022-07-05 03:49:04 +00:00
default: return 0;
2022-06-15 11:01:22 +00:00
}
// key size
u32 key_size = 0;
2022-06-15 11:01:22 +00:00
switch (luks->key_size)
{
case HC_LUKS_KEY_SIZE_128: key_size = 128; break;
case HC_LUKS_KEY_SIZE_256: key_size = 256; break;
case HC_LUKS_KEY_SIZE_512: key_size = 512; break;
2022-07-05 03:49:04 +00:00
default: return 0;
2022-06-15 11:01:22 +00:00
}
// iterations
u32 iterations = salt->salt_iter + 1;
// salt
2022-07-05 03:49:04 +00:00
char salt_buf[LUKS_SALT_HEX_LEN + 1] = { 0 };
2022-06-15 11:01:22 +00:00
2022-07-05 03:49:04 +00:00
hex_encode ((const u8 *) salt->salt_buf, LUKS_SALT_LEN, (u8 *) salt_buf);
2022-06-15 11:01:22 +00:00
// af
2022-07-05 03:49:04 +00:00
char af_buf[LUKS_AF_MAX_HEX_LEN + 1] = { 0 };
2022-06-15 11:01:22 +00:00
2022-07-05 03:49:04 +00:00
hex_encode ((const u8 *) luks->af_buf, luks->af_len, (u8 *) af_buf);
2022-06-15 11:01:22 +00:00
// ct
2022-07-05 03:49:04 +00:00
char ct_buf[LUKS_CT_HEX_LEN + 1] = { 0 };
2022-06-15 11:01:22 +00:00
2022-07-05 03:49:04 +00:00
hex_encode ((const u8 *) luks->ct_buf, LUKS_CT_LEN, (u8 *) ct_buf);
2022-06-15 11:01:22 +00:00
// output
int line_len = snprintf (line_buf, line_size, "%s%s$%u$%u$%s$%s$%s",
SIGNATURE_LUKS,
cipher_mode,
key_size,
iterations,
salt_buf,
af_buf,
ct_buf);
return line_len;
}
void module_init (module_ctx_t *module_ctx)
{
module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT;
module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT;
module_ctx->module_attack_exec = module_attack_exec;
module_ctx->module_benchmark_esalt = MODULE_DEFAULT;
module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT;
module_ctx->module_benchmark_mask = MODULE_DEFAULT;
module_ctx->module_benchmark_charset = MODULE_DEFAULT;
2022-06-15 11:01:22 +00:00
module_ctx->module_benchmark_salt = MODULE_DEFAULT;
module_ctx->module_build_plain_postprocess = MODULE_DEFAULT;
module_ctx->module_deep_comp_kernel = MODULE_DEFAULT;
module_ctx->module_deprecated_notice = MODULE_DEFAULT;
module_ctx->module_dgst_pos0 = module_dgst_pos0;
module_ctx->module_dgst_pos1 = module_dgst_pos1;
module_ctx->module_dgst_pos2 = module_dgst_pos2;
module_ctx->module_dgst_pos3 = module_dgst_pos3;
module_ctx->module_dgst_size = module_dgst_size;
module_ctx->module_dictstat_disable = MODULE_DEFAULT;
module_ctx->module_esalt_size = module_esalt_size;
module_ctx->module_extra_buffer_size = MODULE_DEFAULT;
module_ctx->module_extra_tmp_size = MODULE_DEFAULT;
module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT;
module_ctx->module_forced_outfile_format = MODULE_DEFAULT;
module_ctx->module_hash_binary_count = MODULE_DEFAULT;
module_ctx->module_hash_binary_parse = MODULE_DEFAULT;
module_ctx->module_hash_binary_save = MODULE_DEFAULT;
module_ctx->module_hash_decode_postprocess = MODULE_DEFAULT;
module_ctx->module_hash_decode_potfile = MODULE_DEFAULT;
module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT;
module_ctx->module_hash_decode = module_hash_decode;
module_ctx->module_hash_encode_status = MODULE_DEFAULT;
module_ctx->module_hash_encode_potfile = MODULE_DEFAULT;
module_ctx->module_hash_encode = module_hash_encode;
module_ctx->module_hash_init_selftest = MODULE_DEFAULT;
module_ctx->module_hash_mode = MODULE_DEFAULT;
module_ctx->module_hash_category = module_hash_category;
module_ctx->module_hash_name = module_hash_name;
module_ctx->module_hashes_count_min = MODULE_DEFAULT;
module_ctx->module_hashes_count_max = MODULE_DEFAULT;
module_ctx->module_hlfmt_disable = MODULE_DEFAULT;
module_ctx->module_hook_extra_param_size = MODULE_DEFAULT;
module_ctx->module_hook_extra_param_init = MODULE_DEFAULT;
module_ctx->module_hook_extra_param_term = MODULE_DEFAULT;
module_ctx->module_hook12 = MODULE_DEFAULT;
module_ctx->module_hook23 = MODULE_DEFAULT;
module_ctx->module_hook_salt_size = MODULE_DEFAULT;
module_ctx->module_hook_size = MODULE_DEFAULT;
module_ctx->module_jit_build_options = MODULE_DEFAULT;
module_ctx->module_jit_cache_disable = MODULE_DEFAULT;
module_ctx->module_kernel_accel_max = MODULE_DEFAULT;
module_ctx->module_kernel_accel_min = MODULE_DEFAULT;
module_ctx->module_kernel_loops_max = MODULE_DEFAULT;
module_ctx->module_kernel_loops_min = MODULE_DEFAULT;
module_ctx->module_kernel_threads_max = MODULE_DEFAULT;
module_ctx->module_kernel_threads_min = MODULE_DEFAULT;
module_ctx->module_kern_type = module_kern_type;
module_ctx->module_kern_type_dynamic = MODULE_DEFAULT;
module_ctx->module_opti_type = module_opti_type;
module_ctx->module_opts_type = module_opts_type;
module_ctx->module_outfile_check_disable = MODULE_DEFAULT;
module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT;
module_ctx->module_potfile_custom_check = MODULE_DEFAULT;
module_ctx->module_potfile_disable = MODULE_DEFAULT;
module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT;
module_ctx->module_pwdump_column = MODULE_DEFAULT;
module_ctx->module_pw_max = module_pw_max;
module_ctx->module_pw_min = MODULE_DEFAULT;
module_ctx->module_salt_max = MODULE_DEFAULT;
module_ctx->module_salt_min = MODULE_DEFAULT;
module_ctx->module_salt_type = module_salt_type;
module_ctx->module_separator = MODULE_DEFAULT;
module_ctx->module_st_hash = module_st_hash;
module_ctx->module_st_pass = module_st_pass;
module_ctx->module_tmp_size = module_tmp_size;
module_ctx->module_unstable_warning = MODULE_DEFAULT;
module_ctx->module_warmup_disable = MODULE_DEFAULT;
}