mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-22 13:31:32 -05:00
Remove dependency of sshrand.c on SHA-512.
Rather like some of the tricks I did in mpint.h, this replaces the unparametrised function random_setup_special() with one called random_setup_custom() taking a hash-algorithm parameter. The old syntax random_setup_special() still exists, and is a macro wrapper on random_setup_custom() that passes ssh_sha512 as an argument. This means I can keep the choice of hash function consistent between the key generation front ends. This adds potential flexibility: now, anyone wanting a different kind of special RNG can make it out of whatever primitive they like. But a more immediate point is to remove an inter-module dependency: sshrand.c now doesn't need to be linked against the SHA-512 code.
This commit is contained in:
@ -19,7 +19,7 @@ int random_active = 0;
|
||||
*/
|
||||
void random_add_noise(NoiseSourceId source, const void *noise, int length) { }
|
||||
void random_ref(void) { }
|
||||
void random_setup_special(void) { }
|
||||
void random_setup_custom(const ssh_hashalg *hash) { }
|
||||
void random_unref(void) { }
|
||||
void random_read(void *out, size_t size)
|
||||
{
|
||||
@ -97,10 +97,10 @@ void random_ref(void)
|
||||
random_create(&ssh_sha256);
|
||||
}
|
||||
|
||||
void random_setup_special()
|
||||
void random_setup_custom(const ssh_hashalg *hash)
|
||||
{
|
||||
random_active++;
|
||||
random_create(&ssh_sha512);
|
||||
random_create(hash);
|
||||
}
|
||||
|
||||
void random_reseed(ptrlen seed)
|
||||
|
Reference in New Issue
Block a user