summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--auth1.c10
-rw-r--r--kexdh.c10
-rw-r--r--kexgex.c14
-rw-r--r--packet.c10
-rw-r--r--packet.h6
-rw-r--r--sshconnect1.c28
-rw-r--r--sshd.c6
8 files changed, 47 insertions, 46 deletions
diff --git a/ChangeLog b/ChangeLog
index 8e6c98876..ce8664d9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -56,8 +56,13 @@
56 [serverloop.c session.c ssh.c sshconnect1.c sshd.c ttymodes.c] 56 [serverloop.c session.c ssh.c sshconnect1.c sshd.c ttymodes.c]
57 get rid of packet_integrity_check, use packet_done() instead. 57 get rid of packet_integrity_check, use packet_done() instead.
58 - markus@cvs.openbsd.org 2001/12/28 12:14:27 58 - markus@cvs.openbsd.org 2001/12/28 12:14:27
59 [auth1.c auth2.c auth2-chall.c auth-rsa.c channels.c clientloop.c kex.c kexdh.c kexgex.c packet.c packet.h serverloop.c session.c ssh.c sshconnect1.c sshconnect2.c sshd.c] 59 [auth1.c auth2.c auth2-chall.c auth-rsa.c channels.c clientloop.c]
60 [kex.c kexdh.c kexgex.c packet.c packet.h serverloop.c session.c]
61 [ssh.c sshconnect1.c sshconnect2.c sshd.c]
60 s/packet_done/packet_check_eom/ (end-of-message); ok djm@ 62 s/packet_done/packet_check_eom/ (end-of-message); ok djm@
63 - markus@cvs.openbsd.org 2001/12/28 13:57:33
64 [auth1.c kexdh.c kexgex.c packet.c packet.h sshconnect1.c sshd.c]
65 packet_get_bignum* no longer returns a size
61 66
62 67
6320020121 6820020121
@@ -7206,4 +7211,4 @@
7206 - Wrote replacements for strlcpy and mkdtemp 7211 - Wrote replacements for strlcpy and mkdtemp
7207 - Released 1.0pre1 7212 - Released 1.0pre1
7208 7213
7209$Id: ChangeLog,v 1.1740 2002/01/22 12:14:10 djm Exp $ 7214$Id: ChangeLog,v 1.1741 2002/01/22 12:14:44 djm Exp $
diff --git a/auth1.c b/auth1.c
index 42524cc96..6585fa7c5 100644
--- a/auth1.c
+++ b/auth1.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include "includes.h" 12#include "includes.h"
13RCSID("$OpenBSD: auth1.c,v 1.32 2001/12/28 12:14:27 markus Exp $"); 13RCSID("$OpenBSD: auth1.c,v 1.33 2001/12/28 13:57:33 markus Exp $");
14 14
15#include "xmalloc.h" 15#include "xmalloc.h"
16#include "rsa.h" 16#include "rsa.h"
@@ -71,7 +71,7 @@ do_authloop(Authctxt *authctxt)
71 char *client_user, *password; 71 char *client_user, *password;
72 char info[1024]; 72 char info[1024];
73 u_int dlen; 73 u_int dlen;
74 int plen, nlen, elen; 74 int plen;
75 u_int ulen; 75 u_int ulen;
76 int type = 0; 76 int type = 0;
77 struct passwd *pw = authctxt->pw; 77 struct passwd *pw = authctxt->pw;
@@ -203,8 +203,8 @@ do_authloop(Authctxt *authctxt)
203 /* Get the client host key. */ 203 /* Get the client host key. */
204 client_host_key = key_new(KEY_RSA1); 204 client_host_key = key_new(KEY_RSA1);
205 bits = packet_get_int(); 205 bits = packet_get_int();
206 packet_get_bignum(client_host_key->rsa->e, &elen); 206 packet_get_bignum(client_host_key->rsa->e);
207 packet_get_bignum(client_host_key->rsa->n, &nlen); 207 packet_get_bignum(client_host_key->rsa->n);
208 208
209 if (bits != BN_num_bits(client_host_key->rsa->n)) 209 if (bits != BN_num_bits(client_host_key->rsa->n))
210 verbose("Warning: keysize mismatch for client_host_key: " 210 verbose("Warning: keysize mismatch for client_host_key: "
@@ -227,7 +227,7 @@ do_authloop(Authctxt *authctxt)
227 /* RSA authentication requested. */ 227 /* RSA authentication requested. */
228 if ((n = BN_new()) == NULL) 228 if ((n = BN_new()) == NULL)
229 fatal("do_authloop: BN_new failed"); 229 fatal("do_authloop: BN_new failed");
230 packet_get_bignum(n, &nlen); 230 packet_get_bignum(n);
231 packet_check_eom(); 231 packet_check_eom();
232 authenticated = auth_rsa(pw, n); 232 authenticated = auth_rsa(pw, n);
233 BN_clear_free(n); 233 BN_clear_free(n);
diff --git a/kexdh.c b/kexdh.c
index 43a14f558..226b81bc9 100644
--- a/kexdh.c
+++ b/kexdh.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: kexdh.c,v 1.10 2001/12/28 12:14:27 markus Exp $"); 26RCSID("$OpenBSD: kexdh.c,v 1.11 2001/12/28 13:57:33 markus Exp $");
27 27
28#include <openssl/crypto.h> 28#include <openssl/crypto.h>
29#include <openssl/bn.h> 29#include <openssl/bn.h>
@@ -97,7 +97,7 @@ kexdh_client(Kex *kex)
97 u_char *server_host_key_blob = NULL, *signature = NULL; 97 u_char *server_host_key_blob = NULL, *signature = NULL;
98 u_char *kbuf, *hash; 98 u_char *kbuf, *hash;
99 u_int klen, kout, slen, sbloblen; 99 u_int klen, kout, slen, sbloblen;
100 int dlen, plen; 100 int plen;
101 101
102 /* generate and send 'e', client DH public key */ 102 /* generate and send 'e', client DH public key */
103 dh = dh_new_group1(); 103 dh = dh_new_group1();
@@ -131,7 +131,7 @@ kexdh_client(Kex *kex)
131 /* DH paramter f, server public DH key */ 131 /* DH paramter f, server public DH key */
132 if ((dh_server_pub = BN_new()) == NULL) 132 if ((dh_server_pub = BN_new()) == NULL)
133 fatal("dh_server_pub == NULL"); 133 fatal("dh_server_pub == NULL");
134 packet_get_bignum2(dh_server_pub, &dlen); 134 packet_get_bignum2(dh_server_pub);
135 135
136#ifdef DEBUG_KEXDH 136#ifdef DEBUG_KEXDH
137 fprintf(stderr, "dh_server_pub= "); 137 fprintf(stderr, "dh_server_pub= ");
@@ -201,7 +201,7 @@ kexdh_server(Kex *kex)
201 Key *server_host_key; 201 Key *server_host_key;
202 u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL; 202 u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL;
203 u_int sbloblen, klen, kout; 203 u_int sbloblen, klen, kout;
204 int dlen, slen, plen; 204 int slen, plen;
205 205
206 /* generate server DH public key */ 206 /* generate server DH public key */
207 dh = dh_new_group1(); 207 dh = dh_new_group1();
@@ -219,7 +219,7 @@ kexdh_server(Kex *kex)
219 /* key, cert */ 219 /* key, cert */
220 if ((dh_client_pub = BN_new()) == NULL) 220 if ((dh_client_pub = BN_new()) == NULL)
221 fatal("dh_client_pub == NULL"); 221 fatal("dh_client_pub == NULL");
222 packet_get_bignum2(dh_client_pub, &dlen); 222 packet_get_bignum2(dh_client_pub);
223 223
224#ifdef DEBUG_KEXDH 224#ifdef DEBUG_KEXDH
225 fprintf(stderr, "dh_client_pub= "); 225 fprintf(stderr, "dh_client_pub= ");
diff --git a/kexgex.c b/kexgex.c
index 49f639c61..99344bbba 100644
--- a/kexgex.c
+++ b/kexgex.c
@@ -24,7 +24,7 @@
24 */ 24 */
25 25
26#include "includes.h" 26#include "includes.h"
27RCSID("$OpenBSD: kexgex.c,v 1.13 2001/12/28 12:14:27 markus Exp $"); 27RCSID("$OpenBSD: kexgex.c,v 1.14 2001/12/28 13:57:33 markus Exp $");
28 28
29#include <openssl/bn.h> 29#include <openssl/bn.h>
30 30
@@ -107,7 +107,7 @@ kexgex_client(Kex *kex)
107 Key *server_host_key; 107 Key *server_host_key;
108 u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL; 108 u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL;
109 u_int klen, kout, slen, sbloblen; 109 u_int klen, kout, slen, sbloblen;
110 int dlen, plen, min, max, nbits; 110 int plen, min, max, nbits;
111 DH *dh; 111 DH *dh;
112 112
113 nbits = dh_estimate(kex->we_need * 8); 113 nbits = dh_estimate(kex->we_need * 8);
@@ -142,10 +142,10 @@ kexgex_client(Kex *kex)
142 142
143 if ((p = BN_new()) == NULL) 143 if ((p = BN_new()) == NULL)
144 fatal("BN_new"); 144 fatal("BN_new");
145 packet_get_bignum2(p, &dlen); 145 packet_get_bignum2(p);
146 if ((g = BN_new()) == NULL) 146 if ((g = BN_new()) == NULL)
147 fatal("BN_new"); 147 fatal("BN_new");
148 packet_get_bignum2(g, &dlen); 148 packet_get_bignum2(g);
149 packet_check_eom(); 149 packet_check_eom();
150 150
151 if (BN_num_bits(p) < min || BN_num_bits(p) > max) 151 if (BN_num_bits(p) < min || BN_num_bits(p) > max)
@@ -185,7 +185,7 @@ kexgex_client(Kex *kex)
185 /* DH paramter f, server public DH key */ 185 /* DH paramter f, server public DH key */
186 if ((dh_server_pub = BN_new()) == NULL) 186 if ((dh_server_pub = BN_new()) == NULL)
187 fatal("dh_server_pub == NULL"); 187 fatal("dh_server_pub == NULL");
188 packet_get_bignum2(dh_server_pub, &dlen); 188 packet_get_bignum2(dh_server_pub);
189 189
190#ifdef DEBUG_KEXDH 190#ifdef DEBUG_KEXDH
191 fprintf(stderr, "dh_server_pub= "); 191 fprintf(stderr, "dh_server_pub= ");
@@ -261,7 +261,7 @@ kexgex_server(Kex *kex)
261 DH *dh = dh; 261 DH *dh = dh;
262 u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL; 262 u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL;
263 u_int sbloblen, klen, kout; 263 u_int sbloblen, klen, kout;
264 int min = -1, max = -1, nbits = -1, type, plen, dlen, slen; 264 int min = -1, max = -1, nbits = -1, type, plen, slen;
265 265
266 if (kex->load_host_key == NULL) 266 if (kex->load_host_key == NULL)
267 fatal("Cannot load hostkey"); 267 fatal("Cannot load hostkey");
@@ -317,7 +317,7 @@ kexgex_server(Kex *kex)
317 /* key, cert */ 317 /* key, cert */
318 if ((dh_client_pub = BN_new()) == NULL) 318 if ((dh_client_pub = BN_new()) == NULL)
319 fatal("dh_client_pub == NULL"); 319 fatal("dh_client_pub == NULL");
320 packet_get_bignum2(dh_client_pub, &dlen); 320 packet_get_bignum2(dh_client_pub);
321 321
322#ifdef DEBUG_KEXDH 322#ifdef DEBUG_KEXDH
323 fprintf(stderr, "dh_client_pub= "); 323 fprintf(stderr, "dh_client_pub= ");
diff --git a/packet.c b/packet.c
index ea16847d9..065f8a52a 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.79 2001/12/28 12:14:27 markus Exp $"); 40RCSID("$OpenBSD: packet.c,v 1.80 2001/12/28 13:57:33 markus Exp $");
41 41
42#include "xmalloc.h" 42#include "xmalloc.h"
43#include "buffer.h" 43#include "buffer.h"
@@ -1000,15 +1000,15 @@ packet_get_int(void)
1000 */ 1000 */
1001 1001
1002void 1002void
1003packet_get_bignum(BIGNUM * value, int *length_ptr) 1003packet_get_bignum(BIGNUM * value)
1004{ 1004{
1005 *length_ptr = buffer_get_bignum(&incoming_packet, value); 1005 (void)buffer_get_bignum(&incoming_packet, value);
1006} 1006}
1007 1007
1008void 1008void
1009packet_get_bignum2(BIGNUM * value, int *length_ptr) 1009packet_get_bignum2(BIGNUM * value)
1010{ 1010{
1011 *length_ptr = buffer_get_bignum2(&incoming_packet, value); 1011 (void)buffer_get_bignum2(&incoming_packet, value);
1012} 1012}
1013 1013
1014void * 1014void *
diff --git a/packet.h b/packet.h
index 269b4c7f8..dcf2a664f 100644
--- a/packet.h
+++ b/packet.h
@@ -11,7 +11,7 @@
11 * called by a name other than "ssh" or "Secure Shell". 11 * called by a name other than "ssh" or "Secure Shell".
12 */ 12 */
13 13
14/* RCSID("$OpenBSD: packet.h,v 1.30 2001/12/28 12:14:27 markus Exp $"); */ 14/* RCSID("$OpenBSD: packet.h,v 1.31 2001/12/28 13:57:33 markus Exp $"); */
15 15
16#ifndef PACKET_H 16#ifndef PACKET_H
17#define PACKET_H 17#define PACKET_H
@@ -49,8 +49,8 @@ int packet_read_poll_seqnr(int *packet_len_ptr, u_int32_t *seqnr_p);
49 49
50u_int packet_get_char(void); 50u_int packet_get_char(void);
51u_int packet_get_int(void); 51u_int packet_get_int(void);
52void packet_get_bignum(BIGNUM * value, int *length_ptr); 52void packet_get_bignum(BIGNUM * value);
53void packet_get_bignum2(BIGNUM * value, int *length_ptr); 53void packet_get_bignum2(BIGNUM * value);
54void *packet_get_raw(int *length_ptr); 54void *packet_get_raw(int *length_ptr);
55void *packet_get_string(u_int *length_ptr); 55void *packet_get_string(u_int *length_ptr);
56void packet_disconnect(const char *fmt,...) __attribute__((format(printf, 1, 2))); 56void packet_disconnect(const char *fmt,...) __attribute__((format(printf, 1, 2)));
diff --git a/sshconnect1.c b/sshconnect1.c
index a5fef1036..e66f35040 100644
--- a/sshconnect1.c
+++ b/sshconnect1.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: sshconnect1.c,v 1.45 2001/12/28 12:14:27 markus Exp $"); 16RCSID("$OpenBSD: sshconnect1.c,v 1.46 2001/12/28 13:57:33 markus Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19#include <openssl/evp.h> 19#include <openssl/evp.h>
@@ -67,7 +67,7 @@ try_agent_authentication(void)
67 AuthenticationConnection *auth; 67 AuthenticationConnection *auth;
68 u_char response[16]; 68 u_char response[16];
69 u_int i; 69 u_int i;
70 int plen, clen; 70 int plen;
71 Key *key; 71 Key *key;
72 BIGNUM *challenge; 72 BIGNUM *challenge;
73 73
@@ -108,7 +108,7 @@ try_agent_authentication(void)
108 packet_disconnect("Protocol error during RSA authentication: %d", 108 packet_disconnect("Protocol error during RSA authentication: %d",
109 type); 109 type);
110 110
111 packet_get_bignum(challenge, &clen); 111 packet_get_bignum(challenge);
112 packet_check_eom(); 112 packet_check_eom();
113 113
114 debug("Received RSA challenge from server."); 114 debug("Received RSA challenge from server.");
@@ -209,7 +209,7 @@ try_rsa_authentication(int idx)
209 BIGNUM *challenge; 209 BIGNUM *challenge;
210 Key *public, *private; 210 Key *public, *private;
211 char buf[300], *passphrase, *comment, *authfile; 211 char buf[300], *passphrase, *comment, *authfile;
212 int i, type, quit, plen, clen; 212 int i, type, quit, plen;
213 213
214 public = options.identity_keys[idx]; 214 public = options.identity_keys[idx];
215 authfile = options.identity_files[idx]; 215 authfile = options.identity_files[idx];
@@ -242,7 +242,7 @@ try_rsa_authentication(int idx)
242 /* Get the challenge from the packet. */ 242 /* Get the challenge from the packet. */
243 if ((challenge = BN_new()) == NULL) 243 if ((challenge = BN_new()) == NULL)
244 fatal("try_rsa_authentication: BN_new failed"); 244 fatal("try_rsa_authentication: BN_new failed");
245 packet_get_bignum(challenge, &clen); 245 packet_get_bignum(challenge);
246 packet_check_eom(); 246 packet_check_eom();
247 247
248 debug("Received RSA challenge from server."); 248 debug("Received RSA challenge from server.");
@@ -327,7 +327,7 @@ try_rhosts_rsa_authentication(const char *local_user, Key * host_key)
327{ 327{
328 int type; 328 int type;
329 BIGNUM *challenge; 329 BIGNUM *challenge;
330 int plen, clen; 330 int plen;
331 331
332 debug("Trying rhosts or /etc/hosts.equiv with RSA host authentication."); 332 debug("Trying rhosts or /etc/hosts.equiv with RSA host authentication.");
333 333
@@ -356,7 +356,7 @@ try_rhosts_rsa_authentication(const char *local_user, Key * host_key)
356 /* Get the challenge from the packet. */ 356 /* Get the challenge from the packet. */
357 if ((challenge = BN_new()) == NULL) 357 if ((challenge = BN_new()) == NULL)
358 fatal("try_rhosts_rsa_authentication: BN_new failed"); 358 fatal("try_rhosts_rsa_authentication: BN_new failed");
359 packet_get_bignum(challenge, &clen); 359 packet_get_bignum(challenge);
360 packet_check_eom(); 360 packet_check_eom();
361 361
362 debug("Received RSA challenge for host key from server."); 362 debug("Received RSA challenge for host key from server.");
@@ -917,7 +917,7 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
917 u_char cookie[8]; 917 u_char cookie[8];
918 u_int supported_ciphers; 918 u_int supported_ciphers;
919 u_int server_flags, client_flags; 919 u_int server_flags, client_flags;
920 int payload_len, clen, sum_len = 0; 920 int payload_len;
921 u_int32_t rand = 0; 921 u_int32_t rand = 0;
922 922
923 debug("Waiting for server public key."); 923 debug("Waiting for server public key.");
@@ -932,10 +932,8 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
932 /* Get the public key. */ 932 /* Get the public key. */
933 server_key = key_new(KEY_RSA1); 933 server_key = key_new(KEY_RSA1);
934 bits = packet_get_int(); 934 bits = packet_get_int();
935 packet_get_bignum(server_key->rsa->e, &clen); 935 packet_get_bignum(server_key->rsa->e);
936 sum_len += clen; 936 packet_get_bignum(server_key->rsa->n);
937 packet_get_bignum(server_key->rsa->n, &clen);
938 sum_len += clen;
939 937
940 rbits = BN_num_bits(server_key->rsa->n); 938 rbits = BN_num_bits(server_key->rsa->n);
941 if (bits != rbits) { 939 if (bits != rbits) {
@@ -946,10 +944,8 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
946 /* Get the host key. */ 944 /* Get the host key. */
947 host_key = key_new(KEY_RSA1); 945 host_key = key_new(KEY_RSA1);
948 bits = packet_get_int(); 946 bits = packet_get_int();
949 packet_get_bignum(host_key->rsa->e, &clen); 947 packet_get_bignum(host_key->rsa->e);
950 sum_len += clen; 948 packet_get_bignum(host_key->rsa->n);
951 packet_get_bignum(host_key->rsa->n, &clen);
952 sum_len += clen;
953 949
954 rbits = BN_num_bits(host_key->rsa->n); 950 rbits = BN_num_bits(host_key->rsa->n);
955 if (bits != rbits) { 951 if (bits != rbits) {
diff --git a/sshd.c b/sshd.c
index b5f995c06..39b58a43e 100644
--- a/sshd.c
+++ b/sshd.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: sshd.c,v 1.220 2001/12/28 12:14:27 markus Exp $"); 43RCSID("$OpenBSD: sshd.c,v 1.221 2001/12/28 13:57:33 markus Exp $");
44 44
45#include <openssl/dh.h> 45#include <openssl/dh.h>
46#include <openssl/bn.h> 46#include <openssl/bn.h>
@@ -1251,7 +1251,7 @@ static void
1251do_ssh1_kex(void) 1251do_ssh1_kex(void)
1252{ 1252{
1253 int i, len; 1253 int i, len;
1254 int plen, slen; 1254 int plen;
1255 int rsafail = 0; 1255 int rsafail = 0;
1256 BIGNUM *session_key_int; 1256 BIGNUM *session_key_int;
1257 u_char session_key[SSH_SESSION_KEY_LENGTH]; 1257 u_char session_key[SSH_SESSION_KEY_LENGTH];
@@ -1354,7 +1354,7 @@ do_ssh1_kex(void)
1354 /* Get the encrypted integer. */ 1354 /* Get the encrypted integer. */
1355 if ((session_key_int = BN_new()) == NULL) 1355 if ((session_key_int = BN_new()) == NULL)
1356 fatal("do_ssh1_kex: BN_new failed"); 1356 fatal("do_ssh1_kex: BN_new failed");
1357 packet_get_bignum(session_key_int, &slen); 1357 packet_get_bignum(session_key_int);
1358 1358
1359 protocol_flags = packet_get_int(); 1359 protocol_flags = packet_get_int();
1360 packet_set_protocol_flags(protocol_flags); 1360 packet_set_protocol_flags(protocol_flags);