]> git.codecow.com Git - Monocypher.git/commitdiff
Renamed init1 and init2 into init_first_pass and init_second_pass
authorLoup Vaillant <loup@loup-vaillant.fr>
Wed, 11 Oct 2017 18:57:15 +0000 (20:57 +0200)
committerLoup Vaillant <loup@loup-vaillant.fr>
Wed, 11 Oct 2017 18:57:15 +0000 (20:57 +0200)
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
src/monocypher.h

index 5ce78aa288293413056134da8a58d7c9634bb54c..50ddf64bc9bd9d0c979ff8b4008dd241eb3368cd 100644 (file)
@@ -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_init(&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])
index 926412896229c4c679d27f3121c4ee9d5eb079d1..2fed39a603ff95f71fc21f6164ff03a8e803bad7 100644 (file)
@@ -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]);