Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2020-02-29 12:10:47 +0300
committerSimon Tatham <anakin@pobox.com>2020-03-01 23:09:01 +0300
commitece788240c3fed2a77d42a7783907fb8a29640e1 (patch)
tree79b4e03d24528bdcf09a9e48acaecc8a9b08e689 /cmdgen.c
parent08a3547bc54051e455ac450ee536612befcb9a5a (diff)
Introduce a vtable system for prime generation.
The functions primegen() and primegen_add_progress_phase() are gone. In their place is a small vtable system with two methods corresponding to them, plus the usual admin of allocating and freeing contexts. This API change is the starting point for being able to drop in different prime generation algorithms at run time in response to user configuration.
Diffstat (limited to 'cmdgen.c')
-rw-r--r--cmdgen.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmdgen.c b/cmdgen.c
index 6d06c443..d48b3166 100644
--- a/cmdgen.c
+++ b/cmdgen.c
@@ -668,9 +668,12 @@ int main(int argc, char **argv)
smemclr(entropy, bits/8);
sfree(entropy);
+ PrimeGenerationContext *pgc = primegen_new_context(
+ &primegen_probabilistic);
+
if (keytype == DSA) {
struct dss_key *dsskey = snew(struct dss_key);
- dsa_generate(dsskey, bits, &cmdgen_progress);
+ dsa_generate(dsskey, bits, pgc, &cmdgen_progress);
ssh2key = snew(ssh2_userkey);
ssh2key->key = &dsskey->sshk;
ssh1key = NULL;
@@ -688,7 +691,7 @@ int main(int argc, char **argv)
ssh1key = NULL;
} else {
RSAKey *rsakey = snew(RSAKey);
- rsa_generate(rsakey, bits, &cmdgen_progress);
+ rsa_generate(rsakey, bits, pgc, &cmdgen_progress);
rsakey->comment = NULL;
if (keytype == RSA1) {
ssh1key = rsakey;
@@ -698,6 +701,8 @@ int main(int argc, char **argv)
}
}
+ primegen_free_context(pgc);
+
if (ssh2key)
ssh2key->comment = dupstr(default_comment);
if (ssh1key)