mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-12 08:43:53 -05:00
Provide an 'extra' pointer in ssh_signkey and ssh_kex.
This gives families of public key and kex functions (by which I mean those sharing a set of methods) a place to store parameters that allow the methods to vary depending on which exact algorithm is in use. The ssh_kex structure already had a set of parameters specific to Diffie-Hellman key exchange; I've moved those into sshdh.c and made them part of the 'extra' structure for that family only, so that unrelated kex methods don't have to faff about saying NULL,NULL,0,0. (This required me to write an extra accessor function for ssh.c to ask whether a DH method was group-exchange style or fixed-group style, but that doesn't seem too silly.)
This commit is contained in:
6
ssh.h
6
ssh.h
@ -344,10 +344,8 @@ struct ssh_hash {
|
||||
struct ssh_kex {
|
||||
char *name, *groupname;
|
||||
enum { KEXTYPE_DH, KEXTYPE_RSA, KEXTYPE_ECDH } main_type;
|
||||
/* For DH */
|
||||
const unsigned char *pdata, *gdata; /* NULL means group exchange */
|
||||
int plen, glen;
|
||||
const struct ssh_hash *hash;
|
||||
const void *extra; /* private to the kex methods */
|
||||
};
|
||||
|
||||
struct ssh_kexes {
|
||||
@ -385,6 +383,7 @@ struct ssh_signkey {
|
||||
int *siglen);
|
||||
const char *name;
|
||||
const char *keytype; /* for host key cache */
|
||||
const void *extra; /* private to the public key methods */
|
||||
};
|
||||
|
||||
struct ssh_compress {
|
||||
@ -639,6 +638,7 @@ Bignum bignum_from_decimal(const char *decimal);
|
||||
void diagbn(char *prefix, Bignum md);
|
||||
#endif
|
||||
|
||||
int dh_is_gex(const struct ssh_kex *kex);
|
||||
void *dh_setup_group(const struct ssh_kex *kex);
|
||||
void *dh_setup_gex(Bignum pval, Bignum gval);
|
||||
void dh_cleanup(void *);
|
||||
|
Reference in New Issue
Block a user