ec-field-test.c: Make the field-element type use internal format.
[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/. (The curve here is 4-isogenous to
59 * Hamburg's curve.)
60 *
61 * The RFC-specified operation is simpler than the Diffie--Hellman function
62 * described in Hamburg's paper, since it doesn't involve the `Decaf'
63 * cofactor elimination procedure. Indeed, it looks very much like X25519
64 * with Hamburg's curve slotted in in place of Bernstein's.
65 */
66
67 /*----- Header files ------------------------------------------------------*/
68
69 #include "fake-mLib-bits.h"
70
71 /*----- Important constants -----------------------------------------------*/
72
73 #define X448_KEYSZ 56
74 #define X448_PUBSZ 56
75 #define X448_OUTSZ 56
76
77 extern const octet x448_base[56];
78
79 /*----- Functions provided ------------------------------------------------*/
80
81 /* --- @x448@ --- *
82 *
83 * Arguments: @octet zz[X448_OUTSZ]@ = where to put the result
84 * @const octet k[X448_KEYSZ]@ = pointer to private key
85 * @const octet qx[X448_PUBSZ]@ = pointer to public value
86 *
87 * Returns: ---
88 *
89 * Use: Calculates X448 of @k@ and @qx@.
90 */
91
92 extern void x448(octet /*zz*/[X448_OUTSZ],
93 const octet /*k*/[X448_KEYSZ],
94 const octet /*qx*/[X448_PUBSZ]);
95
96 /*----- That's all, folks -------------------------------------------------*/
97
98 #ifdef __cplusplus
99 }
100 #endif
101
102 #endif