Change some crypto_sign macros to functions.

This commit is contained in:
Frank Denis 2013-04-19 21:39:13 +02:00
parent a821eae055
commit 5ca15fa3e8
4 changed files with 46 additions and 5 deletions

View File

@ -54,6 +54,7 @@ libsodium_la_SOURCES = \
crypto_shorthash/crypto_shorthash.c \
crypto_shorthash/siphash24/ref/api.h \
crypto_shorthash/siphash24/ref/shorthash_siphash24.c \
crypto_sign/crypto_sign.c \
crypto_sign/ed25519/ref10/base.h \
crypto_sign/ed25519/ref10/base2.h \
crypto_sign/ed25519/ref10/api.h \

View File

@ -0,0 +1,31 @@
#include "crypto_sign.h"
int
crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
const unsigned char *seed)
{
return crypto_sign_ed25519_seed_keypair(pk, sk, seed);
}
int
crypto_sign_keypair(unsigned char *pk, unsigned char *sk)
{
return crypto_sign_ed25519_keypair(pk, sk);
}
int
crypto_sign(unsigned char *sm, unsigned long long *smlen,
const unsigned char *m, unsigned long long mlen,
const unsigned char *sk)
{
return crypto_sign_ed25519(sm, smlen, m, mlen, sk);
}
int
crypto_sign_open(unsigned char *m, unsigned long long *mlen,
const unsigned char *sm, unsigned long long smlen,
const unsigned char *pk)
{
return crypto_sign_ed25519_open(m, mlen, sm, smlen, pk);
}

View File

@ -3,13 +3,22 @@
#include "crypto_sign_ed25519.h"
#define crypto_sign crypto_sign_ed25519
#define crypto_sign_open crypto_sign_ed25519_open
#define crypto_sign_keypair crypto_sign_ed25519_keypair
#define crypto_sign_seed_keypair crypto_sign_ed25519_seed_keypair
#define crypto_sign_BYTES crypto_sign_ed25519_BYTES
#define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES
#define crypto_sign_SECRETKEYBYTES crypto_sign_ed25519_SECRETKEYBYTES
#define crypto_sign_PRIMITIVE "ed25519"
int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
const unsigned char *seed);
int crypto_sign_keypair(unsigned char *pk, unsigned char *sk);
int crypto_sign(unsigned char *sm, unsigned long long *smlen,
const unsigned char *m, unsigned long long mlen,
const unsigned char *sk);
int crypto_sign_open(unsigned char *m, unsigned long long *mlen,
const unsigned char *sm, unsigned long long smlen,
const unsigned char *pk);
#endif

View File

@ -11,7 +11,7 @@ extern "C" {
extern int crypto_sign_ed25519_ref10(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *);
extern int crypto_sign_ed25519_ref10_open(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *);
extern int crypto_sign_ed25519_ref10_keypair(unsigned char *,unsigned char *);
extern int crypto_sign_ed25519_ref10_seed_keypair(unsigned char *,unsigned char *,unsigned char *);
extern int crypto_sign_ed25519_ref10_seed_keypair(unsigned char *,unsigned char *,const unsigned char *);
#ifdef __cplusplus
}
#endif