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

Use the new 'HYBRID' names for the hybrid KEX packets.

draft-kampanakis-curdle-ssh-pq-ke defines the packet names
SSH_MSG_KEX_HYBRID_INIT and SSH_MSG_KEX_HYBRID_REPLY. They have the
same numbers as ECDH_INIT and ECDH_REPLY, and don't change anything
else, so this is just a naming change. But I think it's a good one,
because the post-quantum KEMs are less symmetric than ECDH (they're
much more like Ben's RSA kex in concept, though very different in
detail), and shouldn't try to pretend they're the same kind of thing.
Also this enables logparse.pl to give a warning about the fact that
one string in each packet contains two separate keys glomphed together.

For the latter reason (and also because it's easier in my code
structure) I've also switched to using the HYBRID naming for the
existing NTRU + Curve25519 hybrid method, even though the
Internet-Draft for that one still uses the ECDH names. Sorry, but I
think it's clearer!
This commit is contained in:
Simon Tatham
2024-12-08 10:34:10 +00:00
parent e98615f0ba
commit a3f22a2cf9
5 changed files with 55 additions and 1 deletions

View File

@ -172,6 +172,16 @@ my %packets = (
my ($direction, $seq, $data) = @_;
print "\n";
},
#define SSH2_MSG_KEX_HYBRID_INIT 30 /* 0x1e */
'SSH2_MSG_KEX_HYBRID_INIT' => sub {
my ($direction, $seq, $data) = @_;
print "\n";
},
#define SSH2_MSG_KEX_HYBRID_REPLY 31 /* 0x1f */
'SSH2_MSG_KEX_HYBRID_REPLY' => sub {
my ($direction, $seq, $data) = @_;
print "\n";
},
#define SSH2_MSG_USERAUTH_REQUEST 50 /* 0x32 */
'SSH2_MSG_USERAUTH_REQUEST' => sub {
my ($direction, $seq, $data) = @_;
@ -657,6 +667,16 @@ my %verbose_packet_dump_functions = (
# curve is. So the best we can do is just dump the raw data.
printf " client public value: %s\n", (unpack "H*", $cpv);
},
'SSH2_MSG_KEX_HYBRID_INIT' => sub {
my ($data) = @_;
my ($cpv) = &parse("s", $data);
# Hybrid post-quantum + classical KEX is even more confusing,
# since two separate pieces of data are glomphed together into
# this string without any obvious dividing line. The best we
# can sensibly do is to announce that in the log.
printf " client PQ encryption key + public ECDH value: %s\n",
(unpack "H*", $cpv);
},
'SSH2_MSG_KEXDH_REPLY' => sub {
my ($data) = @_;
my ($hostkeyblob, $f, $sigblob) = &parse("sms", $data);
@ -708,6 +728,26 @@ my %verbose_packet_dump_functions = (
printf " $key: $value\n";
}
},
'SSH2_MSG_KEX_HYBRID_REPLY' => sub {
my ($data) = @_;
my ($hostkeyblob, $spv, $sigblob) = &parse("sss", $data);
my ($hktype, @hostkey) = &parse_public_key($hostkeyblob);
printf " host key: %s\n", $hktype;
while (@hostkey) {
my ($key, $value) = splice @hostkey, 0, 2;
printf " $key: $value\n";
}
# Similarly to HYBRID_INIT, warn the reader that this string
# contains two separate things glomphed together
printf " server PQ KEM ciphertext + public ECDH value: %s\n",
(unpack "H*", $spv);
printf " signature:\n";
my @signature = &parse_signature($sigblob, $hktype);
while (@signature) {
my ($key, $value) = splice @signature, 0, 2;
printf " $key: $value\n";
}
},
'SSH2_MSG_NEWKEYS' => sub {},
'SSH2_MSG_SERVICE_REQUEST' => sub {
my ($data) = @_;