From 39212987bdef8e16794e756e3c78b531be25b70a Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 2 Sep 2016 15:11:14 +0100 Subject: Create new constants for key lengths, etc We were using olm::KEY_LENGTH for everything under the sun which happened to be 32 bytes long, and making a bunch of assumptions in the process. Create a bunch of new constants (as C #defines rather than C++ consts so that I can use them in another forthcoming refactor). --- include/olm/ratchet.hh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/olm/ratchet.hh') diff --git a/include/olm/ratchet.hh b/include/olm/ratchet.hh index 13f7097..e91d634 100644 --- a/include/olm/ratchet.hh +++ b/include/olm/ratchet.hh @@ -21,8 +21,13 @@ struct _olm_cipher; namespace olm { -typedef std::uint8_t SharedKey[olm::KEY_LENGTH]; +/** length of a shared key: the root key R(i), chain key C(i,j), and message key + * M(i,j)). They are all only used to stuff into HMACs, so could be any length + * for that. The chain key and message key are both derived from SHA256 + * operations, so their length is determined by that. */ +const std::size_t OLM_SHARED_KEY_LENGTH = SHA256_OUTPUT_LENGTH; +typedef std::uint8_t SharedKey[OLM_SHARED_KEY_LENGTH]; struct ChainKey { std::uint32_t index; -- cgit v1.2.3