diff rsa.c @ 346:ed24dfc44904 debug-unrandom

add some debugging of mpints
author Matt Johnston <matt@ucc.asn.au>
date Fri, 04 Aug 2006 17:15:35 +0000
parents 454a34b2dfd1
children
line wrap: on
line diff
--- a/rsa.c	Fri Aug 04 17:15:05 2006 +0000
+++ b/rsa.c	Fri Aug 04 17:15:35 2006 +0000
@@ -211,6 +211,10 @@
 
 	dropbear_assert(key != NULL);
 
+	printhex("buf_rsa_verify buffer", buf->data, buf->len);
+	print_mp_int("buf_rsa_verify key n", key->n);
+	print_mp_int("buf_rsa_verify key e", key->e);
+
 	m_mp_init_multi(&rsa_mdash, &rsa_s, &rsa_em, NULL);
 
 	slen = buf_getint(buf);
@@ -225,6 +229,8 @@
 		goto out;
 	}
 
+	print_mp_int("buf_rsa_verify rsa_s", &rsa_s);
+
 	/* check that s <= n-1 */
 	if (mp_cmp(&rsa_s, key->n) != MP_LT) {
 		TRACE(("s > n-1"))
@@ -233,11 +239,13 @@
 
 	/* create the magic PKCS padded value */
 	rsa_pad_em(key, data, len, &rsa_em);
+	print_mp_int("buf_rsa_verify rsa_em", &rsa_em);
 
 	if (mp_exptmod(&rsa_s, key->e, key->n, &rsa_mdash) != MP_OKAY) {
 		TRACE(("failed exptmod rsa_s"))
 		goto out;
 	}
+	print_mp_int("buf_rsa_verify rsa_mdash", &rsa_mdash);
 
 	if (mp_cmp(&rsa_em, &rsa_mdash) == MP_EQ) {
 		/* signature is valid */