diff options
Diffstat (limited to 'packet.c')
-rw-r--r-- | packet.c | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -37,7 +37,7 @@ | |||
37 | */ | 37 | */ |
38 | 38 | ||
39 | #include "includes.h" | 39 | #include "includes.h" |
40 | RCSID("$OpenBSD: packet.c,v 1.114 2004/06/14 01:44:39 djm Exp $"); | 40 | RCSID("$OpenBSD: packet.c,v 1.115 2004/06/21 17:36:31 avsm Exp $"); |
41 | 41 | ||
42 | #include "openbsd-compat/sys-queue.h" | 42 | #include "openbsd-compat/sys-queue.h" |
43 | 43 | ||
@@ -507,7 +507,7 @@ packet_send1(void) | |||
507 | u_char buf[8], *cp; | 507 | u_char buf[8], *cp; |
508 | int i, padding, len; | 508 | int i, padding, len; |
509 | u_int checksum; | 509 | u_int checksum; |
510 | u_int32_t rand = 0; | 510 | u_int32_t rnd = 0; |
511 | 511 | ||
512 | /* | 512 | /* |
513 | * If using packet compression, compress the payload of the outgoing | 513 | * If using packet compression, compress the payload of the outgoing |
@@ -533,9 +533,9 @@ packet_send1(void) | |||
533 | cp = buffer_ptr(&outgoing_packet); | 533 | cp = buffer_ptr(&outgoing_packet); |
534 | for (i = 0; i < padding; i++) { | 534 | for (i = 0; i < padding; i++) { |
535 | if (i % 4 == 0) | 535 | if (i % 4 == 0) |
536 | rand = arc4random(); | 536 | rnd = arc4random(); |
537 | cp[7 - i] = rand & 0xff; | 537 | cp[7 - i] = rnd & 0xff; |
538 | rand >>= 8; | 538 | rnd >>= 8; |
539 | } | 539 | } |
540 | } | 540 | } |
541 | buffer_consume(&outgoing_packet, 8 - padding); | 541 | buffer_consume(&outgoing_packet, 8 - padding); |
@@ -580,18 +580,18 @@ set_newkeys(int mode) | |||
580 | Comp *comp; | 580 | Comp *comp; |
581 | CipherContext *cc; | 581 | CipherContext *cc; |
582 | u_int64_t *max_blocks; | 582 | u_int64_t *max_blocks; |
583 | int encrypt; | 583 | int crypt_type; |
584 | 584 | ||
585 | debug2("set_newkeys: mode %d", mode); | 585 | debug2("set_newkeys: mode %d", mode); |
586 | 586 | ||
587 | if (mode == MODE_OUT) { | 587 | if (mode == MODE_OUT) { |
588 | cc = &send_context; | 588 | cc = &send_context; |
589 | encrypt = CIPHER_ENCRYPT; | 589 | crypt_type = CIPHER_ENCRYPT; |
590 | p_send.packets = p_send.blocks = 0; | 590 | p_send.packets = p_send.blocks = 0; |
591 | max_blocks = &max_blocks_out; | 591 | max_blocks = &max_blocks_out; |
592 | } else { | 592 | } else { |
593 | cc = &receive_context; | 593 | cc = &receive_context; |
594 | encrypt = CIPHER_DECRYPT; | 594 | crypt_type = CIPHER_DECRYPT; |
595 | p_read.packets = p_read.blocks = 0; | 595 | p_read.packets = p_read.blocks = 0; |
596 | max_blocks = &max_blocks_in; | 596 | max_blocks = &max_blocks_in; |
597 | } | 597 | } |
@@ -620,7 +620,7 @@ set_newkeys(int mode) | |||
620 | mac->enabled = 1; | 620 | mac->enabled = 1; |
621 | DBG(debug("cipher_init_context: %d", mode)); | 621 | DBG(debug("cipher_init_context: %d", mode)); |
622 | cipher_init(cc, enc->cipher, enc->key, enc->key_len, | 622 | cipher_init(cc, enc->cipher, enc->key, enc->key_len, |
623 | enc->iv, enc->block_size, encrypt); | 623 | enc->iv, enc->block_size, crypt_type); |
624 | /* Deleting the keys does not gain extra security */ | 624 | /* Deleting the keys does not gain extra security */ |
625 | /* memset(enc->iv, 0, enc->block_size); | 625 | /* memset(enc->iv, 0, enc->block_size); |
626 | memset(enc->key, 0, enc->key_len); */ | 626 | memset(enc->key, 0, enc->key_len); */ |
@@ -654,7 +654,7 @@ packet_send2_wrapped(void) | |||
654 | u_char padlen, pad; | 654 | u_char padlen, pad; |
655 | u_int packet_length = 0; | 655 | u_int packet_length = 0; |
656 | u_int i, len; | 656 | u_int i, len; |
657 | u_int32_t rand = 0; | 657 | u_int32_t rnd = 0; |
658 | Enc *enc = NULL; | 658 | Enc *enc = NULL; |
659 | Mac *mac = NULL; | 659 | Mac *mac = NULL; |
660 | Comp *comp = NULL; | 660 | Comp *comp = NULL; |
@@ -713,9 +713,9 @@ packet_send2_wrapped(void) | |||
713 | /* random padding */ | 713 | /* random padding */ |
714 | for (i = 0; i < padlen; i++) { | 714 | for (i = 0; i < padlen; i++) { |
715 | if (i % 4 == 0) | 715 | if (i % 4 == 0) |
716 | rand = arc4random(); | 716 | rnd = arc4random(); |
717 | cp[i] = rand & 0xff; | 717 | cp[i] = rnd & 0xff; |
718 | rand >>= 8; | 718 | rnd >>= 8; |
719 | } | 719 | } |
720 | } else { | 720 | } else { |
721 | /* clear padding */ | 721 | /* clear padding */ |
@@ -1489,16 +1489,16 @@ packet_add_padding(u_char pad) | |||
1489 | void | 1489 | void |
1490 | packet_send_ignore(int nbytes) | 1490 | packet_send_ignore(int nbytes) |
1491 | { | 1491 | { |
1492 | u_int32_t rand = 0; | 1492 | u_int32_t rnd = 0; |
1493 | int i; | 1493 | int i; |
1494 | 1494 | ||
1495 | packet_start(compat20 ? SSH2_MSG_IGNORE : SSH_MSG_IGNORE); | 1495 | packet_start(compat20 ? SSH2_MSG_IGNORE : SSH_MSG_IGNORE); |
1496 | packet_put_int(nbytes); | 1496 | packet_put_int(nbytes); |
1497 | for (i = 0; i < nbytes; i++) { | 1497 | for (i = 0; i < nbytes; i++) { |
1498 | if (i % 4 == 0) | 1498 | if (i % 4 == 0) |
1499 | rand = arc4random(); | 1499 | rnd = arc4random(); |
1500 | packet_put_char(rand & 0xff); | 1500 | packet_put_char(rnd & 0xff); |
1501 | rand >>= 8; | 1501 | rnd >>= 8; |
1502 | } | 1502 | } |
1503 | } | 1503 | } |
1504 | 1504 | ||