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

Use C99 named initialisers in all ssh_kex instances.

No functional change, but this will allow me to add more fields to
that structure without breaking the existing initialisers.
This commit is contained in:
Simon Tatham 2022-04-14 06:38:30 +01:00
parent e103ab1fb6
commit 422a89e208
3 changed files with 72 additions and 32 deletions

View File

@ -40,8 +40,11 @@ static const struct dh_extra extra_group1 = {
}; };
const ssh_kex ssh_diffiehellman_group1_sha1 = { const ssh_kex ssh_diffiehellman_group1_sha1 = {
"diffie-hellman-group1-sha1", "group1", .name = "diffie-hellman-group1-sha1",
KEXTYPE_DH, &ssh_sha1, &extra_group1, .groupname = "group1",
.main_type = KEXTYPE_DH,
.hash = &ssh_sha1,
.extra = &extra_group1,
}; };
static const ssh_kex *const group1_list[] = { static const ssh_kex *const group1_list[] = {
@ -55,13 +58,19 @@ static const struct dh_extra extra_group14 = {
}; };
const ssh_kex ssh_diffiehellman_group14_sha256 = { const ssh_kex ssh_diffiehellman_group14_sha256 = {
"diffie-hellman-group14-sha256", "group14", .name = "diffie-hellman-group14-sha256",
KEXTYPE_DH, &ssh_sha256, &extra_group14, .groupname = "group14",
.main_type = KEXTYPE_DH,
.hash = &ssh_sha256,
.extra = &extra_group14,
}; };
const ssh_kex ssh_diffiehellman_group14_sha1 = { const ssh_kex ssh_diffiehellman_group14_sha1 = {
"diffie-hellman-group14-sha1", "group14", .name = "diffie-hellman-group14-sha1",
KEXTYPE_DH, &ssh_sha1, &extra_group14, .groupname = "group14",
.main_type = KEXTYPE_DH,
.hash = &ssh_sha1,
.extra = &extra_group14,
}; };
static const ssh_kex *const group14_list[] = { static const ssh_kex *const group14_list[] = {
@ -76,13 +85,19 @@ const ssh_kexes ssh_diffiehellman_group14 = {
static const struct dh_extra extra_gex = { true }; static const struct dh_extra extra_gex = { true };
static const ssh_kex ssh_diffiehellman_gex_sha256 = { static const ssh_kex ssh_diffiehellman_gex_sha256 = {
"diffie-hellman-group-exchange-sha256", NULL, .name = "diffie-hellman-group-exchange-sha256",
KEXTYPE_DH, &ssh_sha256, &extra_gex, .groupname = NULL,
.main_type = KEXTYPE_DH,
.hash = &ssh_sha256,
.extra = &extra_gex,
}; };
static const ssh_kex ssh_diffiehellman_gex_sha1 = { static const ssh_kex ssh_diffiehellman_gex_sha1 = {
"diffie-hellman-group-exchange-sha1", NULL, .name = "diffie-hellman-group-exchange-sha1",
KEXTYPE_DH, &ssh_sha1, &extra_gex, .groupname = NULL,
.main_type = KEXTYPE_DH,
.hash = &ssh_sha1,
.extra = &extra_gex,
}; };
static const ssh_kex *const gex_list[] = { static const ssh_kex *const gex_list[] = {
@ -107,18 +122,27 @@ const ssh_kexes ssh_diffiehellman_gex = { lenof(gex_list), gex_list };
#define GSS_KRB5_OID_HASH "toWM5Slw5Ew8Mqkay+al2g==" #define GSS_KRB5_OID_HASH "toWM5Slw5Ew8Mqkay+al2g=="
static const ssh_kex ssh_gssk5_diffiehellman_gex_sha1 = { static const ssh_kex ssh_gssk5_diffiehellman_gex_sha1 = {
"gss-gex-sha1-" GSS_KRB5_OID_HASH, NULL, .name = "gss-gex-sha1-" GSS_KRB5_OID_HASH,
KEXTYPE_GSS, &ssh_sha1, &extra_gex, .groupname = NULL,
.main_type = KEXTYPE_GSS,
.hash = &ssh_sha1,
.extra = &extra_gex,
}; };
static const ssh_kex ssh_gssk5_diffiehellman_group14_sha1 = { static const ssh_kex ssh_gssk5_diffiehellman_group14_sha1 = {
"gss-group14-sha1-" GSS_KRB5_OID_HASH, "group14", .name = "gss-group14-sha1-" GSS_KRB5_OID_HASH,
KEXTYPE_GSS, &ssh_sha1, &extra_group14, .groupname = "group14",
.main_type = KEXTYPE_GSS,
.hash = &ssh_sha1,
.extra = &extra_group14,
}; };
static const ssh_kex ssh_gssk5_diffiehellman_group1_sha1 = { static const ssh_kex ssh_gssk5_diffiehellman_group1_sha1 = {
"gss-group1-sha1-" GSS_KRB5_OID_HASH, "group1", .name = "gss-group1-sha1-" GSS_KRB5_OID_HASH,
KEXTYPE_GSS, &ssh_sha1, &extra_group1, .groupname = "group1",
.main_type = KEXTYPE_GSS,
.hash = &ssh_sha1,
.extra = &extra_group1,
}; };
static const ssh_kex *const gssk5_sha1_kex_list[] = { static const ssh_kex *const gssk5_sha1_kex_list[] = {

View File

@ -1563,13 +1563,17 @@ static const struct eckex_extra kex_extra_curve25519 = {
ssh_ecdhkex_m_getkey, ssh_ecdhkex_m_getkey,
}; };
const ssh_kex ssh_ec_kex_curve25519 = { const ssh_kex ssh_ec_kex_curve25519 = {
"curve25519-sha256", NULL, KEXTYPE_ECDH, .name = "curve25519-sha256",
&ssh_sha256, &kex_extra_curve25519, .main_type = KEXTYPE_ECDH,
.hash = &ssh_sha256,
.extra = &kex_extra_curve25519,
}; };
/* Pre-RFC alias */ /* Pre-RFC alias */
const ssh_kex ssh_ec_kex_curve25519_libssh = { const ssh_kex ssh_ec_kex_curve25519_libssh = {
"curve25519-sha256@libssh.org", NULL, KEXTYPE_ECDH, .name = "curve25519-sha256@libssh.org",
&ssh_sha256, &kex_extra_curve25519, .main_type = KEXTYPE_ECDH,
.hash = &ssh_sha256,
.extra = &kex_extra_curve25519,
}; };
static const struct eckex_extra kex_extra_curve448 = { static const struct eckex_extra kex_extra_curve448 = {
@ -1580,8 +1584,10 @@ static const struct eckex_extra kex_extra_curve448 = {
ssh_ecdhkex_m_getkey, ssh_ecdhkex_m_getkey,
}; };
const ssh_kex ssh_ec_kex_curve448 = { const ssh_kex ssh_ec_kex_curve448 = {
"curve448-sha512", NULL, KEXTYPE_ECDH, .name = "curve448-sha512",
&ssh_sha512, &kex_extra_curve448, .main_type = KEXTYPE_ECDH,
.hash = &ssh_sha512,
.extra = &kex_extra_curve448,
}; };
static const struct eckex_extra kex_extra_nistp256 = { static const struct eckex_extra kex_extra_nistp256 = {
@ -1592,8 +1598,10 @@ static const struct eckex_extra kex_extra_nistp256 = {
ssh_ecdhkex_w_getkey, ssh_ecdhkex_w_getkey,
}; };
const ssh_kex ssh_ec_kex_nistp256 = { const ssh_kex ssh_ec_kex_nistp256 = {
"ecdh-sha2-nistp256", NULL, KEXTYPE_ECDH, .name = "ecdh-sha2-nistp256",
&ssh_sha256, &kex_extra_nistp256, .main_type = KEXTYPE_ECDH,
.hash = &ssh_sha256,
.extra = &kex_extra_nistp256,
}; };
static const struct eckex_extra kex_extra_nistp384 = { static const struct eckex_extra kex_extra_nistp384 = {
@ -1604,8 +1612,10 @@ static const struct eckex_extra kex_extra_nistp384 = {
ssh_ecdhkex_w_getkey, ssh_ecdhkex_w_getkey,
}; };
const ssh_kex ssh_ec_kex_nistp384 = { const ssh_kex ssh_ec_kex_nistp384 = {
"ecdh-sha2-nistp384", NULL, KEXTYPE_ECDH, .name = "ecdh-sha2-nistp384",
&ssh_sha384, &kex_extra_nistp384, .main_type = KEXTYPE_ECDH,
.hash = &ssh_sha384,
.extra = &kex_extra_nistp384,
}; };
static const struct eckex_extra kex_extra_nistp521 = { static const struct eckex_extra kex_extra_nistp521 = {
@ -1616,8 +1626,10 @@ static const struct eckex_extra kex_extra_nistp521 = {
ssh_ecdhkex_w_getkey, ssh_ecdhkex_w_getkey,
}; };
const ssh_kex ssh_ec_kex_nistp521 = { const ssh_kex ssh_ec_kex_nistp521 = {
"ecdh-sha2-nistp521", NULL, KEXTYPE_ECDH, .name = "ecdh-sha2-nistp521",
&ssh_sha512, &kex_extra_nistp521, .main_type = KEXTYPE_ECDH,
.hash = &ssh_sha512,
.extra = &kex_extra_nistp521,
}; };
static const ssh_kex *const ec_kex_list[] = { static const ssh_kex *const ec_kex_list[] = {

View File

@ -1092,13 +1092,17 @@ static const struct ssh_rsa_kex_extra ssh_rsa_kex_extra_sha1 = { 1024 };
static const struct ssh_rsa_kex_extra ssh_rsa_kex_extra_sha256 = { 2048 }; static const struct ssh_rsa_kex_extra ssh_rsa_kex_extra_sha256 = { 2048 };
static const ssh_kex ssh_rsa_kex_sha1 = { static const ssh_kex ssh_rsa_kex_sha1 = {
"rsa1024-sha1", NULL, KEXTYPE_RSA, .name = "rsa1024-sha1",
&ssh_sha1, &ssh_rsa_kex_extra_sha1, .main_type = KEXTYPE_RSA,
.hash = &ssh_sha1,
.extra = &ssh_rsa_kex_extra_sha1,
}; };
static const ssh_kex ssh_rsa_kex_sha256 = { static const ssh_kex ssh_rsa_kex_sha256 = {
"rsa2048-sha256", NULL, KEXTYPE_RSA, .name = "rsa2048-sha256",
&ssh_sha256, &ssh_rsa_kex_extra_sha256, .main_type = KEXTYPE_RSA,
.hash = &ssh_sha256,
.extra = &ssh_rsa_kex_extra_sha256,
}; };
static const ssh_kex *const rsa_kex_list[] = { static const ssh_kex *const rsa_kex_list[] = {