summaryrefslogtreecommitdiff
path: root/lib/lib6.c
diff options
context:
space:
mode:
authorBenedict <benedict@0xb8000.de>2016-12-18 00:14:25 +0100
committerBenedict <benedict@0xb8000.de>2017-02-21 13:00:26 +0100
commita5b4baa713ed4ffeca70573193ecbc3c0d7421a4 (patch)
tree80a59b512540f25592b58389ebdae1c12d7e189f /lib/lib6.c
parent29591502e2ab22a262063e5552438b23380b3e55 (diff)
set6: challenge44: completed
Diffstat (limited to 'lib/lib6.c')
-rw-r--r--lib/lib6.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/lib6.c b/lib/lib6.c
index 7239228..ef0db85 100644
--- a/lib/lib6.c
+++ b/lib/lib6.c
@@ -209,3 +209,18 @@ void dsa_recover_x_from_known_k(struct dsa_public_params *pub, BIGNUM *k,
BN_mod_sub(priv->private, priv->private, mess_hash, pub->q, ctx);
BN_mod_mul(priv->private, priv->private, r_1, pub->q, ctx);
}
+
+void dsa_recover_k_from_repeated_nonce(BIGNUM *mess1_hash, BIGNUM *mess2_hash,
+ BIGNUM *s1, BIGNUM *s2, struct dsa_public_params *pub,
+ struct dsa_per_user_param *priv, BIGNUM *k)
+{
+
+ BIGNUM *diff1 = BN_new();
+
+ BN_mod_sub(diff1, mess1_hash, mess2_hash, pub->q, ctx);
+ BN_mod_sub(k, s1, s2, pub->q, ctx);
+ BN_mod_inverse(k, k, pub->q, ctx);
+ BN_mod_mul(k, k, diff1, pub->q, ctx);
+ printf("recoverd k is: \n");
+ BN_print(out, k);
+}