From ba8d05502470fd161acbc4b726c563e9b940b75d Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Wed, 11 Oct 2017 20:57:15 +0200 Subject: [PATCH] Renamed init1 and init2 into init_first_pass and init_second_pass The names are a bit long for my taste, but we must be absolutely clear to the user that we need two passes. Hopefully "first" will act as a strong enough hint that there is a "second". --- src/monocypher.c | 18 +++++++++--------- src/monocypher.h | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/monocypher.c b/src/monocypher.c index 5ce78aa..50ddf64 100644 --- a/src/monocypher.c +++ b/src/monocypher.c @@ -1474,9 +1474,9 @@ void crypto_sign_public_key(u8 public_key[32], ge_tobytes(public_key, &A); } -void crypto_sign_init1(crypto_sign_ctx *ctx, - const u8 secret_key[32], - const u8 public_key[32]) +void crypto_sign_init_first_pass(crypto_sign_ctx *ctx, + const u8 secret_key[32], + const u8 public_key[32]) { u8 *a = ctx->buf; u8 *prefix = ctx->buf + 32; @@ -1504,7 +1504,7 @@ void crypto_sign_update(crypto_sign_ctx *ctx, const u8 *msg, size_t msg_size) HASH_UPDATE(&(ctx->hash), msg, msg_size); } -void crypto_sign_init2(crypto_sign_ctx *ctx) +void crypto_sign_init_second_pass(crypto_sign_ctx *ctx) { u8 *r = ctx->buf + 32; u8 *half_sig = ctx->buf + 64; @@ -1552,11 +1552,11 @@ void crypto_sign(u8 signature[64], const u8 *message, size_t message_size) { crypto_sign_ctx ctx; - crypto_sign_init1 (&ctx, secret_key, public_key); - crypto_sign_update(&ctx, message, message_size); - crypto_sign_init2 (&ctx); - crypto_sign_update(&ctx, message, message_size); - crypto_sign_final (&ctx, signature); + crypto_sign_init_first_pass (&ctx, secret_key, public_key); + crypto_sign_update (&ctx, message, message_size); + crypto_sign_init_second_pass(&ctx); + crypto_sign_update (&ctx, message, message_size); + crypto_sign_final (&ctx, signature); } int crypto_check_public_key(const u8 public_key[32]) diff --git a/src/monocypher.h b/src/monocypher.h index 9264128..2fed39a 100644 --- a/src/monocypher.h +++ b/src/monocypher.h @@ -142,14 +142,14 @@ typedef struct { uint8_t pk [32]; } crypto_sign_ctx; -void crypto_sign_init1(crypto_sign_ctx *ctx, - const uint8_t secret_key[32], - const uint8_t public_key[32]); +void crypto_sign_init_first_pass(crypto_sign_ctx *ctx, + const uint8_t secret_key[32], + const uint8_t public_key[32]); void crypto_sign_update(crypto_sign_ctx *ctx, const uint8_t *message, size_t message_size); -void crypto_sign_init2(crypto_sign_ctx *ctx); +void crypto_sign_init_second_pass(crypto_sign_ctx *ctx); void crypto_sign_final(crypto_sign_ctx *ctx, uint8_t signature[64]); -- 2.47.3