summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-01-22 23:18:15 +1100
committerDamien Miller <djm@mindrot.org>2002-01-22 23:18:15 +1100
commit708d21c8028ed2bf137a0c4ff75bf7c6bfeff6e9 (patch)
treee878520026f2a9e970f4152da6ffb3b864a2a195
parentdc9e067614947f2f2b0866cb1bc75e6ac620fb7f (diff)
- stevesk@cvs.openbsd.org 2001/12/29 21:56:01
[authfile.c channels.c compress.c packet.c sftp-server.c ssh-agent.c ssh-keygen.c] remove unneeded casts and some char->u_char cleanup; ok markus@
-rw-r--r--ChangeLog6
-rw-r--r--authfile.c14
-rw-r--r--channels.c4
-rw-r--r--compress.c14
-rw-r--r--packet.c20
-rw-r--r--sftp-server.c4
-rw-r--r--ssh-agent.c6
-rw-r--r--ssh-keygen.c4
8 files changed, 38 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index b06f07eef..ac58a0eb3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -78,6 +78,10 @@
78 - stevesk@cvs.openbsd.org 2001/12/28 22:37:48 78 - stevesk@cvs.openbsd.org 2001/12/28 22:37:48
79 [ssh.1 sshd.8] 79 [ssh.1 sshd.8]
80 document LogLevel DEBUG[123]; ok markus@ 80 document LogLevel DEBUG[123]; ok markus@
81 - stevesk@cvs.openbsd.org 2001/12/29 21:56:01
82 [authfile.c channels.c compress.c packet.c sftp-server.c]
83 [ssh-agent.c ssh-keygen.c]
84 remove unneeded casts and some char->u_char cleanup; ok markus@
81 85
82 86
8320020121 8720020121
@@ -7226,4 +7230,4 @@
7226 - Wrote replacements for strlcpy and mkdtemp 7230 - Wrote replacements for strlcpy and mkdtemp
7227 - Released 1.0pre1 7231 - Released 1.0pre1
7228 7232
7229$Id: ChangeLog,v 1.1745 2002/01/22 12:17:51 djm Exp $ 7233$Id: ChangeLog,v 1.1746 2002/01/22 12:18:15 djm Exp $
diff --git a/authfile.c b/authfile.c
index 7026e24c4..69e0da03b 100644
--- a/authfile.c
+++ b/authfile.c
@@ -36,7 +36,7 @@
36 */ 36 */
37 37
38#include "includes.h" 38#include "includes.h"
39RCSID("$OpenBSD: authfile.c,v 1.44 2001/12/27 18:26:13 markus Exp $"); 39RCSID("$OpenBSD: authfile.c,v 1.45 2001/12/29 21:56:01 stevesk Exp $");
40 40
41#include <openssl/err.h> 41#include <openssl/err.h>
42#include <openssl/evp.h> 42#include <openssl/evp.h>
@@ -68,7 +68,7 @@ key_save_private_rsa1(Key *key, const char *filename, const char *passphrase,
68 const char *comment) 68 const char *comment)
69{ 69{
70 Buffer buffer, encrypted; 70 Buffer buffer, encrypted;
71 char buf[100], *cp; 71 u_char buf[100], *cp;
72 int fd, i; 72 int fd, i;
73 CipherContext ciphercontext; 73 CipherContext ciphercontext;
74 Cipher *cipher; 74 Cipher *cipher;
@@ -132,8 +132,8 @@ key_save_private_rsa1(Key *key, const char *filename, const char *passphrase,
132 cp = buffer_append_space(&encrypted, buffer_len(&buffer)); 132 cp = buffer_append_space(&encrypted, buffer_len(&buffer));
133 133
134 cipher_set_key_string(&ciphercontext, cipher, passphrase); 134 cipher_set_key_string(&ciphercontext, cipher, passphrase);
135 cipher_encrypt(&ciphercontext, (u_char *) cp, 135 cipher_encrypt(&ciphercontext, cp,
136 (u_char *) buffer_ptr(&buffer), buffer_len(&buffer)); 136 buffer_ptr(&buffer), buffer_len(&buffer));
137 memset(&ciphercontext, 0, sizeof(ciphercontext)); 137 memset(&ciphercontext, 0, sizeof(ciphercontext));
138 138
139 /* Destroy temporary data. */ 139 /* Destroy temporary data. */
@@ -314,7 +314,7 @@ key_load_private_rsa1(int fd, const char *filename, const char *passphrase,
314 int i, check1, check2, cipher_type; 314 int i, check1, check2, cipher_type;
315 off_t len; 315 off_t len;
316 Buffer buffer, decrypted; 316 Buffer buffer, decrypted;
317 char *cp; 317 u_char *cp;
318 CipherContext ciphercontext; 318 CipherContext ciphercontext;
319 Cipher *cipher; 319 Cipher *cipher;
320 Key *prv = NULL; 320 Key *prv = NULL;
@@ -381,8 +381,8 @@ key_load_private_rsa1(int fd, const char *filename, const char *passphrase,
381 381
382 /* Rest of the buffer is encrypted. Decrypt it using the passphrase. */ 382 /* Rest of the buffer is encrypted. Decrypt it using the passphrase. */
383 cipher_set_key_string(&ciphercontext, cipher, passphrase); 383 cipher_set_key_string(&ciphercontext, cipher, passphrase);
384 cipher_decrypt(&ciphercontext, (u_char *) cp, 384 cipher_decrypt(&ciphercontext, cp,
385 (u_char *) buffer_ptr(&buffer), buffer_len(&buffer)); 385 buffer_ptr(&buffer), buffer_len(&buffer));
386 memset(&ciphercontext, 0, sizeof(ciphercontext)); 386 memset(&ciphercontext, 0, sizeof(ciphercontext));
387 buffer_free(&buffer); 387 buffer_free(&buffer);
388 388
diff --git a/channels.c b/channels.c
index 7c0997c5d..4f02fc5b8 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.154 2001/12/28 15:06:00 markus Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.155 2001/12/29 21:56:01 stevesk Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -786,7 +786,7 @@ x11_open_helper(Buffer *b)
786 return 0; 786 return 0;
787 787
788 /* Parse the lengths of variable-length fields. */ 788 /* Parse the lengths of variable-length fields. */
789 ucp = (u_char *) buffer_ptr(b); 789 ucp = buffer_ptr(b);
790 if (ucp[0] == 0x42) { /* Byte order MSB first. */ 790 if (ucp[0] == 0x42) { /* Byte order MSB first. */
791 proto_len = 256 * ucp[6] + ucp[7]; 791 proto_len = 256 * ucp[6] + ucp[7];
792 data_len = 256 * ucp[8] + ucp[9]; 792 data_len = 256 * ucp[8] + ucp[9];
diff --git a/compress.c b/compress.c
index 73aebe89a..3badbf452 100644
--- a/compress.c
+++ b/compress.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: compress.c,v 1.16 2001/12/19 07:18:56 deraadt Exp $"); 15RCSID("$OpenBSD: compress.c,v 1.17 2001/12/29 21:56:01 stevesk Exp $");
16 16
17#include "log.h" 17#include "log.h"
18#include "buffer.h" 18#include "buffer.h"
@@ -80,7 +80,7 @@ buffer_compress_uninit(void)
80void 80void
81buffer_compress(Buffer * input_buffer, Buffer * output_buffer) 81buffer_compress(Buffer * input_buffer, Buffer * output_buffer)
82{ 82{
83 char buf[4096]; 83 u_char buf[4096];
84 int status; 84 int status;
85 85
86 /* This case is not handled below. */ 86 /* This case is not handled below. */
@@ -88,13 +88,13 @@ buffer_compress(Buffer * input_buffer, Buffer * output_buffer)
88 return; 88 return;
89 89
90 /* Input is the contents of the input buffer. */ 90 /* Input is the contents of the input buffer. */
91 outgoing_stream.next_in = (u_char *) buffer_ptr(input_buffer); 91 outgoing_stream.next_in = buffer_ptr(input_buffer);
92 outgoing_stream.avail_in = buffer_len(input_buffer); 92 outgoing_stream.avail_in = buffer_len(input_buffer);
93 93
94 /* Loop compressing until deflate() returns with avail_out != 0. */ 94 /* Loop compressing until deflate() returns with avail_out != 0. */
95 do { 95 do {
96 /* Set up fixed-size output buffer. */ 96 /* Set up fixed-size output buffer. */
97 outgoing_stream.next_out = (u_char *)buf; 97 outgoing_stream.next_out = buf;
98 outgoing_stream.avail_out = sizeof(buf); 98 outgoing_stream.avail_out = sizeof(buf);
99 99
100 /* Compress as much data into the buffer as possible. */ 100 /* Compress as much data into the buffer as possible. */
@@ -124,15 +124,15 @@ buffer_compress(Buffer * input_buffer, Buffer * output_buffer)
124void 124void
125buffer_uncompress(Buffer * input_buffer, Buffer * output_buffer) 125buffer_uncompress(Buffer * input_buffer, Buffer * output_buffer)
126{ 126{
127 char buf[4096]; 127 u_char buf[4096];
128 int status; 128 int status;
129 129
130 incoming_stream.next_in = (u_char *) buffer_ptr(input_buffer); 130 incoming_stream.next_in = buffer_ptr(input_buffer);
131 incoming_stream.avail_in = buffer_len(input_buffer); 131 incoming_stream.avail_in = buffer_len(input_buffer);
132 132
133 for (;;) { 133 for (;;) {
134 /* Set up fixed-size output buffer. */ 134 /* Set up fixed-size output buffer. */
135 incoming_stream.next_out = (u_char *) buf; 135 incoming_stream.next_out = buf;
136 incoming_stream.avail_out = sizeof(buf); 136 incoming_stream.avail_out = sizeof(buf);
137 137
138 status = inflate(&incoming_stream, Z_PARTIAL_FLUSH); 138 status = inflate(&incoming_stream, Z_PARTIAL_FLUSH);
diff --git a/packet.c b/packet.c
index 3b2522356..5d97c379e 100644
--- a/packet.c
+++ b/packet.c
@@ -37,7 +37,7 @@
37 */ 37 */
38 38
39#include "includes.h" 39#include "includes.h"
40RCSID("$OpenBSD: packet.c,v 1.82 2001/12/28 14:50:54 markus Exp $"); 40RCSID("$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.");
diff --git a/sftp-server.c b/sftp-server.c
index 7c8a6b65b..6d6658614 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -22,7 +22,7 @@
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24#include "includes.h" 24#include "includes.h"
25RCSID("$OpenBSD: sftp-server.c,v 1.31 2001/12/19 07:18:56 deraadt Exp $"); 25RCSID("$OpenBSD: sftp-server.c,v 1.32 2001/12/29 21:56:01 stevesk Exp $");
26 26
27#include "buffer.h" 27#include "buffer.h"
28#include "bufaux.h" 28#include "bufaux.h"
@@ -951,7 +951,7 @@ process(void)
951 951
952 if (buffer_len(&iqueue) < 5) 952 if (buffer_len(&iqueue) < 5)
953 return; /* Incomplete message. */ 953 return; /* Incomplete message. */
954 cp = (u_char *) buffer_ptr(&iqueue); 954 cp = buffer_ptr(&iqueue);
955 msg_len = GET_32BIT(cp); 955 msg_len = GET_32BIT(cp);
956 if (msg_len > 256 * 1024) { 956 if (msg_len > 256 * 1024) {
957 error("bad message "); 957 error("bad message ");
diff --git a/ssh-agent.c b/ssh-agent.c
index 5620b6b90..f5849cee4 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-agent.c,v 1.76 2001/12/27 18:22:16 markus Exp $ */ 1/* $OpenBSD: ssh-agent.c,v 1.77 2001/12/29 21:56:01 stevesk Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -36,7 +36,7 @@
36 */ 36 */
37 37
38#include "includes.h" 38#include "includes.h"
39RCSID("$OpenBSD: ssh-agent.c,v 1.76 2001/12/27 18:22:16 markus Exp $"); 39RCSID("$OpenBSD: ssh-agent.c,v 1.77 2001/12/29 21:56:01 stevesk Exp $");
40 40
41#include <openssl/evp.h> 41#include <openssl/evp.h>
42#include <openssl/md5.h> 42#include <openssl/md5.h>
@@ -566,7 +566,7 @@ process_message(SocketEntry *e)
566 u_char *cp; 566 u_char *cp;
567 if (buffer_len(&e->input) < 5) 567 if (buffer_len(&e->input) < 5)
568 return; /* Incomplete message. */ 568 return; /* Incomplete message. */
569 cp = (u_char *) buffer_ptr(&e->input); 569 cp = buffer_ptr(&e->input);
570 msg_len = GET_32BIT(cp); 570 msg_len = GET_32BIT(cp);
571 if (msg_len > 256 * 1024) { 571 if (msg_len > 256 * 1024) {
572 shutdown(e->fd, SHUT_RDWR); 572 shutdown(e->fd, SHUT_RDWR);
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 4f976a826..f8c7316dd 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: ssh-keygen.c,v 1.88 2001/12/27 18:10:29 markus Exp $"); 15RCSID("$OpenBSD: ssh-keygen.c,v 1.89 2001/12/29 21:56:01 stevesk Exp $");
16 16
17#include <openssl/evp.h> 17#include <openssl/evp.h>
18#include <openssl/pem.h> 18#include <openssl/pem.h>
@@ -187,7 +187,7 @@ buffer_get_bignum_bits(Buffer *b, BIGNUM *value)
187 if (buffer_len(b) < bytes) 187 if (buffer_len(b) < bytes)
188 fatal("buffer_get_bignum_bits: input buffer too small: " 188 fatal("buffer_get_bignum_bits: input buffer too small: "
189 "need %d have %d", bytes, buffer_len(b)); 189 "need %d have %d", bytes, buffer_len(b));
190 BN_bin2bn((u_char *)buffer_ptr(b), bytes, value); 190 BN_bin2bn(buffer_ptr(b), bytes, value);
191 buffer_consume(b, bytes); 191 buffer_consume(b, bytes);
192} 192}
193 193