diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | bufaux.c | 6 | ||||
-rw-r--r-- | bufaux.h | 6 | ||||
-rw-r--r-- | cipher.c | 12 | ||||
-rw-r--r-- | cipher.h | 12 | ||||
-rw-r--r-- | hostfile.c | 10 | ||||
-rw-r--r-- | hostfile.h | 6 | ||||
-rw-r--r-- | key.c | 40 | ||||
-rw-r--r-- | key.h | 46 | ||||
-rw-r--r-- | sftp-common.c | 10 | ||||
-rw-r--r-- | sftp-common.h | 10 | ||||
-rw-r--r-- | sftp-server.c | 16 | ||||
-rw-r--r-- | ssh-dss.c | 20 | ||||
-rw-r--r-- | ssh-rsa.c | 10 | ||||
-rw-r--r-- | sshconnect.c | 4 | ||||
-rw-r--r-- | sshd.c | 11 | ||||
-rw-r--r-- | uuencode.c | 4 | ||||
-rw-r--r-- | uuencode.h | 4 |
18 files changed, 121 insertions, 113 deletions
@@ -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 | ||
27 | 20031115 | 32 | 20031115 |
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 $ |
@@ -37,7 +37,7 @@ | |||
37 | */ | 37 | */ |
38 | 38 | ||
39 | #include "includes.h" | 39 | #include "includes.h" |
40 | RCSID("$OpenBSD: bufaux.c,v 1.30 2003/09/18 13:02:21 miod Exp $"); | 40 | RCSID("$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 | */ |
52 | void | 52 | void |
53 | buffer_put_bignum(Buffer *buffer, BIGNUM *value) | 53 | buffer_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 | */ |
103 | void | 103 | void |
104 | buffer_put_bignum2(Buffer *buffer, BIGNUM *value) | 104 | buffer_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); |
@@ -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 | ||
21 | void buffer_put_bignum(Buffer *, BIGNUM *); | 21 | void buffer_put_bignum(Buffer *, const BIGNUM *); |
22 | void buffer_put_bignum2(Buffer *, BIGNUM *); | 22 | void buffer_put_bignum2(Buffer *, const BIGNUM *); |
23 | void buffer_get_bignum(Buffer *, BIGNUM *); | 23 | void buffer_get_bignum(Buffer *, BIGNUM *); |
24 | void buffer_get_bignum2(Buffer *, BIGNUM *); | 24 | void buffer_get_bignum2(Buffer *, BIGNUM *); |
25 | 25 | ||
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$OpenBSD: cipher.c,v 1.65 2003/05/17 04:27:52 markus Exp $"); | 38 | RCSID("$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 | ||
101 | u_int | 101 | u_int |
102 | cipher_blocksize(Cipher *c) | 102 | cipher_blocksize(const Cipher *c) |
103 | { | 103 | { |
104 | return (c->block_size); | 104 | return (c->block_size); |
105 | } | 105 | } |
106 | 106 | ||
107 | u_int | 107 | u_int |
108 | cipher_keylen(Cipher *c) | 108 | cipher_keylen(const Cipher *c) |
109 | { | 109 | { |
110 | return (c->key_len); | 110 | return (c->key_len); |
111 | } | 111 | } |
112 | 112 | ||
113 | u_int | 113 | u_int |
114 | cipher_get_number(Cipher *c) | 114 | cipher_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 | ||
313 | int | 313 | int |
314 | cipher_get_keyiv_len(CipherContext *cc) | 314 | cipher_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 | ||
399 | int | 399 | int |
400 | cipher_get_keycontext(CipherContext *cc, u_char *dat) | 400 | cipher_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; |
@@ -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, | |||
79 | void cipher_crypt(CipherContext *, u_char *, const u_char *, u_int); | 79 | void cipher_crypt(CipherContext *, u_char *, const u_char *, u_int); |
80 | void cipher_cleanup(CipherContext *); | 80 | void cipher_cleanup(CipherContext *); |
81 | void cipher_set_key_string(CipherContext *, Cipher *, const char *, int); | 81 | void cipher_set_key_string(CipherContext *, Cipher *, const char *, int); |
82 | u_int cipher_blocksize(Cipher *); | 82 | u_int cipher_blocksize(const Cipher *); |
83 | u_int cipher_keylen(Cipher *); | 83 | u_int cipher_keylen(const Cipher *); |
84 | 84 | ||
85 | u_int cipher_get_number(Cipher *); | 85 | u_int cipher_get_number(const Cipher *); |
86 | void cipher_get_keyiv(CipherContext *, u_char *, u_int); | 86 | void cipher_get_keyiv(CipherContext *, u_char *, u_int); |
87 | void cipher_set_keyiv(CipherContext *, u_char *); | 87 | void cipher_set_keyiv(CipherContext *, u_char *); |
88 | int cipher_get_keyiv_len(CipherContext *); | 88 | int cipher_get_keyiv_len(const CipherContext *); |
89 | int cipher_get_keycontext(CipherContext *, u_char *); | 89 | int cipher_get_keycontext(const CipherContext *, u_char *); |
90 | void cipher_set_keycontext(CipherContext *, u_char *); | 90 | void 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" |
39 | RCSID("$OpenBSD: hostfile.c,v 1.31 2003/04/08 20:21:28 itojun Exp $"); | 39 | RCSID("$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 | ||
74 | static int | 74 | static int |
75 | hostfile_check_key(int bits, Key *key, const char *host, const char *filename, int linenum) | 75 | hostfile_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 | ||
99 | static HostStatus | 99 | static HostStatus |
100 | check_host_in_hostfile_by_key_or_type(const char *filename, | 100 | check_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 | ||
190 | HostStatus | 190 | HostStatus |
191 | check_host_in_hostfile(const char *filename, const char *host, Key *key, | 191 | check_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 | ||
213 | int | 213 | int |
214 | add_host_to_hostfile(const char *filename, const char *host, Key *key) | 214 | add_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 | ||
21 | int hostfile_read_key(char **, u_int *, Key *); | 21 | int hostfile_read_key(char **, u_int *, Key *); |
22 | HostStatus check_host_in_hostfile(const char *, const char *, | 22 | HostStatus check_host_in_hostfile(const char *, const char *, |
23 | Key *, Key *, int *); | 23 | const Key *, Key *, int *); |
24 | int add_host_to_hostfile(const char *, const char *, Key *); | 24 | int add_host_to_hostfile(const char *, const char *, const Key *); |
25 | int lookup_key_in_hostfile_by_type(const char *, const char *, | 25 | int lookup_key_in_hostfile_by_type(const char *, const char *, |
26 | int, Key *, int *); | 26 | int, Key *, int *); |
27 | 27 | ||
@@ -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" |
35 | RCSID("$OpenBSD: key.c,v 1.54 2003/07/09 13:58:19 avsm Exp $"); | 35 | RCSID("$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 | |||
146 | int | 147 | int |
147 | key_equal(Key *a, Key *b) | 148 | key_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 | ||
172 | u_char* | 173 | u_char* |
173 | key_fingerprint_raw(Key *k, enum fp_type dgst_type, u_int *dgst_raw_length) | 174 | key_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 | ||
294 | char * | 296 | char * |
295 | key_fingerprint(Key *k, enum fp_type dgst_type, enum fp_rep dgst_rep) | 297 | key_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 | ||
492 | int | 494 | int |
493 | key_write(Key *key, FILE *f) | 495 | key_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 | ||
525 | char * | 527 | const char * |
526 | key_type(Key *k) | 528 | key_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 | ||
542 | char * | 544 | const char * |
543 | key_ssh_name(Key *k) | 545 | key_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 | ||
556 | u_int | 558 | u_int |
557 | key_size(Key *k) | 559 | key_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 | ||
613 | Key * | 615 | Key * |
614 | key_from_private(Key *k) | 616 | key_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 | ||
678 | Key * | 680 | Key * |
679 | key_from_blob(u_char *blob, u_int blen) | 681 | key_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 | ||
728 | int | 730 | int |
729 | key_to_blob(Key *key, u_char **blobp, u_int *lenp) | 731 | key_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 | ||
769 | int | 771 | int |
770 | key_sign( | 772 | key_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 | */ |
793 | int | 795 | int |
794 | key_verify( | 796 | key_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 */ |
817 | Key * | 819 | Key * |
818 | key_demote(Key *k) | 820 | key_demote(const Key *k) |
819 | { | 821 | { |
820 | Key *pk; | 822 | Key *pk; |
821 | 823 | ||
@@ -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 | ||
58 | Key *key_new(int); | 58 | Key *key_new(int); |
59 | Key *key_new_private(int); | 59 | Key *key_new_private(int); |
60 | void key_free(Key *); | 60 | void key_free(Key *); |
61 | Key *key_demote(Key *); | 61 | Key *key_demote(const Key *); |
62 | int key_equal(Key *, Key *); | 62 | int key_equal(const Key *, const Key *); |
63 | char *key_fingerprint(Key *, enum fp_type, enum fp_rep); | 63 | char *key_fingerprint(const Key *, enum fp_type, enum fp_rep); |
64 | u_char *key_fingerprint_raw(Key *, enum fp_type, u_int *); | 64 | u_char *key_fingerprint_raw(const Key *, enum fp_type, u_int *); |
65 | char *key_type(Key *); | 65 | const char *key_type(const Key *); |
66 | int key_write(Key *, FILE *); | 66 | int key_write(const Key *, FILE *); |
67 | int key_read(Key *, char **); | 67 | int key_read(Key *, char **); |
68 | u_int key_size(Key *); | 68 | u_int key_size(const Key *); |
69 | 69 | ||
70 | Key *key_generate(int, u_int); | 70 | Key *key_generate(int, u_int); |
71 | Key *key_from_private(Key *); | 71 | Key *key_from_private(const Key *); |
72 | int key_type_from_name(char *); | 72 | int key_type_from_name(char *); |
73 | 73 | ||
74 | Key *key_from_blob(u_char *, u_int); | 74 | Key *key_from_blob(const u_char *, u_int); |
75 | int key_to_blob(Key *, u_char **, u_int *); | 75 | int key_to_blob(const Key *, u_char **, u_int *); |
76 | char *key_ssh_name(Key *); | 76 | const char *key_ssh_name(const Key *); |
77 | int key_names_valid2(const char *); | 77 | int key_names_valid2(const char *); |
78 | 78 | ||
79 | int key_sign(Key *, u_char **, u_int *, u_char *, u_int); | 79 | int key_sign(const Key *, u_char **, u_int *, const u_char *, u_int); |
80 | int key_verify(Key *, u_char *, u_int, u_char *, u_int); | 80 | int key_verify(const Key *, const u_char *, u_int, const u_char *, u_int); |
81 | 81 | ||
82 | int ssh_dss_sign(Key *, u_char **, u_int *, u_char *, u_int); | 82 | int ssh_dss_sign(const Key *, u_char **, u_int *, const u_char *, u_int); |
83 | int ssh_dss_verify(Key *, u_char *, u_int, u_char *, u_int); | 83 | int ssh_dss_verify(const Key *, const u_char *, u_int, const u_char *, u_int); |
84 | int ssh_rsa_sign(Key *, u_char **, u_int *, u_char *, u_int); | 84 | int ssh_rsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int); |
85 | int ssh_rsa_verify(Key *, u_char *, u_int, u_char *, u_int); | 85 | int 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" |
27 | RCSID("$OpenBSD: sftp-common.c,v 1.9 2003/05/24 09:30:40 djm Exp $"); | 27 | RCSID("$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 */ |
51 | void | 51 | void |
52 | stat_to_attrib(struct stat *st, Attrib *a) | 52 | stat_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 */ |
69 | void | 69 | void |
70 | attrib_to_stat(Attrib *a, struct stat *st) | 70 | attrib_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 */ |
126 | void | 126 | void |
127 | encode_attrib(Buffer *b, Attrib *a) | 127 | encode_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 | */ |
176 | char * | 176 | char * |
177 | ls_file(char *name, struct stat *st, int remote) | 177 | ls_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 | ||
41 | void attrib_clear(Attrib *); | 41 | void attrib_clear(Attrib *); |
42 | void stat_to_attrib(struct stat *, Attrib *); | 42 | void stat_to_attrib(const struct stat *, Attrib *); |
43 | void attrib_to_stat(Attrib *, struct stat *); | 43 | void attrib_to_stat(const Attrib *, struct stat *); |
44 | Attrib *decode_attrib(Buffer *); | 44 | Attrib *decode_attrib(Buffer *); |
45 | void encode_attrib(Buffer *, Attrib *); | 45 | void encode_attrib(Buffer *, const Attrib *); |
46 | char *ls_file(char *, struct stat *, int); | 46 | char *ls_file(const char *, const struct stat *, int); |
47 | 47 | ||
48 | const char *fx2txt(int); | 48 | const 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" |
25 | RCSID("$OpenBSD: sftp-server.c,v 1.43 2003/06/25 22:39:36 miod Exp $"); | 25 | RCSID("$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 | ||
151 | static int | 151 | static int |
152 | handle_new(int use, char *name, int fd, DIR *dirp) | 152 | handle_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 | ||
186 | static int | 186 | static int |
187 | handle_from_string(char *handle, u_int hlen) | 187 | handle_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 | } |
300 | static void | 300 | static void |
301 | send_data_or_handle(char type, u_int32_t id, char *data, int dlen) | 301 | send_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 | ||
313 | static void | 313 | static void |
314 | send_data(u_int32_t id, char *data, int dlen) | 314 | send_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 | ||
332 | static void | 332 | static void |
333 | send_names(u_int32_t id, int count, Stat *stats) | 333 | send_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 | ||
352 | static void | 352 | static void |
353 | send_attrib(u_int32_t id, Attrib *a) | 353 | send_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 | ||
569 | static struct timeval * | 569 | static struct timeval * |
570 | attrib_to_tv(Attrib *a) | 570 | attrib_to_tv(const Attrib *a) |
571 | { | 571 | { |
572 | static struct timeval tv[2]; | 572 | static struct timeval tv[2]; |
573 | 573 | ||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: ssh-dss.c,v 1.18 2003/02/12 09:33:04 markus Exp $"); | 26 | RCSID("$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 | ||
41 | int | 41 | int |
42 | ssh_dss_sign(Key *key, u_char **sigp, u_int *lenp, | 42 | ssh_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 | } |
103 | int | 103 | int |
104 | ssh_dss_verify(Key *key, u_char *signature, u_int signaturelen, | 104 | ssh_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); |
@@ -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" |
17 | RCSID("$OpenBSD: ssh-rsa.c,v 1.30 2003/06/18 11:28:11 markus Exp $"); | 17 | RCSID("$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 */ |
33 | int | 33 | int |
34 | ssh_rsa_sign(Key *key, u_char **sigp, u_int *lenp, | 34 | ssh_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 | ||
98 | int | 98 | int |
99 | ssh_rsa_verify(Key *key, u_char *signature, u_int signaturelen, | 99 | ssh_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" |
16 | RCSID("$OpenBSD: sshconnect.c,v 1.151 2003/11/03 09:37:32 jakob Exp $"); | 16 | RCSID("$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; |
@@ -42,7 +42,7 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include "includes.h" | 44 | #include "includes.h" |
45 | RCSID("$OpenBSD: sshd.c,v 1.280 2003/10/02 10:41:59 markus Exp $"); | 45 | RCSID("$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 * | |||
668 | list_hostkey_types(void) | 668 | list_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 | ||
696 | Key * | 697 | Key * |
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" |
26 | RCSID("$OpenBSD: uuencode.c,v 1.16 2002/09/09 14:54:15 markus Exp $"); | 26 | RCSID("$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 | ||
31 | int | 31 | int |
32 | uuencode(u_char *src, u_int srclength, | 32 | uuencode(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 |
29 | int uuencode(u_char *, u_int, char *, size_t); | 29 | int uuencode(const u_char *, u_int, char *, size_t); |
30 | int uudecode(const char *, u_char *, size_t); | 30 | int uudecode(const char *, u_char *, size_t); |
31 | void dump_base64(FILE *, u_char *, u_int); | 31 | void dump_base64(FILE *, u_char *, u_int); |
32 | #endif | 32 | #endif |