changeset 351:e66eec4dcba7 debug-unrandom

some more debugging output
author Matt Johnston <matt@ucc.asn.au>
date Tue, 08 Aug 2006 15:31:38 +0000
parents cd14c94fe89c
children 2481bc4370b8
files common-kex.c libtomcrypt/src/headers/tomcrypt.h libtommath/Makefile.in libtommath/bn_mp_exptmod_fast.c random.c
diffstat 5 files changed, 24 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/common-kex.c	Sun Aug 06 15:29:41 2006 +0000
+++ b/common-kex.c	Tue Aug 08 15:31:38 2006 +0000
@@ -479,7 +479,7 @@
 	DEF_MP_INT(dh_q);
 	DEF_MP_INT(dh_g);
 
-	TRACE(("enter send_msg_kexdh_reply"))
+	TRACE(("enter gen_kexdh_vals"))
 	
 	m_mp_init_multi(&dh_g, &dh_p, &dh_q, NULL);
 
@@ -507,6 +507,7 @@
 		dropbear_exit("Diffie-Hellman error");
 	}
 	mp_clear_multi(&dh_g, &dh_p, &dh_q, NULL);
+    TRACE(("leave gen_kexdh_vals"))
 }
 
 /* This function is fairly common between client/server, with some substitution
@@ -520,6 +521,8 @@
 	mp_int *dh_e = NULL, *dh_f = NULL;
 	hash_state hs;
 
+    TRACE(("enter kexdh_comb_key"))
+
 	/* read the prime and generator*/
 	m_mp_init(&dh_p);
 	bytes_to_mp(&dh_p, dh_p_val, DH_P_LEN);
@@ -577,6 +580,7 @@
 		ses.session_id = (unsigned char*)m_malloc(SHA1_HASH_SIZE);
 		memcpy(ses.session_id, ses.hash, SHA1_HASH_SIZE);
 	}
+    TRACE(("leave kexdh_comb_key"))
 }
 
 /* read the other side's algo list. buf_match_algo is a callback to match
--- a/libtomcrypt/src/headers/tomcrypt.h	Sun Aug 06 15:29:41 2006 +0000
+++ b/libtomcrypt/src/headers/tomcrypt.h	Tue Aug 08 15:31:38 2006 +0000
@@ -9,7 +9,7 @@
 #include <limits.h>
 
 /* use configuration data */
-#include <tomcrypt_custom.h>
+#include "tomcrypt_custom.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -63,16 +63,16 @@
    CRYPT_INVALID_PRIME_SIZE/* Invalid size of prime requested */
 };
 
-#include <tomcrypt_cfg.h>
-#include <tomcrypt_macros.h>
-#include <tomcrypt_cipher.h>
-#include <tomcrypt_hash.h>
-#include <tomcrypt_mac.h>
-#include <tomcrypt_prng.h>
-#include <tomcrypt_pk.h>
-#include <tomcrypt_misc.h>
-#include <tomcrypt_argchk.h>
-#include <tomcrypt_pkcs.h>
+#include "tomcrypt_cfg.h"
+#include "tomcrypt_macros.h"
+#include "tomcrypt_cipher.h"
+#include "tomcrypt_hash.h"
+#include "tomcrypt_mac.h"
+#include "tomcrypt_prng.h"
+#include "tomcrypt_pk.h"
+#include "tomcrypt_misc.h"
+#include "tomcrypt_argchk.h"
+#include "tomcrypt_pkcs.h"
 
 #ifdef __cplusplus
    }
--- a/libtommath/Makefile.in	Sun Aug 06 15:29:41 2006 +0000
+++ b/libtommath/Makefile.in	Tue Aug 08 15:31:38 2006 +0000
@@ -9,7 +9,7 @@
 srcdir=@srcdir@
 
 # Dropbear takes flags from the toplevel makefile
-CFLAGS += -I$(srcdir)
+CFLAGS += -I$(srcdir) -I$(srcdir)/../
 
 #CFLAGS  +=  -I./ -Wall -W -Wshadow -Wsign-compare
 
--- a/libtommath/bn_mp_exptmod_fast.c	Sun Aug 06 15:29:41 2006 +0000
+++ b/libtommath/bn_mp_exptmod_fast.c	Tue Aug 08 15:31:38 2006 +0000
@@ -42,6 +42,10 @@
    */
   int     (*redux)(mp_int*,mp_int*,mp_digit);
 
+  print_mp_int("mp_exptmod_fast G", G);
+  print_mp_int("mp_exptmod_fast X", X);
+  print_mp_int("mp_exptmod_fast P", P);
+
   /* find window size */
   x = mp_count_bits (X);
   if (x <= 7) {
--- a/random.c	Sun Aug 06 15:29:41 2006 +0000
+++ b/random.c	Tue Aug 08 15:31:38 2006 +0000
@@ -71,6 +71,8 @@
 	hash_state hs;
 	unsigned char hash[SHA1_HASH_SIZE];
 	unsigned int copylen;
+    const unsigned int total_len = len;
+    unsigned char* start_buf = buf;
 
 	if (!donerandinit) {
 		dropbear_exit("seedrandom not done");
@@ -93,6 +95,7 @@
 		buf += copylen;
 	}
 	m_burn(hash, sizeof(hash));
+    printhex("genrandom", start_buf, total_len);
 }
 
 /* Generates a random mp_int.