parent
36e8ef48f1
commit
e808d405a1
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
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);
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ED25519_HASH_CUSTOM
|
||||||
|
#define ED25519_HASH_CUSTOM
|
||||||
|
|
||||||
|
#include "sha3.h"
|
||||||
|
|
||||||
|
#define ed25519_hash_context SHA3_CTX
|
||||||
|
#define ed25519_hash_init(ctx) sha3_512_Init(ctx)
|
||||||
|
#define ed25519_hash_update(ctx, in, inlen) sha3_Update((ctx), (in), (inlen))
|
||||||
|
#define ed25519_hash_final(ctx, hash) sha3_Final((ctx), (hash))
|
||||||
|
#define ed25519_hash(hash, in, inlen) sha3_512((in), (inlen), (hash))
|
||||||
|
|
||||||
|
#endif // ED25519_HASH_CUSTOM
|
@ -0,0 +1,8 @@
|
|||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include "ed25519-sha3.h"
|
||||||
|
#include "ed25519-hash-custom-sha3.h"
|
||||||
|
|
||||||
|
#define ED25519_SUFFIX _sha3
|
||||||
|
|
||||||
|
#include "ed25519.c"
|
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef ED25519_SHA3_H
|
||||||
|
#define ED25519_SHA3_H
|
||||||
|
|
||||||
|
#include "ed25519.h"
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void ed25519_publickey_sha3(const ed25519_secret_key sk, ed25519_public_key pk);
|
||||||
|
|
||||||
|
int ed25519_sign_open_sha3(const unsigned char *m, size_t mlen, const ed25519_public_key pk, const ed25519_signature RS);
|
||||||
|
void ed25519_sign_sha3(const unsigned char *m, size_t mlen, const ed25519_secret_key sk, const ed25519_public_key pk, ed25519_signature RS);
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // ED25519_SHA3_H
|
Loading…
Reference in new issue