[auth1.c kexdh.c kexgex.c packet.c packet.h sshconnect1.c sshd.c]
     packet_get_bignum* no longer returns a size
This commit is contained in:
Damien Miller 2002-01-22 23:14:44 +11:00
parent 29f75f5c25
commit d432ccf740
8 changed files with 47 additions and 46 deletions

View File

@ -56,8 +56,13 @@
[serverloop.c session.c ssh.c sshconnect1.c sshd.c ttymodes.c]
get rid of packet_integrity_check, use packet_done() instead.
- markus@cvs.openbsd.org 2001/12/28 12:14:27
[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]
[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]
s/packet_done/packet_check_eom/ (end-of-message); ok djm@
- markus@cvs.openbsd.org 2001/12/28 13:57:33
[auth1.c kexdh.c kexgex.c packet.c packet.h sshconnect1.c sshd.c]
packet_get_bignum* no longer returns a size
20020121
@ -7206,4 +7211,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
$Id: ChangeLog,v 1.1740 2002/01/22 12:14:10 djm Exp $
$Id: ChangeLog,v 1.1741 2002/01/22 12:14:44 djm Exp $

10
auth1.c
View File

@ -10,7 +10,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: auth1.c,v 1.32 2001/12/28 12:14:27 markus Exp $");
RCSID("$OpenBSD: auth1.c,v 1.33 2001/12/28 13:57:33 markus Exp $");
#include "xmalloc.h"
#include "rsa.h"
@ -71,7 +71,7 @@ do_authloop(Authctxt *authctxt)
char *client_user, *password;
char info[1024];
u_int dlen;
int plen, nlen, elen;
int plen;
u_int ulen;
int type = 0;
struct passwd *pw = authctxt->pw;
@ -203,8 +203,8 @@ do_authloop(Authctxt *authctxt)
/* Get the client host key. */
client_host_key = key_new(KEY_RSA1);
bits = packet_get_int();
packet_get_bignum(client_host_key->rsa->e, &elen);
packet_get_bignum(client_host_key->rsa->n, &nlen);
packet_get_bignum(client_host_key->rsa->e);
packet_get_bignum(client_host_key->rsa->n);
if (bits != BN_num_bits(client_host_key->rsa->n))
verbose("Warning: keysize mismatch for client_host_key: "
@ -227,7 +227,7 @@ do_authloop(Authctxt *authctxt)
/* RSA authentication requested. */
if ((n = BN_new()) == NULL)
fatal("do_authloop: BN_new failed");
packet_get_bignum(n, &nlen);
packet_get_bignum(n);
packet_check_eom();
authenticated = auth_rsa(pw, n);
BN_clear_free(n);

10
kexdh.c
View File

@ -23,7 +23,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: kexdh.c,v 1.10 2001/12/28 12:14:27 markus Exp $");
RCSID("$OpenBSD: kexdh.c,v 1.11 2001/12/28 13:57:33 markus Exp $");
#include <openssl/crypto.h>
#include <openssl/bn.h>
@ -97,7 +97,7 @@ kexdh_client(Kex *kex)
u_char *server_host_key_blob = NULL, *signature = NULL;
u_char *kbuf, *hash;
u_int klen, kout, slen, sbloblen;
int dlen, plen;
int plen;
/* generate and send 'e', client DH public key */
dh = dh_new_group1();
@ -131,7 +131,7 @@ kexdh_client(Kex *kex)
/* DH paramter f, server public DH key */
if ((dh_server_pub = BN_new()) == NULL)
fatal("dh_server_pub == NULL");
packet_get_bignum2(dh_server_pub, &dlen);
packet_get_bignum2(dh_server_pub);
#ifdef DEBUG_KEXDH
fprintf(stderr, "dh_server_pub= ");
@ -201,7 +201,7 @@ kexdh_server(Kex *kex)
Key *server_host_key;
u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL;
u_int sbloblen, klen, kout;
int dlen, slen, plen;
int slen, plen;
/* generate server DH public key */
dh = dh_new_group1();
@ -219,7 +219,7 @@ kexdh_server(Kex *kex)
/* key, cert */
if ((dh_client_pub = BN_new()) == NULL)
fatal("dh_client_pub == NULL");
packet_get_bignum2(dh_client_pub, &dlen);
packet_get_bignum2(dh_client_pub);
#ifdef DEBUG_KEXDH
fprintf(stderr, "dh_client_pub= ");

View File

@ -24,7 +24,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: kexgex.c,v 1.13 2001/12/28 12:14:27 markus Exp $");
RCSID("$OpenBSD: kexgex.c,v 1.14 2001/12/28 13:57:33 markus Exp $");
#include <openssl/bn.h>
@ -107,7 +107,7 @@ kexgex_client(Kex *kex)
Key *server_host_key;
u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL;
u_int klen, kout, slen, sbloblen;
int dlen, plen, min, max, nbits;
int plen, min, max, nbits;
DH *dh;
nbits = dh_estimate(kex->we_need * 8);
@ -142,10 +142,10 @@ kexgex_client(Kex *kex)
if ((p = BN_new()) == NULL)
fatal("BN_new");
packet_get_bignum2(p, &dlen);
packet_get_bignum2(p);
if ((g = BN_new()) == NULL)
fatal("BN_new");
packet_get_bignum2(g, &dlen);
packet_get_bignum2(g);
packet_check_eom();
if (BN_num_bits(p) < min || BN_num_bits(p) > max)
@ -185,7 +185,7 @@ kexgex_client(Kex *kex)
/* DH paramter f, server public DH key */
if ((dh_server_pub = BN_new()) == NULL)
fatal("dh_server_pub == NULL");
packet_get_bignum2(dh_server_pub, &dlen);
packet_get_bignum2(dh_server_pub);
#ifdef DEBUG_KEXDH
fprintf(stderr, "dh_server_pub= ");
@ -261,7 +261,7 @@ kexgex_server(Kex *kex)
DH *dh = dh;
u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL;
u_int sbloblen, klen, kout;
int min = -1, max = -1, nbits = -1, type, plen, dlen, slen;
int min = -1, max = -1, nbits = -1, type, plen, slen;
if (kex->load_host_key == NULL)
fatal("Cannot load hostkey");
@ -317,7 +317,7 @@ kexgex_server(Kex *kex)
/* key, cert */
if ((dh_client_pub = BN_new()) == NULL)
fatal("dh_client_pub == NULL");
packet_get_bignum2(dh_client_pub, &dlen);
packet_get_bignum2(dh_client_pub);
#ifdef DEBUG_KEXDH
fprintf(stderr, "dh_client_pub= ");

View File

@ -37,7 +37,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: packet.c,v 1.79 2001/12/28 12:14:27 markus Exp $");
RCSID("$OpenBSD: packet.c,v 1.80 2001/12/28 13:57:33 markus Exp $");
#include "xmalloc.h"
#include "buffer.h"
@ -1000,15 +1000,15 @@ packet_get_int(void)
*/
void
packet_get_bignum(BIGNUM * value, int *length_ptr)
packet_get_bignum(BIGNUM * value)
{
*length_ptr = buffer_get_bignum(&incoming_packet, value);
(void)buffer_get_bignum(&incoming_packet, value);
}
void
packet_get_bignum2(BIGNUM * value, int *length_ptr)
packet_get_bignum2(BIGNUM * value)
{
*length_ptr = buffer_get_bignum2(&incoming_packet, value);
(void)buffer_get_bignum2(&incoming_packet, value);
}
void *

View File

@ -11,7 +11,7 @@
* called by a name other than "ssh" or "Secure Shell".
*/
/* RCSID("$OpenBSD: packet.h,v 1.30 2001/12/28 12:14:27 markus Exp $"); */
/* RCSID("$OpenBSD: packet.h,v 1.31 2001/12/28 13:57:33 markus Exp $"); */
#ifndef PACKET_H
#define PACKET_H
@ -49,8 +49,8 @@ int packet_read_poll_seqnr(int *packet_len_ptr, u_int32_t *seqnr_p);
u_int packet_get_char(void);
u_int packet_get_int(void);
void packet_get_bignum(BIGNUM * value, int *length_ptr);
void packet_get_bignum2(BIGNUM * value, int *length_ptr);
void packet_get_bignum(BIGNUM * value);
void packet_get_bignum2(BIGNUM * value);
void *packet_get_raw(int *length_ptr);
void *packet_get_string(u_int *length_ptr);
void packet_disconnect(const char *fmt,...) __attribute__((format(printf, 1, 2)));

View File

@ -13,7 +13,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: sshconnect1.c,v 1.45 2001/12/28 12:14:27 markus Exp $");
RCSID("$OpenBSD: sshconnect1.c,v 1.46 2001/12/28 13:57:33 markus Exp $");
#include <openssl/bn.h>
#include <openssl/evp.h>
@ -67,7 +67,7 @@ try_agent_authentication(void)
AuthenticationConnection *auth;
u_char response[16];
u_int i;
int plen, clen;
int plen;
Key *key;
BIGNUM *challenge;
@ -108,7 +108,7 @@ try_agent_authentication(void)
packet_disconnect("Protocol error during RSA authentication: %d",
type);
packet_get_bignum(challenge, &clen);
packet_get_bignum(challenge);
packet_check_eom();
debug("Received RSA challenge from server.");
@ -209,7 +209,7 @@ try_rsa_authentication(int idx)
BIGNUM *challenge;
Key *public, *private;
char buf[300], *passphrase, *comment, *authfile;
int i, type, quit, plen, clen;
int i, type, quit, plen;
public = options.identity_keys[idx];
authfile = options.identity_files[idx];
@ -242,7 +242,7 @@ try_rsa_authentication(int idx)
/* Get the challenge from the packet. */
if ((challenge = BN_new()) == NULL)
fatal("try_rsa_authentication: BN_new failed");
packet_get_bignum(challenge, &clen);
packet_get_bignum(challenge);
packet_check_eom();
debug("Received RSA challenge from server.");
@ -327,7 +327,7 @@ try_rhosts_rsa_authentication(const char *local_user, Key * host_key)
{
int type;
BIGNUM *challenge;
int plen, clen;
int plen;
debug("Trying rhosts or /etc/hosts.equiv with RSA host authentication.");
@ -356,7 +356,7 @@ try_rhosts_rsa_authentication(const char *local_user, Key * host_key)
/* Get the challenge from the packet. */
if ((challenge = BN_new()) == NULL)
fatal("try_rhosts_rsa_authentication: BN_new failed");
packet_get_bignum(challenge, &clen);
packet_get_bignum(challenge);
packet_check_eom();
debug("Received RSA challenge for host key from server.");
@ -917,7 +917,7 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
u_char cookie[8];
u_int supported_ciphers;
u_int server_flags, client_flags;
int payload_len, clen, sum_len = 0;
int payload_len;
u_int32_t rand = 0;
debug("Waiting for server public key.");
@ -932,10 +932,8 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
/* Get the public key. */
server_key = key_new(KEY_RSA1);
bits = packet_get_int();
packet_get_bignum(server_key->rsa->e, &clen);
sum_len += clen;
packet_get_bignum(server_key->rsa->n, &clen);
sum_len += clen;
packet_get_bignum(server_key->rsa->e);
packet_get_bignum(server_key->rsa->n);
rbits = BN_num_bits(server_key->rsa->n);
if (bits != rbits) {
@ -946,10 +944,8 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
/* Get the host key. */
host_key = key_new(KEY_RSA1);
bits = packet_get_int();
packet_get_bignum(host_key->rsa->e, &clen);
sum_len += clen;
packet_get_bignum(host_key->rsa->n, &clen);
sum_len += clen;
packet_get_bignum(host_key->rsa->e);
packet_get_bignum(host_key->rsa->n);
rbits = BN_num_bits(host_key->rsa->n);
if (bits != rbits) {

6
sshd.c
View File

@ -40,7 +40,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: sshd.c,v 1.220 2001/12/28 12:14:27 markus Exp $");
RCSID("$OpenBSD: sshd.c,v 1.221 2001/12/28 13:57:33 markus Exp $");
#include <openssl/dh.h>
#include <openssl/bn.h>
@ -1251,7 +1251,7 @@ static void
do_ssh1_kex(void)
{
int i, len;
int plen, slen;
int plen;
int rsafail = 0;
BIGNUM *session_key_int;
u_char session_key[SSH_SESSION_KEY_LENGTH];
@ -1354,7 +1354,7 @@ do_ssh1_kex(void)
/* Get the encrypted integer. */
if ((session_key_int = BN_new()) == NULL)
fatal("do_ssh1_kex: BN_new failed");
packet_get_bignum(session_key_int, &slen);
packet_get_bignum(session_key_int);
protocol_flags = packet_get_int();
packet_set_protocol_flags(protocol_flags);