diff --git a/a.exe b/a.exe deleted file mode 100644 index 283c25c..0000000 Binary files a/a.exe and /dev/null differ diff --git a/crypto_sign.h b/crypto_sign.h deleted file mode 100644 index ae0f601..0000000 --- a/crypto_sign.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef crypto_sign_edwards25519sha512batch_H -#define crypto_sign_edwards25519sha512batch_H - -#define SECRETKEYBYTES 64 -#define PUBLICKEYBYTES 32 -#define SIGNATUREBYTES 64 - -extern int crypto_sign(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *); -extern int crypto_sign_open(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *); -extern int crypto_sign_keypair(unsigned char *,unsigned char *,unsigned char *); - -#endif \ No newline at end of file diff --git a/keypair.c b/keypair.c index 9c0cace..ca65c5e 100644 --- a/keypair.c +++ b/keypair.c @@ -1,8 +1,8 @@ -#include "crypto_sign.h" +#include "ed25519.h" #include "sha512.h" #include "ge.h" -int crypto_sign_keypair(unsigned char *pk, unsigned char *sk, unsigned char *seed) +int ed25519_sign_keypair(unsigned char *pk, unsigned char *sk, unsigned char *seed) { unsigned char h[64]; ge_p3 A; @@ -18,5 +18,6 @@ int crypto_sign_keypair(unsigned char *pk, unsigned char *sk, unsigned char *see for (i = 0;i < 32;++i) sk[i] = seed[i]; for (i = 0;i < 32;++i) sk[32 + i] = pk[i]; + return 0; } diff --git a/open.c b/open.c index f65fab3..862c7b6 100644 --- a/open.c +++ b/open.c @@ -1,9 +1,9 @@ -#include "crypto_sign.h" +#include "ed25519.h" #include "sha512.h" #include "ge.h" #include "sc.h" -int crypto_sign_open( +int ed25519_sign_open( unsigned char *m,unsigned long long *mlen, const unsigned char *sm,unsigned long long smlen, const unsigned char *pk diff --git a/sign.c b/sign.c index f98312c..891c719 100644 --- a/sign.c +++ b/sign.c @@ -1,9 +1,9 @@ -#include "crypto_sign.h" +#include "ed25519.h" #include "sha512.h" #include "ge.h" #include "sc.h" -int crypto_sign( +int ed25519_sign( unsigned char *sm,unsigned long long *smlen, const unsigned char *m,unsigned long long mlen, const unsigned char *sk diff --git a/test.c b/test.c index 91b7349..a6b1180 100644 --- a/test.c +++ b/test.c @@ -2,7 +2,7 @@ #include #include #include -#include "crypto_sign.h" +#include "ed25519.h" char *msg = "Hello World"; @@ -11,26 +11,26 @@ int main(int argc, char *argv[]) { unsigned char *sigmsg, *newmsg; unsigned long long sigmsglen, newmsglen; int ret; - crypto_sign_keypair(vk, sk, "0123456890123456789012"); + ed25519_sign_keypair(vk, sk, "0123456890123456789012"); printf("got keypair\n"); sigmsg = malloc(strlen(msg)+1+64); if (!sigmsg) return 1; - crypto_sign(sigmsg, &sigmsglen, (unsigned char *)msg, strlen(msg)+1, sk); + ed25519_sign(sigmsg, &sigmsglen, (unsigned char *)msg, strlen(msg)+1, sk); printf("got signature\n"); if (sigmsglen != strlen(msg)+1+64) return 2; newmsg = malloc(sigmsglen); if (!newmsg) return 3; - ret = crypto_sign_open(newmsg, &newmsglen, sigmsg, sigmsglen, vk); + ret = ed25519_sign_open(newmsg, &newmsglen, sigmsg, sigmsglen, vk); printf("verified signature\n"); if (ret == 0) printf("good!\n"); else printf("bad\n"); sigmsg[0] ^= 0x01; - ret = crypto_sign_open(newmsg, &newmsglen, sigmsg, sigmsglen, vk); + ret = ed25519_sign_open(newmsg, &newmsglen, sigmsg, sigmsglen, vk); if (ret == 0) printf("bad: failed to detect simple corruption\n"); else