Skip to content

Commit 704b3f7

Browse files
committed
KWallet format: Report tunable costs
1 parent d3cf2fa commit 704b3f7

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/kwallet_fmt_plug.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ static void *get_salt(char *ciphertext)
193193
// KWallet 4.13, from that point we use it to upgrade the hash
194194
// to PBKDF2_SHA512
195195
salt->kwallet_minor_version = 0;
196+
salt->iterations = 2000;
196197
}
197198

198199
MEM_FREE(keeptr);
@@ -427,6 +428,18 @@ static char *get_key(int index)
427428
return saved_key[index];
428429
}
429430

431+
static unsigned int tunable_cost_version(void *_salt)
432+
{
433+
struct custom_salt *salt = (struct custom_salt *)_salt;
434+
return salt->kwallet_minor_version;
435+
}
436+
437+
static unsigned int tunable_cost_iterations(void *_salt)
438+
{
439+
struct custom_salt *salt = (struct custom_salt *)_salt;
440+
return salt->iterations;
441+
}
442+
430443
struct fmt_main fmt_kwallet = {
431444
{
432445
FORMAT_LABEL,
@@ -443,7 +456,7 @@ struct fmt_main fmt_kwallet = {
443456
MIN_KEYS_PER_CRYPT,
444457
MAX_KEYS_PER_CRYPT,
445458
FMT_CASE | FMT_8_BIT | FMT_OMP | FMT_HUGE_INPUT,
446-
{ NULL },
459+
{"version", "iterations"},
447460
{ FORMAT_TAG },
448461
kwallet_tests
449462
}, {
@@ -455,7 +468,7 @@ struct fmt_main fmt_kwallet = {
455468
fmt_default_split,
456469
fmt_default_binary,
457470
get_salt,
458-
{ NULL },
471+
{tunable_cost_version, tunable_cost_iterations},
459472
fmt_default_source,
460473
{
461474
fmt_default_binary_hash

0 commit comments

Comments
 (0)