aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-10-14 13:33:07 +0200
committerMattias Andrée <maandree@kth.se>2017-10-14 13:33:07 +0200
commitb5612bbbcbfd4fff7e8552579a7dd81a141d90d3 (patch)
tree1ed81a17345ac89a5ce89e232ac478b84297a4ce /common.h
parentUse arg.h instead of argparser (diff)
downloadsha3sum-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.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/common.h b/common.h
index f4fff6b..d503811 100644
--- a/common.h
+++ b/common.h
@@ -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)
/**