# HG changeset patch # User Matt Johnston # Date 1117729318 0 # Node ID 85cc531f711e4d2a5fe1103308dd0d72917730db # Parent 3924393e2456a0cd7f8ee3c39a1977c352f8a8ef# Parent 0d56e4b80dfb5dc593918ac88572315f30bb69ed merge of 72b0db220b7fc6b4fb6079d6b82c843186bab5a7 and feb4fdd2cc17783a3cd158d06be59a57382b398d diff -r 0d56e4b80dfb -r 85cc531f711e Makefile.in --- a/Makefile.in Wed Jun 01 16:15:38 2005 +0000 +++ b/Makefile.in Thu Jun 02 16:21:58 2005 +0000 @@ -69,7 +69,7 @@ RANLIB=@RANLIB@ STRIP=@STRIP@ INSTALL=@INSTALL@ -CFLAGS=-I. -I$(srcdir)/libtomcrypt @CFLAGS@ +CFLAGS=-I. -I$(srcdir)/libtomcrypt/src/headers/ @CFLAGS@ LIBS=$(LTC) $(LTM) @LIBS@ LDFLAGS=@LDFLAGS@ diff -r 0d56e4b80dfb -r 85cc531f711e algo.h --- a/algo.h Wed Jun 01 16:15:38 2005 +0000 +++ b/algo.h Thu Jun 02 16:21:58 2005 +0000 @@ -51,13 +51,13 @@ extern const struct dropbear_hash dropbear_nohash; struct dropbear_cipher { - const struct _cipher_descriptor *cipherdesc; + const struct ltc_cipher_descriptor *cipherdesc; unsigned long keysize; unsigned char blocksize; }; struct dropbear_hash { - const struct _hash_descriptor *hashdesc; + const struct ltc_hash_descriptor *hashdesc; unsigned long keysize; unsigned char hashsize; }; diff -r 0d56e4b80dfb -r 85cc531f711e common-algo.c --- a/common-algo.c Wed Jun 01 16:15:38 2005 +0000 +++ b/common-algo.c Thu Jun 02 16:21:58 2005 +0000 @@ -125,7 +125,7 @@ * This should be run before using any of the ciphers/hashes */ void crypto_init() { - const struct _cipher_descriptor *regciphers[] = { + const struct ltc_cipher_descriptor *regciphers[] = { #ifdef DROPBEAR_AES128_CBC &aes_desc, #endif @@ -141,7 +141,7 @@ NULL }; - const struct _hash_descriptor *reghashes[] = { + const struct ltc_hash_descriptor *reghashes[] = { /* we need sha1 for hostkey stuff regardless */ &sha1_desc, #ifdef DROPBEAR_MD5_HMAC diff -r 0d56e4b80dfb -r 85cc531f711e dbutil.c --- a/dbutil.c Wed Jun 01 16:15:38 2005 +0000 +++ b/dbutil.c Thu Jun 02 16:21:58 2005 +0000 @@ -430,10 +430,11 @@ } #ifdef DEBUG_TRACE -void printhex(unsigned char* buf, int len) { +void printhex(const char * label, const unsigned char * buf, int len) { int i; + fprintf(stderr, "%s\n", label); for (i = 0; i < len; i++) { fprintf(stderr, "%02x", buf[i]); if (i % 16 == 15) { diff -r 0d56e4b80dfb -r 85cc531f711e dbutil.h --- a/dbutil.h Wed Jun 01 16:15:38 2005 +0000 +++ b/dbutil.h Thu Jun 02 16:21:58 2005 +0000 @@ -41,7 +41,7 @@ void dropbear_log(int priority, const char* format, ...); #ifdef DEBUG_TRACE 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; #endif char * stripcontrol(const char * text); diff -r 0d56e4b80dfb -r 85cc531f711e includes.h --- a/includes.h Wed Jun 01 16:15:38 2005 +0000 +++ b/includes.h Thu Jun 02 16:21:58 2005 +0000 @@ -111,7 +111,7 @@ #include #endif -#include "libtomcrypt/mycrypt.h" +#include "libtomcrypt/src/headers/tomcrypt.h" #include "libtommath/tommath.h" #include "compat.h" diff -r 0d56e4b80dfb -r 85cc531f711e packet.c --- a/packet.c Wed Jun 01 16:15:38 2005 +0000 +++ b/packet.c Thu Jun 02 16:21:58 2005 +0000 @@ -201,6 +201,7 @@ /* decrypt it */ if (cbc_decrypt(buf_getptr(ses.readbuf, blocksize), buf_getwriteptr(ses.decryptreadbuf,blocksize), + blocksize, &ses.keys->recv_symmetric_struct) != CRYPT_OK) { dropbear_exit("error decrypting"); } @@ -254,6 +255,7 @@ while (ses.readbuf->pos < ses.readbuf->len - macsize) { if (cbc_decrypt(buf_getptr(ses.readbuf, blocksize), buf_getwriteptr(ses.decryptreadbuf, blocksize), + blocksize, &ses.keys->recv_symmetric_struct) != CRYPT_OK) { dropbear_exit("error decrypting"); } @@ -491,6 +493,7 @@ while (clearwritebuf->pos < clearwritebuf->len) { if (cbc_encrypt(buf_getptr(clearwritebuf, blocksize), buf_getwriteptr(writebuf, blocksize), + blocksize, &ses.keys->trans_symmetric_struct) != CRYPT_OK) { dropbear_exit("error encrypting"); } diff -r 0d56e4b80dfb -r 85cc531f711e random.c --- a/random.c Wed Jun 01 16:15:38 2005 +0000 +++ b/random.c Thu Jun 02 16:21:58 2005 +0000 @@ -27,13 +27,13 @@ #include "dbutil.h" #include "bignum.h" -int donerandinit = 0; +static int donerandinit = 0; /* 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 */ -unsigned char hashpool[SHA1_HASH_SIZE]; +static unsigned char hashpool[SHA1_HASH_SIZE]; #define INIT_SEED_SIZE 32 /* 256 bits */ diff -r 0d56e4b80dfb -r 85cc531f711e rsa.c --- a/rsa.c Wed Jun 01 16:15:38 2005 +0000 +++ b/rsa.c Thu Jun 02 16:21:58 2005 +0000 @@ -333,7 +333,7 @@ mp_clear(&rsa_s); #if defined(DEBUG_RSA) && defined(DEBUG_TRACE) - printhex(buf->data, buf->len); + printhex("RSA sig", buf->data, buf->len); #endif @@ -357,10 +357,11 @@ mp_int * rsa_em) { /* 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, 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; hash_state hs; unsigned int nsize;