1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Stop using unqualified {GET,PUT}_32BIT.

Those were a reasonable abbreviation when the code almost never had to
deal with little-endian numbers, but they've crept into enough places
now (e.g. the ECC formatting) that I think I'd now prefer that every
use of the integer read/write macros was clearly marked with its
endianness.

So all uses of GET_??BIT and PUT_??BIT are now qualified. The special
versions in x11fwd.c, which used variable endianness because so does
the X11 protocol, are suffixed _X11 to make that clear, and where that
pushed line lengths over 80 characters I've taken the opportunity to
name a local variable to remind me of what that extra parameter
actually does.
This commit is contained in:
Simon Tatham
2019-02-04 07:39:03 +00:00
parent 5538091f0d
commit acc21c4c0f
17 changed files with 56 additions and 58 deletions

View File

@ -2273,8 +2273,8 @@ static bool sshcom_write(
for (i = 0; i < nnumbers; i++)
put_mp_sshcom_from_string(outblob, numbers[i].ptr, numbers[i].len);
/* Now wrap up the encrypted payload. */
PUT_32BIT(outblob->s + lenpos + 4,
outblob->len - (lenpos + 8));
PUT_32BIT_MSB_FIRST(outblob->s + lenpos + 4,
outblob->len - (lenpos + 8));
/* Pad encrypted blob to a multiple of cipher block size. */
if (passphrase) {
int padding = -(outblob->len - (lenpos+4)) & 7;
@ -2286,9 +2286,9 @@ static bool sshcom_write(
cipherlen = outblob->len - (lenpos + 4);
assert(!passphrase || cipherlen % 8 == 0);
/* Wrap up the encrypted blob string. */
PUT_32BIT(outblob->s + lenpos, cipherlen);
PUT_32BIT_MSB_FIRST(outblob->s + lenpos, cipherlen);
/* And finally fill in the total length field. */
PUT_32BIT(outblob->s + 4, outblob->len);
PUT_32BIT_MSB_FIRST(outblob->s + 4, outblob->len);
/*
* Encrypt the key.