chiark / gitweb /
group: Implement KCDSA group generation.
[catacomb-python] / algorithms.h
index 26099ebce987e45b9d83d6a3025024fc0126add0..3ebef05a3675fa809eda876302bf2a04277be95e 100644 (file)
 #include <catacomb/whirlpool256-mgf.h>
 #include <catacomb/whirlpool256-hmac.h>
 
 #include <catacomb/whirlpool256-mgf.h>
 #include <catacomb/whirlpool256-hmac.h>
 
-#define PRPS(DO) \
-  DO(DES, des) \
-  DO(DESX, desx) \
-  DO(DES3, des3) \
-  DO(MARS, mars) \
-  DO(IDEA, idea) \
-  DO(SAFER, safer) \
-  DO(SAFERSK, safersk) \
-  DO(BLOWFISH, blowfish) \
-  DO(TWOFISH, twofish) \
-  DO(TEA, tea) \
-  DO(XTEA, xtea) \
-  DO(RC2, rc2) \
-  DO(RC5, rc5) \
-  DO(SKIPJACK, skipjack) \
-  DO(CAST128, cast128) \
-  DO(CAST256, cast256) \
-  DO(SQUARE, square) \
-  DO(RIJNDAEL, rijndael) \
-  DO(RIJNDAEL192, rijndael192) \
-  DO(RIJNDAEL256, rijndael256) \
-  DO(SERPENT, serpent) \
-  DO(NOEKEON, noekeon) \
+#define PRPS(_) \
+  _(DES, des) \
+  _(DESX, desx) \
+  _(DES3, des3) \
+  _(MARS, mars) \
+  _(IDEA, idea) \
+  _(SAFER, safer) \
+  _(SAFERSK, safersk) \
+  _(BLOWFISH, blowfish) \
+  _(TWOFISH, twofish) \
+  _(TEA, tea) \
+  _(XTEA, xtea) \
+  _(RC2, rc2) \
+  _(RC5, rc5) \
+  _(SKIPJACK, skipjack) \
+  _(CAST128, cast128) \
+  _(CAST256, cast256) \
+  _(SQUARE, square) \
+  _(RIJNDAEL, rijndael) \
+  _(RIJNDAEL192, rijndael192) \
+  _(RIJNDAEL256, rijndael256) \
+  _(SERPENT, serpent) \
+  _(NOEKEON, noekeon) \
   /* end */
 
   /* end */
 
