summaryrefslogtreecommitdiff
path: root/ecc-hash.c
diff options
context:
space:
mode:
authorDmitry Baryshkov <dbaryshkov@gmail.com>2020-01-17 00:52:35 +0300
committerNiels Möller <nisse@lysator.liu.se>2020-01-25 16:04:24 +0100
commit32ca8abcd9f0468bbd757c09317418a39d110fa1 (patch)
tree81e9cca754d82c3c1626aadba41e54186b58e7ed /ecc-hash.c
parent3f2d5b73a84b073c7b7c3e5803dd58c1c1b41561 (diff)
downloadnettle-32ca8abcd9f0468bbd757c09317418a39d110fa1.tar.gz
Add GOST DSA according to GOST R 34.10-2001/-2012
Add GOST Digital Signature Algorithms support according to GOST R 34.10-2001/-2012. English translations of these standards are provided as RFC 5832 and RFC 7091. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Diffstat (limited to 'ecc-hash.c')
-rw-r--r--ecc-hash.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ecc-hash.c b/ecc-hash.c
index 4e830a51..07877110 100644
--- a/ecc-hash.c
+++ b/ecc-hash.c
@@ -62,3 +62,14 @@ ecc_hash (const struct ecc_modulo *m,
/* We got a few extra bits, at the low end. Discard them. */
mpn_rshift (hp, hp, m->size + 1, 8*length - m->bit_size);
}
+
+void
+gost_hash (const struct ecc_modulo *m,
+ mp_limb_t *hp,
+ size_t length, const uint8_t *digest)
+{
+ if (length > ((size_t) m->bit_size + 7) / 8)
+ length = (m->bit_size + 7) / 8;
+
+ mpn_set_base256_le (hp, m->size + 1, digest, length);
+}