1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-08 08:58:00 +00:00

Centralise 'no random numbers' stubs into norand.c.

This is a small cleanup that removes a couple of copies of some boring
stubs, in favour of having just one copy that you can link against.

Unix Pageant can't currently use this, because it's in a precarious
state of _nearly_ having a random number generator: it links against
sshprng but not sshrand, and only uses it for the randomised keypress
acknowledgments in the GUI askpass prompt. But that means it does use
uxnoise, unlike the truly randomness-free tools.
This commit is contained in:
Simon Tatham 2020-02-07 19:17:19 +00:00
parent 231e482fd2
commit 06531c3b61
4 changed files with 25 additions and 33 deletions

6
Recipe
View File

@ -312,15 +312,15 @@ LIBS = advapi32.lib user32.lib gdi32.lib comdlg32.lib
# Network backend sets. This also brings in the relevant attachment
# to proxy.c depending on whether we're crypto-avoidant or not.
BE_ALL = be_all cproxy
BE_NOSSH = be_nossh nocproxy
BE_NOSSH = be_nossh norand nocproxy
BE_SSH = be_ssh cproxy
BE_NONE = be_none nocproxy
# More backend sets, with the additional Windows serial-port module.
W_BE_ALL = be_all_s winser cproxy
W_BE_NOSSH = be_nos_s winser nocproxy
W_BE_NOSSH = be_nos_s norand winser nocproxy
# And with the Unix serial-port module.
U_BE_ALL = be_all_s uxser cproxy
U_BE_NOSSH = be_nos_s uxser nocproxy
U_BE_NOSSH = be_nos_s norand uxser nocproxy
# Auxiliary crypto modules used by key generators.
KEYGEN = sshrsag sshdssg sshecdsag

View File

@ -17,18 +17,3 @@ const struct BackendVtable *const backends[] = {
&serial_backend,
NULL
};
/*
* Stub implementations of functions not used in non-ssh versions.
*/
void random_save_seed(void)
{
}
void random_destroy_seed(void)
{
}
void noise_ultralight(NoiseSourceId id, unsigned long data)
{
}

View File

@ -16,18 +16,3 @@ const struct BackendVtable *const backends[] = {
&raw_backend,
NULL
};
/*
* Stub implementations of functions not used in non-ssh versions.
*/
void random_save_seed(void)
{
}
void random_destroy_seed(void)
{
}
void noise_ultralight(NoiseSourceId id, unsigned long data)
{
}

22
norand.c Normal file
View File

@ -0,0 +1,22 @@
/*
* Stub implementations of RNG functions for applications without an RNG.
*/
#include "putty.h"
void random_read(void *out, size_t size)
{
unreachable("Random numbers are not available in this application");
}
void random_save_seed(void)
{
}
void random_destroy_seed(void)
{
}
void noise_ultralight(NoiseSourceId id, unsigned long data)
{
}