mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Pass diffiehellman ssh_kex objects to testcrypt.
This slightly simplifies the lookup function get_dh_group(), but mostly, the point is to make it more similar to the other lookup functions, because I'm planning to have those autogenerated.
This commit is contained in:
parent
42120dd1c5
commit
a434b13050
@ -39,7 +39,7 @@ static const struct dh_extra extra_group1 = {
|
||||
false, dh_group1_construct,
|
||||
};
|
||||
|
||||
static const ssh_kex ssh_diffiehellman_group1_sha1 = {
|
||||
const ssh_kex ssh_diffiehellman_group1_sha1 = {
|
||||
"diffie-hellman-group1-sha1", "group1",
|
||||
KEXTYPE_DH, &ssh_sha1, &extra_group1,
|
||||
};
|
||||
@ -54,12 +54,12 @@ static const struct dh_extra extra_group14 = {
|
||||
false, dh_group14_construct,
|
||||
};
|
||||
|
||||
static const ssh_kex ssh_diffiehellman_group14_sha256 = {
|
||||
const ssh_kex ssh_diffiehellman_group14_sha256 = {
|
||||
"diffie-hellman-group14-sha256", "group14",
|
||||
KEXTYPE_DH, &ssh_sha256, &extra_group14,
|
||||
};
|
||||
|
||||
static const ssh_kex ssh_diffiehellman_group14_sha1 = {
|
||||
const ssh_kex ssh_diffiehellman_group14_sha1 = {
|
||||
"diffie-hellman-group14-sha1", "group14",
|
||||
KEXTYPE_DH, &ssh_sha1, &extra_group14,
|
||||
};
|
||||
|
3
ssh.h
3
ssh.h
@ -1023,6 +1023,9 @@ extern const ssh_hashalg ssh_blake2b;
|
||||
extern const ssh_kexes ssh_diffiehellman_group1;
|
||||
extern const ssh_kexes ssh_diffiehellman_group14;
|
||||
extern const ssh_kexes ssh_diffiehellman_gex;
|
||||
extern const ssh_kex ssh_diffiehellman_group1_sha1;
|
||||
extern const ssh_kex ssh_diffiehellman_group14_sha256;
|
||||
extern const ssh_kex ssh_diffiehellman_group14_sha1;
|
||||
extern const ssh_kexes ssh_gssk5_sha1_kex;
|
||||
extern const ssh_kexes ssh_rsa_kex;
|
||||
extern const ssh_kex ssh_ec_kex_curve25519;
|
||||
|
@ -347,16 +347,16 @@ static const ssh_kex *get_dh_group(BinarySource *in)
|
||||
{
|
||||
static const struct {
|
||||
const char *key;
|
||||
const ssh_kexes *value;
|
||||
const ssh_kex *value;
|
||||
} algs[] = {
|
||||
{"group1", &ssh_diffiehellman_group1},
|
||||
{"group14", &ssh_diffiehellman_group14},
|
||||
{"group1", &ssh_diffiehellman_group1_sha1},
|
||||
{"group14", &ssh_diffiehellman_group14_sha256},
|
||||
};
|
||||
|
||||
ptrlen name = get_word(in);
|
||||
for (size_t i = 0; i < lenof(algs); i++)
|
||||
if (ptrlen_eq_string(name, algs[i].key))
|
||||
return algs[i].value->list[0];
|
||||
return algs[i].value;
|
||||
|
||||
fatal_error("dh_group '%.*s': not found", PTRLEN_PRINTF(name));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user