-#define RNGS(DO) \
-  DO("des-ofb", des_ofbrand) \
-  DO("des-counter", des_counterrand) \
-  DO("desx-ofb", desx_ofbrand) \
-  DO("desx-counter", desx_counterrand) \
-  DO("des3-ofb", des3_ofbrand) \
-  DO("des3-counter", des3_counterrand) \
-  DO("mars-ofb", mars_ofbrand) \
-  DO("mars-counter", mars_counterrand) \
-  DO("idea-ofb", idea_ofbrand) \
-  DO("idea-counter", idea_counterrand) \
-  DO("safer-ofb", safer_ofbrand) \
-  DO("safer-counter", safer_counterrand) \
-  DO("safersk-ofb", safersk_ofbrand) \
-  DO("safersk-counter", safersk_counterrand) \
-  DO("blowfish-ofb", blowfish_ofbrand) \
-  DO("blowfish-counter", blowfish_counterrand) \
-  DO("twofish-ofb", twofish_ofbrand) \
-  DO("twofish-counter", twofish_counterrand) \
-  DO("tea-ofb", tea_ofbrand) \
-  DO("tea-counter", tea_counterrand) \
-  DO("xtea-ofb", xtea_ofbrand) \
-  DO("xtea-counter", xtea_counterrand) \
-  DO("rc2-ofb", rc2_ofbrand) \
-  DO("rc2-counter", rc2_counterrand) \
-  DO("rc5-ofb", rc5_ofbrand) \
-  DO("rc5-counter", rc5_counterrand) \
-  DO("skipjack-ofb", skipjack_ofbrand) \
-  DO("skipjack-counter", skipjack_counterrand) \
-  DO("cast128-ofb", cast128_ofbrand) \
-  DO("cast128-counter", cast128_counterrand) \
-  DO("cast256-ofb", cast256_ofbrand) \
-  DO("cast256-counter", cast256_counterrand) \
-  DO("square-ofb", square_ofbrand) \
-  DO("square-counter", square_counterrand) \
-  DO("rijndael-ofb", rijndael_ofbrand) \
-  DO("rijndael-counter", rijndael_counterrand) \
-  DO("rijndael192-ofb", rijndael192_ofbrand) \
-  DO("rijndael192-counter", rijndael192_counterrand) \
-  DO("rijndael256-ofb", rijndael256_ofbrand) \
-  DO("rijndael256-counter", rijndael256_counterrand) \
-  DO("serpent-ofb", serpent_ofbrand) \
-  DO("serpent-counter", serpent_counterrand) \
-  DO("noekeon-ofb", noekeon_ofbrand) \
-  DO("noekeon-counter", noekeon_counterrand) \
-  DO("md2-mgf", md2_mgfrand) \
-  DO("md4-mgf", md4_mgfrand) \
-  DO("md5-mgf", md5_mgfrand) \
-  DO("tiger-mgf", tiger_mgfrand) \
-  DO("has160-mgf", has160_mgfrand) \
-  DO("sha-mgf", sha_mgfrand) \
-  DO("sha224-mgf", sha224_mgfrand) \
-  DO("sha256-mgf", sha256_mgfrand) \
-  DO("sha384-mgf", sha384_mgfrand) \
-  DO("sha512-mgf", sha512_mgfrand) \
-  DO("rmd128-mgf", rmd128_mgfrand) \
-  DO("rmd160-mgf", rmd160_mgfrand) \
-  DO("rmd256-mgf", rmd256_mgfrand) \
-  DO("rmd320-mgf", rmd320_mgfrand) \
-  DO("whirlpool-mgf", whirlpool_mgfrand) \
-  DO("whirlpool256-mgf", whirlpool256_mgfrand) \
-  DO("rc4", rc4_rand) \
-  DO("seal", seal_randkludge) \
+#define RNGF_INT 1u
+
+#define RNGS(_) \
+  _("des-ofb", des_keysz, des_ofbrand, 0) \
+  _("des-counter", des_keysz, des_counterrand, 0) \
+  _("desx-ofb", desx_keysz, desx_ofbrand, 0) \
+  _("desx-counter", desx_keysz, desx_counterrand, 0) \
+  _("des3-ofb", des3_keysz, des3_ofbrand, 0) \
+  _("des3-counter", des3_keysz, des3_counterrand, 0) \
+  _("mars-ofb", mars_keysz, mars_ofbrand, 0) \
+  _("mars-counter", mars_keysz, mars_counterrand, 0) \
+  _("idea-ofb", idea_keysz, idea_ofbrand, 0) \
+  _("idea-counter", idea_keysz, idea_counterrand, 0) \
+  _("safer-ofb", safer_keysz, safer_ofbrand, 0) \
+  _("safer-counter", safer_keysz, safer_counterrand, 0) \
+  _("safersk-ofb", safersk_keysz, safersk_ofbrand, 0) \
+  _("safersk-counter", safersk_keysz, safersk_counterrand, 0) \
+  _("blowfish-ofb", blowfish_keysz, blowfish_ofbrand, 0) \
+  _("blowfish-counter", blowfish_keysz, blowfish_counterrand, 0) \
+  _("twofish-ofb", twofish_keysz, twofish_ofbrand, 0) \
+  _("twofish-counter", twofish_keysz, twofish_counterrand, 0) \
+  _("tea-ofb", tea_keysz, tea_ofbrand, 0) \
+  _("tea-counter", tea_keysz, tea_counterrand, 0) \
+  _("xtea-ofb", xtea_keysz, xtea_ofbrand, 0) \
+  _("xtea-counter", xtea_keysz, xtea_counterrand, 0) \
+  _("rc2-ofb", rc2_keysz, rc2_ofbrand, 0) \
+  _("rc2-counter", rc2_keysz, rc2_counterrand, 0) \
+  _("rc5-ofb", rc5_keysz, rc5_ofbrand, 0) \
+  _("rc5-counter", rc5_keysz, rc5_counterrand, 0) \
+  _("skipjack-ofb", skipjack_keysz, skipjack_ofbrand, 0) \
+  _("skipjack-counter", skipjack_keysz, skipjack_counterrand, 0) \
+  _("cast128-ofb", cast128_keysz, cast128_ofbrand, 0) \
+  _("cast128-counter", cast128_keysz, cast128_counterrand, 0) \
+  _("cast256-ofb", cast256_keysz, cast256_ofbrand, 0) \
+  _("cast256-counter", cast256_keysz, cast256_counterrand, 0) \
+  _("square-ofb", square_keysz, square_ofbrand, 0) \
+  _("square-counter", square_keysz, square_counterrand, 0) \
+  _("rijndael-ofb", rijndael_keysz, rijndael_ofbrand, 0) \
+  _("rijndael-counter", rijndael_keysz, rijndael_counterrand, 0) \
+  _("rijndael192-ofb", rijndael192_keysz, rijndael192_ofbrand, 0) \
+  _("rijndael192-counter", rijndael192_keysz, rijndael192_counterrand, 0) \
+  _("rijndael256-ofb", rijndael256_keysz, rijndael256_ofbrand, 0) \
+  _("rijndael256-counter", rijndael256_keysz, rijndael256_counterrand, 0) \
+  _("serpent-ofb", serpent_keysz, serpent_ofbrand, 0) \
+  _("serpent-counter", serpent_keysz, serpent_counterrand, 0) \
+  _("noekeon-ofb", noekeon_keysz, noekeon_ofbrand, 0) \
+  _("noekeon-counter", noekeon_keysz, noekeon_counterrand, 0) \
+  _("md2-mgf", md2_mgfkeysz, md2_mgfrand, 0) \
+  _("md4-mgf", md4_mgfkeysz, md4_mgfrand, 0) \
+  _("md5-mgf", md5_mgfkeysz, md5_mgfrand, 0) \
+  _("tiger-mgf", tiger_mgfkeysz, tiger_mgfrand, 0) \
+  _("has160-mgf", has160_mgfkeysz, has160_mgfrand, 0) \
+  _("sha-mgf", sha_mgfkeysz, sha_mgfrand, 0) \
+  _("sha224-mgf", sha224_mgfkeysz, sha224_mgfrand, 0) \
+  _("sha256-mgf", sha256_mgfkeysz, sha256_mgfrand, 0) \
+  _("sha384-mgf", sha384_mgfkeysz, sha384_mgfrand, 0) \
+  _("sha512-mgf", sha512_mgfkeysz, sha512_mgfrand, 0) \
+  _("rmd128-mgf", rmd128_mgfkeysz, rmd128_mgfrand, 0) \
+  _("rmd160-mgf", rmd160_mgfkeysz, rmd160_mgfrand, 0) \
+  _("rmd256-mgf", rmd256_mgfkeysz, rmd256_mgfrand, 0) \
+  _("rmd320-mgf", rmd320_mgfkeysz, rmd320_mgfrand, 0) \
+  _("whirlpool-mgf", whirlpool_mgfkeysz, whirlpool_mgfrand, 0) \
+  _("whirlpool256-mgf", whirlpool256_mgfkeysz, whirlpool256_mgfrand, 0) \
+  _("rc4", rc4_keysz, rc4_rand, 0) \
+  _("seal", seal_keysz, seal_rand, RNGF_INT) \
   /* end */
 
   /* end */