From 42721f776e9b6a62ace78a424aea8d01e0643598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Mon, 27 Jan 2003 23:14:59 +0100 Subject: [PATCH] (dsa_signature_from_sexp): New function. Rev: src/nettle/dsa.h:1.6 Rev: src/nettle/sexp2dsa.c:1.3 --- dsa.h | 4 ++++ sexp2dsa.c | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/dsa.h b/dsa.h index beb15dda..5214c36a 100644 --- a/dsa.h +++ b/dsa.h @@ -153,6 +153,10 @@ dsa_generate_keypair(struct dsa_public_key *pub, struct sexp_iterator; +int +dsa_signature_from_sexp(struct dsa_signature *rs, + struct sexp_iterator *i); + int dsa_keypair_from_sexp_alist(struct dsa_public_key *pub, struct dsa_private_key *priv, diff --git a/sexp2dsa.c b/sexp2dsa.c index 357b3cf8..4d99cf4a 100644 --- a/sexp2dsa.c +++ b/sexp2dsa.c @@ -87,4 +87,20 @@ dsa_keypair_from_sexp(struct dsa_public_key *pub, && dsa_keypair_from_sexp_alist(pub, priv, limit, &i); } +int +dsa_signature_from_sexp(struct dsa_signature *rs, + struct sexp_iterator *i) +{ + static const uint8_t *names[2] = { "r", "s" }; + struct sexp_iterator values[2]; + + if (!sexp_iterator_assoc(i, 2, names, values)) + return 0; + + GET(rs->r, 160, &values[0]); + GET(rs->s, 160, &values[1]); + + return 1; +} + #endif /* WITH_PUBLIC_KEY */ -- GitLab