mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
Fix determinism failures in cgtest.
Thanks to Pavel and his CI for pointing out what I'd forgotten: the automated test of cmdgen.c expects that round-tripping a PPK file to some other format and back will regenerate the identical file. Of course, with a randomised salt in the new-look password hash, that isn't true any more in normal usage. Fixed by adding an option in the existing parameters structure to provide a salt override. That shouldn't be used anywhere except cgtest, but in cgtest, it restores the determinism we need. Another potential (but not guaranteed) source of difference is the automatic time-scaling of the Argon2 parameter choice. So I've turned that off too, while I'm at it.
This commit is contained in:
17
cgtest.c
17
cgtest.c
@ -24,6 +24,7 @@
|
||||
#define get_random_data get_random_data_diagnostic
|
||||
#define console_get_userpass_input console_get_userpass_input_diagnostic
|
||||
#define main cmdgen_main
|
||||
#define ppk_save_default_parameters ppk_save_cgtest_parameters
|
||||
|
||||
#include "cmdgen.c"
|
||||
|
||||
@ -33,6 +34,22 @@
|
||||
|
||||
static bool cgtest_verbose = false;
|
||||
|
||||
const struct ppk_save_parameters ppk_save_cgtest_parameters = {
|
||||
/* Replacement set of key derivation parameters that make this
|
||||
* test suite run a bit faster and also add determinism: we don't
|
||||
* try to auto-scale the number of passes (in case it gets
|
||||
* different answers twice in the test suite when we were
|
||||
* expecting two key files to compare equal), and we specify a
|
||||
* passphrase salt. */
|
||||
.argon2_flavour = Argon2id,
|
||||
.argon2_mem = 16,
|
||||
.argon2_passes_auto = false,
|
||||
.argon2_passes = 2,
|
||||
.argon2_parallelism = 1,
|
||||
.salt = (const uint8_t *)"SameSaltEachTime",
|
||||
.saltlen = 16,
|
||||
};
|
||||
|
||||
/*
|
||||
* Define the special versions of get_random_data and
|
||||
* console_get_userpass_input that we need for this test rig.
|
||||
|
Reference in New Issue
Block a user