@@ -130,18 +130,25 @@ ::olm_create_account(account, random.data(), random.size());
130130std::vector<std::uint8_t > session_buffer (::olm_session_size ());
131131::OlmSession *session = ::olm_session (session_buffer.data ());
132132std::uint8_t identity_key[32 ];
133+ std::uint8_t identity_signing_key[32 ];
133134std::uint8_t one_time_key[32 ];
134135std::uint8_t pre_key[32 ];
135136mock_random (identity_key, sizeof (identity_key));
137+ mock_random (identity_signing_key, sizeof (identity_key));
136138mock_random (one_time_key, sizeof (one_time_key));
137139mock_random (pre_key, sizeof (one_time_key));
138140std::vector<std::uint8_t > random2 (::olm_create_outbound_session_random_length (session));
139141mock_random (random2.data (), random2.size ());
142+ std::uint8_t pre_key_signature[86 ];
143+ olm_account_prekey_signature (account, pre_key_signature);
144+ // ::olm_account_sign(account, pre_key, sizeof(pre_key), pre_key_signature, olm_account_signature_length(account));
140145
141146::olm_create_outbound_session (
142147 session, account,
143148 identity_key, sizeof (identity_key),
149+ identity_signing_key, sizeof(identity_signing_key),
144150 pre_key, sizeof(pre_key),
151+ pre_key_signature, sizeof(pre_key_signature),
145152 one_time_key, sizeof(one_time_key),
146153 random2.data(), random2.size()
147154);
@@ -217,9 +224,11 @@ ::olm_account_identity_keys(a_account, a_id_keys.data(), a_id_keys.size());
217224
218225std::vector<std::uint8_t > b_id_keys (::olm_account_identity_keys_length (b_account));
219226std::vector<std::uint8_t > b_pre_key (::olm_account_prekey_length (b_account));
227+ std::vector<std::uint8_t > b_pre_key_signature (::olm_account_signature_length (b_account));
220228std::vector<std::uint8_t > b_ot_keys (::olm_account_one_time_keys_length (b_account));
221229::olm_account_identity_keys (b_account, b_id_keys.data(), b_id_keys.size());
222230::olm_account_prekey (b_account, b_pre_key.data(), b_pre_key.size());
231+ ::olm_account_prekey_signature (b_account, b_pre_key_signature.data());
223232::olm_account_one_time_keys (b_account, b_ot_keys.data(), b_ot_keys.size());
224233
225234std::vector<std::uint8_t > a_session_buffer (::olm_session_size ());
@@ -229,7 +238,9 @@ mock_random_a(a_rand.data(), a_rand.size());
229238CHECK_NE (std::size_t (-1 ), ::olm_create_outbound_session (
230239 a_session, a_account,
231240 b_id_keys.data () + 15 , 43 , // B's curve25519 identity key
241+ b_id_keys.data () + 71 , 43 , // B's ed25519 signing key
232242 b_pre_key.data () + 25 , 43 , // B's curve25519 pre key
243+ b_pre_key_signature.data (), 86 , // B's ed25519 prekey signature
233244 b_ot_keys.data () + 25 , 43 , // B's curve25519 one time key
234245 a_rand.data (), a_rand.size ()
235246));
@@ -369,9 +380,11 @@ ::olm_account_generate_prekey(b_account, p_random.data(), p_random.size());
369380
370381std::vector<std::uint8_t > b_id_keys (::olm_account_identity_keys_length (b_account));
371382std::vector<std::uint8_t > b_pre_key (::olm_account_prekey_length (b_account));
383+ std::vector<std::uint8_t > b_pre_key_signature (::olm_account_signature_length (b_account));
372384std::vector<std::uint8_t > b_ot_keys (::olm_account_one_time_keys_length (b_account));
373385::olm_account_identity_keys (b_account, b_id_keys.data(), b_id_keys.size());
374386::olm_account_prekey (b_account, b_pre_key.data(), b_pre_key.size());
387+ ::olm_account_prekey_signature (b_account, b_pre_key_signature.data());
375388::olm_account_one_time_keys (b_account, b_ot_keys.data(), b_ot_keys.size());
376389
377390std::vector<std::uint8_t > a_session_buffer (::olm_session_size ());
@@ -381,7 +394,9 @@ mock_random_a(a_rand.data(), a_rand.size());
381394CHECK_NE (std::size_t (-1 ), ::olm_create_outbound_session (
382395 a_session, a_account,
383396 b_id_keys.data () + 15 , 43 ,
397+ b_id_keys.data () + 71 , 43 ,
384398 b_pre_key.data () + 25 , 43 ,
399+ b_pre_key_signature.data (), 86 ,
385400 b_ot_keys.data () + 25 , 43 ,
386401 a_rand.data (), a_rand.size ()
387402));
@@ -492,9 +507,11 @@ mock_random_b(f_random.data(), f_random.size());
492507::olm_account_generate_fallback_key (b_account, f_random.data(), f_random.size());
493508std::vector<std::uint8_t > b_fb_key (::olm_account_unpublished_fallback_key_length (b_account));
494509std::vector<std::uint8_t > b_pre_key (::olm_account_prekey_length (b_account));
510+ std::vector<std::uint8_t > b_pre_key_signature (::olm_account_signature_length (b_account));
495511
496512::olm_account_identity_keys (b_account, b_id_keys.data(), b_id_keys.size());
497513::olm_account_prekey (b_account, b_pre_key.data(), b_pre_key.size());
514+ ::olm_account_prekey_signature (b_account, b_pre_key_signature.data());
498515::olm_account_unpublished_fallback_key (b_account, b_fb_key.data(), b_fb_key.size());
499516
500517// start a new olm session and encrypt a message
@@ -505,7 +522,9 @@ mock_random_a(a_rand.data(), a_rand.size());
505522CHECK_NE (std::size_t (-1 ), ::olm_create_outbound_session (
506523 a_session1, a_account,
507524 b_id_keys.data () + 15 , 43 , // B's curve25519 identity key
525+ b_id_keys.data () + 71 , 43 , // B's ed25519 identity key
508526 b_pre_key.data () + 25 , 43 , // B's curve25519 pre key
527+ b_pre_key_signature.data (), 86 , // B's ed25519 prekey signature
509528 b_fb_key.data () + 25 , 43 , // B's curve25519 one time key
510529 a_rand.data (), a_rand.size ()
511530));
@@ -580,7 +599,9 @@ mock_random_a(a_rand.data(), a_rand.size());
580599CHECK_NE (std::size_t (-1 ), ::olm_create_outbound_session (
581600 a_session2, a_account,
582601 b_id_keys.data () + 15 , 43 , // B's curve25519 identity key
602+ b_id_keys.data () + 71 , 43 , // B's ed25519 identity key
583603 b_pre_key.data () + 25 , 43 , // B's curve25519 pre key
604+ b_pre_key_signature.data (), 86 , // B's ed25519 prekey signature
584605 b_fb_key.data () + 25 , 43 , // B's curve25519 one time key
585606 a_rand.data (), a_rand.size ()
586607));
@@ -649,7 +670,9 @@ mock_random_a(a_rand.data(), a_rand.size());
649670CHECK_NE (std::size_t (-1 ), ::olm_create_outbound_session (
650671 a_session3, a_account,
651672 b_id_keys.data () + 15 , 43 , // B's curve25519 identity key
673+ b_id_keys.data () + 71 , 43 , // B's ed25519 identity key
652674 b_pre_key.data () + 25 , 43 , // B's curve25519 pre key
675+ b_pre_key_signature.data (), 86 , // B's ed25519 prekey signature
653676 b_fb_key.data () + 25 , 43 , // B's curve25519 one time key
654677 a_rand.data (), a_rand.size ()
655678));
0 commit comments