diff options
author | Mattias Andrée <maandree@kth.se> | 2017-10-14 13:33:07 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2017-10-14 13:33:07 +0200 |
commit | b5612bbbcbfd4fff7e8552579a7dd81a141d90d3 (patch) | |
tree | 1ed81a17345ac89a5ce89e232ac478b84297a4ce /common.h | |
parent | Use arg.h instead of argparser (diff) | |
download | sha3sum-b5612bbbcbfd4fff7e8552579a7dd81a141d90d3.tar.gz sha3sum-b5612bbbcbfd4fff7e8552579a7dd81a141d90d3.tar.bz2 sha3sum-b5612bbbcbfd4fff7e8552579a7dd81a141d90d3.tar.xz |
Generate all C files except common.c and keccaksum.c
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -1,13 +1,22 @@ /* See LICENSE file for copyright and license details. */ #include <libkeccak.h> -/** - * Wrapper for `run` that also initialises the command line parser - * - * @param suffix The message suffix - */ -#define RUN(suffix)\ - (run(argc, argv, &spec, suffix)) + +#define COMMON_MAIN(CONFIGURATION, SUFFIX)\ + int main(int argc, char *argv[]) {\ + libkeccak_generalised_spec_t spec;\ + libkeccak_generalised_spec_initialise(&spec);\ + CONFIGURATION;\ + return run(argc, argv, &spec, SUFFIX);\ + } +#define KECCAK_MAIN(N)\ + COMMON_MAIN(libkeccak_spec_sha3((libkeccak_spec_t *)&spec, N), "") +#define SHA3_MAIN(N)\ + COMMON_MAIN(libkeccak_spec_sha3((libkeccak_spec_t *)&spec, N), LIBKECCAK_SHA3_SUFFIX) +#define RAWSHAKE_MAIN(N)\ + COMMON_MAIN(libkeccak_spec_rawshake((libkeccak_spec_t *)&spec, N, N), LIBKECCAK_RAWSHAKE_SUFFIX) +#define SHAKE_MAIN(N)\ + COMMON_MAIN(libkeccak_spec_shake((libkeccak_spec_t *)&spec, N, N), LIBKECCAK_SHAKE_SUFFIX) /** |