xref: /netbsd-src/sys/crypto/sodium/crypto_scalarmult_curve25519.h (revision a5b568d2b48c11c3ad18eebbe13a39088222eb4b)
1 #ifndef crypto_scalarmult_curve25519_H
2 #define crypto_scalarmult_curve25519_H
3 
4 #if 0
5 #include <stddef.h>
6 #endif
7 
8 #include "export.h"
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 #define crypto_scalarmult_curve25519_BYTES 32U
15 SODIUM_EXPORT
16 size_t crypto_scalarmult_curve25519_bytes(void);
17 
18 #define crypto_scalarmult_curve25519_SCALARBYTES 32U
19 SODIUM_EXPORT
20 size_t crypto_scalarmult_curve25519_scalarbytes(void);
21 
22 /*
23  * NOTE: Do not use the result of this function directly.
24  *
25  * Hash the result with the public keys in order to compute a shared
26  * secret key: H(q || client_pk || server_pk)
27  *
28  * Or unless this is not an option, use the crypto_kx() API instead.
29  */
30 SODIUM_EXPORT
31 int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
32                                  const unsigned char *p)
33             __attribute__ ((warn_unused_result));
34 
35 SODIUM_EXPORT
36 int crypto_scalarmult_curve25519_base(unsigned char *q, const unsigned char *n);
37 
38 #ifdef __cplusplus
39 }
40 #endif
41 
42 #endif
43 #ifndef crypto_scalarmult_curve25519_H
44 #define crypto_scalarmult_curve25519_H
45 
46 #if 0
47 #include <stddef.h>
48 #endif
49 
50 #include "export.h"
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 #define crypto_scalarmult_curve25519_BYTES 32U
57 SODIUM_EXPORT
58 size_t crypto_scalarmult_curve25519_bytes(void);
59 
60 #define crypto_scalarmult_curve25519_SCALARBYTES 32U
61 SODIUM_EXPORT
62 size_t crypto_scalarmult_curve25519_scalarbytes(void);
63 
64 /*
65  * NOTE: Do not use the result of this function directly.
66  *
67  * Hash the result with the public keys in order to compute a shared
68  * secret key: H(q || client_pk || server_pk)
69  *
70  * Or unless this is not an option, use the crypto_kx() API instead.
71  */
72 SODIUM_EXPORT
73 int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
74                                  const unsigned char *p)
75             __attribute__ ((warn_unused_result));
76 
77 SODIUM_EXPORT
78 int crypto_scalarmult_curve25519_base(unsigned char *q, const unsigned char *n);
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif
85 #ifndef crypto_scalarmult_curve25519_H
86 #define crypto_scalarmult_curve25519_H
87 
88 #if 0
89 #include <stddef.h>
90 #endif
91 
92 #include "export.h"
93 
94 #ifdef __cplusplus
95 extern "C" {
96 #endif
97 
98 #define crypto_scalarmult_curve25519_BYTES 32U
99 SODIUM_EXPORT
100 size_t crypto_scalarmult_curve25519_bytes(void);
101 
102 #define crypto_scalarmult_curve25519_SCALARBYTES 32U
103 SODIUM_EXPORT
104 size_t crypto_scalarmult_curve25519_scalarbytes(void);
105 
106 /*
107  * NOTE: Do not use the result of this function directly.
108  *
109  * Hash the result with the public keys in order to compute a shared
110  * secret key: H(q || client_pk || server_pk)
111  *
112  * Or unless this is not an option, use the crypto_kx() API instead.
113  */
114 SODIUM_EXPORT
115 int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
116                                  const unsigned char *p)
117             __attribute__ ((warn_unused_result));
118 
119 SODIUM_EXPORT
120 int crypto_scalarmult_curve25519_base(unsigned char *q, const unsigned char *n);
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif
127 #ifndef crypto_scalarmult_curve25519_H
128 #define crypto_scalarmult_curve25519_H
129 
130 #if 0
131 #include <stddef.h>
132 #endif
133 
134 #include "export.h"
135 
136 #ifdef __cplusplus
137 extern "C" {
138 #endif
139 
140 #define crypto_scalarmult_curve25519_BYTES 32U
141 SODIUM_EXPORT
142 size_t crypto_scalarmult_curve25519_bytes(void);
143 
144 #define crypto_scalarmult_curve25519_SCALARBYTES 32U
145 SODIUM_EXPORT
146 size_t crypto_scalarmult_curve25519_scalarbytes(void);
147 
148 /*
149  * NOTE: Do not use the result of this function directly.
150  *
151  * Hash the result with the public keys in order to compute a shared
152  * secret key: H(q || client_pk || server_pk)
153  *
154  * Or unless this is not an option, use the crypto_kx() API instead.
155  */
156 SODIUM_EXPORT
157 int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
158                                  const unsigned char *p)
159             __attribute__ ((warn_unused_result));
160 
161 SODIUM_EXPORT
162 int crypto_scalarmult_curve25519_base(unsigned char *q, const unsigned char *n);
163 
164 #ifdef __cplusplus
165 }
166 #endif
167 
168 #endif
169