mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00:00
Support rsa-sha2-* host keys in Uppity.
As with the userauth keys, there's a localised bodge when sending algorithm names, where I just write a couple of extra entries into the list when I notice that a key is RSA-typed. Then I arrange that the selection of those entries sets the new variable s->hkflags to the right value to pass to ssh_key_sign.
This commit is contained in:
parent
33de96ffa9
commit
e105908661
@ -32,7 +32,7 @@ static strbuf *finalise_and_sign_exhash(struct ssh2_transport_state *s)
|
|||||||
sb = strbuf_new();
|
sb = strbuf_new();
|
||||||
ssh_key_sign(
|
ssh_key_sign(
|
||||||
s->hkey, make_ptrlen(s->exchange_hash, s->kex_alg->hash->hlen),
|
s->hkey, make_ptrlen(s->exchange_hash, s->kex_alg->hash->hlen),
|
||||||
0, BinarySink_UPCAST(sb));
|
s->hkflags, BinarySink_UPCAST(sb));
|
||||||
return sb;
|
return sb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,10 +627,27 @@ static void ssh2_write_kexinit_lists(
|
|||||||
* host keys we actually have.
|
* host keys we actually have.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < our_nhostkeys; i++) {
|
for (i = 0; i < our_nhostkeys; i++) {
|
||||||
|
const ssh_keyalg *keyalg = ssh_key_alg(our_hostkeys[i]);
|
||||||
|
|
||||||
alg = ssh2_kexinit_addalg(kexlists[KEXLIST_HOSTKEY],
|
alg = ssh2_kexinit_addalg(kexlists[KEXLIST_HOSTKEY],
|
||||||
ssh_key_alg(our_hostkeys[i])->ssh_id);
|
keyalg->ssh_id);
|
||||||
alg->u.hk.hostkey = ssh_key_alg(our_hostkeys[i]);
|
alg->u.hk.hostkey = keyalg;
|
||||||
|
alg->u.hk.hkflags = 0;
|
||||||
alg->u.hk.warn = false;
|
alg->u.hk.warn = false;
|
||||||
|
|
||||||
|
if (keyalg == &ssh_rsa) {
|
||||||
|
alg = ssh2_kexinit_addalg(kexlists[KEXLIST_HOSTKEY],
|
||||||
|
"rsa-sha2-256");
|
||||||
|
alg->u.hk.hostkey = keyalg;
|
||||||
|
alg->u.hk.hkflags = SSH_AGENT_RSA_SHA2_256;
|
||||||
|
alg->u.hk.warn = false;
|
||||||
|
|
||||||
|
alg = ssh2_kexinit_addalg(kexlists[KEXLIST_HOSTKEY],
|
||||||
|
"rsa-sha2-512");
|
||||||
|
alg->u.hk.hostkey = keyalg;
|
||||||
|
alg->u.hk.hkflags = SSH_AGENT_RSA_SHA2_512;
|
||||||
|
alg->u.hk.warn = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (first_time) {
|
} else if (first_time) {
|
||||||
/*
|
/*
|
||||||
@ -841,7 +858,7 @@ static bool ssh2_scan_kexinits(
|
|||||||
transport_direction *cs, transport_direction *sc,
|
transport_direction *cs, transport_direction *sc,
|
||||||
bool *warn_kex, bool *warn_hk, bool *warn_cscipher, bool *warn_sccipher,
|
bool *warn_kex, bool *warn_hk, bool *warn_cscipher, bool *warn_sccipher,
|
||||||
Ssh *ssh, bool *ignore_guess_cs_packet, bool *ignore_guess_sc_packet,
|
Ssh *ssh, bool *ignore_guess_cs_packet, bool *ignore_guess_sc_packet,
|
||||||
int *n_server_hostkeys, int server_hostkeys[MAXKEXLIST])
|
int *n_server_hostkeys, int server_hostkeys[MAXKEXLIST], unsigned *hkflags)
|
||||||
{
|
{
|
||||||
BinarySource client[1], server[1];
|
BinarySource client[1], server[1];
|
||||||
int i;
|
int i;
|
||||||
@ -1002,6 +1019,7 @@ static bool ssh2_scan_kexinits(
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
*hostkey_alg = alg->u.hk.hostkey;
|
*hostkey_alg = alg->u.hk.hostkey;
|
||||||
|
*hkflags = alg->u.hk.hkflags;
|
||||||
*warn_hk = alg->u.hk.warn;
|
*warn_hk = alg->u.hk.warn;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1210,7 +1228,8 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
|
|||||||
ptrlen_from_strbuf(s->server_kexinit),
|
ptrlen_from_strbuf(s->server_kexinit),
|
||||||
s->kexlists, &s->kex_alg, &s->hostkey_alg, s->cstrans,
|
s->kexlists, &s->kex_alg, &s->hostkey_alg, s->cstrans,
|
||||||
s->sctrans, &s->warn_kex, &s->warn_hk, &s->warn_cscipher,
|
s->sctrans, &s->warn_kex, &s->warn_hk, &s->warn_cscipher,
|
||||||
&s->warn_sccipher, s->ppl.ssh, NULL, &s->ignorepkt, &nhk, hks))
|
&s->warn_sccipher, s->ppl.ssh, NULL, &s->ignorepkt, &nhk, hks,
|
||||||
|
&s->hkflags))
|
||||||
return; /* false means a fatal error function was called */
|
return; /* false means a fatal error function was called */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -28,6 +28,7 @@ struct kexinit_algorithm {
|
|||||||
} kex;
|
} kex;
|
||||||
struct {
|
struct {
|
||||||
const ssh_keyalg *hostkey;
|
const ssh_keyalg *hostkey;
|
||||||
|
unsigned hkflags;
|
||||||
bool warn;
|
bool warn;
|
||||||
} hk;
|
} hk;
|
||||||
struct {
|
struct {
|
||||||
@ -175,6 +176,7 @@ struct ssh2_transport_state {
|
|||||||
strbuf *hostkeyblob;
|
strbuf *hostkeyblob;
|
||||||
char *keystr, *fingerprint;
|
char *keystr, *fingerprint;
|
||||||
ssh_key *hkey; /* actual host key */
|
ssh_key *hkey; /* actual host key */
|
||||||
|
unsigned hkflags; /* signing flags, used in server */
|
||||||
RSAKey *rsa_kex_key; /* for RSA kex */
|
RSAKey *rsa_kex_key; /* for RSA kex */
|
||||||
bool rsa_kex_key_needs_freeing;
|
bool rsa_kex_key_needs_freeing;
|
||||||
ecdh_key *ecdh_key; /* for ECDH kex */
|
ecdh_key *ecdh_key; /* for ECDH kex */
|
||||||
|
Loading…
Reference in New Issue
Block a user