summaryrefslogtreecommitdiffhomepage
path: root/dss.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2017-06-20 20:07:25 +0800
committerMatt Johnston <matt@ucc.asn.au>2017-06-20 20:07:25 +0800
commit2cbe70ba344b2af273aab8d1a4e228faa0934751 (patch)
tree3a0ac98b7c083e76a1cc279ff1446d9400ee5c3f /dss.c
parent8e1ea0f27b596882356dcbb4beb647ce69c1fe9d (diff)
verify debug printing
--HG-- branch : fuzz
Diffstat (limited to 'dss.c')
-rw-r--r--dss.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/dss.c b/dss.c
index a3b4dce..91412ae 100644
--- a/dss.c
+++ b/dss.c
@@ -174,6 +174,13 @@ int buf_dss_verify(buffer* buf, dropbear_dss_key *key, buffer *data_buf) {
goto out;
}
+#if DEBUG_DSS_VERIFY
+ printmpint("dss verify p", key->p);
+ printmpint("dss verify q", key->q);
+ printmpint("dss verify g", key->g);
+ printmpint("dss verify x", key->x);
+#endif
+
/* hash the data */
sha1_init(&hs);
sha1_process(&hs, data_buf->data, data_buf->len);
@@ -183,6 +190,9 @@ int buf_dss_verify(buffer* buf, dropbear_dss_key *key, buffer *data_buf) {
/* w = (s')-1 mod q */
/* let val1 = s' */
bytes_to_mp(&val1, (const unsigned char*) &string[SHA1_HASH_SIZE], SHA1_HASH_SIZE);
+#if DEBUG_DSS_VERIFY
+ printmpint("dss verify s'", &val1);
+#endif
if (mp_cmp(&val1, key->q) != MP_LT) {
TRACE(("verify failed, s' >= q"))
@@ -200,6 +210,9 @@ int buf_dss_verify(buffer* buf, dropbear_dss_key *key, buffer *data_buf) {
/* u1 = ((SHA(M')w) mod q */
/* let val1 = SHA(M') = msghash */
bytes_to_mp(&val1, msghash, SHA1_HASH_SIZE);
+#if DEBUG_DSS_VERIFY
+ printmpint("dss verify r'", &val1);
+#endif
/* let val3 = u1 = ((SHA(M')w) mod q */
if (mp_mulmod(&val1, &val2, key->q, &val3) != MP_OKAY) {