algo_suite: register all algorithms and enjoy them
This commit is contained in:
parent
9731e41beb
commit
6b96cc33e6
38
src/algo_suite.cpp
Normal file
38
src/algo_suite.cpp
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Codecrypt.
|
||||||
|
*
|
||||||
|
* Codecrypt is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* Codecrypt 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 Lesser General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Codecrypt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "algo_suite.h"
|
||||||
|
|
||||||
|
#include "algos_enc.h"
|
||||||
|
#include "algos_sig.h"
|
||||||
|
|
||||||
|
void fill_algorithm_suite (algorithm_suite&s)
|
||||||
|
{
|
||||||
|
|
||||||
|
static algo_mceqd128 mce1;
|
||||||
|
mce1.register_into_suite (s);
|
||||||
|
|
||||||
|
static algo_mceqd256 mce2;
|
||||||
|
mce2.register_into_suite (s);
|
||||||
|
|
||||||
|
static algo_fmtseq128 fmt1;
|
||||||
|
fmt1.register_into_suite (s);
|
||||||
|
|
||||||
|
static algo_fmtseq256 fmt2;
|
||||||
|
fmt2.register_into_suite (s);
|
||||||
|
}
|
26
src/algo_suite.h
Normal file
26
src/algo_suite.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Codecrypt.
|
||||||
|
*
|
||||||
|
* Codecrypt is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* Codecrypt 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 Lesser General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Codecrypt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ccr_algo_suite_h_
|
||||||
|
#define _ccr_algo_suite_h_
|
||||||
|
|
||||||
|
#include "algorithm.h"
|
||||||
|
|
||||||
|
void fill_algorithm_suite (algorithm_suite&);
|
||||||
|
|
||||||
|
#endif
|
10
src/main.cpp
10
src/main.cpp
|
@ -97,7 +97,9 @@ void test()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
#include "keyring.h"
|
#include "keyring.h"
|
||||||
|
#include "algo_suite.h"
|
||||||
|
|
||||||
int main (int argc, char**argv)
|
int main (int argc, char**argv)
|
||||||
{
|
{
|
||||||
|
@ -207,13 +209,14 @@ int main (int argc, char**argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* something is happening here, therefore init everything
|
* something will be happening, therefore init everything
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int exitflag = 0;
|
int exitflag = 0;
|
||||||
|
|
||||||
keyring KR;
|
keyring KR;
|
||||||
|
algorithm_suite AS;
|
||||||
|
|
||||||
|
//keyring initialization
|
||||||
if (!KR.open() ) {
|
if (!KR.open() ) {
|
||||||
err ("could not open keyring!");
|
err ("could not open keyring!");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -225,6 +228,9 @@ int main (int argc, char**argv)
|
||||||
goto exit_ok;
|
goto exit_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//register all available algorithms
|
||||||
|
fill_algorithm_suite (AS);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check the option flags and do whatever was requested
|
* check the option flags and do whatever was requested
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue