aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/hash/sha3/sha3.h
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-01-30 12:16:50 -0500
committerJack Lloyd <[email protected]>2018-01-30 12:41:35 -0500
commitc3a2c598f7f9ac714681e7f7c7568dd022451382 (patch)
treef2d7bc6939cbdc81653115eb64bde1f6634df93f /src/lib/hash/sha3/sha3.h
parentd8e6c5bd2912e19654ad46389fb27dcb00610b66 (diff)
Avoid allocating zero bytes for SHA-3 padding
Inspired by #1433
Diffstat (limited to 'src/lib/hash/sha3/sha3.h')
-rw-r--r--src/lib/hash/sha3/sha3.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/hash/sha3/sha3.h b/src/lib/hash/sha3/sha3.h
index ac01ca6dc..a3a666971 100644
--- a/src/lib/hash/sha3/sha3.h
+++ b/src/lib/hash/sha3/sha3.h
@@ -50,6 +50,20 @@ class BOTAN_PUBLIC_API(2,0) SHA_3 : public HashFunction
const uint8_t input[], size_t length);
/**
+ * Add final padding and permute. The padding is assumed to be
+ * init_pad || 00... || fini_pad
+ *
+ * @param bitrate the bitrate to absorb into the sponge
+ * @param S the sponge state
+ * @param S_pos where to begin absorbing into S
+ * @param init_pad the leading pad bits
+ * @param fini_pad the final pad bits
+ */
+ static void finish(size_t bitrate,
+ secure_vector<uint64_t>& S, size_t S_pos,
+ uint8_t init_pad, uint8_t fini_pad);
+
+ /**
* Expand from provided state
* @param bitrate sponge parameter
* @param S the state