From: ben Date: Wed, 20 Feb 2013 22:37:34 +0000 (+0000) Subject: Take advantage of PUT_32BIT_MSB_FIRST when constructing sequence numbers X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/commitdiff_plain/bb4a3bb6f043641c4696b2df364380a01cc82bef Take advantage of PUT_32BIT_MSB_FIRST when constructing sequence numbers to MAC. git-svn-id: svn://svn.tartarus.org/sgt/putty@9758 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/sshmd5.c b/sshmd5.c index e5187a66..2fdb5900 100644 --- a/sshmd5.c +++ b/sshmd5.c @@ -312,11 +312,7 @@ static void hmacmd5_do_hmac_ssh(void *handle, unsigned char const *blk, int len, { unsigned char seqbuf[16]; - seqbuf[0] = (unsigned char) ((seq >> 24) & 0xFF); - seqbuf[1] = (unsigned char) ((seq >> 16) & 0xFF); - seqbuf[2] = (unsigned char) ((seq >> 8) & 0xFF); - seqbuf[3] = (unsigned char) ((seq) & 0xFF); - + PUT_32BIT_MSB_FIRST(seqbuf, seq); hmacmd5_do_hmac_internal(handle, seqbuf, 4, blk, len, hmac); } diff --git a/sshsha.c b/sshsha.c index 30113511..b2493f2f 100644 --- a/sshsha.c +++ b/sshsha.c @@ -297,11 +297,7 @@ static void sha1_do_hmac(void *handle, unsigned char *blk, int len, { unsigned char seqbuf[4]; - seqbuf[0] = (unsigned char) ((seq >> 24) & 0xFF); - seqbuf[1] = (unsigned char) ((seq >> 16) & 0xFF); - seqbuf[2] = (unsigned char) ((seq >> 8) & 0xFF); - seqbuf[3] = (unsigned char) ((seq) & 0xFF); - + PUT_32BIT_MSB_FIRST(seqbuf, seq); hmacsha1_start(handle); hmacsha1_bytes(handle, seqbuf, 4); hmacsha1_bytes(handle, blk, len);