summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-11-17 21:18:23 +1100
committerDamien Miller <djm@mindrot.org>2003-11-17 21:18:23 +1100
commitf58b58ced10c2e9ae899f63d4e915ec9723cf5a1 (patch)
treea40f405796853a41d0da48a47c82a72d3be818fe
parent939cd38122a2fadf9e82c15239ac86ec4cd1baec (diff)
- jakob@cvs.openbsd.org 2003/11/10 16:23:41
[bufaux.c bufaux.h cipher.c cipher.h hostfile.c hostfile.h key.c] [key.h sftp-common.c sftp-common.h sftp-server.c sshconnect.c sshd.c] [ssh-dss.c ssh-rsa.c uuencode.c uuencode.h] constify. ok markus@ & djm@
-rw-r--r--ChangeLog7
-rw-r--r--bufaux.c6
-rw-r--r--bufaux.h6
-rw-r--r--cipher.c12
-rw-r--r--cipher.h12
-rw-r--r--hostfile.c10
-rw-r--r--hostfile.h6
-rw-r--r--key.c40
-rw-r--r--key.h46
-rw-r--r--sftp-common.c10
-rw-r--r--sftp-common.h10
-rw-r--r--sftp-server.c16
-rw-r--r--ssh-dss.c20
-rw-r--r--ssh-rsa.c10
-rw-r--r--sshconnect.c4
-rw-r--r--sshd.c11
-rw-r--r--uuencode.c4
-rw-r--r--uuencode.h4
18 files changed, 121 insertions, 113 deletions
diff --git a/ChangeLog b/ChangeLog
index e688333f2..d1b0f6421 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,11 @@
23 - jmc@cvs.openbsd.org 2003/11/08 19:17:29 23 - jmc@cvs.openbsd.org 2003/11/08 19:17:29
24 [sftp-int.c] 24 [sftp-int.c]
25 typos from Jonathon Gray; 25 typos from Jonathon Gray;
26 - jakob@cvs.openbsd.org 2003/11/10 16:23:41
27 [bufaux.c bufaux.h cipher.c cipher.h hostfile.c hostfile.h key.c]
28 [key.h sftp-common.c sftp-common.h sftp-server.c sshconnect.c sshd.c]
29 [ssh-dss.c ssh-rsa.c uuencode.c uuencode.h]
30 constify. ok markus@ & djm@
26 31
2720031115 3220031115
28 - (dtucker) [regress/agent-ptrace.sh] Test for GDB output from Solaris and 33 - (dtucker) [regress/agent-ptrace.sh] Test for GDB output from Solaris and
@@ -1443,4 +1448,4 @@
1443 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. 1448 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
1444 Report from murple@murple.net, diagnosis from dtucker@zip.com.au 1449 Report from murple@murple.net, diagnosis from dtucker@zip.com.au
1445 1450
1446$Id: ChangeLog,v 1.3103 2003/11/17 10:17:24 djm Exp $ 1451$Id: ChangeLog,v 1.3104 2003/11/17 10:18:23 djm Exp $
diff --git a/bufaux.c b/bufaux.c
index 1df15b548..339d74435 100644
--- a/bufaux.c
+++ b/bufaux.c
@@ -37,7 +37,7 @@
37 */ 37 */
38 38
39#include "includes.h" 39#include "includes.h"
40RCSID("$OpenBSD: bufaux.c,v 1.30 2003/09/18 13:02:21 miod Exp $"); 40RCSID("$OpenBSD: bufaux.c,v 1.31 2003/11/10 16:23:41 jakob Exp $");
41 41
42#include <openssl/bn.h> 42#include <openssl/bn.h>
43#include "bufaux.h" 43#include "bufaux.h"
@@ -50,7 +50,7 @@ RCSID("$OpenBSD: bufaux.c,v 1.30 2003/09/18 13:02:21 miod Exp $");
50 * by (bits+7)/8 bytes of binary data, msb first. 50 * by (bits+7)/8 bytes of binary data, msb first.
51 */ 51 */
52void 52void
53buffer_put_bignum(Buffer *buffer, BIGNUM *value) 53buffer_put_bignum(Buffer *buffer, const BIGNUM *value)
54{ 54{
55 int bits = BN_num_bits(value); 55 int bits = BN_num_bits(value);
56 int bin_size = (bits + 7) / 8; 56 int bin_size = (bits + 7) / 8;
@@ -101,7 +101,7 @@ buffer_get_bignum(Buffer *buffer, BIGNUM *value)
101 * Stores an BIGNUM in the buffer in SSH2 format. 101 * Stores an BIGNUM in the buffer in SSH2 format.
102 */ 102 */
103void 103void
104buffer_put_bignum2(Buffer *buffer, BIGNUM *value) 104buffer_put_bignum2(Buffer *buffer, const BIGNUM *value)
105{ 105{
106 u_int bytes = BN_num_bytes(value) + 1; 106 u_int bytes = BN_num_bytes(value) + 1;
107 u_char *buf = xmalloc(bytes); 107 u_char *buf = xmalloc(bytes);
diff --git a/bufaux.h b/bufaux.h
index 935553579..61c72e353 100644
--- a/bufaux.h
+++ b/bufaux.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bufaux.h,v 1.18 2002/04/20 09:14:58 markus Exp $ */ 1/* $OpenBSD: bufaux.h,v 1.19 2003/11/10 16:23:41 jakob Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -18,8 +18,8 @@
18#include "buffer.h" 18#include "buffer.h"
19#include <openssl/bn.h> 19#include <openssl/bn.h>
20 20
21void buffer_put_bignum(Buffer *, BIGNUM *); 21void buffer_put_bignum(Buffer *, const BIGNUM *);
22void buffer_put_bignum2(Buffer *, BIGNUM *); 22void buffer_put_bignum2(Buffer *, const BIGNUM *);
23void buffer_get_bignum(Buffer *, BIGNUM *); 23void buffer_get_bignum(Buffer *, BIGNUM *);
24void buffer_get_bignum2(Buffer *, BIGNUM *); 24void buffer_get_bignum2(Buffer *, BIGNUM *);
25 25
diff --git a/cipher.c b/cipher.c
index ce533670b..a1c40cc4a 100644
--- a/cipher.c
+++ b/cipher.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: cipher.c,v 1.65 2003/05/17 04:27:52 markus Exp $"); 38RCSID("$OpenBSD: cipher.c,v 1.66 2003/11/10 16:23:41 jakob Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "log.h" 41#include "log.h"
@@ -99,19 +99,19 @@ struct Cipher {
99/*--*/ 99/*--*/
100 100
101u_int 101u_int
102cipher_blocksize(Cipher *c) 102cipher_blocksize(const Cipher *c)
103{ 103{
104 return (c->block_size); 104 return (c->block_size);
105} 105}
106 106
107u_int 107u_int
108cipher_keylen(Cipher *c) 108cipher_keylen(const Cipher *c)
109{ 109{
110 return (c->key_len); 110 return (c->key_len);
111} 111}
112 112
113u_int 113u_int
114cipher_get_number(Cipher *c) 114cipher_get_number(const Cipher *c)
115{ 115{
116 return (c->number); 116 return (c->number);
117} 117}
@@ -311,7 +311,7 @@ cipher_set_key_string(CipherContext *cc, Cipher *cipher,
311 */ 311 */
312 312
313int 313int
314cipher_get_keyiv_len(CipherContext *cc) 314cipher_get_keyiv_len(const CipherContext *cc)
315{ 315{
316 Cipher *c = cc->cipher; 316 Cipher *c = cc->cipher;
317 int ivlen; 317 int ivlen;
@@ -397,7 +397,7 @@ cipher_set_keyiv(CipherContext *cc, u_char *iv)
397#endif 397#endif
398 398
399int 399int
400cipher_get_keycontext(CipherContext *cc, u_char *dat) 400cipher_get_keycontext(const CipherContext *cc, u_char *dat)
401{ 401{
402 Cipher *c = cc->cipher; 402 Cipher *c = cc->cipher;
403 int plen = 0; 403 int plen = 0;
diff --git a/cipher.h b/cipher.h
index fc7f6dd0f..74b3669fd 100644
--- a/cipher.h
+++ b/cipher.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: cipher.h,v 1.33 2002/03/18 17:13:15 markus Exp $ */ 1/* $OpenBSD: cipher.h,v 1.34 2003/11/10 16:23:41 jakob Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -79,13 +79,13 @@ void cipher_init(CipherContext *, Cipher *, const u_char *, u_int,
79void cipher_crypt(CipherContext *, u_char *, const u_char *, u_int); 79void cipher_crypt(CipherContext *, u_char *, const u_char *, u_int);
80void cipher_cleanup(CipherContext *); 80void cipher_cleanup(CipherContext *);
81void cipher_set_key_string(CipherContext *, Cipher *, const char *, int); 81void cipher_set_key_string(CipherContext *, Cipher *, const char *, int);
82u_int cipher_blocksize(Cipher *); 82u_int cipher_blocksize(const Cipher *);
83u_int cipher_keylen(Cipher *); 83u_int cipher_keylen(const Cipher *);
84 84
85u_int cipher_get_number(Cipher *); 85u_int cipher_get_number(const Cipher *);
86void cipher_get_keyiv(CipherContext *, u_char *, u_int); 86void cipher_get_keyiv(CipherContext *, u_char *, u_int);
87void cipher_set_keyiv(CipherContext *, u_char *); 87void cipher_set_keyiv(CipherContext *, u_char *);
88int cipher_get_keyiv_len(CipherContext *); 88int cipher_get_keyiv_len(const CipherContext *);
89int cipher_get_keycontext(CipherContext *, u_char *); 89int cipher_get_keycontext(const CipherContext *, u_char *);
90void cipher_set_keycontext(CipherContext *, u_char *); 90void cipher_set_keycontext(CipherContext *, u_char *);
91#endif /* CIPHER_H */ 91#endif /* CIPHER_H */
diff --git a/hostfile.c b/hostfile.c
index 42a8aa71d..88c054912 100644
--- a/hostfile.c
+++ b/hostfile.c
@@ -36,7 +36,7 @@
36 */ 36 */
37 37
38#include "includes.h" 38#include "includes.h"
39RCSID("$OpenBSD: hostfile.c,v 1.31 2003/04/08 20:21:28 itojun Exp $"); 39RCSID("$OpenBSD: hostfile.c,v 1.32 2003/11/10 16:23:41 jakob Exp $");
40 40
41#include "packet.h" 41#include "packet.h"
42#include "match.h" 42#include "match.h"
@@ -72,7 +72,7 @@ hostfile_read_key(char **cpp, u_int *bitsp, Key *ret)
72} 72}
73 73
74static int 74static int
75hostfile_check_key(int bits, Key *key, const char *host, const char *filename, int linenum) 75hostfile_check_key(int bits, const Key *key, const char *host, const char *filename, int linenum)
76{ 76{
77 if (key == NULL || key->type != KEY_RSA1 || key->rsa == NULL) 77 if (key == NULL || key->type != KEY_RSA1 || key->rsa == NULL)
78 return 1; 78 return 1;
@@ -98,7 +98,7 @@ hostfile_check_key(int bits, Key *key, const char *host, const char *filename, i
98 98
99static HostStatus 99static HostStatus
100check_host_in_hostfile_by_key_or_type(const char *filename, 100check_host_in_hostfile_by_key_or_type(const char *filename,
101 const char *host, Key *key, int keytype, Key *found, int *numret) 101 const char *host, const Key *key, int keytype, Key *found, int *numret)
102{ 102{
103 FILE *f; 103 FILE *f;
104 char line[8192]; 104 char line[8192];
@@ -188,7 +188,7 @@ check_host_in_hostfile_by_key_or_type(const char *filename,
188} 188}
189 189
190HostStatus 190HostStatus
191check_host_in_hostfile(const char *filename, const char *host, Key *key, 191check_host_in_hostfile(const char *filename, const char *host, const Key *key,
192 Key *found, int *numret) 192 Key *found, int *numret)
193{ 193{
194 if (key == NULL) 194 if (key == NULL)
@@ -211,7 +211,7 @@ lookup_key_in_hostfile_by_type(const char *filename, const char *host,
211 */ 211 */
212 212
213int 213int
214add_host_to_hostfile(const char *filename, const char *host, Key *key) 214add_host_to_hostfile(const char *filename, const char *host, const Key *key)
215{ 215{
216 FILE *f; 216 FILE *f;
217 int success = 0; 217 int success = 0;
diff --git a/hostfile.h b/hostfile.h
index e3d116581..efcddc9f9 100644
--- a/hostfile.h
+++ b/hostfile.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: hostfile.h,v 1.13 2002/11/21 23:03:51 deraadt Exp $ */ 1/* $OpenBSD: hostfile.h,v 1.14 2003/11/10 16:23:41 jakob Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -20,8 +20,8 @@ typedef enum {
20 20
21int hostfile_read_key(char **, u_int *, Key *); 21int hostfile_read_key(char **, u_int *, Key *);
22HostStatus check_host_in_hostfile(const char *, const char *, 22HostStatus check_host_in_hostfile(const char *, const char *,
23 Key *, Key *, int *); 23 const Key *, Key *, int *);
24int add_host_to_hostfile(const char *, const char *, Key *); 24int add_host_to_hostfile(const char *, const char *, const Key *);
25int lookup_key_in_hostfile_by_type(const char *, const char *, 25int lookup_key_in_hostfile_by_type(const char *, const char *,
26 int, Key *, int *); 26 int, Key *, int *);
27 27
diff --git a/key.c b/key.c
index 54318cbbf..323e6ff84 100644
--- a/key.c
+++ b/key.c
@@ -32,7 +32,7 @@
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34#include "includes.h" 34#include "includes.h"
35RCSID("$OpenBSD: key.c,v 1.54 2003/07/09 13:58:19 avsm Exp $"); 35RCSID("$OpenBSD: key.c,v 1.55 2003/11/10 16:23:41 jakob Exp $");
36 36
37#include <openssl/evp.h> 37#include <openssl/evp.h>
38 38
@@ -143,8 +143,9 @@ key_free(Key *k)
143 } 143 }
144 xfree(k); 144 xfree(k);
145} 145}
146
146int 147int
147key_equal(Key *a, Key *b) 148key_equal(const Key *a, const Key *b)
148{ 149{
149 if (a == NULL || b == NULL || a->type != b->type) 150 if (a == NULL || b == NULL || a->type != b->type)
150 return 0; 151 return 0;
@@ -170,7 +171,8 @@ key_equal(Key *a, Key *b)
170} 171}
171 172
172u_char* 173u_char*
173key_fingerprint_raw(Key *k, enum fp_type dgst_type, u_int *dgst_raw_length) 174key_fingerprint_raw(const Key *k, enum fp_type dgst_type,
175 u_int *dgst_raw_length)
174{ 176{
175 const EVP_MD *md = NULL; 177 const EVP_MD *md = NULL;
176 EVP_MD_CTX ctx; 178 EVP_MD_CTX ctx;
@@ -292,7 +294,7 @@ key_fingerprint_bubblebabble(u_char *dgst_raw, u_int dgst_raw_len)
292} 294}
293 295
294char * 296char *
295key_fingerprint(Key *k, enum fp_type dgst_type, enum fp_rep dgst_rep) 297key_fingerprint(const Key *k, enum fp_type dgst_type, enum fp_rep dgst_rep)
296{ 298{
297 char *retval = NULL; 299 char *retval = NULL;
298 u_char *dgst_raw; 300 u_char *dgst_raw;
@@ -490,7 +492,7 @@ key_read(Key *ret, char **cpp)
490} 492}
491 493
492int 494int
493key_write(Key *key, FILE *f) 495key_write(const Key *key, FILE *f)
494{ 496{
495 int n, success = 0; 497 int n, success = 0;
496 u_int len, bits = 0; 498 u_int len, bits = 0;
@@ -522,8 +524,8 @@ key_write(Key *key, FILE *f)
522 return success; 524 return success;
523} 525}
524 526
525char * 527const char *
526key_type(Key *k) 528key_type(const Key *k)
527{ 529{
528 switch (k->type) { 530 switch (k->type) {
529 case KEY_RSA1: 531 case KEY_RSA1:
@@ -539,8 +541,8 @@ key_type(Key *k)
539 return "unknown"; 541 return "unknown";
540} 542}
541 543
542char * 544const char *
543key_ssh_name(Key *k) 545key_ssh_name(const Key *k)
544{ 546{
545 switch (k->type) { 547 switch (k->type) {
546 case KEY_RSA: 548 case KEY_RSA:
@@ -554,7 +556,7 @@ key_ssh_name(Key *k)
554} 556}
555 557
556u_int 558u_int
557key_size(Key *k) 559key_size(const Key *k)
558{ 560{
559 switch (k->type) { 561 switch (k->type) {
560 case KEY_RSA1: 562 case KEY_RSA1:
@@ -611,7 +613,7 @@ key_generate(int type, u_int bits)
611} 613}
612 614
613Key * 615Key *
614key_from_private(Key *k) 616key_from_private(const Key *k)
615{ 617{
616 Key *n = NULL; 618 Key *n = NULL;
617 switch (k->type) { 619 switch (k->type) {
@@ -676,7 +678,7 @@ key_names_valid2(const char *names)
676} 678}
677 679
678Key * 680Key *
679key_from_blob(u_char *blob, u_int blen) 681key_from_blob(const u_char *blob, u_int blen)
680{ 682{
681 Buffer b; 683 Buffer b;
682 char *ktype; 684 char *ktype;
@@ -726,7 +728,7 @@ key_from_blob(u_char *blob, u_int blen)
726} 728}
727 729
728int 730int
729key_to_blob(Key *key, u_char **blobp, u_int *lenp) 731key_to_blob(const Key *key, u_char **blobp, u_int *lenp)
730{ 732{
731 Buffer b; 733 Buffer b;
732 int len; 734 int len;
@@ -768,9 +770,9 @@ key_to_blob(Key *key, u_char **blobp, u_int *lenp)
768 770
769int 771int
770key_sign( 772key_sign(
771 Key *key, 773 const Key *key,
772 u_char **sigp, u_int *lenp, 774 u_char **sigp, u_int *lenp,
773 u_char *data, u_int datalen) 775 const u_char *data, u_int datalen)
774{ 776{
775 switch (key->type) { 777 switch (key->type) {
776 case KEY_DSA: 778 case KEY_DSA:
@@ -792,9 +794,9 @@ key_sign(
792 */ 794 */
793int 795int
794key_verify( 796key_verify(
795 Key *key, 797 const Key *key,
796 u_char *signature, u_int signaturelen, 798 const u_char *signature, u_int signaturelen,
797 u_char *data, u_int datalen) 799 const u_char *data, u_int datalen)
798{ 800{
799 if (signaturelen == 0) 801 if (signaturelen == 0)
800 return -1; 802 return -1;
@@ -815,7 +817,7 @@ key_verify(
815 817
816/* Converts a private to a public key */ 818/* Converts a private to a public key */
817Key * 819Key *
818key_demote(Key *k) 820key_demote(const Key *k)
819{ 821{
820 Key *pk; 822 Key *pk;
821 823
diff --git a/key.h b/key.h
index 28753fdfa..50df8500b 100644
--- a/key.h
+++ b/key.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: key.h,v 1.22 2003/06/24 08:23:46 markus Exp $ */ 1/* $OpenBSD: key.h,v 1.23 2003/11/10 16:23:41 jakob Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@@ -55,33 +55,33 @@ struct Key {
55 DSA *dsa; 55 DSA *dsa;
56}; 56};
57 57
58Key *key_new(int); 58Key *key_new(int);
59Key *key_new_private(int); 59Key *key_new_private(int);
60void key_free(Key *); 60void key_free(Key *);
61Key *key_demote(Key *); 61Key *key_demote(const Key *);
62int key_equal(Key *, Key *); 62int key_equal(const Key *, const Key *);
63char *key_fingerprint(Key *, enum fp_type, enum fp_rep); 63char *key_fingerprint(const Key *, enum fp_type, enum fp_rep);
64u_char *key_fingerprint_raw(Key *, enum fp_type, u_int *); 64u_char *key_fingerprint_raw(const Key *, enum fp_type, u_int *);
65char *key_type(Key *); 65const char *key_type(const Key *);
66int key_write(Key *, FILE *); 66int key_write(const Key *, FILE *);
67int key_read(Key *, char **); 67int key_read(Key *, char **);
68u_int key_size(Key *); 68u_int key_size(const Key *);
69 69
70Key *key_generate(int, u_int); 70Key *key_generate(int, u_int);
71Key *key_from_private(Key *); 71Key *key_from_private(const Key *);
72int key_type_from_name(char *); 72int key_type_from_name(char *);
73 73
74Key *key_from_blob(u_char *, u_int); 74Key *key_from_blob(const u_char *, u_int);
75int key_to_blob(Key *, u_char **, u_int *); 75int key_to_blob(const Key *, u_char **, u_int *);
76char *key_ssh_name(Key *); 76const char *key_ssh_name(const Key *);
77int key_names_valid2(const char *); 77int key_names_valid2(const char *);
78 78
79int key_sign(Key *, u_char **, u_int *, u_char *, u_int); 79int key_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
80int key_verify(Key *, u_char *, u_int, u_char *, u_int); 80int key_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
81 81
82int ssh_dss_sign(Key *, u_char **, u_int *, u_char *, u_int); 82int ssh_dss_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
83int ssh_dss_verify(Key *, u_char *, u_int, u_char *, u_int); 83int ssh_dss_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
84int ssh_rsa_sign(Key *, u_char **, u_int *, u_char *, u_int); 84int ssh_rsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
85int ssh_rsa_verify(Key *, u_char *, u_int, u_char *, u_int); 85int ssh_rsa_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
86 86
87#endif 87#endif
diff --git a/sftp-common.c b/sftp-common.c
index 5313b134d..4cea3c305 100644
--- a/sftp-common.c
+++ b/sftp-common.c
@@ -24,7 +24,7 @@
24 */ 24 */
25 25
26#include "includes.h" 26#include "includes.h"
27RCSID("$OpenBSD: sftp-common.c,v 1.9 2003/05/24 09:30:40 djm Exp $"); 27RCSID("$OpenBSD: sftp-common.c,v 1.10 2003/11/10 16:23:41 jakob Exp $");
28 28
29#include "buffer.h" 29#include "buffer.h"
30#include "bufaux.h" 30#include "bufaux.h"
@@ -49,7 +49,7 @@ attrib_clear(Attrib *a)
49 49
50/* Convert from struct stat to filexfer attribs */ 50/* Convert from struct stat to filexfer attribs */
51void 51void
52stat_to_attrib(struct stat *st, Attrib *a) 52stat_to_attrib(const struct stat *st, Attrib *a)
53{ 53{
54 attrib_clear(a); 54 attrib_clear(a);
55 a->flags = 0; 55 a->flags = 0;
@@ -67,7 +67,7 @@ stat_to_attrib(struct stat *st, Attrib *a)
67 67
68/* Convert from filexfer attribs to struct stat */ 68/* Convert from filexfer attribs to struct stat */
69void 69void
70attrib_to_stat(Attrib *a, struct stat *st) 70attrib_to_stat(const Attrib *a, struct stat *st)
71{ 71{
72 memset(st, 0, sizeof(*st)); 72 memset(st, 0, sizeof(*st));
73 73
@@ -124,7 +124,7 @@ decode_attrib(Buffer *b)
124 124
125/* Encode attributes to buffer */ 125/* Encode attributes to buffer */
126void 126void
127encode_attrib(Buffer *b, Attrib *a) 127encode_attrib(Buffer *b, const Attrib *a)
128{ 128{
129 buffer_put_int(b, a->flags); 129 buffer_put_int(b, a->flags);
130 if (a->flags & SSH2_FILEXFER_ATTR_SIZE) 130 if (a->flags & SSH2_FILEXFER_ATTR_SIZE)
@@ -174,7 +174,7 @@ fx2txt(int status)
174 * drwxr-xr-x 5 markus markus 1024 Jan 13 18:39 .ssh 174 * drwxr-xr-x 5 markus markus 1024 Jan 13 18:39 .ssh
175 */ 175 */
176char * 176char *
177ls_file(char *name, struct stat *st, int remote) 177ls_file(const char *name, const struct stat *st, int remote)
178{ 178{
179 int ulen, glen, sz = 0; 179 int ulen, glen, sz = 0;
180 struct passwd *pw; 180 struct passwd *pw;
diff --git a/sftp-common.h b/sftp-common.h
index 201611cc4..b42ba9140 100644
--- a/sftp-common.h
+++ b/sftp-common.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-common.h,v 1.4 2002/09/11 22:41:50 djm Exp $ */ 1/* $OpenBSD: sftp-common.h,v 1.5 2003/11/10 16:23:41 jakob Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -39,10 +39,10 @@ struct Attrib {
39}; 39};
40 40
41void attrib_clear(Attrib *); 41void attrib_clear(Attrib *);
42void stat_to_attrib(struct stat *, Attrib *); 42void stat_to_attrib(const struct stat *, Attrib *);
43void attrib_to_stat(Attrib *, struct stat *); 43void attrib_to_stat(const Attrib *, struct stat *);
44Attrib *decode_attrib(Buffer *); 44Attrib *decode_attrib(Buffer *);
45void encode_attrib(Buffer *, Attrib *); 45void encode_attrib(Buffer *, const Attrib *);
46char *ls_file(char *, struct stat *, int); 46char *ls_file(const char *, const struct stat *, int);
47 47
48const char *fx2txt(int); 48const char *fx2txt(int);
diff --git a/sftp-server.c b/sftp-server.c
index 9166853ed..d528a1d6e 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.43 2003/06/25 22:39:36 miod Exp $"); 25RCSID("$OpenBSD: sftp-server.c,v 1.44 2003/11/10 16:23:41 jakob Exp $");
26 26
27#include "buffer.h" 27#include "buffer.h"
28#include "bufaux.h" 28#include "bufaux.h"
@@ -149,7 +149,7 @@ handle_init(void)
149} 149}
150 150
151static int 151static int
152handle_new(int use, char *name, int fd, DIR *dirp) 152handle_new(int use, const char *name, int fd, DIR *dirp)
153{ 153{
154 int i; 154 int i;
155 155
@@ -184,7 +184,7 @@ handle_to_string(int handle, char **stringp, int *hlenp)
184} 184}
185 185
186static int 186static int
187handle_from_string(char *handle, u_int hlen) 187handle_from_string(const char *handle, u_int hlen)
188{ 188{
189 int val; 189 int val;
190 190
@@ -298,7 +298,7 @@ send_status(u_int32_t id, u_int32_t error)
298 buffer_free(&msg); 298 buffer_free(&msg);
299} 299}
300static void 300static void
301send_data_or_handle(char type, u_int32_t id, char *data, int dlen) 301send_data_or_handle(char type, u_int32_t id, const char *data, int dlen)
302{ 302{
303 Buffer msg; 303 Buffer msg;
304 304
@@ -311,7 +311,7 @@ send_data_or_handle(char type, u_int32_t id, char *data, int dlen)
311} 311}
312 312
313static void 313static void
314send_data(u_int32_t id, char *data, int dlen) 314send_data(u_int32_t id, const char *data, int dlen)
315{ 315{
316 TRACE("sent data id %u len %d", id, dlen); 316 TRACE("sent data id %u len %d", id, dlen);
317 send_data_or_handle(SSH2_FXP_DATA, id, data, dlen); 317 send_data_or_handle(SSH2_FXP_DATA, id, data, dlen);
@@ -330,7 +330,7 @@ send_handle(u_int32_t id, int handle)
330} 330}
331 331
332static void 332static void
333send_names(u_int32_t id, int count, Stat *stats) 333send_names(u_int32_t id, int count, const Stat *stats)
334{ 334{
335 Buffer msg; 335 Buffer msg;
336 int i; 336 int i;
@@ -350,7 +350,7 @@ send_names(u_int32_t id, int count, Stat *stats)
350} 350}
351 351
352static void 352static void
353send_attrib(u_int32_t id, Attrib *a) 353send_attrib(u_int32_t id, const Attrib *a)
354{ 354{
355 Buffer msg; 355 Buffer msg;
356 356
@@ -567,7 +567,7 @@ process_fstat(void)
567} 567}
568 568
569static struct timeval * 569static struct timeval *
570attrib_to_tv(Attrib *a) 570attrib_to_tv(const Attrib *a)
571{ 571{
572 static struct timeval tv[2]; 572 static struct timeval tv[2];
573 573
diff --git a/ssh-dss.c b/ssh-dss.c
index 6cedcc4dc..381b7dedb 100644
--- a/ssh-dss.c
+++ b/ssh-dss.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: ssh-dss.c,v 1.18 2003/02/12 09:33:04 markus Exp $"); 26RCSID("$OpenBSD: ssh-dss.c,v 1.19 2003/11/10 16:23:41 jakob Exp $");
27 27
28#include <openssl/bn.h> 28#include <openssl/bn.h>
29#include <openssl/evp.h> 29#include <openssl/evp.h>
@@ -39,8 +39,8 @@ RCSID("$OpenBSD: ssh-dss.c,v 1.18 2003/02/12 09:33:04 markus Exp $");
39#define SIGBLOB_LEN (2*INTBLOB_LEN) 39#define SIGBLOB_LEN (2*INTBLOB_LEN)
40 40
41int 41int
42ssh_dss_sign(Key *key, u_char **sigp, u_int *lenp, 42ssh_dss_sign(const Key *key, u_char **sigp, u_int *lenp,
43 u_char *data, u_int datalen) 43 const u_char *data, u_int datalen)
44{ 44{
45 DSA_SIG *sig; 45 DSA_SIG *sig;
46 const EVP_MD *evp_md = EVP_sha1(); 46 const EVP_MD *evp_md = EVP_sha1();
@@ -101,8 +101,8 @@ ssh_dss_sign(Key *key, u_char **sigp, u_int *lenp,
101 return 0; 101 return 0;
102} 102}
103int 103int
104ssh_dss_verify(Key *key, u_char *signature, u_int signaturelen, 104ssh_dss_verify(const Key *key, const u_char *signature, u_int signaturelen,
105 u_char *data, u_int datalen) 105 const u_char *data, u_int datalen)
106{ 106{
107 DSA_SIG *sig; 107 DSA_SIG *sig;
108 const EVP_MD *evp_md = EVP_sha1(); 108 const EVP_MD *evp_md = EVP_sha1();
@@ -119,7 +119,8 @@ ssh_dss_verify(Key *key, u_char *signature, u_int signaturelen,
119 119
120 /* fetch signature */ 120 /* fetch signature */
121 if (datafellows & SSH_BUG_SIGBLOB) { 121 if (datafellows & SSH_BUG_SIGBLOB) {
122 sigblob = signature; 122 sigblob = xmalloc(signaturelen);
123 memcpy(sigblob, signature, signaturelen);
123 len = signaturelen; 124 len = signaturelen;
124 } else { 125 } else {
125 /* ietf-drafts */ 126 /* ietf-drafts */
@@ -159,10 +160,9 @@ ssh_dss_verify(Key *key, u_char *signature, u_int signaturelen,
159 BN_bin2bn(sigblob, INTBLOB_LEN, sig->r); 160 BN_bin2bn(sigblob, INTBLOB_LEN, sig->r);
160 BN_bin2bn(sigblob+ INTBLOB_LEN, INTBLOB_LEN, sig->s); 161 BN_bin2bn(sigblob+ INTBLOB_LEN, INTBLOB_LEN, sig->s);
161 162
162 if (!(datafellows & SSH_BUG_SIGBLOB)) { 163 /* clean up */
163 memset(sigblob, 0, len); 164 memset(sigblob, 0, len);
164 xfree(sigblob); 165 xfree(sigblob);
165 }
166 166
167 /* sha1 the data */ 167 /* sha1 the data */
168 EVP_DigestInit(&md, evp_md); 168 EVP_DigestInit(&md, evp_md);
diff --git a/ssh-rsa.c b/ssh-rsa.c
index 53e5023f7..6e3be0a7e 100644
--- a/ssh-rsa.c
+++ b/ssh-rsa.c
@@ -14,7 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16#include "includes.h" 16#include "includes.h"
17RCSID("$OpenBSD: ssh-rsa.c,v 1.30 2003/06/18 11:28:11 markus Exp $"); 17RCSID("$OpenBSD: ssh-rsa.c,v 1.31 2003/11/10 16:23:41 jakob Exp $");
18 18
19#include <openssl/evp.h> 19#include <openssl/evp.h>
20#include <openssl/err.h> 20#include <openssl/err.h>
@@ -31,8 +31,8 @@ static int openssh_RSA_verify(int, u_char *, u_int, u_char *, u_int, RSA *);
31 31
32/* RSASSA-PKCS1-v1_5 (PKCS #1 v2.0 signature) with SHA1 */ 32/* RSASSA-PKCS1-v1_5 (PKCS #1 v2.0 signature) with SHA1 */
33int 33int
34ssh_rsa_sign(Key *key, u_char **sigp, u_int *lenp, 34ssh_rsa_sign(const Key *key, u_char **sigp, u_int *lenp,
35 u_char *data, u_int datalen) 35 const u_char *data, u_int datalen)
36{ 36{
37 const EVP_MD *evp_md; 37 const EVP_MD *evp_md;
38 EVP_MD_CTX md; 38 EVP_MD_CTX md;
@@ -96,8 +96,8 @@ ssh_rsa_sign(Key *key, u_char **sigp, u_int *lenp,
96} 96}
97 97
98int 98int
99ssh_rsa_verify(Key *key, u_char *signature, u_int signaturelen, 99ssh_rsa_verify(const Key *key, const u_char *signature, u_int signaturelen,
100 u_char *data, u_int datalen) 100 const u_char *data, u_int datalen)
101{ 101{
102 Buffer b; 102 Buffer b;
103 const EVP_MD *evp_md; 103 const EVP_MD *evp_md;
diff --git a/sshconnect.c b/sshconnect.c
index 55ebd7ef2..bf8c23d73 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: sshconnect.c,v 1.151 2003/11/03 09:37:32 jakob Exp $"); 16RCSID("$OpenBSD: sshconnect.c,v 1.152 2003/11/10 16:23:41 jakob Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19 19
@@ -563,7 +563,7 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key,
563 int readonly, const char *user_hostfile, const char *system_hostfile) 563 int readonly, const char *user_hostfile, const char *system_hostfile)
564{ 564{
565 Key *file_key; 565 Key *file_key;
566 char *type = key_type(host_key); 566 const char *type = key_type(host_key);
567 char *ip = NULL; 567 char *ip = NULL;
568 char hostline[1000], *hostp, *fp; 568 char hostline[1000], *hostp, *fp;
569 HostStatus host_status; 569 HostStatus host_status;
diff --git a/sshd.c b/sshd.c
index 7d97c92de..a9001a040 100644
--- a/sshd.c
+++ b/sshd.c
@@ -42,7 +42,7 @@
42 */ 42 */
43 43
44#include "includes.h" 44#include "includes.h"
45RCSID("$OpenBSD: sshd.c,v 1.280 2003/10/02 10:41:59 markus Exp $"); 45RCSID("$OpenBSD: sshd.c,v 1.281 2003/11/10 16:23:41 jakob Exp $");
46 46
47#include <openssl/dh.h> 47#include <openssl/dh.h>
48#include <openssl/bn.h> 48#include <openssl/bn.h>
@@ -668,7 +668,8 @@ static char *
668list_hostkey_types(void) 668list_hostkey_types(void)
669{ 669{
670 Buffer b; 670 Buffer b;
671 char *p; 671 const char *p;
672 char *ret;
672 int i; 673 int i;
673 674
674 buffer_init(&b); 675 buffer_init(&b);
@@ -687,10 +688,10 @@ list_hostkey_types(void)
687 } 688 }
688 } 689 }
689 buffer_append(&b, "\0", 1); 690 buffer_append(&b, "\0", 1);
690 p = xstrdup(buffer_ptr(&b)); 691 ret = xstrdup(buffer_ptr(&b));
691 buffer_free(&b); 692 buffer_free(&b);
692 debug("list_hostkey_types: %s", p); 693 debug("list_hostkey_types: %s", ret);
693 return p; 694 return ret;
694} 695}
695 696
696Key * 697Key *
diff --git a/uuencode.c b/uuencode.c
index 21eaf4d3f..0a7c8d16a 100644
--- a/uuencode.c
+++ b/uuencode.c
@@ -23,13 +23,13 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: uuencode.c,v 1.16 2002/09/09 14:54:15 markus Exp $"); 26RCSID("$OpenBSD: uuencode.c,v 1.17 2003/11/10 16:23:41 jakob Exp $");
27 27
28#include "xmalloc.h" 28#include "xmalloc.h"
29#include "uuencode.h" 29#include "uuencode.h"
30 30
31int 31int
32uuencode(u_char *src, u_int srclength, 32uuencode(const u_char *src, u_int srclength,
33 char *target, size_t targsize) 33 char *target, size_t targsize)
34{ 34{
35 return __b64_ntop(src, srclength, target, targsize); 35 return __b64_ntop(src, srclength, target, targsize);
diff --git a/uuencode.h b/uuencode.h
index 682b623ac..08e87c4bc 100644
--- a/uuencode.h
+++ b/uuencode.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: uuencode.h,v 1.9 2002/02/25 16:33:27 markus Exp $ */ 1/* $OpenBSD: uuencode.h,v 1.10 2003/11/10 16:23:41 jakob Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000 Markus Friedl. All rights reserved.
@@ -26,7 +26,7 @@
26 26
27#ifndef UUENCODE_H 27#ifndef UUENCODE_H
28#define UUENCODE_H 28#define UUENCODE_H
29int uuencode(u_char *, u_int, char *, size_t); 29int uuencode(const u_char *, u_int, char *, size_t);
30int uudecode(const char *, u_char *, size_t); 30int uudecode(const char *, u_char *, size_t);
31void dump_base64(FILE *, u_char *, u_int); 31void dump_base64(FILE *, u_char *, u_int);
32#endif 32#endif