2016-04-22 15:47:48 +00:00
|
|
|
/*
|
|
|
|
a custom hash must have a 512bit digest and implement:
|
|
|
|
|
|
|
|
struct ed25519_hash_context;
|
|
|
|
|
|
|
|
void ed25519_hash_init(ed25519_hash_context *ctx);
|
|
|
|
void ed25519_hash_update(ed25519_hash_context *ctx, const uint8_t *in, size_t inlen);
|
|
|
|
void ed25519_hash_final(ed25519_hash_context *ctx, uint8_t *hash);
|
|
|
|
void ed25519_hash(uint8_t *hash, const uint8_t *in, size_t inlen);
|
|
|
|
*/
|
|
|
|
|
2017-05-16 18:22:24 +00:00
|
|
|
#ifndef ED25519_HASH_CUSTOM
|
|
|
|
#define ED25519_HASH_CUSTOM
|
|
|
|
|
2016-04-22 15:47:48 +00:00
|
|
|
#include "sha2.h"
|
|
|
|
|
|
|
|
#define ed25519_hash_context SHA512_CTX
|
|
|
|
#define ed25519_hash_init(ctx) sha512_Init(ctx)
|
|
|
|
#define ed25519_hash_update(ctx, in, inlen) sha512_Update((ctx), (in), (inlen))
|
2016-04-26 09:50:04 +00:00
|
|
|
#define ed25519_hash_final(ctx, hash) sha512_Final((ctx), (hash))
|
2016-04-22 15:47:48 +00:00
|
|
|
#define ed25519_hash(hash, in, inlen) sha512_Raw((in), (inlen), (hash))
|
2017-05-16 18:22:24 +00:00
|
|
|
|
|
|
|
#endif // ED25519_HASH_CUSTOM
|