From 030c7f2c9c0efe3da34571a79b8f2836d6619027 Mon Sep 17 00:00:00 2001 From: Andreas Enge <andreas.enge@inria.fr> Date: Wed, 10 Jan 2024 16:09:07 +0100 Subject: [PATCH] Add a missing source file. * src/ecpp-check.c: New file. * .gitignore: Add new binary. --- .gitignore | 1 + src/ecpp-check.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 src/ecpp-check.c diff --git a/.gitignore b/.gitignore index 2a416fa..dfd066c 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ src/classpol src/cm src/ecpp src/ecpp-mpi +src/ecpp-check aclocal.m4 autom4te.cache/ diff --git a/src/ecpp-check.c b/src/ecpp-check.c new file mode 100644 index 0000000..d9e866d --- /dev/null +++ b/src/ecpp-check.c @@ -0,0 +1,59 @@ +/* + +ecpp-check.c - executable for verifying ECPP certificates + +Copyright (C) 2024 Andreas Enge + +This file is part of CM. + +CM is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the license, or (at your +option) any later version. + +CM 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 CM; see the file COPYING. If not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "params.h" + +int main (int argc, char* argv []) +{ + char *filename; + int res, res_pari; + + cm_pari_init (); + + evaluate_parameters_ecpp_check (argc, argv, &filename); + + res = cm_pari_ecpp_file_check (filename, true, true); + + if (res == 1) + printf ("The file contains a valid ECPP certificate " + "in the CM format.\n"); + else if (res == 2) + printf ("The file contains a valid partial ECPP certificate " + "in the CM format.\n"); + else { + res_pari = cm_pari_ecpp_file_check (filename, false, true); + printf ("The certificate in the file is invalid according to the " + "CM specification.\n"); + if (res_pari == 1) + printf ("But it is valid "); + else if (res_pari == 2) + printf ("But it is a valid partial certificate "); + else + printf ("It is also invalid "); + printf ("according to the PARI/GP specification.\n"); + } + + cm_pari_clear (); + + return 0; +} -- GitLab