Commit | Line | Data |
---|---|---|
0bcb8184 MW |
1 | /* |
2 | * x448.h: Hamburg's X448 key-exchange function | |
3 | */ | |
4 | /* | |
5 | * This file is Free Software. It has been modified to as part of its | |
6 | * incorporation into secnet. | |
7 | * | |
8 | * Copyright 2017 Mark Wooding | |
9 | * | |
10 | * You may redistribute this file and/or modify it under the terms of | |
11 | * the permissive licence shown below. | |
12 | * | |
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 | |
16 | * later version. | |
17 | * | |
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. | |
22 | * | |
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. | |
26 | */ | |
27 | /* | |
28 | * Imported from Catacomb, and modified for Secnet (2017-04-30): | |
29 | * | |
30 | * * Use `fake-mLib-bits.h' in place of the real <mLib/bits.h>. | |
31 | * | |
32 | * * Strip out the key-management definitions. | |
33 | * | |
34 | * The file's original comment headers are preserved below. | |
35 | */ | |
b7a5ecfc MW |
36 | /* -*-c-*- |
37 | * | |
38 | * The X448 key-agreement algorithm | |
39 | * | |
40 | * (c) 2017 Straylight/Edgeware | |
41 | */ | |
42 | ||
43 | /*----- Licensing notice --------------------------------------------------* | |
44 | * | |
45 | * This file is part of Catacomb. | |
46 | * | |
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. | |
51 | * | |
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. | |
56 | * | |
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, | |
60 | * MA 02111-1307, USA. | |
61 | */ | |
62 | ||
63 | #ifndef CATACOMB_X448_H | |
64 | #define CATACOMB_X448_H | |
65 | ||
66 | #ifdef __cplusplus | |
67 | extern "C" { | |
68 | #endif | |
69 | ||
70 | /*----- Notes on the X448 key-agreement algorithm -------------------------* | |
71 | * | |
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/. | |
75 | * | |
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. | |
80 | */ | |
81 | ||
82 | /*----- Header files ------------------------------------------------------*/ | |
83 | ||
0bcb8184 | 84 | #include "fake-mLib-bits.h" |
b7a5ecfc MW |
85 | |
86 | /*----- Important constants -----------------------------------------------*/ | |
87 | ||
88 | #define X448_KEYSZ 56 | |
89 | #define X448_PUBSZ 56 | |
90 | #define X448_OUTSZ 56 | |
91 | ||
92 | extern const octet x448_base[56]; | |
93 | ||
94 | /*----- Functions provided ------------------------------------------------*/ | |
95 | ||
96 | /* --- @x448@ --- * | |
97 | * | |
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 | |
101 | * | |
102 | * Returns: --- | |
103 | * | |
104 | * Use: Calculates X448 of @k@ and @qx@. | |
105 | */ | |
106 | ||
107 | extern void x448(octet /*zz*/[X448_OUTSZ], | |
108 | const octet /*k*/[X448_KEYSZ], | |
109 | const octet /*qx*/[X448_PUBSZ]); | |
110 | ||
111 | /*----- That's all, folks -------------------------------------------------*/ | |
112 | ||
113 | #ifdef __cplusplus | |
114 | } | |
115 | #endif | |
116 | ||
117 | #endif |