776e0d35545262fa4c6dda951e7f034c0ce19d31
[oweals/gnunet.git] / src / util / tweetnacl-gnunet.h
1 /*
2       This file has been placed in the public domain.
3
4       Based on TweetNaCl version 20140427
5
6       Originally obtained from:
7       https://tweetnacl.cr.yp.to/20140427/tweetnacl.h
8  */
9
10
11 #ifndef TWEETNACL_H
12 #define TWEETNACL_H
13 #include <stdint.h>
14 #define crypto_scalarmult_PRIMITIVE "curve25519"
15 #define crypto_scalarmult crypto_scalarmult_curve25519
16 #define crypto_scalarmult_base crypto_scalarmult_curve25519_base
17 #define crypto_scalarmult_BYTES crypto_scalarmult_curve25519_BYTES
18 #define crypto_scalarmult_SCALARBYTES crypto_scalarmult_curve25519_SCALARBYTES
19 #define crypto_scalarmult_IMPLEMENTATION \
20   crypto_scalarmult_curve25519_IMPLEMENTATION
21 #define crypto_scalarmult_VERSION crypto_scalarmult_curve25519_VERSION
22 #define crypto_scalarmult_curve25519_tweet_BYTES 32
23 #define crypto_scalarmult_curve25519_tweet_SCALARBYTES 32
24 extern int crypto_scalarmult_curve25519_tweet (uint8_t *,
25                                                const uint8_t *,
26                                                const uint8_t *);
27 extern int crypto_scalarmult_curve25519_tweet_base (uint8_t *,
28                                                     const uint8_t *);
29 #define crypto_scalarmult_curve25519_tweet_VERSION "-"
30 #define crypto_scalarmult_curve25519 crypto_scalarmult_curve25519_tweet
31 #define crypto_scalarmult_curve25519_base \
32   crypto_scalarmult_curve25519_tweet_base
33 #define crypto_scalarmult_curve25519_BYTES \
34   crypto_scalarmult_curve25519_tweet_BYTES
35 #define crypto_scalarmult_curve25519_SCALARBYTES \
36   crypto_scalarmult_curve25519_tweet_SCALARBYTES
37 #define crypto_scalarmult_curve25519_VERSION \
38   crypto_scalarmult_curve25519_tweet_VERSION
39 #define crypto_scalarmult_curve25519_IMPLEMENTATION \
40   "crypto_scalarmult/curve25519/tweet"
41 #define crypto_sign_PRIMITIVE "ed25519"
42 #define crypto_sign crypto_sign_ed25519
43 #define crypto_sign_BYTES crypto_sign_ed25519_BYTES
44 #define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES
45 #define crypto_sign_SECRETKEYBYTES crypto_sign_ed25519_SECRETKEYBYTES
46 #define crypto_sign_IMPLEMENTATION crypto_sign_ed25519_IMPLEMENTATION
47 #define crypto_sign_VERSION crypto_sign_ed25519_VERSION
48 #define crypto_sign_ed25519_tweet_BYTES 64
49 #define crypto_sign_ed25519_tweet_PUBLICKEYBYTES 32
50 #define crypto_sign_ed25519_tweet_SECRETKEYBYTES 64
51 extern int crypto_sign_ed25519_tweet (uint8_t *,
52                                       uint64_t *,
53                                       const uint8_t *,
54                                       uint64_t,
55                                       const uint8_t *);
56 extern int crypto_sign_ed25519_tweet_open (uint8_t *,
57                                            uint64_t *,
58                                            const uint8_t *,
59                                            uint64_t,
60                                            const uint8_t *);
61 extern int crypto_sign_ed25519_tweet_keypair (uint8_t *,uint8_t *);
62 #define crypto_sign_ed25519_tweet_VERSION "-"
63 #define crypto_sign_ed25519 crypto_sign_ed25519_tweet
64 #define crypto_sign_ed25519_open crypto_sign_ed25519_tweet_open
65 #define crypto_sign_ed25519_keypair crypto_sign_ed25519_tweet_keypair
66 #define crypto_sign_ed25519_BYTES crypto_sign_ed25519_tweet_BYTES
67 #define crypto_sign_ed25519_PUBLICKEYBYTES \
68   crypto_sign_ed25519_tweet_PUBLICKEYBYTES
69 #define crypto_sign_ed25519_SECRETKEYBYTES \
70   crypto_sign_ed25519_tweet_SECRETKEYBYTES
71 #define crypto_sign_ed25519_VERSION crypto_sign_ed25519_tweet_VERSION
72 #define crypto_sign_ed25519_IMPLEMENTATION "crypto_sign/ed25519/tweet"
73 void crypto_sign_pk_from_seed (uint8_t *pk, const uint8_t *seed);
74 void crypto_sign_sk_from_seed (uint8_t *sk, const uint8_t *seed);
75 int crypto_sign_ed25519_pk_to_curve25519 (uint8_t *x25519_pk,
76                                           const uint8_t *ed25519_pk);
77 int crypto_sign_detached_verify (const uint8_t *sig,
78                                  const uint8_t *m,
79                                  uint64_t n,
80                                  const uint8_t *pk);
81 int crypto_sign_detached (uint8_t *sig,
82                           const uint8_t *m,
83                           uint64_t n,
84                           const uint8_t *sk);
85 #endif