summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2006-03-31 23:13:02 +1100
committerDamien Miller <djm@mindrot.org>2006-03-31 23:13:02 +1100
commit3f9418893e1254bda3b87e7d3af7029d11b0a6c7 (patch)
tree97662277f300ea1ab8255905b9d5d72a26f7578f /packet.c
parentd79b424e8ad424a44119f327e5ab1f79cd35649c (diff)
- djm@cvs.openbsd.org 2006/03/30 09:58:16
[authfd.c bufaux.c deattack.c gss-serv.c mac.c misc.c misc.h] [monitor_wrap.c msg.c packet.c sftp-client.c sftp-server.c ssh-agent.c] replace {GET,PUT}_XXBIT macros with functionally similar functions, silencing a heap of lint warnings. also allows them to use __bounded__ checking which can't be applied to macros; requested by and feedback from deraadt@
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/packet.c b/packet.c
index 5eb2c1c9e..ea0a82e21 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.130 2006/03/25 18:56:55 deraadt Exp $ */ 1/* $OpenBSD: packet.c,v 1.131 2006/03/30 09:58:16 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -48,7 +48,6 @@
48#include "packet.h" 48#include "packet.h"
49#include "bufaux.h" 49#include "bufaux.h"
50#include "crc32.h" 50#include "crc32.h"
51#include "getput.h"
52 51
53#include "compress.h" 52#include "compress.h"
54#include "deattack.h" 53#include "deattack.h"
@@ -559,7 +558,7 @@ packet_send1(void)
559 /* Add check bytes. */ 558 /* Add check bytes. */
560 checksum = ssh_crc32(buffer_ptr(&outgoing_packet), 559 checksum = ssh_crc32(buffer_ptr(&outgoing_packet),
561 buffer_len(&outgoing_packet)); 560 buffer_len(&outgoing_packet));
562 PUT_32BIT(buf, checksum); 561 put_u32(buf, checksum);
563 buffer_append(&outgoing_packet, buf, 4); 562 buffer_append(&outgoing_packet, buf, 4);
564 563
565#ifdef PACKET_DEBUG 564#ifdef PACKET_DEBUG
@@ -568,7 +567,7 @@ packet_send1(void)
568#endif 567#endif
569 568
570 /* Append to output. */ 569 /* Append to output. */
571 PUT_32BIT(buf, len); 570 put_u32(buf, len);
572 buffer_append(&output, buf, 4); 571 buffer_append(&output, buf, 4);
573 cp = buffer_append_space(&output, buffer_len(&outgoing_packet)); 572 cp = buffer_append_space(&output, buffer_len(&outgoing_packet));
574 cipher_crypt(&send_context, cp, buffer_ptr(&outgoing_packet), 573 cipher_crypt(&send_context, cp, buffer_ptr(&outgoing_packet),
@@ -771,7 +770,7 @@ packet_send2_wrapped(void)
771 /* packet_length includes payload, padding and padding length field */ 770 /* packet_length includes payload, padding and padding length field */
772 packet_length = buffer_len(&outgoing_packet) - 4; 771 packet_length = buffer_len(&outgoing_packet) - 4;
773 cp = buffer_ptr(&outgoing_packet); 772 cp = buffer_ptr(&outgoing_packet);
774 PUT_32BIT(cp, packet_length); 773 put_u32(cp, packet_length);
775 cp[4] = padlen; 774 cp[4] = padlen;
776 DBG(debug("send: len %d (includes padlen %d)", packet_length+4, padlen)); 775 DBG(debug("send: len %d (includes padlen %d)", packet_length+4, padlen));
777 776
@@ -969,7 +968,7 @@ packet_read_poll1(void)
969 return SSH_MSG_NONE; 968 return SSH_MSG_NONE;
970 /* Get length of incoming packet. */ 969 /* Get length of incoming packet. */
971 cp = buffer_ptr(&input); 970 cp = buffer_ptr(&input);
972 len = GET_32BIT(cp); 971 len = get_u32(cp);
973 if (len < 1 + 2 + 2 || len > 256 * 1024) 972 if (len < 1 + 2 + 2 || len > 256 * 1024)
974 packet_disconnect("Bad packet length %u.", len); 973 packet_disconnect("Bad packet length %u.", len);
975 padded_len = (len + 8) & ~7; 974 padded_len = (len + 8) & ~7;
@@ -1017,7 +1016,7 @@ packet_read_poll1(void)
1017 len, buffer_len(&incoming_packet)); 1016 len, buffer_len(&incoming_packet));
1018 1017
1019 cp = (u_char *)buffer_ptr(&incoming_packet) + len - 4; 1018 cp = (u_char *)buffer_ptr(&incoming_packet) + len - 4;
1020 stored_checksum = GET_32BIT(cp); 1019 stored_checksum = get_u32(cp);
1021 if (checksum != stored_checksum) 1020 if (checksum != stored_checksum)
1022 packet_disconnect("Corrupted check bytes on input."); 1021 packet_disconnect("Corrupted check bytes on input.");
1023 buffer_consume_end(&incoming_packet, 4); 1022 buffer_consume_end(&incoming_packet, 4);
@@ -1066,7 +1065,7 @@ packet_read_poll2(u_int32_t *seqnr_p)
1066 cipher_crypt(&receive_context, cp, buffer_ptr(&input), 1065 cipher_crypt(&receive_context, cp, buffer_ptr(&input),
1067 block_size); 1066 block_size);
1068 cp = buffer_ptr(&incoming_packet); 1067 cp = buffer_ptr(&incoming_packet);
1069 packet_length = GET_32BIT(cp); 1068 packet_length = get_u32(cp);
1070 if (packet_length < 1 + 4 || packet_length > 256 * 1024) { 1069 if (packet_length < 1 + 4 || packet_length > 256 * 1024) {
1071#ifdef PACKET_DEBUG 1070#ifdef PACKET_DEBUG
1072 buffer_dump(&incoming_packet); 1071 buffer_dump(&incoming_packet);