HEIMDAL: move code from source4/heimdal* to third_party/heimdal*
[samba.git] / third_party / heimdal / lib / hcrypto / x25519_ref10.h
1 /*
2  * ISC License
3  *
4  * Copyright (c) 2013-2019
5  * Frank Denis <j at pureftpd dot org>
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19
20 #ifndef x25519_ref10_H
21 #define x25519_ref10_H
22
23 #include <stddef.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #define crypto_scalarmult_curve25519_BYTES 32U
30 size_t crypto_scalarmult_curve25519_bytes(void);
31
32 #define crypto_scalarmult_curve25519_SCALARBYTES 32U
33 size_t crypto_scalarmult_curve25519_scalarbytes(void);
34
35 /*
36  * NOTE: Do not use the result of this function directly for key exchange.
37  *
38  * Hash the result with the public keys in order to compute a shared
39  * secret key: H(q || client_pk || server_pk)
40  *
41  * Or unless this is not an option, use the crypto_kx() API instead.
42  */
43 #define crypto_scalarmult_curve25519 hc_hcrypto_scalarmult_curve25519
44 int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
45                                  const unsigned char *p);
46
47 #define crypto_scalarmult_curve25519_base hc_hcrypto_scalarmult_curve25519_base
48 int crypto_scalarmult_curve25519_base(unsigned char *q,
49                                       const unsigned char *n);
50
51 #ifdef __cplusplus
52 }
53 #endif
54
55 #endif