mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-16 10:37:38 -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:
@ -181,7 +181,7 @@ static void ssh1_bpp_handle_input(BinaryPacketProtocol *bpp)
|
||||
ssh_cipher_decrypt(s->cipher_in, s->data, s->biglen);
|
||||
|
||||
s->realcrc = crc32_ssh1(make_ptrlen(s->data, s->biglen - 4));
|
||||
s->gotcrc = GET_32BIT(s->data + s->biglen - 4);
|
||||
s->gotcrc = GET_32BIT_MSB_FIRST(s->data + s->biglen - 4);
|
||||
if (s->gotcrc != s->realcrc) {
|
||||
ssh_sw_abort(s->bpp.ssh, "Incorrect CRC received on packet");
|
||||
crStopV;
|
||||
@ -332,8 +332,8 @@ static void ssh1_bpp_format_packet(struct ssh1_bpp_state *s, PktOut *pkt)
|
||||
random_read(pkt->data + pktoffs, 4+8 - pktoffs);
|
||||
crc = crc32_ssh1(
|
||||
make_ptrlen(pkt->data + pktoffs + 4, biglen - 4)); /* all ex len */
|
||||
PUT_32BIT(pkt->data + pktoffs + 4 + biglen - 4, crc);
|
||||
PUT_32BIT(pkt->data + pktoffs, len);
|
||||
PUT_32BIT_MSB_FIRST(pkt->data + pktoffs + 4 + biglen - 4, crc);
|
||||
PUT_32BIT_MSB_FIRST(pkt->data + pktoffs, len);
|
||||
|
||||
if (s->cipher_out)
|
||||
ssh_cipher_encrypt(s->cipher_out, pkt->data + pktoffs + 4, biglen);
|
||||
|
Reference in New Issue
Block a user