aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-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)
/**