1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 11:32:48 -05:00

Expose key generation functions in testcrypt.

They're not much use for 'real' key generation, since like all the
other randomness-using testcrypt functions, they need you to have
explicitly queued up some random data. But for generating keys for
test purposes, they have the great virtue that they deliver the key in
the internal format, where we can generate all the various public and
private blobs from it as well as the on-disk formats.

A minor change to one of the keygen functions itself: rsa_generate now
fills in the 'bits' and 'bytes' fields of the returned RSAKey, without
which it didn't actually work to try to generate a public blob from
it. (We'd never noticed before, because no previous client of
rsa_generate even tried that.)
This commit is contained in:
Simon Tatham
2020-01-09 07:21:30 +00:00
parent 13e988b6ee
commit 8a87f4509c
4 changed files with 66 additions and 7 deletions

View File

@ -228,6 +228,16 @@ FUNC1(void, prng_seed_finish, val_prng)
FUNC2(val_string, prng_read, val_prng, uint)
FUNC3(void, prng_add_entropy, val_prng, uint, val_string_ptrlen)
/*
* Key generation functions.
*/
FUNC1(val_key, rsa_generate, uint)
FUNC1(val_key, dsa_generate, uint)
FUNC1(opt_val_key, ecdsa_generate, uint)
FUNC1(opt_val_key, eddsa_generate, uint)
FUNC1(val_rsa, rsa1_generate, uint)
FUNC5(val_mpint, primegen, uint, uint, uint, val_mpint, uint)
/*
* Miscellaneous.
*/
@ -245,7 +255,6 @@ FUNC1(uint, crc32_rfc1662, val_string_ptrlen)
FUNC1(uint, crc32_ssh1, val_string_ptrlen)
FUNC2(uint, crc32_update, uint, val_string_ptrlen)
FUNC2(boolean, crcda_detect, val_string_ptrlen, val_string_ptrlen)
FUNC5(val_mpint, primegen, uint, uint, uint, val_mpint, uint)
/*
* These functions aren't part of PuTTY's own API, but are additions