Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/ssh.h
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2022-04-19 19:05:36 +0300
committerSimon Tatham <anakin@pobox.com>2022-04-24 10:39:04 +0300
commitf9775a7b676c8878239eafe8c88cc6b9240eda86 (patch)
treed05fe334a55a404202870aa06f16c67cf1b23229 /ssh.h
parent6143a50ed228fdf5a72c2970629b4ff643d001fc (diff)
Make ssh_keyalg's supported_flags a method.
It's a class method rather than an object method, so it doesn't allow keys with the same algorithm to make different choices about what flags they support. But that's not what I wanted it for: the real purpose is to allow one key algorithm to delegate supported_flags to another, by having its method implementation call the one from the delegate class. (If only C's compile/link model permitted me to initialise a field of one global const struct variable to be a copy of that of another, I wouldn't need the runtime overhead of this method! But object file formats don't let you even specify that.) Most key algorithms support no flags at all, so they all want to use the same implementation of this method. So I've started a file of stubs utils/nullkey.c to contain the common stub version.
Diffstat (limited to 'ssh.h')
-rw-r--r--ssh.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/ssh.h b/ssh.h
index 6d808cc1..68a91256 100644
--- a/ssh.h
+++ b/ssh.h
@@ -834,12 +834,12 @@ 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);
/* Constant data fields giving information about the key type */
const char *ssh_id; /* string identifier in the SSH protocol */
const char *cache_id; /* identifier used in PuTTY's host key cache */
const void *extra; /* private to the public key methods */
- const unsigned supported_flags; /* signature-type flags we understand */
};
static inline ssh_key *ssh_key_new_pub(const ssh_keyalg *self, ptrlen pub)
@@ -877,6 +877,13 @@ static inline const char *ssh_key_ssh_id(ssh_key *key)
{ return key->vt->ssh_id; }
static inline const char *ssh_key_cache_id(ssh_key *key)
{ return key->vt->cache_id; }
+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); }
+
+/* Stub functions shared between multiple key types */
+unsigned nullkey_supported_flags(const ssh_keyalg *self);
/*
* SSH2 ECDH key exchange vtable