aboutsummaryrefslogtreecommitdiff
path: root/include/axolotl/axolotl.hh
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2015-02-26 16:30:19 +0000
committerMark Haines <mjark@negativecurvature.net>2015-02-26 16:30:19 +0000
commit09d8e84c7cbbf21195f3fd2eabbcff44042d5a4e (patch)
tree73a1f072bf86175c266579089fecb21e83d1d22c /include/axolotl/axolotl.hh
parent186df91246cc61febb398383e4e742973fc9aaf0 (diff)
Implement the axlotl ratchet
Diffstat (limited to 'include/axolotl/axolotl.hh')
-rw-r--r--include/axolotl/axolotl.hh24
1 files changed, 21 insertions, 3 deletions
diff --git a/include/axolotl/axolotl.hh b/include/axolotl/axolotl.hh
index 34280d4..ead52fc 100644
--- a/include/axolotl/axolotl.hh
+++ b/include/axolotl/axolotl.hh
@@ -1,6 +1,6 @@
-#include "axololt/crypto.hh"
-#include "axololt/list.hh"
+#include "axolotl/crypto.hh"
+#include "axolotl/list.hh"
namespace axolotl {
@@ -52,7 +52,10 @@ enum struct ErrorCode {
static std::size_t const MAX_RECEIVER_CHAINS = 5;
static std::size_t const MAX_SKIPPED_MESSAGE_KEYS = 40;
+
struct KdfInfo {
+ std::uint8_t const * root_info;
+ std::size_t root_info_length;
std::uint8_t const * ratchet_info;
std::size_t ratchet_info_length;
std::uint8_t const * message_info;
@@ -61,15 +64,30 @@ struct KdfInfo {
struct Session {
+
+ Session(
+ KdfInfo const & kdf_info
+ );
+
/** A pair of string to feed into the KDF identifing the application */
KdfInfo kdf_info;
/** The last error that happened encypting or decrypting a message */
ErrorCode last_error;
SharedKey root_key;
List<SenderChain, 1> sender_chain;
- List<ReceiverChain, MAX_RECEIVER_CHAINS> reciever_chains;
+ List<ReceiverChain, MAX_RECEIVER_CHAINS> receiver_chains;
List<SkippedMessageKey, MAX_SKIPPED_MESSAGE_KEYS> skipped_message_keys;
+ void initialise_as_bob(
+ std::uint8_t const * shared_secret, std::size_t shared_secret_length,
+ Curve25519PublicKey const & their_ratchet_key
+ );
+
+ void initialise_as_alice(
+ std::uint8_t const * shared_secret, std::size_t shared_secret_length,
+ Curve25519KeyPair const & our_ratchet_key
+ );
+
std::size_t encrypt_max_output_length(
std::size_t plaintext_length
);