From: Loup Vaillant Date: Sun, 1 Dec 2019 11:18:27 +0000 (+0100) Subject: Marked the vtable as part of the public API X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=c42083ffe5066c141f2b85d17e69501be7cc3f87;p=Monocypher.git Marked the vtable as part of the public API --- diff --git a/src/monocypher.h b/src/monocypher.h index f9ba177..f60366b 100644 --- a/src/monocypher.h +++ b/src/monocypher.h @@ -10,7 +10,18 @@ /// Type definitions /// //////////////////////// -// Do not rely on the size or content on any of those types, +// Vtable for EdDSA with a custom hash. +// Instantiate it to define a custom hash. +// Its size, contents, and layout, are part of the public API. +typedef struct { + void (*hash)(uint8_t hash[64], const uint8_t *message, size_t message_size); + void (*init )(void *ctx); + void (*update)(void *ctx, const uint8_t *message, size_t message_size); + void (*final )(void *ctx, uint8_t *hash); + size_t ctx_size; +} crypto_hash_vtable; + +// Do not rely on the size or contents of any of the types below, // they may change without notice. // Poly1305 @@ -32,14 +43,6 @@ typedef struct { } crypto_blake2b_ctx; // Signatures (EdDSA) -typedef struct { - void (*hash)(uint8_t hash[64], const uint8_t *message, size_t message_size); - void (*init )(void *ctx); - void (*update)(void *ctx, const uint8_t *message, size_t message_size); - void (*final )(void *ctx, uint8_t *hash); - size_t ctx_size; -} crypto_hash_vtable; - typedef struct { const crypto_hash_vtable *hash; uint8_t buf[96];