summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-05-07 12:03:14 +1000
committerDamien Miller <djm@mindrot.org>2000-05-07 12:03:14 +1000
commite247cc402bc391650f014316363dbce78ad85dc7 (patch)
tree65d72c3d3514c6119f47017f14b71ed153485a5d /packet.c
parent0437b33e54fd72060d17908d6abf96bfabaacad2 (diff)
- Remove references to SSLeay.
- Big OpenBSD CVS update - markus@cvs.openbsd.org [clientloop.c] - typo [session.c] - update proctitle on pty alloc/dealloc, e.g. w/ windows client [session.c] - update proctitle for proto 1, too [channels.h nchan.c serverloop.c session.c sshd.c] - use c-style comments - deraadt@cvs.openbsd.org [scp.c] - more atomicio - markus@cvs.openbsd.org [channels.c] - set O_NONBLOCK [ssh.1] - update AUTHOR [readconf.c ssh-keygen.c ssh.h] - default DSA key file ~/.ssh/id_dsa [clientloop.c] - typo, rm verbose debug - deraadt@cvs.openbsd.org [ssh-keygen.1] - document DSA use of ssh-keygen [sshd.8] - a start at describing what i understand of the DSA side [ssh-keygen.1] - document -X and -x [ssh-keygen.c] - simplify usage - markus@cvs.openbsd.org [sshd.8] - there is no rhosts_dsa [ssh-keygen.1] - document -y, update -X,-x [nchan.c] - fix close for non-open ssh1 channels [servconf.c servconf.h ssh.h sshd.8 sshd.c ] - s/DsaKey/HostDSAKey/, document option [sshconnect2.c] - respect number_of_password_prompts [channels.c channels.h servconf.c servconf.h session.c sshd.8] - GatewayPorts for sshd, ok deraadt@ [ssh-add.1 ssh-agent.1 ssh.1] - more doc on: DSA, id_dsa, known_hosts2, authorized_keys2 [ssh.1] - more info on proto 2 [sshd.8] - sync AUTHOR w/ ssh.1 [key.c key.h sshconnect.c] - print key type when talking about host keys [packet.c] - clear padding in ssh2 [dsa.c key.c radix.c ssh.h sshconnect1.c uuencode.c uuencode.h] - replace broken uuencode w/ libc b64_ntop [auth2.c] - log failure before sending the reply [key.c radix.c uuencode.c] - remote trailing comments before calling __b64_pton [auth2.c readconf.c readconf.h servconf.c servconf.h ssh.1] [sshconnect2.c sshd.8] - add DSAAuthetication option to ssh/sshd, document SSH2 in sshd.8 - Bring in b64_ntop and b64_pton from OpenBSD libc (bsd-base64.[ch])
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/packet.c b/packet.c
index e70d06091..dfe21fa1c 100644
--- a/packet.c
+++ b/packet.c
@@ -17,7 +17,7 @@
17 */ 17 */
18 18
19#include "includes.h" 19#include "includes.h"
20RCSID("$Id: packet.c,v 1.21 2000/05/01 11:10:33 damien Exp $"); 20RCSID("$Id: packet.c,v 1.22 2000/05/07 02:03:17 damien Exp $");
21 21
22#include "xmalloc.h" 22#include "xmalloc.h"
23#include "buffer.h" 23#include "buffer.h"
@@ -465,7 +465,7 @@ packet_send1()
465 /* Compute packet length without padding (add checksum, remove padding). */ 465 /* Compute packet length without padding (add checksum, remove padding). */
466 len = buffer_len(&outgoing_packet) + 4 - 8; 466 len = buffer_len(&outgoing_packet) + 4 - 8;
467 467
468 /* Insert padding. */ 468 /* Insert padding. Initialized to zero in packet_start1() */
469 padding = 8 - len % 8; 469 padding = 8 - len % 8;
470 if (cipher_type != SSH_CIPHER_NONE) { 470 if (cipher_type != SSH_CIPHER_NONE) {
471 cp = buffer_ptr(&outgoing_packet); 471 cp = buffer_ptr(&outgoing_packet);
@@ -569,12 +569,16 @@ packet_send2()
569 padlen += block_size; 569 padlen += block_size;
570 buffer_append_space(&outgoing_packet, &cp, padlen); 570 buffer_append_space(&outgoing_packet, &cp, padlen);
571 if (enc && enc->type != SSH_CIPHER_NONE) { 571 if (enc && enc->type != SSH_CIPHER_NONE) {
572 /* random padding */
572 for (i = 0; i < padlen; i++) { 573 for (i = 0; i < padlen; i++) {
573 if (i % 4 == 0) 574 if (i % 4 == 0)
574 rand = arc4random(); 575 rand = arc4random();
575 cp[i] = rand & 0xff; 576 cp[i] = rand & 0xff;
576 rand <<= 8; 577 rand <<= 8;
577 } 578 }
579 } else {
580 /* clear padding */
581 memset(cp, 0, padlen);
578 } 582 }
579 /* packet_length includes payload, padding and padding length field */ 583 /* packet_length includes payload, padding and padding length field */
580 packet_length = buffer_len(&outgoing_packet) - 4; 584 packet_length = buffer_len(&outgoing_packet) - 4;
@@ -657,10 +661,11 @@ packet_read(int *payload_len_ptr)
657 for (;;) { 661 for (;;) {
658 /* Try to read a packet from the buffer. */ 662 /* Try to read a packet from the buffer. */
659 type = packet_read_poll(payload_len_ptr); 663 type = packet_read_poll(payload_len_ptr);
660 if (type == SSH_SMSG_SUCCESS 664 if (!use_ssh2_packet_format && (
665 type == SSH_SMSG_SUCCESS
661 || type == SSH_SMSG_FAILURE 666 || type == SSH_SMSG_FAILURE
662 || type == SSH_CMSG_EOF 667 || type == SSH_CMSG_EOF
663 || type == SSH_CMSG_EXIT_CONFIRMATION) 668 || type == SSH_CMSG_EXIT_CONFIRMATION))
664 packet_integrity_check(*payload_len_ptr, 0, type); 669 packet_integrity_check(*payload_len_ptr, 0, type);
665 /* If we got a packet, return it. */ 670 /* If we got a packet, return it. */
666 if (type != SSH_MSG_NONE) 671 if (type != SSH_MSG_NONE)