docs and changed to void functions
This commit is contained in:
parent
4ee64c0560
commit
440f4a06a4
BIN
ed25519.dll
BIN
ed25519.dll
Binary file not shown.
12
readme.md
12
readme.md
|
@ -1,8 +1,8 @@
|
||||||
Ed25519
|
Ed25519
|
||||||
-------
|
-------
|
||||||
|
|
||||||
This is a portable implementation of [Ed25519](http://ed25519.cr.yp.to/). All
|
This is a portable implementation of [Ed25519](http://ed25519.cr.yp.to/) based
|
||||||
code is in the public domain.
|
on the SUPERCOP "ref10" implementation. All code is in the public domain.
|
||||||
|
|
||||||
All code is pure ANSI C without any dependencies, except for the random seed
|
All code is pure ANSI C without any dependencies, except for the random seed
|
||||||
generation which uses standard OS cryptography APIs. If you wish to be
|
generation which uses standard OS cryptography APIs. If you wish to be
|
||||||
|
@ -35,20 +35,20 @@ API
|
||||||
Creates a 32 byte random seed in `seed` for key generation. `seed` must be a
|
Creates a 32 byte random seed in `seed` for key generation. `seed` must be a
|
||||||
writable 32 byte buffer. Returns 0 on success, and nonzero on failure.
|
writable 32 byte buffer. Returns 0 on success, and nonzero on failure.
|
||||||
|
|
||||||
int ed25519_create_keypair(unsigned char *verify_key, unsigned char *sign_key, const unsigned char *seed);
|
void ed25519_create_keypair(unsigned char *verify_key, unsigned char *sign_key, const unsigned char *seed);
|
||||||
|
|
||||||
Creates a new key pair from the given seed. `verify_key` must be a writable 32
|
Creates a new key pair from the given seed. `verify_key` must be a writable 32
|
||||||
byte buffer, `sign_key` must be a writable 64 byte buffer and `seed` must be a
|
byte buffer, `sign_key` must be a writable 64 byte buffer and `seed` must be a
|
||||||
32 byte buffer. Returns 0 on success, and nonzero on failure.
|
32 byte buffer.
|
||||||
|
|
||||||
int ed25519_sign(unsigned char *signature,
|
void ed25519_sign(unsigned char *signature,
|
||||||
const unsigned char *message, size_t message_len,
|
const unsigned char *message, size_t message_len,
|
||||||
const unsigned char *sign_key);
|
const unsigned char *sign_key);
|
||||||
|
|
||||||
Creates a signature of the given message with `sign_key`. `signature` must be
|
Creates a signature of the given message with `sign_key`. `signature` must be
|
||||||
a writable 64 byte buffer. `message` must have at least `message_len` bytes to
|
a writable 64 byte buffer. `message` must have at least `message_len` bytes to
|
||||||
be read. `sign_key` must be a 64 byte signing key generated by
|
be read. `sign_key` must be a 64 byte signing key generated by
|
||||||
`ed25519_create_keypair`. Returns 0 on success, and nonzero on failure.
|
`ed25519_create_keypair`.
|
||||||
|
|
||||||
int ed25519_verify(const unsigned char *signature,
|
int ed25519_verify(const unsigned char *signature,
|
||||||
const unsigned char *message, size_t message_len,
|
const unsigned char *message, size_t message_len,
|
||||||
|
|
|
@ -24,8 +24,8 @@ extern "C" {
|
||||||
int ED25519_DECLSPEC ed25519_create_seed(unsigned char *seed);
|
int ED25519_DECLSPEC ed25519_create_seed(unsigned char *seed);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ED25519_DECLSPEC ed25519_create_keypair(unsigned char *verify_key, unsigned char *sign_key, const unsigned char *seed);
|
void ED25519_DECLSPEC ed25519_create_keypair(unsigned char *verify_key, unsigned char *sign_key, const unsigned char *seed);
|
||||||
int ED25519_DECLSPEC ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *sign_key);
|
void ED25519_DECLSPEC ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *sign_key);
|
||||||
int ED25519_DECLSPEC ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *verify_key);
|
int ED25519_DECLSPEC ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *verify_key);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "ge.h"
|
#include "ge.h"
|
||||||
|
|
||||||
|
|
||||||
int ed25519_create_keypair(unsigned char *verify_key, unsigned char *sign_key, const unsigned char *seed) {
|
void ed25519_create_keypair(unsigned char *verify_key, unsigned char *sign_key, const unsigned char *seed) {
|
||||||
unsigned char h[64];
|
unsigned char h[64];
|
||||||
ge_p3 A;
|
ge_p3 A;
|
||||||
int i;
|
int i;
|
||||||
|
@ -23,6 +23,4 @@ int ed25519_create_keypair(unsigned char *verify_key, unsigned char *sign_key, c
|
||||||
for (i = 0; i < 32; ++i) {
|
for (i = 0; i < 32; ++i) {
|
||||||
sign_key[32 + i] = verify_key[i];
|
sign_key[32 + i] = verify_key[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "sc.h"
|
#include "sc.h"
|
||||||
|
|
||||||
|
|
||||||
int ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *sign_key) {
|
void ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *sign_key) {
|
||||||
unsigned char az[64];
|
unsigned char az[64];
|
||||||
unsigned char r[64];
|
unsigned char r[64];
|
||||||
unsigned char hram[64];
|
unsigned char hram[64];
|
||||||
|
@ -33,6 +33,4 @@ int ed25519_sign(unsigned char *signature, const unsigned char *message, size_t
|
||||||
|
|
||||||
sc_reduce(hram);
|
sc_reduce(hram);
|
||||||
sc_muladd(signature + 32, hram, az, r);
|
sc_muladd(signature + 32, hram, az, r);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue