diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-06-11 14:20:35 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-06-11 14:20:35 +0100 |
commit | 816435a86097a6609cb6e5ad422083bc49b19632 (patch) | |
tree | 60be06f84b4fe6ee404b3cbce9b0ca1256bab1cb /tests/test_ratchet.cpp | |
parent | 8161b56ff050b81a20002e9d8addf947625d17be (diff) |
Move AES specific details behind a cipher interface
Diffstat (limited to 'tests/test_ratchet.cpp')
-rw-r--r-- | tests/test_ratchet.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/test_ratchet.cpp b/tests/test_ratchet.cpp index 95391e3..18c22e3 100644 --- a/tests/test_ratchet.cpp +++ b/tests/test_ratchet.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ #include "axolotl/ratchet.hh" +#include "axolotl/cipher.hh" #include "unittest.hh" @@ -24,10 +25,13 @@ std::uint8_t message_info[] = "AxolotlMessageKeys"; axolotl::KdfInfo kdf_info = { root_info, sizeof(root_info) - 1, - ratchet_info, sizeof(ratchet_info - 1), - message_info, sizeof(ratchet_info - 1) + ratchet_info, sizeof(ratchet_info) - 1 }; +axolotl::CipherAesSha256 cipher( + message_info, sizeof(message_info) - 1 +); + std::uint8_t random_bytes[] = "0123456789ABDEF0123456789ABCDEF"; axolotl::Curve25519KeyPair bob_key; axolotl::generate_key(random_bytes, bob_key); @@ -37,8 +41,8 @@ std::uint8_t shared_secret[] = "A secret"; { /* Send/Receive test case */ TestCase test_case("Axolotl Send/Receive"); -axolotl::Session alice(kdf_info); -axolotl::Session bob(kdf_info); +axolotl::Session alice(kdf_info, cipher); +axolotl::Session bob(kdf_info, cipher); alice.initialise_as_bob(shared_secret, sizeof(shared_secret) - 1, bob_key); bob.initialise_as_alice(shared_secret, sizeof(shared_secret) - 1, bob_key); @@ -106,8 +110,8 @@ std::size_t encrypt_length, decrypt_length; TestCase test_case("Axolotl Out of Order"); -axolotl::Session alice(kdf_info); -axolotl::Session bob(kdf_info); +axolotl::Session alice(kdf_info, cipher); +axolotl::Session bob(kdf_info, cipher); alice.initialise_as_bob(shared_secret, sizeof(shared_secret) - 1, bob_key); bob.initialise_as_alice(shared_secret, sizeof(shared_secret) - 1, bob_key); |