Hack on the newly imported X25519 and X448 code.
[secnet] / x448.c
diff --git a/x448.c b/x448.c
index d766e5c..c58335a 100644 (file)
--- a/x448.c
+++ b/x448.c
@@ -1,3 +1,40 @@
+/*
+ * x448.c: Hamburg's X448 key-exchange function
+ */
+/*
+ * This file is Free Software.  It has been modified to as part of its
+ * incorporation into secnet.
+ *
+ * Copyright 2017 Mark Wooding
+ *
+ * You may redistribute this file and/or modify it under the terms of
+ * the permissive licence shown below.
+ *
+ * You may redistribute secnet as a whole and/or modify it under the
+ * terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 3, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see
+ * https://www.gnu.org/licenses/gpl.html.
+ */
+/*
+ * Imported from Catacomb, and modified for Secnet (2017-04-30):
+ *
+ *   * Use `fake-mLib-bits.h' in place of the real <mLib/bits.h>.
+ *
+ *   * Remove the test rig code: a replacement is in a separate source file.
+ *
+ *   * Strip out the key-management definitions.
+ *
+ * The file's original comment headers are preserved below.
+ */
 /* -*-c-*-
  *
  * The X448 key-agreement algorithm
@@ -27,7 +64,7 @@
 
 /*----- Header files ------------------------------------------------------*/
 
-#include <mLib/bits.h>
+#include "fake-mLib-bits.h"
 
 #include "montladder.h"
 #include "fgoldi.h"
@@ -39,24 +76,6 @@ const octet x448_base[56] = { 5, 0, /* ... */ };
 
 #define A0 39081
 
-/*----- Key fetching ------------------------------------------------------*/
-
-const key_fetchdef x448_pubfetch[] = {
-  { "pub",     offsetof(x448_pub, pub),        KENC_BINARY,    0 },
-  { 0,         0,                              0,              0 }
-};
-
-static const key_fetchdef priv[] = {
-  { "priv",    offsetof(x448_priv, priv),      KENC_BINARY,    0 },
-  { 0,         0,                              0,              0 }
-};
-
-const key_fetchdef x448_privfetch[] = {
-  { "pub",     offsetof(x448_priv, pub),       KENC_BINARY,    0 },
-  { "private", 0,                              KENC_STRUCT,    priv },
-  { 0,         0,                              0,              0 }
-};
-
 /*----- Main code ---------------------------------------------------------*/
 
 /* --- @x448@ --- *