From 12e7d570a2c853b675ad5157732a265abae295c1 Mon Sep 17 00:00:00 2001
From: Matt Johnston <matt@ucc.asn.au>
Date: Mon, 24 Feb 2014 20:53:32 +0800
Subject: [PATCH] Make some debug info conditional

---
 common-kex.c | 8 +++++---
 rsa.c        | 4 +++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/common-kex.c b/common-kex.c
index 9373aa24..10ea5541 100644
--- a/common-kex.c
+++ b/common-kex.c
@@ -789,9 +789,11 @@ static void finish_kexhashbuf(void) {
 	hash_desc->done(&hs, buf_getwriteptr(ses.hash, hash_desc->hashsize));
 	buf_setlen(ses.hash, hash_desc->hashsize);
 
-#ifdef DEBUG_KEXHASH
-	printhex("kexhashbuf", ses.kexhashbuf->data, ses.kexhashbuf->len);
-	printhex("kexhash", ses.hash->data, ses.hash->len);
+#if defined(DEBUG_KEXHASH) && defined(DEBUG_TRACE)
+	if (!debug_trace) {
+		printhex("kexhashbuf", ses.kexhashbuf->data, ses.kexhashbuf->len);
+		printhex("kexhash", ses.hash->data, ses.hash->len);
+	}
 #endif
 
 	buf_burn(ses.kexhashbuf);
diff --git a/rsa.c b/rsa.c
index 7eb64131..193e5774 100644
--- a/rsa.c
+++ b/rsa.c
@@ -347,7 +347,9 @@ void buf_put_rsa_sign(buffer* buf, dropbear_rsa_key *key, buffer *data_buf) {
 	mp_clear(&rsa_s);
 
 #if defined(DEBUG_RSA) && defined(DEBUG_TRACE)
-	printhex("RSA sig", buf->data, buf->len);
+	if (!debug_trace) {
+		printhex("RSA sig", buf->data, buf->len);
+	}
 #endif
 	
 
-- 
GitLab