From: Loup Vaillant Date: Sat, 2 May 2020 20:18:15 +0000 (+0200) Subject: Cosmetic. compact grouping of vtables X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=21194b8198ef647fe1d507c22818e33b8ff8b039;p=Monocypher.git Cosmetic. compact grouping of vtables --- diff --git a/src/monocypher.c b/src/monocypher.c index 9ae1dbf..c588f22 100644 --- a/src/monocypher.c +++ b/src/monocypher.c @@ -680,21 +680,15 @@ void crypto_blake2b(u8 hash[64], const u8 *message, size_t message_size) crypto_blake2b_general(hash, 64, 0, 0, message, message_size); } -static void blake2b_vtable_init(void *ctx) -{ +static void blake2b_vtable_init(void *ctx) { crypto_blake2b_init(&((crypto_sign_ctx*)ctx)->hash); } - -static void blake2b_vtable_update(void *ctx, const u8 *m, size_t s) -{ +static void blake2b_vtable_update(void *ctx, const u8 *m, size_t s) { crypto_blake2b_update(&((crypto_sign_ctx*)ctx)->hash, m, s); } - -static void blake2b_vtable_final(void *ctx, u8 *h) -{ +static void blake2b_vtable_final(void *ctx, u8 *h) { crypto_blake2b_final(&((crypto_sign_ctx*)ctx)->hash, h); } - const crypto_sign_vtable crypto_blake2b_vtable = { crypto_blake2b, blake2b_vtable_init, diff --git a/src/optional/monocypher-ed25519.c b/src/optional/monocypher-ed25519.c index 92846ef..f173fd8 100644 --- a/src/optional/monocypher-ed25519.c +++ b/src/optional/monocypher-ed25519.c @@ -279,21 +279,15 @@ void crypto_sha512(u8 hash[64], const u8 *message, size_t message_size) crypto_sha512_final (&ctx, hash); } -static void sha512_vtable_init(void *ctx) -{ +static void sha512_vtable_init(void *ctx) { crypto_sha512_init(&((crypto_sign_ed25519_ctx*)ctx)->hash); } - -static void sha512_vtable_update(void *ctx, const u8 *m, size_t s) -{ +static void sha512_vtable_update(void *ctx, const u8 *m, size_t s) { crypto_sha512_update(&((crypto_sign_ed25519_ctx*)ctx)->hash, m, s); } - -static void sha512_vtable_final(void *ctx, u8 *h) -{ +static void sha512_vtable_final(void *ctx, u8 *h) { crypto_sha512_final(&((crypto_sign_ed25519_ctx*)ctx)->hash, h); } - const crypto_sign_vtable crypto_sha512_vtable = { crypto_sha512, sha512_vtable_init,