mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-12 08:43:53 -05:00
ssh_keyalg: new method 'alternate_ssh_id'.
Previously, the fact that "ssh-rsa" sometimes comes with two subtypes "rsa-sha2-256" and "rsa-sha2-512" was known to three different parts of the code - two in userauth and one in transport. Now the knowledge of what those ids are, which one goes with which signing flags, and which key types have subtypes at all, is centralised into a method of the key algorithm, and all those locations just query it. This will enable the introduction of further key algorithms that have a parallel upgrade system.
This commit is contained in:
5
ssh.h
5
ssh.h
@ -835,6 +835,7 @@ struct ssh_keyalg {
|
||||
/* 'Class methods' that don't deal with an ssh_key at all */
|
||||
int (*pubkey_bits) (const ssh_keyalg *self, ptrlen blob);
|
||||
unsigned (*supported_flags) (const ssh_keyalg *self);
|
||||
const char *(*alternate_ssh_id) (const ssh_keyalg *self, unsigned flags);
|
||||
|
||||
/* Constant data fields giving information about the key type */
|
||||
const char *ssh_id; /* string identifier in the SSH protocol */
|
||||
@ -881,9 +882,13 @@ static inline const unsigned ssh_key_supported_flags(ssh_key *key)
|
||||
{ return key->vt->supported_flags(key->vt); }
|
||||
static inline const unsigned ssh_keyalg_supported_flags(const ssh_keyalg *self)
|
||||
{ return self->supported_flags(self); }
|
||||
static inline const char *ssh_keyalg_alternate_ssh_id(
|
||||
const ssh_keyalg *self, unsigned flags)
|
||||
{ return self->alternate_ssh_id(self, flags); }
|
||||
|
||||
/* Stub functions shared between multiple key types */
|
||||
unsigned nullkey_supported_flags(const ssh_keyalg *self);
|
||||
const char *nullkey_alternate_ssh_id(const ssh_keyalg *self, unsigned flags);
|
||||
|
||||
/*
|
||||
* SSH2 ECDH key exchange vtable
|
||||
|
Reference in New Issue
Block a user