From 816435a86097a6609cb6e5ad422083bc49b19632 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Thu, 11 Jun 2015 14:20:35 +0100 Subject: Move AES specific details behind a cipher interface --- tests/test_ratchet.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'tests/test_ratchet.cpp') 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); -- cgit v1.2.3