2 * x448.h: Hamburg's X448 key-exchange function
5 * This file is Free Software. It has been modified to as part of its
6 * incorporation into secnet.
8 * Copyright 2017 Mark Wooding
10 * You may redistribute this file and/or modify it under the terms of
11 * the permissive licence shown below.
13 * You may redistribute secnet as a whole and/or modify it under the
14 * terms of the GNU General Public License as published by the Free
15 * Software Foundation; either version 3, or (at your option) any
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, see
25 * https://www.gnu.org/licenses/gpl.html.
28 * Imported from Catacomb, and modified for Secnet (2017-04-30):
30 * * Use `fake-mLib-bits.h' in place of the real <mLib/bits.h>.
32 * * Strip out the key-management definitions.
34 * The file's original comment headers are preserved below.
38 * The X448 key-agreement algorithm
40 * (c) 2017 Straylight/Edgeware
43 /*----- Licensing notice --------------------------------------------------*
45 * This file is part of Catacomb.
47 * Catacomb is free software; you can redistribute it and/or modify
48 * it under the terms of the GNU Library General Public License as
49 * published by the Free Software Foundation; either version 2 of the
50 * License, or (at your option) any later version.
52 * Catacomb is distributed in the hope that it will be useful,
53 * but WITHOUT ANY WARRANTY; without even the implied warranty of
54 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
55 * GNU Library General Public License for more details.
57 * You should have received a copy of the GNU Library General Public
58 * License along with Catacomb; if not, write to the Free
59 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
63 #ifndef CATACOMB_X448_H
64 #define CATACOMB_X448_H
70 /*----- Notes on the X448 key-agreement algorithm -------------------------*
72 * This is X448, as described in RFC7748, based on the elliptic curve defined
73 * in Mike Hamburg, `Ed448-Goldilocks, a new elliptic curve', EUROCRYPT 2016,
74 * https://eprint.iacr.org/2015/625/.
76 * The RFC-specified operation is simpler than the Diffie--Hellman function
77 * described in Hamburg's paper, since it doesn't involve the `Decaf'
78 * cofactor elimination procedure. Indeed, it looks very much like X25519
79 * with Hamburg's curve slotted in in place of Bernstein's.
82 /*----- Header files ------------------------------------------------------*/
84 #include "fake-mLib-bits.h"
86 /*----- Important constants -----------------------------------------------*/
92 extern const octet x448_base[56];
94 /*----- Functions provided ------------------------------------------------*/
98 * Arguments: @octet zz[X448_OUTSZ]@ = where to put the result
99 * @const octet k[X448_KEYSZ]@ = pointer to private key
100 * @const octet qx[X448_PUBSZ]@ = pointer to public value
104 * Use: Calculates X448 of @k@ and @qx@.
107 extern void x448(octet /*zz*/[X448_OUTSZ],
108 const octet /*k*/[X448_KEYSZ],
109 const octet /*qx*/[X448_PUBSZ]);
111 /*----- That's all, folks -------------------------------------------------*/