aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcryptobox/ed25519
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-02 12:20:53 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-02 12:20:53 +0000
commit91001260bc87b72668381b3a8536b76f93bac26a (patch)
tree8035b36f35b4394f463c4835fba0b55488e8d34c /src/libcryptobox/ed25519
parent8d4c157146b37c673bd393b1070dd588f51a3700 (diff)
downloadrspamd-91001260bc87b72668381b3a8536b76f93bac26a.tar.gz
rspamd-91001260bc87b72668381b3a8536b76f93bac26a.zip
Add basic routines for digital signatures
Diffstat (limited to 'src/libcryptobox/ed25519')
-rw-r--r--src/libcryptobox/ed25519/ed25519.c18
-rw-r--r--src/libcryptobox/ed25519/ed25519.h7
-rw-r--r--src/libcryptobox/ed25519/ref.c6
3 files changed, 16 insertions, 15 deletions
diff --git a/src/libcryptobox/ed25519/ed25519.c b/src/libcryptobox/ed25519/ed25519.c
index 776ac4e13..f4658aff5 100644
--- a/src/libcryptobox/ed25519/ed25519.c
+++ b/src/libcryptobox/ed25519/ed25519.c
@@ -34,23 +34,23 @@ typedef struct ed25519_impl_s {
const char *desc;
void (*keypair) (unsigned char *pk, unsigned char *sk);
- void (*sign) (unsigned char *sig, unsigned long long *siglen_p,
- const unsigned char *m, unsigned long long mlen,
+ void (*sign) (unsigned char *sig, size_t *siglen_p,
+ const unsigned char *m, size_t mlen,
const unsigned char *sk);
bool (*verify) (const unsigned char *sig,
const unsigned char *m,
- unsigned long long mlen,
+ size_t mlen,
const unsigned char *pk);
} ed25519_impl_t;
#define ED25519_DECLARE(ext) \
void ed_keypair_##ext(unsigned char *pk, unsigned char *sk); \
- void ed_sign_##ext(unsigned char *sig, unsigned long long *siglen_p, \
- const unsigned char *m, unsigned long long mlen, \
+ void ed_sign_##ext(unsigned char *sig, size_t *siglen_p, \
+ const unsigned char *m, size_t mlen, \
const unsigned char *sk); \
bool ed_verify_##ext(const unsigned char *sig, \
const unsigned char *m, \
- unsigned long long mlen, \
+ size_t mlen, \
const unsigned char *pk)
#define ED25519_IMPL(cpuflags, desc, ext) \
@@ -90,8 +90,8 @@ ed25519_keypair (unsigned char *pk, unsigned char *sk)
}
void
-ed25519_sign (unsigned char *sig, unsigned long long *siglen_p,
- const unsigned char *m, unsigned long long mlen,
+ed25519_sign (unsigned char *sig, size_t *siglen_p,
+ const unsigned char *m, size_t mlen,
const unsigned char *sk)
{
ed25519_opt->sign (sig, siglen_p, m, mlen, sk);
@@ -100,7 +100,7 @@ ed25519_sign (unsigned char *sig, unsigned long long *siglen_p,
bool
ed25519_verify (const unsigned char *sig,
const unsigned char *m,
- unsigned long long mlen,
+ size_t mlen,
const unsigned char *pk)
{
return ed25519_opt->verify (sig, m, mlen, pk);
diff --git a/src/libcryptobox/ed25519/ed25519.h b/src/libcryptobox/ed25519/ed25519.h
index 34814782b..7a6cd796f 100644
--- a/src/libcryptobox/ed25519/ed25519.h
+++ b/src/libcryptobox/ed25519/ed25519.h
@@ -27,15 +27,16 @@
#include "config.h"
#include <stdbool.h>
+#include <stddef.h>
const char* ed25519_load (void);
void ed25519_keypair (unsigned char *pk, unsigned char *sk);
-void ed25519_sign (unsigned char *sig, unsigned long long *siglen_p,
- const unsigned char *m, unsigned long long mlen,
+void ed25519_sign (unsigned char *sig, size_t *siglen_p,
+ const unsigned char *m, size_t mlen,
const unsigned char *sk);
bool ed25519_verify (const unsigned char *sig,
const unsigned char *m,
- unsigned long long mlen,
+ size_t mlen,
const unsigned char *pk);
#endif /* SRC_LIBCRYPTOBOX_ED25519_ED25519_H_ */
diff --git a/src/libcryptobox/ed25519/ref.c b/src/libcryptobox/ed25519/ref.c
index a1053c607..5ae5eb898 100644
--- a/src/libcryptobox/ed25519/ref.c
+++ b/src/libcryptobox/ed25519/ref.c
@@ -59,7 +59,7 @@ ed_keypair_ref (unsigned char *pk, unsigned char *sk)
int
ed_verify_ref(const unsigned char *sig, const unsigned char *m,
- unsigned long long mlen, const unsigned char *pk)
+ size_t mlen, const unsigned char *pk)
{
EVP_MD_CTX sha_ctx;
unsigned char h[64];
@@ -96,8 +96,8 @@ ed_verify_ref(const unsigned char *sig, const unsigned char *m,
}
void
-ed_sign_ref(unsigned char *sig, unsigned long long *siglen_p,
- const unsigned char *m, unsigned long long mlen,
+ed_sign_ref(unsigned char *sig, size_t *siglen_p,
+ const unsigned char *m, size_t mlen,
const unsigned char *sk)
{
EVP_MD_CTX sha_ctx;