2016-04-22 15:47:48 +00:00
|
|
|
#ifndef ED25519_H
|
|
|
|
#define ED25519_H
|
|
|
|
|
2024-01-24 10:24:11 +00:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2018-09-05 14:26:58 +00:00
|
|
|
#include "options.h"
|
|
|
|
|
2016-04-22 15:47:48 +00:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef unsigned char ed25519_signature[64];
|
|
|
|
typedef unsigned char ed25519_public_key[32];
|
|
|
|
typedef unsigned char ed25519_secret_key[32];
|
|
|
|
|
2017-03-28 17:48:36 +00:00
|
|
|
typedef unsigned char curve25519_key[32];
|
|
|
|
|
2017-04-02 00:51:09 +00:00
|
|
|
typedef unsigned char ed25519_cosi_signature[32];
|
|
|
|
|
2016-04-22 15:47:48 +00:00
|
|
|
void ed25519_publickey(const ed25519_secret_key sk, ed25519_public_key pk);
|
2022-06-29 17:01:47 +00:00
|
|
|
void ed25519_publickey_ext(const ed25519_secret_key extsk, ed25519_public_key pk);
|
2017-04-01 22:08:04 +00:00
|
|
|
|
2016-04-22 15:47:48 +00:00
|
|
|
int ed25519_sign_open(const unsigned char *m, size_t mlen, const ed25519_public_key pk, const ed25519_signature RS);
|
2022-06-23 16:00:31 +00:00
|
|
|
void ed25519_sign(const unsigned char *m, size_t mlen, const ed25519_secret_key sk, ed25519_signature RS);
|
|
|
|
void ed25519_sign_ext(const unsigned char *m, size_t mlen, const ed25519_secret_key sk, const ed25519_secret_key skext, ed25519_signature RS);
|
2016-04-22 15:47:48 +00:00
|
|
|
|
2017-06-01 15:08:55 +00:00
|
|
|
int ed25519_scalarmult(ed25519_public_key res, const ed25519_secret_key sk, const ed25519_public_key pk);
|
|
|
|
|
2017-03-28 21:05:59 +00:00
|
|
|
void curve25519_scalarmult(curve25519_key mypublic, const curve25519_key secret, const curve25519_key basepoint);
|
|
|
|
void curve25519_scalarmult_basepoint(curve25519_key mypublic, const curve25519_key secret);
|
2017-03-28 17:48:36 +00:00
|
|
|
|
2017-04-02 00:54:46 +00:00
|
|
|
#if !defined(__GNUC__) || __GNUC__ > 4
|
2017-04-02 00:51:09 +00:00
|
|
|
#define CONST const
|
|
|
|
#else
|
|
|
|
#define CONST
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int ed25519_cosi_combine_publickeys(ed25519_public_key res, CONST ed25519_public_key *pks, size_t n);
|
|
|
|
void ed25519_cosi_combine_signatures(ed25519_signature res, const ed25519_public_key R, CONST ed25519_cosi_signature *sigs, size_t n);
|
2022-06-24 20:55:25 +00:00
|
|
|
void ed25519_cosi_commit(ed25519_secret_key nonce, ed25519_public_key commitment);
|
|
|
|
int ed25519_cosi_sign(const unsigned char *m, size_t mlen, const ed25519_secret_key key, const ed25519_secret_key nonce, const ed25519_public_key R, const ed25519_public_key pk, ed25519_cosi_signature sig);
|
2017-04-02 00:51:09 +00:00
|
|
|
|
2016-04-22 15:47:48 +00:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // ED25519_H
|