From 606cf4c22b52250bfde03eb61f19520ffd8bb782 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 2 Jan 2019 08:54:07 +0000 Subject: [PATCH] Fix pasto in ssh2_mac_setkey, and start using it. The macro wrapper for the MAC setkey function expanded to completely the wrong vtable method due to a cut and paste error. And I never noticed, because what _should_ have been its two call sites in ssh2bpp.c were directly calling the _right_ vtable method instead. --- ssh.h | 2 +- ssh2bpp.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ssh.h b/ssh.h index 47feb92f..b76ecefc 100644 --- a/ssh.h +++ b/ssh.h @@ -726,7 +726,7 @@ struct ssh2_macalg { #define ssh2_mac_new(alg, cipher) ((alg)->new(alg, cipher)) #define ssh2_mac_free(ctx) ((ctx)->vt->free(ctx)) -#define ssh2_mac_setkey(ctx, key) ((ctx)->vt->free(ctx, key)) +#define ssh2_mac_setkey(ctx, key) ((ctx)->vt->setkey(ctx, key)) #define ssh2_mac_start(ctx) ((ctx)->vt->start(ctx)) #define ssh2_mac_genresult(ctx, out) ((ctx)->vt->genresult(ctx, out)) #define ssh2_mac_alg(ctx) ((ctx)->vt) diff --git a/ssh2bpp.c b/ssh2bpp.c index 67d8306f..2e73b56e 100644 --- a/ssh2bpp.c +++ b/ssh2bpp.c @@ -122,7 +122,7 @@ void ssh2_bpp_new_outgoing_crypto( s->out.etm_mode = etm_mode; if (mac) { s->out.mac = ssh2_mac_new(mac, s->out.cipher); - mac->setkey(s->out.mac, mac_key); + ssh2_mac_setkey(s->out.mac, mac_key); bpp_logevent("Initialised %s outbound MAC algorithm%s%s", ssh2_mac_alg(s->out.mac)->text_name, @@ -184,7 +184,7 @@ void ssh2_bpp_new_incoming_crypto( s->in.etm_mode = etm_mode; if (mac) { s->in.mac = ssh2_mac_new(mac, s->in.cipher); - mac->setkey(s->in.mac, mac_key); + ssh2_mac_setkey(s->in.mac, mac_key); bpp_logevent("Initialised %s inbound MAC algorithm%s%s", ssh2_mac_alg(s->in.mac)->text_name,