diff options
Diffstat (limited to 'packet.c')
-rw-r--r-- | packet.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -37,7 +37,7 @@ | |||
37 | */ | 37 | */ |
38 | 38 | ||
39 | #include "includes.h" | 39 | #include "includes.h" |
40 | RCSID("$OpenBSD: packet.c,v 1.82 2001/12/28 14:50:54 markus Exp $"); | 40 | RCSID("$OpenBSD: packet.c,v 1.83 2001/12/29 21:56:01 stevesk Exp $"); |
41 | 41 | ||
42 | #include "xmalloc.h" | 42 | #include "xmalloc.h" |
43 | #include "buffer.h" | 43 | #include "buffer.h" |
@@ -399,7 +399,7 @@ packet_send1(void) | |||
399 | buffer_consume(&outgoing_packet, 8 - padding); | 399 | buffer_consume(&outgoing_packet, 8 - padding); |
400 | 400 | ||
401 | /* Add check bytes. */ | 401 | /* Add check bytes. */ |
402 | checksum = ssh_crc32((u_char *) buffer_ptr(&outgoing_packet), | 402 | checksum = ssh_crc32(buffer_ptr(&outgoing_packet), |
403 | buffer_len(&outgoing_packet)); | 403 | buffer_len(&outgoing_packet)); |
404 | PUT_32BIT(buf, checksum); | 404 | PUT_32BIT(buf, checksum); |
405 | buffer_append(&outgoing_packet, buf, 4); | 405 | buffer_append(&outgoing_packet, buf, 4); |
@@ -505,7 +505,7 @@ packet_send2(void) | |||
505 | } | 505 | } |
506 | block_size = enc ? enc->cipher->block_size : 8; | 506 | block_size = enc ? enc->cipher->block_size : 8; |
507 | 507 | ||
508 | ucp = (u_char *) buffer_ptr(&outgoing_packet); | 508 | ucp = buffer_ptr(&outgoing_packet); |
509 | type = ucp[5]; | 509 | type = ucp[5]; |
510 | 510 | ||
511 | #ifdef PACKET_DEBUG | 511 | #ifdef PACKET_DEBUG |
@@ -561,7 +561,7 @@ packet_send2(void) | |||
561 | } | 561 | } |
562 | /* packet_length includes payload, padding and padding length field */ | 562 | /* packet_length includes payload, padding and padding length field */ |
563 | packet_length = buffer_len(&outgoing_packet) - 4; | 563 | packet_length = buffer_len(&outgoing_packet) - 4; |
564 | ucp = (u_char *)buffer_ptr(&outgoing_packet); | 564 | ucp = buffer_ptr(&outgoing_packet); |
565 | PUT_32BIT(ucp, packet_length); | 565 | PUT_32BIT(ucp, packet_length); |
566 | ucp[4] = padlen; | 566 | ucp[4] = padlen; |
567 | DBG(debug("send: len %d (includes padlen %d)", packet_length+4, padlen)); | 567 | DBG(debug("send: len %d (includes padlen %d)", packet_length+4, padlen)); |
@@ -569,7 +569,7 @@ packet_send2(void) | |||
569 | /* compute MAC over seqnr and packet(length fields, payload, padding) */ | 569 | /* compute MAC over seqnr and packet(length fields, payload, padding) */ |
570 | if (mac && mac->enabled) { | 570 | if (mac && mac->enabled) { |
571 | macbuf = mac_compute(mac, seqnr, | 571 | macbuf = mac_compute(mac, seqnr, |
572 | (u_char *) buffer_ptr(&outgoing_packet), | 572 | buffer_ptr(&outgoing_packet), |
573 | buffer_len(&outgoing_packet)); | 573 | buffer_len(&outgoing_packet)); |
574 | DBG(debug("done calc MAC out #%d", seqnr)); | 574 | DBG(debug("done calc MAC out #%d", seqnr)); |
575 | } | 575 | } |
@@ -708,7 +708,7 @@ packet_read_poll1(void) | |||
708 | if (buffer_len(&input) < 4 + 8) | 708 | if (buffer_len(&input) < 4 + 8) |
709 | return SSH_MSG_NONE; | 709 | return SSH_MSG_NONE; |
710 | /* Get length of incoming packet. */ | 710 | /* Get length of incoming packet. */ |
711 | ucp = (u_char *) buffer_ptr(&input); | 711 | ucp = buffer_ptr(&input); |
712 | len = GET_32BIT(ucp); | 712 | len = GET_32BIT(ucp); |
713 | if (len < 1 + 2 + 2 || len > 256 * 1024) | 713 | if (len < 1 + 2 + 2 || len > 256 * 1024) |
714 | packet_disconnect("Bad packet length %d.", len); | 714 | packet_disconnect("Bad packet length %d.", len); |
@@ -745,7 +745,7 @@ packet_read_poll1(void) | |||
745 | #endif | 745 | #endif |
746 | 746 | ||
747 | /* Compute packet checksum. */ | 747 | /* Compute packet checksum. */ |
748 | checksum = ssh_crc32((u_char *) buffer_ptr(&incoming_packet), | 748 | checksum = ssh_crc32(buffer_ptr(&incoming_packet), |
749 | buffer_len(&incoming_packet) - 4); | 749 | buffer_len(&incoming_packet) - 4); |
750 | 750 | ||
751 | /* Skip padding. */ | 751 | /* Skip padding. */ |
@@ -756,7 +756,7 @@ packet_read_poll1(void) | |||
756 | packet_disconnect("packet_read_poll1: len %d != buffer_len %d.", | 756 | packet_disconnect("packet_read_poll1: len %d != buffer_len %d.", |
757 | len, buffer_len(&incoming_packet)); | 757 | len, buffer_len(&incoming_packet)); |
758 | 758 | ||
759 | ucp = (u_char *) buffer_ptr(&incoming_packet) + len - 4; | 759 | ucp = (u_char *)buffer_ptr(&incoming_packet) + len - 4; |
760 | stored_checksum = GET_32BIT(ucp); | 760 | stored_checksum = GET_32BIT(ucp); |
761 | if (checksum != stored_checksum) | 761 | if (checksum != stored_checksum) |
762 | packet_disconnect("Corrupted check bytes on input."); | 762 | packet_disconnect("Corrupted check bytes on input."); |
@@ -805,7 +805,7 @@ packet_read_poll2(u_int32_t *seqnr_p) | |||
805 | cp = buffer_append_space(&incoming_packet, block_size); | 805 | cp = buffer_append_space(&incoming_packet, block_size); |
806 | cipher_decrypt(&receive_context, cp, buffer_ptr(&input), | 806 | cipher_decrypt(&receive_context, cp, buffer_ptr(&input), |
807 | block_size); | 807 | block_size); |
808 | ucp = (u_char *) buffer_ptr(&incoming_packet); | 808 | ucp = buffer_ptr(&incoming_packet); |
809 | packet_length = GET_32BIT(ucp); | 809 | packet_length = GET_32BIT(ucp); |
810 | if (packet_length < 1 + 4 || packet_length > 256 * 1024) { | 810 | if (packet_length < 1 + 4 || packet_length > 256 * 1024) { |
811 | buffer_dump(&incoming_packet); | 811 | buffer_dump(&incoming_packet); |
@@ -840,7 +840,7 @@ packet_read_poll2(u_int32_t *seqnr_p) | |||
840 | */ | 840 | */ |
841 | if (mac && mac->enabled) { | 841 | if (mac && mac->enabled) { |
842 | macbuf = mac_compute(mac, seqnr, | 842 | macbuf = mac_compute(mac, seqnr, |
843 | (u_char *) buffer_ptr(&incoming_packet), | 843 | buffer_ptr(&incoming_packet), |
844 | buffer_len(&incoming_packet)); | 844 | buffer_len(&incoming_packet)); |
845 | if (memcmp(macbuf, buffer_ptr(&input), mac->mac_len) != 0) | 845 | if (memcmp(macbuf, buffer_ptr(&input), mac->mac_len) != 0) |
846 | packet_disconnect("Corrupted MAC on input."); | 846 | packet_disconnect("Corrupted MAC on input."); |