From 0bb2559805e8dc069e175127fbe7a72da65c9e67 Mon Sep 17 00:00:00 2001 From: Marcos Pernambuco Motta <1091485+mpernambuco@users.noreply.github.com> Date: Fri, 10 Jan 2025 17:39:45 -0300 Subject: [PATCH] chore: remove tiny_sha3 --- src/Makefile | 9 - src/clua-cartesi.cpp | 44 ----- src/keccak-256-hasher.h | 76 --------- tests/lua/cmio-test.lua | 13 +- tests/lua/third_party/plc/LICENSE | 22 +++ tests/lua/third_party/plc/sha3.lua | 255 +++++++++++++++++++++++++++++ third-party/tiny_sha3/LICENSE | 22 --- third-party/tiny_sha3/sha3.c | 205 ----------------------- third-party/tiny_sha3/sha3.h | 39 ----- 9 files changed, 286 insertions(+), 399 deletions(-) delete mode 100644 src/keccak-256-hasher.h create mode 100644 tests/lua/third_party/plc/LICENSE create mode 100644 tests/lua/third_party/plc/sha3.lua delete mode 100644 third-party/tiny_sha3/LICENSE delete mode 100644 third-party/tiny_sha3/sha3.c delete mode 100644 third-party/tiny_sha3/sha3.h diff --git a/src/Makefile b/src/Makefile index 24e4cd177..fdf1c1255 100644 --- a/src/Makefile +++ b/src/Makefile @@ -156,7 +156,6 @@ WARNS=-Wall -Wextra -Wpedantic # Place our include directories before the system's INCS+= \ -I../third-party/llvm-flang-uint128 \ - -I../third-party/tiny_sha3 \ -I../third-party/SHA256 \ -I../third-party/nlohmann-json \ -I../third-party/downloads \ @@ -210,9 +209,6 @@ ifneq ($(git_commit),) DEFS+=-DGIT_COMMIT='"$(git_commit)"' endif -# The SHA3 is third party library we always want to compile with O3 -SHA3_CFLAGS=-O3 - # The SHA256 is third party library we always want to compile with O3 SHA256_CFLAGS=-O3 @@ -370,7 +366,6 @@ LIBCARTESI_OBJS:= \ uarch-machine.o \ uarch-step.o \ uarch-reset-state.o \ - sha3.o \ machine-merkle-tree.o \ pristine-merkle-tree.o \ uarch-interpret.o \ @@ -394,7 +389,6 @@ LUACARTESI_OBJS:= \ $(CARTESI_CLUA_OBJS) LIBCARTESI_MERKLE_TREE_OBJS:= \ - sha3.o \ machine-merkle-tree.o \ back-merkle-tree.o \ pristine-merkle-tree.o \ @@ -557,9 +551,6 @@ jsonrpc-discover.cpp: jsonrpc-discover.json @$(CC) $(CFLAGS) $< -MM -MT $@ -MF $@.d > /dev/null 2>&1 @touch $@ -sha3.o: ../third-party/tiny_sha3/sha3.c - $(CC) $(CFLAGS) $(SHA3_CFLAGS) -c -o $@ $< - sha256.o: ../third-party/SHA256/sha256.c $(CC) $(CFLAGS) $(SHA256_CFLAGS) -c -o $@ $< diff --git a/src/clua-cartesi.cpp b/src/clua-cartesi.cpp index 8a3b1af3a..947588447 100644 --- a/src/clua-cartesi.cpp +++ b/src/clua-cartesi.cpp @@ -25,7 +25,6 @@ #include "base64.h" #include "clua-i-virtual-machine.h" #include "clua.h" -#include "keccak-256-hasher.h" #include "machine-c-api.h" #include "machine-c-version.h" #include "riscv-constants.h" @@ -52,46 +51,6 @@ static const auto gperf_meta = clua_make_luaL_Reg_array({ }); #endif -/// \brief This is the cartesi.keccak() function implementation. -/// \param L Lua state. -static int cartesi_mod_keccak(lua_State *L) { - using namespace cartesi; - keccak_256_hasher h; - keccak_256_hasher::hash_type hash; - if (lua_gettop(L) > 2) { - luaL_argerror(L, 3, "too many arguments"); - } - if (lua_gettop(L) < 1) { - luaL_argerror(L, 1, "too few arguments"); - } - if (lua_isinteger(L, 1) != 0) { - if (lua_gettop(L) > 1) { - luaL_argerror(L, 2, "too many arguments"); - } - uint64_t word = luaL_checkinteger(L, 1); - h.begin(); - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - h.add_data(reinterpret_cast(&word), sizeof(word)); - h.end(hash); - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - lua_pushlstring(L, reinterpret_cast(hash.data()), hash.size()); - return 1; - } - h.begin(); - size_t len1 = 0; - const char *hash1 = luaL_checklstring(L, 1, &len1); - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - h.add_data(reinterpret_cast(hash1), len1); - size_t len2 = 0; - const char *hash2 = luaL_optlstring(L, 2, "", &len2); - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - h.add_data(reinterpret_cast(hash2), len2); - h.end(hash); - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - lua_pushlstring(L, reinterpret_cast(hash.data()), hash.size()); - return 1; -} - /// \brief This is the cartesi.keccak() function implementation. /// \param L Lua state. static int cartesi_mod_hash(lua_State *L) { @@ -187,9 +146,6 @@ static int cartesi_mod_new(lua_State *L) try { /// \brief Contents of the cartesi module table. static const auto cartesi_mod = clua_make_luaL_Reg_array({ - // keccak is only used in cmio-test.lua. - // If we find a pure Lua implementation, we can remove keccak altogether. - {"keccak", cartesi_mod_keccak}, {"hash", cartesi_mod_hash}, {"tobase64", cartesi_mod_tobase64}, {"frombase64", cartesi_mod_frombase64}, diff --git a/src/keccak-256-hasher.h b/src/keccak-256-hasher.h deleted file mode 100644 index a649d8d29..000000000 --- a/src/keccak-256-hasher.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright Cartesi and individual authors (see AUTHORS) -// SPDX-License-Identifier: LGPL-3.0-or-later -// -// This program is free software: you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation, either version 3 of the License, or (at your option) any -// later version. -// -// This program is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License along -// with this program (see COPYING). If not, see . -// - -#ifndef KECCAK_256_HASHER_H -#define KECCAK_256_HASHER_H - -#include -#include -#include - -#include "i-hasher.h" - -extern "C" { -#include "sha3.h" -} - -namespace cartesi { - -struct keccak_instance final { - union { - uint8_t b[200]; - uint64_t q[25]; - } st; - int pt; -}; - -class keccak_256_hasher final : public i_hasher> { - sha3_ctx_t m_ctx{}; - - friend i_hasher>; - - void do_begin() { - sha3_init(&m_ctx, 32, 0x01); - } - - void do_add_data(const unsigned char *data, size_t length) { - sha3_update(&m_ctx, data, length); - } - - void do_end(hash_type &hash) { - sha3_final(hash.data(), &m_ctx); - } - -public: - /// \brief Default constructor - keccak_256_hasher() = default; - - /// \brief Default destructor - ~keccak_256_hasher() = default; - - /// \brief No copy constructor - keccak_256_hasher(const keccak_256_hasher &) = delete; - /// \brief No move constructor - keccak_256_hasher(keccak_256_hasher &&) = delete; - /// \brief No copy assignment - keccak_256_hasher &operator=(const keccak_256_hasher &) = delete; - /// \brief No move assignment - keccak_256_hasher &operator=(keccak_256_hasher &&) = delete; -}; - -} // namespace cartesi - -#endif diff --git a/tests/lua/cmio-test.lua b/tests/lua/cmio-test.lua index 399f4181a..0fd31128f 100755 --- a/tests/lua/cmio-test.lua +++ b/tests/lua/cmio-test.lua @@ -18,9 +18,14 @@ local cartesi = require("cartesi") local test_util = require("cartesi.tests.util") +local sha3 = require("third_party.plc.sha3") local test_data = require("cartesi.tests.data") local jsonrpc +local function keccak(a, b) + return sha3.keccak(a .. (b or "")) +end + local function adjust_images_path(path) return string.gsub(path or ".", "/*$", "") .. "/" end @@ -160,7 +165,7 @@ local function check_output(machine, expected) end assert(expected == output) - return cartesi.keccak(output) + return keccak(output) end local function check_report(machine, expected) @@ -195,14 +200,14 @@ local function check_outputs_root_hash(root_hash, output_hashes) end local c2 = output_hashes[child + 1] if c2 then - parent_output_hashes[parent] = cartesi.keccak(c1, c2) + parent_output_hashes[parent] = keccak(c1, c2) else - parent_output_hashes[parent] = cartesi.keccak(c1, z) + parent_output_hashes[parent] = keccak(c1, z) end parent = parent + 1 child = child + 2 end - z = cartesi.keccak(z, z) + z = keccak(z, z) output_hashes = parent_output_hashes end assert(root_hash == output_hashes[1], "output root hash mismatch") diff --git a/tests/lua/third_party/plc/LICENSE b/tests/lua/third_party/plc/LICENSE new file mode 100644 index 000000000..54200c3b6 --- /dev/null +++ b/tests/lua/third_party/plc/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2018 Phil Leblanc +Copyright (c) 2017 Pierre Chapuis (files salsa20.lua, test_salsa20, box.lua, test_box.lua) + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/tests/lua/third_party/plc/sha3.lua b/tests/lua/third_party/plc/sha3.lua new file mode 100644 index 000000000..57d881d1a --- /dev/null +++ b/tests/lua/third_party/plc/sha3.lua @@ -0,0 +1,255 @@ +-- Copyright (c) 2014 Joseph Wallace +-- Copyright (c) 2015 Phil Leblanc +-- License: MIT - see LICENSE file +------------------------------------------------------------ + +-- 170612 SHA-3 padding fixed. +-- (reported by Michael Rosenberg https://github.com/doomrobo) + +-- 150827 original code modified and optimized +-- (more than 2x performance improvement for sha3-512) --phil + +-- Directly devived from a Keccak implementation by Joseph Wallace +-- published on the Lua mailing list in 2014 +-- http://lua-users.org/lists/lua-l/2014-03/msg00905.html + +------------------------------------------------------------ +-- sha3 / keccak + +local char = string.char +local concat = table.concat +local spack, sunpack = string.pack, string.unpack + +-- the Keccak constants and functionality + +local ROUNDS = 24 + +local roundConstants = { + 0x0000000000000001, + 0x0000000000008082, + 0x800000000000808A, + 0x8000000080008000, + 0x000000000000808B, + 0x0000000080000001, + 0x8000000080008081, + 0x8000000000008009, + 0x000000000000008A, + 0x0000000000000088, + 0x0000000080008009, + 0x000000008000000A, + 0x000000008000808B, + 0x800000000000008B, + 0x8000000000008089, + 0x8000000000008003, + 0x8000000000008002, + 0x8000000000000080, + 0x000000000000800A, + 0x800000008000000A, + 0x8000000080008081, + 0x8000000000008080, + 0x0000000080000001, + 0x8000000080008008, +} + +local rotationOffsets = { + -- ordered for [x][y] dereferencing, so appear flipped here: + { 0, 36, 3, 41, 18 }, + { 1, 44, 10, 45, 2 }, + { 62, 6, 43, 15, 61 }, + { 28, 55, 25, 21, 56 }, + { 27, 20, 39, 8, 14 }, +} + +-- the full permutation function +local function keccakF(st) + local permuted = st.permuted + local parities = st.parities + for round = 1, ROUNDS do + --~ local permuted = permuted + --~ local parities = parities + + -- theta() + for x = 1, 5 do + parities[x] = 0 + local sx = st[x] + for y = 1, 5 do + parities[x] = parities[x] ~ sx[y] + end + end + -- + -- unroll the following loop + --for x = 1,5 do + -- local p5 = parities[(x)%5 + 1] + -- local flip = parities[(x-2)%5 + 1] ~ ( p5 << 1 | p5 >> 63) + -- for y = 1,5 do st[x][y] = st[x][y] ~ flip end + --end + local p5, flip, s + --x=1 + p5 = parities[2] + flip = parities[5] ~ (p5 << 1 | p5 >> 63) + s = st[1] + for y = 1, 5 do + s[y] = s[y] ~ flip + end + --x=2 + p5 = parities[3] + flip = parities[1] ~ (p5 << 1 | p5 >> 63) + s = st[2] + for y = 1, 5 do + s[y] = s[y] ~ flip + end + --x=3 + p5 = parities[4] + flip = parities[2] ~ (p5 << 1 | p5 >> 63) + s = st[3] + for y = 1, 5 do + s[y] = s[y] ~ flip + end + --x=4 + p5 = parities[5] + flip = parities[3] ~ (p5 << 1 | p5 >> 63) + s = st[4] + for y = 1, 5 do + s[y] = s[y] ~ flip + end + --x=5 + p5 = parities[1] + flip = parities[4] ~ (p5 << 1 | p5 >> 63) + s = st[5] + for y = 1, 5 do + s[y] = s[y] ~ flip + end + + -- rhopi() + for y = 1, 5 do + local py = permuted[y] + local r + for x = 1, 5 do + s, r = st[x][y], rotationOffsets[x][y] + py[(2 * x + 3 * y) % 5 + 1] = (s << r | s >> (64 - r)) + end + end + + -- chi() - unroll the loop + --for x = 1,5 do + -- for y = 1,5 do + -- local combined = (~ permuted[(x)%5 +1][y]) & permuted[(x+1)%5 +1][y] + -- st[x][y] = permuted[x][y] ~ combined + -- end + --end + + local p, p1, p2 + --x=1 + s, p, p1, p2 = st[1], permuted[1], permuted[2], permuted[3] + for y = 1, 5 do + s[y] = p[y] ~ ~p1[y] & p2[y] + end + --x=2 + s, p, p1, p2 = st[2], permuted[2], permuted[3], permuted[4] + for y = 1, 5 do + s[y] = p[y] ~ ~p1[y] & p2[y] + end + --x=3 + s, p, p1, p2 = st[3], permuted[3], permuted[4], permuted[5] + for y = 1, 5 do + s[y] = p[y] ~ ~p1[y] & p2[y] + end + --x=4 + s, p, p1, p2 = st[4], permuted[4], permuted[5], permuted[1] + for y = 1, 5 do + s[y] = p[y] ~ ~p1[y] & p2[y] + end + --x=5 + s, p, p1, p2 = st[5], permuted[5], permuted[1], permuted[2] + for y = 1, 5 do + s[y] = p[y] ~ ~p1[y] & p2[y] + end + + -- iota() + st[1][1] = st[1][1] ~ roundConstants[round] + end +end + +local function absorb(st, buffer) + local blockBytes = st.rate / 8 + local blockWords = blockBytes / 8 + + -- append 0x01 byte and pad with zeros to block size (rate/8 bytes) + local totalBytes = #buffer + 1 + -- for keccak (2012 submission), the padding is byte 0x01 followed by zeros + -- for SHA3 (NIST, 2015), the padding is byte 0x06 followed by zeros + + -- Keccak: + buffer = buffer .. ("\x01" .. char(0):rep(blockBytes - (totalBytes % blockBytes))) + + -- SHA3: + -- buffer = buffer .. ( '\x06' .. char(0):rep(blockBytes - (totalBytes % blockBytes))) + totalBytes = #buffer + + --convert data to an array of u64 + local words = {} + for i = 1, totalBytes - (totalBytes % 8), 8 do + words[#words + 1] = sunpack(" - -// Revised 07-Aug-15 to match with official release of FIPS PUB 202 "SHA3" -// Revised 03-Sep-15 for portability + OpenSSL - style API - -#include "sha3.h" - -// Helper macros for stringification -#define TO_STRING_HELPER(X) #X -#define TO_STRING(X) TO_STRING_HELPER(X) - -// Define loop unrolling depending on the compiler -#if defined(__clang__) -#define UNROLL_LOOP(n) _Pragma(TO_STRING(unroll(n))) -#elif defined(__GNUC__) && !defined(__clang__) -#define UNROLL_LOOP(n) _Pragma(TO_STRING(GCC unroll(n))) -#else -#define UNROLL_LOOP(n) -#endif - -#ifndef KECCAKF_ROUNDS -#define KECCAKF_ROUNDS 24 -#endif - -#ifndef ROTL64 -#define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y)))) -#endif - -// update the state with given number of rounds - -void sha3_keccakf(uint64_t st[25]) -{ - // constants - const uint64_t keccakf_rndc[24] = { - 0x0000000000000001, 0x0000000000008082, 0x800000000000808a, - 0x8000000080008000, 0x000000000000808b, 0x0000000080000001, - 0x8000000080008081, 0x8000000000008009, 0x000000000000008a, - 0x0000000000000088, 0x0000000080008009, 0x000000008000000a, - 0x000000008000808b, 0x800000000000008b, 0x8000000000008089, - 0x8000000000008003, 0x8000000000008002, 0x8000000000000080, - 0x000000000000800a, 0x800000008000000a, 0x8000000080008081, - 0x8000000000008080, 0x0000000080000001, 0x8000000080008008 - }; - const int keccakf_rotc[24] = { - 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, - 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44 - }; - const int keccakf_piln[24] = { - 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, - 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1 - }; - - // variables - int i, j, r; - uint64_t t, bc[5]; - -#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ - // endianess conversion. this is redundant on little-endian targets - for (i = 0; i < 25; i++) { - st[i] = __builtin_bswap64(st[i]); - } -#endif - - // actual iteration - for (r = 0; r < KECCAKF_ROUNDS; r++) { - - // Theta - UNROLL_LOOP(5) - for (i = 0; i < 5; i++) - bc[i] = st[i] ^ st[i + 5] ^ st[i + 10] ^ st[i + 15] ^ st[i + 20]; - - UNROLL_LOOP(5) - for (i = 0; i < 5; i++) { - t = bc[(i + 4) % 5] ^ ROTL64(bc[(i + 1) % 5], 1); - UNROLL_LOOP(25) - for (j = 0; j < 25; j += 5) - st[j + i] ^= t; - } - - // Rho Pi - t = st[1]; - UNROLL_LOOP(24) - for (i = 0; i < 24; i++) { - j = keccakf_piln[i]; - bc[0] = st[j]; - st[j] = ROTL64(t, keccakf_rotc[i]); - t = bc[0]; - } - - // Chi - UNROLL_LOOP(25) - for (j = 0; j < 25; j += 5) { - UNROLL_LOOP(5) - for (i = 0; i < 5; i++) - bc[i] = st[j + i]; - UNROLL_LOOP(5) - for (i = 0; i < 5; i++) - st[j + i] ^= (~bc[(i + 1) % 5]) & bc[(i + 2) % 5]; - } - - // Iota - st[0] ^= keccakf_rndc[r]; - } - -#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ - // endianess conversion. this is redundant on little-endian targets - for (i = 0; i < 25; i++) { - st[i] = __builtin_bswap64(st[i]); - } -#endif -} - -// Initialize the context for SHA3 - -int sha3_init(sha3_ctx_t *c, int mdlen, int dsuffix) -{ - int i; - - for (i = 0; i < 25; i++) - c->st.q[i] = 0; - c->mdlen = mdlen; - c->rsiz = 200 - 2 * mdlen; - c->pt = 0; - c->dsuffix = dsuffix; - - return 1; -} - -// update state with more data - -int sha3_update(sha3_ctx_t *c, const void *data, size_t len) -{ - size_t i; - int j; - - j = c->pt; - for (i = 0; i < len; i++) { - c->st.b[j++] ^= ((const uint8_t *) data)[i]; - if (j >= c->rsiz) { - sha3_keccakf(c->st.q); - j = 0; - } - } - c->pt = j; - - return 1; -} - -// finalize and output a hash - -int sha3_final(void *md, sha3_ctx_t *c) -{ - int i; - - c->st.b[c->pt] ^= c->dsuffix; - c->st.b[c->rsiz - 1] ^= 0x80; - sha3_keccakf(c->st.q); - - for (i = 0; i < c->mdlen; i++) { - ((uint8_t *) md)[i] = c->st.b[i]; - } - - return 1; -} - -// compute a SHA-3 hash (md) of given byte length from "in" - -void *sha3(const void *in, size_t inlen, void *md, int mdlen) -{ - sha3_ctx_t sha3; - - sha3_init(&sha3, mdlen, 0x06); - sha3_update(&sha3, in, inlen); - sha3_final(md, &sha3); - - return md; -} - -// SHAKE128 and SHAKE256 extensible-output functionality - -void shake_xof(sha3_ctx_t *c) -{ - c->st.b[c->pt] ^= 0x1F; - c->st.b[c->rsiz - 1] ^= 0x80; - sha3_keccakf(c->st.q); - c->pt = 0; -} - -void shake_out(sha3_ctx_t *c, void *out, size_t len) -{ - size_t i; - int j; - - j = c->pt; - for (i = 0; i < len; i++) { - if (j >= c->rsiz) { - sha3_keccakf(c->st.q); - j = 0; - } - ((uint8_t *) out)[i] = c->st.b[j++]; - } - c->pt = j; -} - diff --git a/third-party/tiny_sha3/sha3.h b/third-party/tiny_sha3/sha3.h deleted file mode 100644 index d130afdf0..000000000 --- a/third-party/tiny_sha3/sha3.h +++ /dev/null @@ -1,39 +0,0 @@ -// sha3.h -// 19-Nov-11 Markku-Juhani O. Saarinen - -#ifndef SHA3_H -#define SHA3_H - -#include -#include - -// state context -typedef struct { - union { // state: - uint8_t b[200]; // 8-bit bytes - uint64_t q[25]; // 64-bit words - } st; - int pt, rsiz, mdlen, dsuffix; // these don't overflow -} sha3_ctx_t; - -// Compression function. -void sha3_keccakf(uint64_t st[25]); - -// OpenSSL - like interfece -int sha3_init(sha3_ctx_t *c, int mdlen, int dsuffix); // mdlen = hash output in bytes -int sha3_update(sha3_ctx_t *c, const void *data, size_t len); -int sha3_final(void *md, sha3_ctx_t *c); // digest goes to md - -// compute a sha3 hash (md) of given byte length from "in" -void *sha3(const void *in, size_t inlen, void *md, int mdlen); - -// SHAKE128 and SHAKE256 extensible-output functions -#define shake128_init(c) sha3_init(c, 16, 0x06) -#define shake256_init(c) sha3_init(c, 32, 0x06) -#define shake_update sha3_update - -void shake_xof(sha3_ctx_t *c); -void shake_out(sha3_ctx_t *c, void *out, size_t len); - -#endif -