docs and changed to void functions

This commit is contained in:
Orson Peters 2013-01-22 11:31:58 +01:00
parent 4ee64c0560
commit 440f4a06a4
5 changed files with 10 additions and 14 deletions

Binary file not shown.

View File

@ -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,

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}