summaryrefslogtreecommitdiff
path: root/eddsa.h
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2015-03-19 06:43:17 +0100
committerNiels Möller <nisse@lysator.liu.se>2015-03-19 06:43:17 +0100
commit0d66c601ee79bae8d8b175ad7dd0f0e8d5e56c45 (patch)
tree4ac4de05e0b3a086e07a30edc1ee929854e4adb4 /eddsa.h
parent7fdb2fec724c0504a67c8a41da26984132d63d1c (diff)
downloadnettle-0d66c601ee79bae8d8b175ad7dd0f0e8d5e56c45.tar.gz
EdDSA interface change, use plain strings to represent keys.
Diffstat (limited to 'eddsa.h')
-rw-r--r--eddsa.h41
1 files changed, 7 insertions, 34 deletions
diff --git a/eddsa.h b/eddsa.h
index b052ef82..49f1a025 100644
--- a/eddsa.h
+++ b/eddsa.h
@@ -42,8 +42,8 @@ extern "C" {
/* Name mangling */
#define ed25519_sha512_set_private_key nettle_ed25519_sha512_set_private_key
+#define ed25519_sha512_public_key nettle_ed25519_sha512_public_key
#define ed25519_sha512_sign nettle_ed25519_sha512_sign
-#define ed25519_sha512_set_public_key nettle_ed25519_sha512_set_public_key
#define ed25519_sha512_verify nettle_ed25519_sha512_verify
#define _eddsa_compress _nettle_eddsa_compress
@@ -51,7 +51,6 @@ extern "C" {
#define _eddsa_decompress _nettle_eddsa_decompress
#define _eddsa_decompress_itch _nettle_eddsa_decompress_itch
#define _eddsa_hash _nettle_eddsa_hash
-#define _eddsa_expand_key_itch _nettle_eddsa_expand_key_itch
#define _eddsa_expand_key _nettle_eddsa_expand_key
#define _eddsa_sign _nettle_eddsa_sign
#define _eddsa_sign_itch _nettle_eddsa_sign_itch
@@ -63,38 +62,17 @@ extern "C" {
#define ED25519_KEY_SIZE 32
#define ED25519_SIGNATURE_SIZE 64
-/* Number of limbs needed to represent a point coordinate, or a secret
- exponent (note that exponents are 254 bits, larger than q). */
-#define _ED25519_LIMB_SIZE ((255 + (GMP_NUMB_BITS - 1)) / GMP_NUMB_BITS)
-
-struct ed25519_private_key
-{
- uint8_t pub[ED25519_KEY_SIZE];
- uint8_t k1[ED25519_KEY_SIZE];
- mp_limb_t k2[_ED25519_LIMB_SIZE];
-};
-
void
-ed25519_sha512_set_private_key (struct ed25519_private_key *priv,
- const uint8_t *key);
+ed25519_sha512_public_key (uint8_t *pub, const uint8_t *priv);
void
-ed25519_sha512_sign (const struct ed25519_private_key *priv,
+ed25519_sha512_sign (const uint8_t *pub,
+ const uint8_t *priv,
size_t length, const uint8_t *msg,
uint8_t *signature);
-struct ed25519_public_key
-{
- uint8_t pub[ED25519_KEY_SIZE];
- mp_limb_t A[2*_ED25519_LIMB_SIZE];
-};
-
-int
-ed25519_sha512_set_public_key (struct ed25519_public_key *pub,
- const uint8_t *key);
-
int
-ed25519_sha512_verify (const struct ed25519_public_key *pub,
+ed25519_sha512_verify (const uint8_t *pub,
size_t length, const uint8_t *msg,
const uint8_t *signature);
@@ -148,18 +126,13 @@ _eddsa_verify (const struct ecc_curve *ecc,
const uint8_t *signature,
mp_limb_t *scratch);
-mp_size_t
-_eddsa_expand_key_itch (const struct ecc_curve *ecc);
-
void
_eddsa_expand_key (const struct ecc_curve *ecc,
const struct nettle_hash *H,
void *ctx,
const uint8_t *key,
- uint8_t *pub,
- uint8_t *k1,
- mp_limb_t *k2,
- mp_limb_t *scratch);
+ uint8_t *digest,
+ mp_limb_t *k2);
mp_size_t
_eddsa_public_key_itch (const struct ecc_curve *ecc);