From d006f388ebcdf4564aebb5b025955e220a95e72b Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Sun, 1 Dec 2019 12:26:47 +0100 Subject: [PATCH] Added aliases for Ed25519 --- src/optional/ed25519.c | 14 +++++++------- src/optional/ed25519.h | 9 ++++++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/optional/ed25519.c b/src/optional/ed25519.c index cc1da19..3782994 100644 --- a/src/optional/ed25519.c +++ b/src/optional/ed25519.c @@ -261,11 +261,11 @@ void crypto_ed25519_sign(u8 signature [64], const u8 *message, size_t message_size) { crypto_sign_sha512_ctx ctx; - crypto_ed25519_sign_init_first_pass((void*)&ctx, secret_key, public_key); - crypto_sign_update ((void*)&ctx, message, message_size); - crypto_sign_init_second_pass ((void*)&ctx); - crypto_sign_update ((void*)&ctx, message, message_size); - crypto_sign_final ((void*)&ctx, signature); + crypto_ed25519_sign_init_first_pass ((void*)&ctx, secret_key, public_key); + crypto_ed25519_sign_update ((void*)&ctx, message, message_size); + crypto_ed25519_sign_init_second_pass((void*)&ctx); + crypto_ed25519_sign_update ((void*)&ctx, message, message_size); + crypto_ed25519_sign_final ((void*)&ctx, signature); } @@ -275,7 +275,7 @@ int crypto_ed25519_check(const u8 signature [64], { crypto_check_sha512_ctx ctx; crypto_ed25519_check_init((void*)&ctx, signature, public_key); - crypto_check_update((void*)&ctx, message, message_size); - return crypto_check_final((void*)&ctx); + crypto_ed25519_check_update((void*)&ctx, message, message_size); + return crypto_ed25519_check_final((void*)&ctx); } diff --git a/src/optional/ed25519.h b/src/optional/ed25519.h index fa40cb7..3753c21 100644 --- a/src/optional/ed25519.h +++ b/src/optional/ed25519.h @@ -53,13 +53,20 @@ int crypto_ed25519_check(const uint8_t signature [64], const uint8_t public_key[32], const uint8_t *message, size_t message_size); -// Init functions for the incremental interface +// Incremental interface void crypto_ed25519_sign_init_first_pass(crypto_sign_ctx_abstract *ctx, const uint8_t secret_key[32], const uint8_t public_key[32]); +#define crypto_ed25519_sign_update crypto_sign_update +#define crypto_ed25519_sign_init_second_pass crypto_sign_init_second_pass +// use crypto_ed25519_sign_update() again. +#define crypto_ed25519_sign_final crypto_sign_final + void crypto_ed25519_check_init(crypto_check_ctx_abstract *ctx, const uint8_t signature[64], const uint8_t public_key[32]); +#define crypto_ed25519_check_update crypto_check_update +#define crypto_ed25519_check_final crypto_check_final #endif // ED25519_H -- 2.47.3