Browse Source

Add KangarooTwelve XOF functions.

KangarooTwelve 128bits and KangarooTwelve 256 bits.

https://keccak.team/files/TurboSHAKE.pdf
https://www.rfc-editor.org/rfc/rfc9861.txt
https://datatracker.ietf.org/doc/html/rfc9861
Marek Knápek 2 weeks ago
parent
commit
6832f3c106

+ 15 - 0
doc/crypt.tex

@@ -3143,6 +3143,21 @@ int turbo_shake_done(hash_state *md, unsigned char *out, unsigned long outlen);
 The init function \code{turbo\_shake\_init()} is implemented as a macro which calls \code{sha3\_shake\_init()}.
 
 
+\subsection{KangarooTwelve}
+Another variation of SHA3 SHAKE is KangarooTwelve, which has been specified in \href{https://datatracker.ietf.org/doc/rfc9861/}{\texttt{RFC 9861}}.
+
+The API works equivalent to the one of SHA3 SHAKE, where the APIs only have a different name. Additionally, KangarooTwelve supports customization. You can append any or none customization bytes after all input bytes and before squeezing any output digest bytes.
+
+\begin{small}
+\begin{verbatim}
+int kangaroo_twelve_init(hash_state *md, int num);
+int kangaroo_twelve_process(hash_state *md, const unsigned char *in, unsigned long inlen);
+int kangaroo_twelve_customization(hash_state *md, const unsigned char *in, unsigned long inlen);
+int kangaroo_twelve_done(hash_state *md, unsigned char *out, unsigned long outlen);
+\end{verbatim}
+\end{small}
+
+
 \mysection{Extended Tiger API}
 
 The Tiger and Tiger2 hash algorithms \url{http://www.cs.technion.ac.il/~biham/Reports/Tiger/} specify the possibility to run the algorithm with

+ 148 - 0
src/hashes/sha3.c

@@ -416,4 +416,152 @@ int sha3_shake_memory(int num, const unsigned char *in, unsigned long inlen, uns
 }
 #endif
 
+#ifdef LTC_KANGAROO_TWELVE
+
+static const unsigned char kangaroo_twelve_filler[] = { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+int kangaroo_twelve_init(hash_state *md, int num)
+{
+   int err;
+
+   LTC_ARGCHK(md != NULL);
+   LTC_ARGCHK(num == 128 || num == 256);
+
+   if ((err = sha3_shake_init((hash_state*)&md->kt.outer, num)) != CRYPT_OK) return err;
+   if ((err = sha3_shake_init((hash_state*)&md->kt.inner, num)) != CRYPT_OK) return err;
+   md->kt.blocks_count = 0;
+   md->kt.customization_len = 0;
+   md->kt.remaining = 8 * 1024;
+   md->kt.phase = 0;
+   md->kt.finished = 0;
+   return CRYPT_OK;
+}
+
+static LTC_INLINE int s_kangaroo_twelve_process(hash_state *md, const unsigned char *in, unsigned long inlen)
+{
+   unsigned long rem;
+   unsigned long amount;
+   int err;
+   int variant;
+   int digest_len;
+   unsigned char digest_buf[64];
+
+   LTC_ARGCHK(md != NULL);
+   LTC_ARGCHK(in != NULL || inlen == 0);
+
+   if (md->kt.phase == 0)
+   {
+      rem = md->kt.remaining;
+      amount = rem < inlen ? rem : inlen;
+      md->kt.remaining -= amount;
+      if ((err = turbo_shake_process((hash_state*)&md->kt.outer, in, amount)) != CRYPT_OK) return err;
+      in += amount;
+      inlen -= amount;
+      if (md->kt.remaining == 0 && inlen != 0)
+      {
+         md->kt.remaining = 8 * 1024;
+         md->kt.phase = 1;
+         md->kt.blocks_count += 1;
+         if ((err = turbo_shake_process((hash_state*)&md->kt.outer, kangaroo_twelve_filler, sizeof(kangaroo_twelve_filler))) != CRYPT_OK) return err;
+      }
+   }
+   if (md->kt.phase == 1)
+   {
+      do
+      {
+         rem = md->kt.remaining;
+         amount = rem < inlen ? rem : inlen;
+         md->kt.remaining -= amount;
+         if ((err = turbo_shake_process((hash_state*)&md->kt.inner, in, amount)) != CRYPT_OK) return err;
+         in += amount;
+         inlen -= amount;
+         if (md->kt.remaining == 0 && inlen != 0)
+         {
+            md->kt.remaining = 8 * 1024;
+            md->kt.blocks_count += 1;
+            assert(md->kt.outer.capacity_words == 4 || md->kt.outer.capacity_words == 8);
+            variant = md->kt.outer.capacity_words == 4 ? 128 : 256;
+            digest_len = variant == 128 ? 32 : 64;
+            if ((err = s_sha3_shake_done((hash_state*)&md->kt.inner, digest_buf, digest_len, 0x0b, s_keccak_turbo_f)) != CRYPT_OK) return err;
+            if ((err = turbo_shake_init((hash_state*)&md->kt.inner, variant)) != CRYPT_OK) return err;
+            if ((err = turbo_shake_process((hash_state*)&md->kt.outer, digest_buf, digest_len)) != CRYPT_OK) return err;
+         }
+      } while (inlen != 0);
+   }
+   return CRYPT_OK;
+}
+
+int kangaroo_twelve_process(hash_state *md, const unsigned char *in, unsigned long inlen)
+{
+   LTC_ARGCHK(md != NULL);
+   LTC_ARGCHK(in != NULL || inlen == 0);
+   LTC_ARGCHK(md->kt.customization_len == 0);
+   LTC_ARGCHK(md->kt.finished == 0);
+
+   return s_kangaroo_twelve_process(md, in, inlen);
+}
+
+int kangaroo_twelve_customization(hash_state *md, const unsigned char *in, unsigned long inlen)
+{
+   LTC_ARGCHK(md != NULL);
+   LTC_ARGCHK(in != NULL || inlen == 0);
+   LTC_ARGCHK(md->kt.finished == 0);
+
+   md->kt.customization_len += inlen;
+   return s_kangaroo_twelve_process(md, in, inlen);
+}
+
+int kangaroo_twelve_done(hash_state *md, unsigned char *out, unsigned long outlen)
+{
+   int couner_len;
+   unsigned char couner_buf[sizeof(ulong64) + 1];
+   int err;
+   int variant;
+   int digest_len;
+   unsigned char digest_buf[64];
+   unsigned char ffff[2];
+   unsigned char domain;
+
+   LTC_ARGCHK(md != NULL);
+   LTC_ARGCHK(out != NULL || outlen == 0);
+
+   if (md->kt.finished == 0)
+   {
+      md->kt.finished = 1;
+      couner_len = 0;
+      while (md->kt.customization_len != 0)
+      {
+         couner_buf[LTC_ARRAY_SIZE(couner_buf) - 1 - 1 - couner_len] = md->kt.customization_len & 0xff;
+         md->kt.customization_len >>= 8;
+         ++couner_len;
+      }
+      couner_buf[LTC_ARRAY_SIZE(couner_buf) - 1] = couner_len;
+      if ((err = s_kangaroo_twelve_process(md, &couner_buf[LTC_ARRAY_SIZE(couner_buf) - 1 - couner_len], couner_len + 1)) != CRYPT_OK) return err;
+      if(md->kt.phase != 0)
+      {
+         assert(md->kt.outer.capacity_words == 4 || md->kt.outer.capacity_words == 8);
+         variant = md->kt.outer.capacity_words == 4 ? 128 : 256;
+         digest_len = variant == 128 ? 32 : 64;
+         if ((err = s_sha3_shake_done((hash_state*)&md->kt.inner, digest_buf, digest_len, 0x0b, s_keccak_turbo_f)) != CRYPT_OK) return err;
+         if ((err = turbo_shake_process((hash_state*)&md->kt.outer, digest_buf, digest_len)) != CRYPT_OK) return err;
+         couner_len = 0;
+         while (md->kt.blocks_count != 0)
+         {
+            couner_buf[LTC_ARRAY_SIZE(couner_buf) - 1 - 1 - couner_len] = md->kt.blocks_count & 0xff;
+            md->kt.blocks_count >>= 8;
+            ++couner_len;
+         }
+         couner_buf[LTC_ARRAY_SIZE(couner_buf) - 1] = couner_len;
+         if ((err = turbo_shake_process((hash_state*)&md->kt.outer, &couner_buf[LTC_ARRAY_SIZE(couner_buf) - 1 - couner_len], couner_len + 1)) != CRYPT_OK) return err;
+         ffff[0] = 0xff;
+         ffff[1] = 0xff;
+         if ((err = turbo_shake_process((hash_state*)&md->kt.outer, ffff, LTC_ARRAY_SIZE(ffff))) != CRYPT_OK) return err;
+      }
+   }
+   domain = md->kt.phase == 0 ? 0x07 : 0x06;
+   return s_sha3_shake_done(md, out, outlen, domain, s_keccak_turbo_f);
+}
+
+#endif
+
 #endif

+ 140 - 1
src/hashes/sha3_test.c

@@ -388,7 +388,7 @@ int sha3_shake_test(void)
 #endif
 }
 
-#if defined LTC_TURBO_SHAKE
+#if defined LTC_TURBO_SHAKE || defined LTC_KANGAROO_TWELVE
 static LTC_INLINE int s_turbo_shake_generate_ptn(unsigned char* buffer, long offset, long amount)
 {
    long i;
@@ -509,6 +509,145 @@ int turbo_shake_test(void)
 }
 #endif
 
+#ifdef LTC_KANGAROO_TWELVE
+typedef struct kangaroo_twelve_test_case {
+   int bits_count, is_ptn;
+   unsigned long input_bytes_count, customization_bytes_count, skip_digest_bytes, digest_bytes_count;
+   const char *expected_digest_hex;
+} kangaroo_twelve_test_case;
+
+static LTC_INLINE int s_kangaroo_twelve_test_one(const kangaroo_twelve_test_case *testcase, int counter)
+{
+   int err;
+   hash_state md;
+   unsigned long offset;
+   unsigned long rem;
+   unsigned long count;
+   unsigned char input[1024];
+   unsigned char digest[64];
+   const char *expected_hex;
+   unsigned char expected_digest_bin[sizeof(digest)];
+   unsigned long decoded;
+
+   LTC_ARGCHK(testcase != NULL);
+   LTC_ARGCHK(testcase->bits_count == 128 || testcase->bits_count == 256);
+   LTC_ARGCHK(testcase->is_ptn == 0 || testcase->is_ptn == 1);
+   LTC_ARGCHK(testcase->digest_bytes_count >= 1);
+   LTC_ARGCHK(testcase->expected_digest_hex && testcase->expected_digest_hex[0] != '\0');
+   LTC_ARGCHK(counter >= 0);
+
+   if ((err = kangaroo_twelve_init(&md, testcase->bits_count)) != CRYPT_OK) return err;
+   offset = 0;
+   rem = testcase->input_bytes_count;
+   do
+   {
+      count = rem < sizeof(input) ? rem : sizeof(input);
+      if (testcase->is_ptn)
+      {
+         if ((err = s_turbo_shake_generate_ptn(input, offset, count)) != CRYPT_OK) return err;
+      }
+      else
+      {
+         XMEMSET(input, 0xff, count);
+      }
+      if ((err = kangaroo_twelve_process(&md, input, count)) != CRYPT_OK) return err;
+      offset += count;
+      rem -= count;
+   }while(rem != 0);
+   offset = 0;
+   rem = testcase->customization_bytes_count;
+   do
+   {
+      count = rem < sizeof(input) ? rem : sizeof(input);
+      if ((err = s_turbo_shake_generate_ptn(input, offset, count)) != CRYPT_OK) return err;
+      if ((err = kangaroo_twelve_customization(&md, input, count)) != CRYPT_OK) return err;
+      offset += count;
+      rem -= count;
+   }while(rem != 0);
+   rem = testcase->skip_digest_bytes;
+   do
+   {
+      count = rem < sizeof(digest) ? rem : sizeof(digest);
+      if ((err = kangaroo_twelve_done(&md, digest, count)) != CRYPT_OK) return err;
+      rem -= count;
+   }while(rem != 0);
+   rem = testcase->digest_bytes_count;
+   expected_hex = testcase->expected_digest_hex;
+   do
+   {
+      count = rem < sizeof(digest) ? rem : sizeof(digest);
+      decoded = count;
+      if ((err = base16_decode(expected_hex, count * 2, expected_digest_bin, &decoded)) != CRYPT_OK) return err;
+      if (decoded != (unsigned long)count) return CRYPT_ERROR;
+      if ((err = kangaroo_twelve_done(&md, digest, count)) != CRYPT_OK) return err;
+      LTC_COMPARE_TESTVECTOR(digest, count, expected_digest_bin, count, "KangarooTwelve", counter);
+      rem -= count;
+      expected_hex += count * 2;
+   }while(rem != 0);
+   return CRYPT_OK;
+}
+#endif
+
+#ifdef LTC_KANGAROO_TWELVE
+int kangaroo_twelve_test(void)
+{
+#ifndef LTC_TEST
+   return CRYPT_NOP;
+#else
+   int counter;
+   int err;
+
+   /* https://datatracker.ietf.org/doc/html/rfc9861#name-test-vectors */
+   /* https://www.rfc-editor.org/rfc/rfc9861.txt */
+
+   const kangaroo_twelve_test_case testcases[] = {
+      { 128, 1,                 0,        0,     0,  32, "1ac2d450fc3b4205d19da7bfca1b37513c0803577ac7167f06fe2ce1f0ef39e5" },
+      { 128, 1,                 0,        0,     0,  64, "1ac2d450fc3b4205d19da7bfca1b37513c0803577ac7167f06fe2ce1f0ef39e54269c056b8c82e48276038b6d292966cc07a3d4645272e31ff38508139eb0a71" },
+      { 128, 1,                 0,        0, 10000,  32, "e8dc563642f7228c84684c898405d3a834799158c079b12880277a1d28e2ff6d" },
+      { 128, 1,                 1,        0,     0,  32, "2bda92450e8b147f8a7cb629e784a058efca7cf7d8218e02d345dfaa65244a1f" },
+      { 128, 1,                17,        0,     0,  32, "6bf75fa2239198db4772e36478f8e19b0f371205f6a9a93a273f51df37122888" },
+      { 128, 1,             17*17,        0,     0,  32, "0c315ebcdedbf61426de7dcf8fb725d1e74675d7f5327a5067f367b108ecb67c" },
+      { 128, 1,          17*17*17,        0,     0,  32, "cb552e2ec77d9910701d578b457ddf772c12e322e4ee7fe417f92c758f0d59d0" },
+      { 128, 1,       17*17*17*17,        0,     0,  32, "8701045e22205345ff4dda05555cbb5c3af1a771c2b89baef37db43d9998b9fe" },
+      { 128, 1,    17*17*17*17*17,        0,     0,  32, "844d610933b1b9963cbdeb5ae3b6b05cc7cbd67ceedf883eb678a0a8e0371682" },
+      { 128, 1, 17*17*17*17*17*17,        0,     0,  32, "3c390782a8a4e89fa6367f72feaaf13255c8d95878481d3cd8ce85f58e880af8" },
+      { 128, 1,                 0,        1,     0,  32, "fab658db63e94a246188bf7af69a133045f46ee984c56e3c3328caaf1aa1a583" },
+      { 128, 0,                 1,       41,     0,  32, "d848c5068ced736f4462159b9867fd4c20b808acc3d5bc48e0b06ba0a3762ec4" },
+      { 128, 0,                 3,    41*41,     0,  32, "c389e5009ae57120854c2e8c64670ac01358cf4c1baf89447a724234dc7ced74" },
+      { 128, 0,                 7, 41*41*41,     0,  32, "75d2f86a2e644566726b4fbcfc5657b9dbcf070c7b0dca06450ab291d7443bcf" },
+      { 128, 1,              8191,        0,     0,  32, "1b577636f723643e990cc7d6a659837436fd6a103626600eb8301cd1dbe553d6" },
+      { 128, 1,              8192,        0,     0,  32, "48f256f6772f9edfb6a8b661ec92dc93b95ebd05a08a17b39ae3490870c926c3" },
+      { 128, 1,              8192,     8189,     0,  32, "3ed12f70fb05ddb58689510ab3e4d23c6c6033849aa01e1d8c220a297fedcd0b" },
+      { 128, 1,              8192,     8190,     0,  32, "6a7c1b6a5cd0d8c9ca943a4a216cc64604559a2ea45f78570a15253d67ba00ae" },
+      { 256, 1,                 0,        0,     0,  64, "b23d2e9cea9f4904e02bec06817fc10ce38ce8e93ef4c89e6537076af8646404e3e8b68107b8833a5d30490aa33482353fd4adc7148ecb782855003aaebde4a9" },
+      { 256, 1,                 0,        0,     0, 128, "b23d2e9cea9f4904e02bec06817fc10ce38ce8e93ef4c89e6537076af8646404e3e8b68107b8833a5d30490aa33482353fd4adc7148ecb782855003aaebde4a9b0925319d8ea1e121a609821ec19efea89e6d08daee1662b69c840289f188ba860f55760b61f82114c030c97e5178449608ccd2cd2d919fc7829ff69931ac4d0" },
+      { 256, 1,                 0,        0, 10000,  64, "ad4a1d718cf950506709a4c33396139b4449041fc79a05d68da35f1e453522e056c64fe94958e7085f2964888259b9932752f3ccd855288efee5fcbb8b563069" },
+      { 256, 1,                 1,        0,     0,  64, "0d005a194085360217128cf17f91e1f71314efa5564539d444912e3437efa17f82db6f6ffe76e781eaa068bce01f2bbf81eacb983d7230f2fb02834a21b1ddd0" },
+      { 256, 1,                17,        0,     0,  64, "1ba3c02b1fc514474f06c8979978a9056c8483f4a1b63d0dccefe3a28a2f323e1cdcca40ebf006ac76ef0397152346837b1277d3e7faa9c9653b19075098527b" },
+      { 256, 1,             17*17,        0,     0,  64, "de8ccbc63e0f133ebb4416814d4c66f691bbf8b6a61ec0a7700f836b086cb029d54f12ac7159472c72db118c35b4e6aa213c6562caaa9dcc518959e69b10f3ba" },
+      { 256, 1,          17*17*17,        0,     0,  64, "647efb49fe9d717500171b41e7f11bd491544443209997ce1c2530d15eb1ffbb598935ef954528ffc152b1e4d731ee2683680674365cd191d562bae753b84aa5" },
+      { 256, 1,       17*17*17*17,        0,     0,  64, "b06275d284cd1cf205bcbe57dccd3ec1ff6686e3ed15776383e1f2fa3c6ac8f08bf8a162829db1a44b2a43ff83dd89c3cf1ceb61ede659766d5ccf817a62ba8d" },
+      { 256, 1,    17*17*17*17*17,        0,     0,  64, "9473831d76a4c7bf77ace45b59f1458b1673d64bcd877a7c66b2664aa6dd149e60eab71b5c2bab858c074ded81ddce2b4022b5215935c0d4d19bf511aeeb0772" },
+      { 256, 1, 17*17*17*17*17*17,        0,     0,  64, "0652b740d78c5e1f7c8dcc1777097382768b7ff38f9a7a20f29f413bb1b3045b31a5578f568f911e09cf44746da84224a5266e96a4a535e871324e4f9c7004da" },
+      { 256, 1,                 0,        1,     0,  64, "9280f5cc39b54a5a594ec63de0bb99371e4609d44bf845c2f5b8c316d72b159811f748f23e3fabbe5c3226ec96c62186df2d33e9df74c5069ceecbb4dd10eff6" },
+      { 256, 0,                 1,       41,     0,  64, "47ef96dd616f200937aa7847e34ec2feae8087e3761dc0f8c1a154f51dc9ccf845d7adbce57ff64b639722c6a1672e3bf5372d87e00aff89be97240756998853" },
+      { 256, 0,                 3,    41*41,     0,  64, "3b48667a5051c5966c53c5d42b95de451e05584e7806e2fb765eda959074172cb438a9e91dde337c98e9c41bed94c4e0aef431d0b64ef2324f7932caa6f54969" },
+      { 256, 0,                 7, 41*41*41,     0,  64, "e0911cc00025e1540831e266d94add9b98712142b80d2629e643aac4efaf5a3a30a88cbf4ac2a91a2432743054fbcc9897670e86ba8cec2fc2ace9c966369724" },
+      { 256, 1,              8191,        0,     0,  64, "3081434d93a4108d8d8a3305b89682cebedc7ca4ea8a3ce869fbb73cbe4a58eef6f24de38ffc170514c70e7ab2d01f03812616e863d769afb3753193ba045b20" },
+      { 256, 1,              8192,        0,     0,  64, "c6ee8e2ad3200c018ac87aaa031cdac22121b412d07dc6e0dccbb53423747e9a1c18834d99df596cf0cf4b8dfafb7bf02d139d0c9035725adc1a01b7230a41fa" },
+      { 256, 1,              8192,     8189,     0,  64, "74e47879f10a9c5d11bd2da7e194fe57e86378bf3c3f7448eff3c576a0f18c5caae0999979512090a7f348af4260d4de3c37f1ecaf8d2c2c96c1d16c64b12496" },
+      { 256, 1,              8192,     8190,     0,  64, "f4b5908b929ffe01e0f79ec2f21243d41a396b2e7303a6af1d6399cd6c7a0a2dd7c4f607e8277f9c9b1cb4ab9ddc59d4b92d1fc7558441f1832c3279a4241b8b" },
+   };
+   for (counter = 0; counter < (int)LTC_ARRAY_SIZE(testcases); counter++) {
+      if ((err = s_kangaroo_twelve_test_one(&testcases[counter], counter)) != CRYPT_OK) {
+         return err;
+      }
+   }
+   return CRYPT_OK;
+#endif
+}
+#endif
+
 #endif
 
 #ifdef LTC_KECCAK

+ 5 - 0
src/headers/tomcrypt_custom.h

@@ -259,6 +259,7 @@
 #define LTC_SHA3
 #define LTC_KECCAK
 #define LTC_TURBO_SHAKE
+#define LTC_KANGAROO_TWELVE
 #define LTC_SHA512
 #define LTC_SHA512_256
 #define LTC_SHA512_224
@@ -713,6 +714,10 @@
    #error LTC_TURBO_SHAKE requires LTC_SHA3
 #endif
 
+#if defined(LTC_KANGAROO_TWELVE) && !defined(LTC_TURBO_SHAKE)
+   #error LTC_KANGAROO_TWELVE requires LTC_TURBO_SHAKE
+#endif
+
 #if defined(LTC_NO_MATH) && (defined(LTM_DESC) || defined(TFM_DESC) || defined(GMP_DESC))
    #error LTC_NO_MATH defined, but also a math descriptor
 #endif

+ 23 - 0
src/headers/tomcrypt_hash.h

@@ -14,6 +14,18 @@ struct sha3_state {
 };
 #endif
 
+#ifdef LTC_KANGAROO_TWELVE
+struct kangaroo_twelve_state {
+    struct sha3_state outer;
+    struct sha3_state inner;
+    ulong64 blocks_count;
+    ulong64 customization_len;
+    unsigned short remaining; /* bytes out of 8kB block */
+    unsigned char phase; /* 0 -- initial, 1 -- additional */
+    unsigned char finished; /* 0 -- false, 1 -- true */
+};
+#endif
+
 #ifdef LTC_SHA512
 struct sha512_state {
     ulong64  length, state[8];
@@ -152,6 +164,9 @@ typedef union Hash_state {
 #if defined(LTC_SHA3) || defined(LTC_KECCAK)
     struct sha3_state sha3;
 #endif
+#ifdef LTC_KANGAROO_TWELVE
+    struct kangaroo_twelve_state kt;
+#endif
 #ifdef LTC_SHA512
     struct sha512_state sha512;
 #endif
@@ -309,6 +324,14 @@ int turbo_shake_done(hash_state *md, unsigned char *out, unsigned long outlen);
 int turbo_shake_test(void);
 #endif
 
+#ifdef LTC_KANGAROO_TWELVE
+int kangaroo_twelve_init(hash_state *md, int num);
+int kangaroo_twelve_process(hash_state *md, const unsigned char *in, unsigned long inlen);
+int kangaroo_twelve_customization(hash_state *md, const unsigned char *in, unsigned long inlen);
+int kangaroo_twelve_done(hash_state *md, unsigned char *out, unsigned long outlen);
+int kangaroo_twelve_test(void);
+#endif
+
 #ifdef LTC_SHA512
 int sha512_init(hash_state * md);
 int sha512_process(hash_state * md, const unsigned char *in, unsigned long inlen);

+ 3 - 0
src/misc/crypt/crypt.c

@@ -160,6 +160,9 @@ const char *crypt_build_settings =
 #if defined(LTC_TURBO_SHAKE)
    "   TurboSHAKE\n"
 #endif
+#if defined(LTC_KANGAROO_TWELVE)
+   "   KangarooTwelve\n"
+#endif
 #if defined(LTC_KECCAK)
    "   KECCAK\n"
 #endif

+ 3 - 0
tests/cipher_hash_test.c

@@ -63,6 +63,9 @@ int cipher_hash_test(void)
 #ifdef LTC_TURBO_SHAKE
    DO(turbo_shake_test());
 #endif
+#ifdef LTC_KANGAROO_TWELVE
+   DO(kangaroo_twelve_test());
+#endif
 
    return 0;
 }