diff --git a/ed25519.dll b/ed25519.dll index e3e370a..9d9b6fd 100644 Binary files a/ed25519.dll and b/ed25519.dll differ diff --git a/readme.md b/readme.md index 8c2cf27..637fe93 100644 --- a/readme.md +++ b/readme.md @@ -1,8 +1,8 @@ Ed25519 ------- -This is a portable implementation of [Ed25519](http://ed25519.cr.yp.to/). All -code is in the public domain. +This is a portable implementation of [Ed25519](http://ed25519.cr.yp.to/) based +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 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 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 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 *sign_key); 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 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, const unsigned char *message, size_t message_len, diff --git a/src/ed25519.h b/src/ed25519.h index f987c6f..e4d5fe0 100644 --- a/src/ed25519.h +++ b/src/ed25519.h @@ -24,8 +24,8 @@ extern "C" { int ED25519_DECLSPEC ed25519_create_seed(unsigned char *seed); #endif -int 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_create_keypair(unsigned char *verify_key, unsigned char *sign_key, const unsigned char *seed); +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); diff --git a/src/keypair.c b/src/keypair.c index b3ed843..abf426b 100644 --- a/src/keypair.c +++ b/src/keypair.c @@ -3,7 +3,7 @@ #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]; ge_p3 A; 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) { sign_key[32 + i] = verify_key[i]; } - - return 0; } diff --git a/src/sign.c b/src/sign.c index 502e344..ffd1122 100644 --- a/src/sign.c +++ b/src/sign.c @@ -4,7 +4,7 @@ #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 r[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_muladd(signature + 32, hram, az, r); - - return 0; }