libsodium (1.0.19)
1 #ifndef crypto_core_ed25519_H
2 #define crypto_core_ed25519_H
3
4 #include <stddef.h>
5 #include "export.h"
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 #define crypto_core_ed25519_BYTES 32
12 SODIUM_EXPORT
13 size_t crypto_core_ed25519_bytes(void);
14
15 #define crypto_core_ed25519_UNIFORMBYTES 32
16 SODIUM_EXPORT
17 size_t crypto_core_ed25519_uniformbytes(void);
18
19 #define crypto_core_ed25519_HASHBYTES 64
20 SODIUM_EXPORT
21 size_t crypto_core_ed25519_hashbytes(void);
22
23 #define crypto_core_ed25519_SCALARBYTES 32
24 SODIUM_EXPORT
25 size_t crypto_core_ed25519_scalarbytes(void);
26
27 #define crypto_core_ed25519_NONREDUCEDSCALARBYTES 64
28 SODIUM_EXPORT
29 size_t crypto_core_ed25519_nonreducedscalarbytes(void);
30
31 SODIUM_EXPORT
32 int crypto_core_ed25519_is_valid_point(const unsigned char *p)
33 __attribute__ ((nonnull));
34
35 SODIUM_EXPORT
36 int crypto_core_ed25519_add(unsigned char *r,
37 const unsigned char *p, const unsigned char *q)
38 __attribute__ ((nonnull));
39
40 SODIUM_EXPORT
41 int crypto_core_ed25519_sub(unsigned char *r,
42 const unsigned char *p, const unsigned char *q)
43 __attribute__ ((nonnull));
44
45 SODIUM_EXPORT
46 int crypto_core_ed25519_from_uniform(unsigned char *p, const unsigned char *r)
47 __attribute__ ((nonnull));
48
49 SODIUM_EXPORT
50 int crypto_core_ed25519_from_hash(unsigned char *p, const unsigned char *h)
51 __attribute__ ((nonnull)) __attribute__ ((deprecated));
52
53 SODIUM_EXPORT
54 void crypto_core_ed25519_random(unsigned char *p)
55 __attribute__ ((nonnull));
56
57 SODIUM_EXPORT
58 void crypto_core_ed25519_scalar_random(unsigned char *r)
59 __attribute__ ((nonnull));
60
61 SODIUM_EXPORT
62 int crypto_core_ed25519_scalar_invert(unsigned char *recip, const unsigned char *s)
63 __attribute__ ((nonnull));
64
65 SODIUM_EXPORT
66 void crypto_core_ed25519_scalar_negate(unsigned char *neg, const unsigned char *s)
67 __attribute__ ((nonnull));
68
69 SODIUM_EXPORT
70 void crypto_core_ed25519_scalar_complement(unsigned char *comp, const unsigned char *s)
71 __attribute__ ((nonnull));
72
73 SODIUM_EXPORT
74 void crypto_core_ed25519_scalar_add(unsigned char *z, const unsigned char *x,
75 const unsigned char *y)
76 __attribute__ ((nonnull));
77
78 SODIUM_EXPORT
79 void crypto_core_ed25519_scalar_sub(unsigned char *z, const unsigned char *x,
80 const unsigned char *y)
81 __attribute__ ((nonnull));
82
83 SODIUM_EXPORT
84 void crypto_core_ed25519_scalar_mul(unsigned char *z, const unsigned char *x,
85 const unsigned char *y)
86 __attribute__ ((nonnull));
87
88 /*
89 * The interval `s` is sampled from should be at least 317 bits to ensure almost
90 * uniformity of `r` over `L`.
91 */
92 SODIUM_EXPORT
93 void crypto_core_ed25519_scalar_reduce(unsigned char *r, const unsigned char *s)
94 __attribute__ ((nonnull));
95
96 #ifdef __cplusplus
97 }
98 #endif
99
100 #endif