diff options
author | Niels Möller <nisse@lysator.liu.se> | 2014-09-22 12:39:19 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2014-09-22 12:39:19 +0200 |
commit | a78c9459fda9204b870350a3e075cd78d448fca2 (patch) | |
tree | 5570986a3a7ee931bc4a43b47b6fa62b6133e8cc /ecc-hash.c | |
parent | 2b552abd4edc775de854014c7b0135902ca2ecd3 (diff) | |
download | nettle-a78c9459fda9204b870350a3e075cd78d448fca2.tar.gz |
Introduced struct ecc_modulo.
Diffstat (limited to 'ecc-hash.c')
-rw-r--r-- | ecc-hash.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -47,17 +47,20 @@ Requires ecc->size + 1 limbs, the extra limb may be needed for unusual limb sizes. */ + +/* FIXME: Take a struct ecc_modulo * as argument, and it would make + more sense to pass q than p. */ void ecc_hash (const struct ecc_curve *ecc, mp_limb_t *hp, size_t length, const uint8_t *digest) { - if (length > ((size_t) ecc->bit_size + 7) / 8) - length = (ecc->bit_size + 7) / 8; + if (length > ((size_t) ecc->p.bit_size + 7) / 8) + length = (ecc->p.bit_size + 7) / 8; - mpn_set_base256 (hp, ecc->size + 1, digest, length); + mpn_set_base256 (hp, ecc->p.size + 1, digest, length); - if (8 * length > ecc->bit_size) + if (8 * length > ecc->p.bit_size) /* We got a few extra bits, at the low end. Discard them. */ - mpn_rshift (hp, hp, ecc->size + 1, 8*length - ecc->bit_size); + mpn_rshift (hp, hp, ecc->p.size + 1, 8*length - ecc->p.bit_size); } |