1
1
#include <stdio.h>
2
2
#include <stdlib.h>
3
3
#include <check.h>
4
- #include <pthread .h>
4
+ #include <time .h>
5
5
6
6
#include "../src/signal_protocol.h"
7
7
#include "session_record.h"
@@ -23,46 +23,31 @@ static signal_protocol_address bob_address = {
23
23
};
24
24
25
25
signal_context * global_context ;
26
- pthread_mutex_t global_mutex ;
27
- pthread_mutexattr_t global_mutex_attr ;
28
26
29
27
void run_interaction (signal_protocol_store_context * alice_store , signal_protocol_store_context * bob_store , uint32_t version );
30
28
int test_basic_pre_key_v3_decrypt_callback (session_cipher * cipher , signal_buffer * plaintext , void * decrypt_context );
31
29
32
- void test_lock (void * user_data )
33
- {
34
- pthread_mutex_lock (& global_mutex );
35
- }
36
-
37
- void test_unlock (void * user_data )
38
- {
39
- pthread_mutex_unlock (& global_mutex );
40
- }
41
30
42
31
void test_setup ()
43
32
{
44
33
int result ;
45
-
46
- pthread_mutexattr_init (& global_mutex_attr );
47
- pthread_mutexattr_settype (& global_mutex_attr , PTHREAD_MUTEX_RECURSIVE );
48
- pthread_mutex_init (& global_mutex , & global_mutex_attr );
34
+ test_global_mutex_setup ();
49
35
50
36
result = signal_context_create (& global_context , 0 );
51
37
ck_assert_int_eq (result , 0 );
52
38
signal_context_set_log_function (global_context , test_log );
53
39
54
40
setup_test_crypto_provider (global_context );
55
41
56
- result = signal_context_set_locking_functions (global_context , test_lock , test_unlock );
42
+ result = signal_context_set_locking_functions (global_context , test_global_mutex_lock , test_global_mutex_unlock );
57
43
ck_assert_int_eq (result , 0 );
58
44
}
59
45
60
46
void test_teardown ()
61
47
{
62
48
signal_context_destroy (global_context );
63
49
64
- pthread_mutex_destroy (& global_mutex );
65
- pthread_mutexattr_destroy (& global_mutex_attr );
50
+ test_global_mutex_teardown ();
66
51
}
67
52
68
53
START_TEST (test_basic_pre_key_v2 )
@@ -221,7 +206,7 @@ START_TEST(test_basic_pre_key_v3)
221
206
loaded_record_state = 0 ;
222
207
223
208
/* Encrypt an outgoing message to send to Bob */
224
- static const char original_message [] = "L'homme est condamné à être libre" ;
209
+ static const char original_message [] = "L'homme est condamn� � �tre libre" ;
225
210
size_t original_message_len = sizeof (original_message ) - 1 ;
226
211
session_cipher * alice_session_cipher = 0 ;
227
212
result = session_cipher_create (& alice_session_cipher , alice_store , & bob_address , global_context );
@@ -603,7 +588,7 @@ START_TEST(test_basic_pre_key_omemo)
603
588
loaded_record_state = 0 ;
604
589
605
590
/* Encrypt an outgoing message to send to Bob */
606
- static const char original_message [] = "L'homme est condamné à être libre" ;
591
+ static const char original_message [] = "L'homme est condamn� � �tre libre" ;
607
592
size_t original_message_len = sizeof (original_message ) - 1 ;
608
593
session_cipher * alice_session_cipher = 0 ;
609
594
result = session_cipher_create (& alice_session_cipher , alice_store , & bob_address , global_context );
@@ -1246,7 +1231,7 @@ START_TEST(test_repeat_bundle_message_v3)
1246
1231
ck_assert_int_eq (result , 0 );
1247
1232
1248
1233
/* Initialize Alice's session cipher */
1249
- static const char original_message [] = "L'homme est condamné à être libre" ;
1234
+ static const char original_message [] = "L'homme est condamn� � �tre libre" ;
1250
1235
size_t original_message_len = sizeof (original_message ) - 1 ;
1251
1236
session_cipher * alice_session_cipher = 0 ;
1252
1237
result = session_cipher_create (& alice_session_cipher , alice_store , & bob_address , global_context );
@@ -1466,7 +1451,7 @@ START_TEST(test_bad_message_bundle)
1466
1451
ck_assert_int_eq (result , 0 );
1467
1452
1468
1453
/* Encrypt an outgoing message to send to Bob */
1469
- static const char original_message [] = "L'homme est condamné à être libre" ;
1454
+ static const char original_message [] = "L'homme est condamn� � �tre libre" ;
1470
1455
size_t original_message_len = sizeof (original_message ) - 1 ;
1471
1456
session_cipher * alice_session_cipher = 0 ;
1472
1457
result = session_cipher_create (& alice_session_cipher , alice_store , & bob_address , global_context );
@@ -1634,7 +1619,7 @@ START_TEST(test_optional_one_time_pre_key)
1634
1619
ck_assert_int_eq (session_state_get_session_version (state ), 3 );
1635
1620
SIGNAL_UNREF (record );
1636
1621
1637
- static const char original_message [] = "L'homme est condamné à être libre" ;
1622
+ static const char original_message [] = "L'homme est condamn� � �tre libre" ;
1638
1623
size_t original_message_len = sizeof (original_message ) - 1 ;
1639
1624
1640
1625
/* Create Alice's session cipher */
0 commit comments