mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-06 05:52:48 -05:00
Turn SSH-2 MACs into a classoid.
This piece of tidying-up has come out particularly well in terms of saving tedious repetition and boilerplate. I've managed to remove three pointless methods from every MAC implementation by means of writing them once centrally in terms of the implementation-specific methods; another method (hmacmd5_sink) vanished because I was able to make the interface type 'ssh2_mac' be directly usable as a BinarySink by way of a new delegation system; and because all the method implementations can now find their own vtable, I was even able to merge a lot of keying and output functions that had previously differed only in length parameters by having them look up the lengths in whatever vtable they were passed.
This commit is contained in:
10
ssh.c
10
ssh.c
@ -328,10 +328,10 @@ const static struct ssh_signkey_with_user_pref_id hostkey_algs[] = {
|
||||
{ &ssh_rsa, HK_RSA },
|
||||
};
|
||||
|
||||
const static struct ssh_mac *const macs[] = {
|
||||
const static struct ssh2_macalg *const macs[] = {
|
||||
&ssh_hmac_sha256, &ssh_hmac_sha1, &ssh_hmac_sha1_96, &ssh_hmac_md5
|
||||
};
|
||||
const static struct ssh_mac *const buggymacs[] = {
|
||||
const static struct ssh2_macalg *const buggymacs[] = {
|
||||
&ssh_hmac_sha1_buggy, &ssh_hmac_sha1_96_buggy, &ssh_hmac_md5
|
||||
};
|
||||
|
||||
@ -4854,7 +4854,7 @@ struct kexinit_algorithm {
|
||||
int warn;
|
||||
} cipher;
|
||||
struct {
|
||||
const struct ssh_mac *mac;
|
||||
const struct ssh2_macalg *mac;
|
||||
int etm;
|
||||
} mac;
|
||||
const struct ssh_compress *comp;
|
||||
@ -5023,11 +5023,11 @@ static void do_ssh2_transport(void *vctx)
|
||||
void *our_kexinit;
|
||||
int our_kexinitlen;
|
||||
int kex_init_value, kex_reply_value;
|
||||
const struct ssh_mac *const *maclist;
|
||||
const struct ssh2_macalg *const *maclist;
|
||||
int nmacs;
|
||||
struct {
|
||||
const struct ssh2_cipheralg *cipher;
|
||||
const struct ssh_mac *mac;
|
||||
const struct ssh2_macalg *mac;
|
||||
int etm_mode;
|
||||
const struct ssh_compress *comp;
|
||||
} in, out;
|
||||
|
Reference in New Issue
Block a user