aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/axolotl/axolotl.hh24
-rw-r--r--include/axolotl/crypto.hh5
-rw-r--r--include/axolotl/list.hh5
3 files changed, 29 insertions, 5 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
);
diff --git a/include/axolotl/crypto.hh b/include/axolotl/crypto.hh
index 42c154b..f1e81ac 100644
--- a/include/axolotl/crypto.hh
+++ b/include/axolotl/crypto.hh
@@ -15,8 +15,9 @@ struct Curve25519KeyPair : public Curve25519PublicKey {
};
-Curve25519KeyPair generate_key(
- std::uint8_t const * random_32_bytes
+void generate_key(
+ std::uint8_t const * random_32_bytes,
+ Curve25519KeyPair & key_pair
);
diff --git a/include/axolotl/list.hh b/include/axolotl/list.hh
index a3c3d01..4c87630 100644
--- a/include/axolotl/list.hh
+++ b/include/axolotl/list.hh
@@ -61,6 +61,11 @@ public:
}
/**
+ * Make space for an item in the list at the start of the list
+ */
+ T * insert() { return insert(begin()); }
+
+ /**
* Insert an item into the list at a given position.
* If inserting the item makes the list longer than max_size then
* the end of the list is discarded.