Update crypto code from Catacomb 2.3.0.1-45-g9c14.
[secnet] / x448.h
1 /* -*-c-*-
2 *
3 * The X448 key-agreement algorithm
4 *
5 * (c) 2017 Straylight/Edgeware
6 */
7
8 /*----- Licensing notice --------------------------------------------------*
9 *
10 * This file is part of secnet.
11 * See README for full list of copyright holders.
12 *
13 * secnet is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version d of the License, or
16 * (at your option) any later version.
17 *
18 * secnet is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * version 3 along with secnet; if not, see
25 * https://www.gnu.org/licenses/gpl.html.
26 *
27 * This file was originally part of Catacomb, but has been automatically
28 * modified for incorporation into secnet: see `import-catacomb-crypto'
29 * for details.
30 *
31 * Catacomb is free software; you can redistribute it and/or modify
32 * it under the terms of the GNU Library General Public License as
33 * published by the Free Software Foundation; either version 2 of the
34 * License, or (at your option) any later version.
35 *
36 * Catacomb is distributed in the hope that it will be useful,
37 * but WITHOUT ANY WARRANTY; without even the implied warranty of
38 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39 * GNU Library General Public License for more details.
40 *
41 * You should have received a copy of the GNU Library General Public
42 * License along with Catacomb; if not, write to the Free
43 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
44 * MA 02111-1307, USA.
45 */
46
47 #ifndef CATACOMB_X448_H
48 #define CATACOMB_X448_H
49
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53
54 /*----- Notes on the X448 key-agreement algorithm -------------------------*
55 *
56 * This is X448, as described in RFC7748, based on the elliptic curve defined
57 * in Mike Hamburg, `Ed448-Goldilocks, a new elliptic curve', EUROCRYPT 2016,
58 * https://eprint.iacr.org/2015/625/.
59 *
60 * The RFC-specified operation is simpler than the Diffie--Hellman function
61 * described in Hamburg's paper, since it doesn't involve the `Decaf'
62 * cofactor elimination procedure. Indeed, it looks very much like X25519
63 * with Hamburg's curve slotted in in place of Bernstein's.
64 */
65
66 /*----- Header files ------------------------------------------------------*/
67
68 #include "fake-mLib-bits.h"
69
70 /*----- Important constants -----------------------------------------------*/
71
72 #define X448_KEYSZ 56
73 #define X448_PUBSZ 56
74 #define X448_OUTSZ 56
75
76 extern const octet x448_base[56];
77
78 /*----- Functions provided ------------------------------------------------*/
79
80 /* --- @x448@ --- *
81 *
82 * Arguments: @octet zz[X448_OUTSZ]@ = where to put the result
83 * @const octet k[X448_KEYSZ]@ = pointer to private key
84 * @const octet qx[X448_PUBSZ]@ = pointer to public value
85 *
86 * Returns: ---
87 *
88 * Use: Calculates X448 of @k@ and @qx@.
89 */
90
91 extern void x448(octet /*zz*/[X448_OUTSZ],
92 const octet /*k*/[X448_KEYSZ],
93 const octet /*qx*/[X448_PUBSZ]);
94
95 /*----- That's all, folks -------------------------------------------------*/
96
97 #ifdef __cplusplus
98 }
99 #endif
100
101 #endif