mirror of
https://github.com/clearml/dropbear
synced 2025-04-18 21:24:58 +00:00
merge of 7d53fee744460df7d2297614c9a4a8a6722eb277
and cc783df3845d0779e2407f0a83fbb605c12efa7d --HG-- extra : convert_revision : 7494f62a22beadfca8acdf77d8916f36245db04f
This commit is contained in:
commit
3d58025805
@ -69,7 +69,7 @@ AR=@AR@
|
|||||||
RANLIB=@RANLIB@
|
RANLIB=@RANLIB@
|
||||||
STRIP=@STRIP@
|
STRIP=@STRIP@
|
||||||
INSTALL=@INSTALL@
|
INSTALL=@INSTALL@
|
||||||
CFLAGS=-I. -I$(srcdir)/libtomcrypt @CFLAGS@
|
CFLAGS=-I. -I$(srcdir)/libtomcrypt/src/headers/ @CFLAGS@
|
||||||
LIBS=$(LTC) $(LTM) @LIBS@
|
LIBS=$(LTC) $(LTM) @LIBS@
|
||||||
LDFLAGS=@LDFLAGS@
|
LDFLAGS=@LDFLAGS@
|
||||||
|
|
||||||
|
4
algo.h
4
algo.h
@ -51,13 +51,13 @@ extern const struct dropbear_cipher dropbear_nocipher;
|
|||||||
extern const struct dropbear_hash dropbear_nohash;
|
extern const struct dropbear_hash dropbear_nohash;
|
||||||
|
|
||||||
struct dropbear_cipher {
|
struct dropbear_cipher {
|
||||||
const struct _cipher_descriptor *cipherdesc;
|
const struct ltc_cipher_descriptor *cipherdesc;
|
||||||
unsigned long keysize;
|
unsigned long keysize;
|
||||||
unsigned char blocksize;
|
unsigned char blocksize;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dropbear_hash {
|
struct dropbear_hash {
|
||||||
const struct _hash_descriptor *hashdesc;
|
const struct ltc_hash_descriptor *hashdesc;
|
||||||
unsigned long keysize;
|
unsigned long keysize;
|
||||||
unsigned char hashsize;
|
unsigned char hashsize;
|
||||||
};
|
};
|
||||||
|
@ -125,7 +125,7 @@ algo_type sshkex[] = {
|
|||||||
* This should be run before using any of the ciphers/hashes */
|
* This should be run before using any of the ciphers/hashes */
|
||||||
void crypto_init() {
|
void crypto_init() {
|
||||||
|
|
||||||
const struct _cipher_descriptor *regciphers[] = {
|
const struct ltc_cipher_descriptor *regciphers[] = {
|
||||||
#ifdef DROPBEAR_AES128_CBC
|
#ifdef DROPBEAR_AES128_CBC
|
||||||
&aes_desc,
|
&aes_desc,
|
||||||
#endif
|
#endif
|
||||||
@ -141,7 +141,7 @@ void crypto_init() {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct _hash_descriptor *reghashes[] = {
|
const struct ltc_hash_descriptor *reghashes[] = {
|
||||||
/* we need sha1 for hostkey stuff regardless */
|
/* we need sha1 for hostkey stuff regardless */
|
||||||
&sha1_desc,
|
&sha1_desc,
|
||||||
#ifdef DROPBEAR_MD5_HMAC
|
#ifdef DROPBEAR_MD5_HMAC
|
||||||
|
3
dbutil.c
3
dbutil.c
@ -430,10 +430,11 @@ char* getaddrhostname(struct sockaddr_storage * addr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_TRACE
|
#ifdef DEBUG_TRACE
|
||||||
void printhex(unsigned char* buf, int len) {
|
void printhex(const char * label, const unsigned char * buf, int len) {
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
fprintf(stderr, "%s\n", label);
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
fprintf(stderr, "%02x", buf[i]);
|
fprintf(stderr, "%02x", buf[i]);
|
||||||
if (i % 16 == 15) {
|
if (i % 16 == 15) {
|
||||||
|
2
dbutil.h
2
dbutil.h
@ -41,7 +41,7 @@ void dropbear_close(const char* format, ...);
|
|||||||
void dropbear_log(int priority, const char* format, ...);
|
void dropbear_log(int priority, const char* format, ...);
|
||||||
#ifdef DEBUG_TRACE
|
#ifdef DEBUG_TRACE
|
||||||
void dropbear_trace(const char* format, ...);
|
void dropbear_trace(const char* format, ...);
|
||||||
void printhex(unsigned char* buf, int len);
|
void printhex(const char * label, const unsigned char * buf, int len);
|
||||||
extern int debug_trace;
|
extern int debug_trace;
|
||||||
#endif
|
#endif
|
||||||
char * stripcontrol(const char * text);
|
char * stripcontrol(const char * text);
|
||||||
|
@ -111,7 +111,7 @@
|
|||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "libtomcrypt/mycrypt.h"
|
#include "libtomcrypt/src/headers/tomcrypt.h"
|
||||||
#include "libtommath/tommath.h"
|
#include "libtommath/tommath.h"
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
3
packet.c
3
packet.c
@ -201,6 +201,7 @@ static void read_packet_init() {
|
|||||||
/* decrypt it */
|
/* decrypt it */
|
||||||
if (cbc_decrypt(buf_getptr(ses.readbuf, blocksize),
|
if (cbc_decrypt(buf_getptr(ses.readbuf, blocksize),
|
||||||
buf_getwriteptr(ses.decryptreadbuf,blocksize),
|
buf_getwriteptr(ses.decryptreadbuf,blocksize),
|
||||||
|
blocksize,
|
||||||
&ses.keys->recv_symmetric_struct) != CRYPT_OK) {
|
&ses.keys->recv_symmetric_struct) != CRYPT_OK) {
|
||||||
dropbear_exit("error decrypting");
|
dropbear_exit("error decrypting");
|
||||||
}
|
}
|
||||||
@ -254,6 +255,7 @@ void decrypt_packet() {
|
|||||||
while (ses.readbuf->pos < ses.readbuf->len - macsize) {
|
while (ses.readbuf->pos < ses.readbuf->len - macsize) {
|
||||||
if (cbc_decrypt(buf_getptr(ses.readbuf, blocksize),
|
if (cbc_decrypt(buf_getptr(ses.readbuf, blocksize),
|
||||||
buf_getwriteptr(ses.decryptreadbuf, blocksize),
|
buf_getwriteptr(ses.decryptreadbuf, blocksize),
|
||||||
|
blocksize,
|
||||||
&ses.keys->recv_symmetric_struct) != CRYPT_OK) {
|
&ses.keys->recv_symmetric_struct) != CRYPT_OK) {
|
||||||
dropbear_exit("error decrypting");
|
dropbear_exit("error decrypting");
|
||||||
}
|
}
|
||||||
@ -491,6 +493,7 @@ void encrypt_packet() {
|
|||||||
while (clearwritebuf->pos < clearwritebuf->len) {
|
while (clearwritebuf->pos < clearwritebuf->len) {
|
||||||
if (cbc_encrypt(buf_getptr(clearwritebuf, blocksize),
|
if (cbc_encrypt(buf_getptr(clearwritebuf, blocksize),
|
||||||
buf_getwriteptr(writebuf, blocksize),
|
buf_getwriteptr(writebuf, blocksize),
|
||||||
|
blocksize,
|
||||||
&ses.keys->trans_symmetric_struct) != CRYPT_OK) {
|
&ses.keys->trans_symmetric_struct) != CRYPT_OK) {
|
||||||
dropbear_exit("error encrypting");
|
dropbear_exit("error encrypting");
|
||||||
}
|
}
|
||||||
|
6
random.c
6
random.c
@ -27,13 +27,13 @@
|
|||||||
#include "dbutil.h"
|
#include "dbutil.h"
|
||||||
#include "bignum.h"
|
#include "bignum.h"
|
||||||
|
|
||||||
int donerandinit = 0;
|
static int donerandinit = 0;
|
||||||
|
|
||||||
/* this is used to generate unique output from the same hashpool */
|
/* this is used to generate unique output from the same hashpool */
|
||||||
unsigned int counter = 0;
|
static unsigned int counter = 0;
|
||||||
#define MAX_COUNTER 1000000/* the max value for the counter, so it won't loop */
|
#define MAX_COUNTER 1000000/* the max value for the counter, so it won't loop */
|
||||||
|
|
||||||
unsigned char hashpool[SHA1_HASH_SIZE];
|
static unsigned char hashpool[SHA1_HASH_SIZE];
|
||||||
|
|
||||||
#define INIT_SEED_SIZE 32 /* 256 bits */
|
#define INIT_SEED_SIZE 32 /* 256 bits */
|
||||||
|
|
||||||
|
7
rsa.c
7
rsa.c
@ -333,7 +333,7 @@ void buf_put_rsa_sign(buffer* buf, rsa_key *key, const unsigned char* data,
|
|||||||
mp_clear(&rsa_s);
|
mp_clear(&rsa_s);
|
||||||
|
|
||||||
#if defined(DEBUG_RSA) && defined(DEBUG_TRACE)
|
#if defined(DEBUG_RSA) && defined(DEBUG_TRACE)
|
||||||
printhex(buf->data, buf->len);
|
printhex("RSA sig", buf->data, buf->len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -357,10 +357,11 @@ static void rsa_pad_em(rsa_key * key,
|
|||||||
mp_int * rsa_em) {
|
mp_int * rsa_em) {
|
||||||
|
|
||||||
/* ASN1 designator (including the 0x00 preceding) */
|
/* ASN1 designator (including the 0x00 preceding) */
|
||||||
const char rsa_asn1_magic[] =
|
const unsigned char rsa_asn1_magic[] =
|
||||||
{0x00, 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b,
|
{0x00, 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b,
|
||||||
0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14};
|
0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14};
|
||||||
#define RSA_ASN1_MAGIC_LEN 16
|
const unsigned int RSA_ASN1_MAGIC_LEN = 16;
|
||||||
|
|
||||||
buffer * rsa_EM = NULL;
|
buffer * rsa_EM = NULL;
|
||||||
hash_state hs;
|
hash_state hs;
|
||||||
unsigned int nsize;
|
unsigned int nsize;
|
||||||
|
Loading…
Reference in New Issue
Block a user