summaryrefslogtreecommitdiff
path: root/auto_tests/encryptsave_test.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-07-16 22:46:02 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-07-21 20:44:26 +0000
commit7245ac11ef9be2420c8356c12acc79f93ea211bb (patch)
treee971c5c6e10c2310afe4b2cd80212feac9839f2a /auto_tests/encryptsave_test.c
parent7c2b95ef5e4ccdae01bd104aa7400294c9ea391b (diff)
Avoid implementations in .h files or #including .c files.
Also, avoid the need for putting `_XOPEN_SOURCE` in every test file.
Diffstat (limited to 'auto_tests/encryptsave_test.c')
-rw-r--r--auto_tests/encryptsave_test.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/auto_tests/encryptsave_test.c b/auto_tests/encryptsave_test.c
index 48a43c86..365a9dbb 100644
--- a/auto_tests/encryptsave_test.c
+++ b/auto_tests/encryptsave_test.c
@@ -2,27 +2,24 @@
2#include "config.h" 2#include "config.h"
3#endif 3#endif
4 4
5#include "check_compat.h"
6
7#include <stdint.h> 5#include <stdint.h>
8#include <stdlib.h> 6#include <stdlib.h>
9#include <string.h> 7#include <string.h>
10#include <sys/types.h> 8#include <sys/types.h>
11#include <time.h>
12 9
13#include "helpers.h"
14
15#include "../toxcore/tox.h"
16
17#include "../toxcore/ccompat.h"
18#include "../toxcore/crypto_core.h"
19#include "../toxencryptsave/toxencryptsave.h"
20#ifdef VANILLA_NACL 10#ifdef VANILLA_NACL
21#include "../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_pwhash_scryptsalsa208sha256.h" 11#include "../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_pwhash_scryptsalsa208sha256.h"
22#else 12#else
23#include <sodium.h> 13#include <sodium.h>
24#endif 14#endif
25 15
16#include "../testing/misc_tools.h"
17#include "../toxcore/ccompat.h"
18#include "../toxcore/crypto_core.h"
19#include "../toxcore/tox.h"
20#include "../toxencryptsave/toxencryptsave.h"
21#include "check_compat.h"
22
26static unsigned char test_salt[TOX_PASS_SALT_LENGTH] = {0xB1, 0xC2, 0x09, 0xEE, 0x50, 0x6C, 0xF0, 0x20, 0xC4, 0xD6, 0xEB, 0xC0, 0x44, 0x51, 0x3B, 0x60, 0x4B, 0x39, 0x4A, 0xCF, 0x09, 0x53, 0x4F, 0xEA, 0x08, 0x41, 0xFA, 0xCA, 0x66, 0xD2, 0x68, 0x7F}; 23static unsigned char test_salt[TOX_PASS_SALT_LENGTH] = {0xB1, 0xC2, 0x09, 0xEE, 0x50, 0x6C, 0xF0, 0x20, 0xC4, 0xD6, 0xEB, 0xC0, 0x44, 0x51, 0x3B, 0x60, 0x4B, 0x39, 0x4A, 0xCF, 0x09, 0x53, 0x4F, 0xEA, 0x08, 0x41, 0xFA, 0xCA, 0x66, 0xD2, 0x68, 0x7F};
27static unsigned char known_key[TOX_PASS_KEY_LENGTH] = {0x29, 0x36, 0x1c, 0x9e, 0x65, 0xbb, 0x46, 0x8b, 0xde, 0xa1, 0xac, 0xf, 0xd5, 0x11, 0x81, 0xc8, 0x29, 0x28, 0x17, 0x23, 0xa6, 0xc3, 0x6b, 0x77, 0x2e, 0xd7, 0xd3, 0x10, 0xeb, 0xd2, 0xf7, 0xc8}; 24static unsigned char known_key[TOX_PASS_KEY_LENGTH] = {0x29, 0x36, 0x1c, 0x9e, 0x65, 0xbb, 0x46, 0x8b, 0xde, 0xa1, 0xac, 0xf, 0xd5, 0x11, 0x81, 0xc8, 0x29, 0x28, 0x17, 0x23, 0xa6, 0xc3, 0x6b, 0x77, 0x2e, 0xd7, 0xd3, 0x10, 0xeb, 0xd2, 0xf7, 0xc8};
28static const char *pw = "hunter2"; 25static const char *pw = "hunter2";
@@ -207,7 +204,6 @@ static Suite *encryptsave_suite(void)
207int main(void) 204int main(void)
208{ 205{
209 setvbuf(stdout, nullptr, _IONBF, 0); 206 setvbuf(stdout, nullptr, _IONBF, 0);
210 srand((unsigned int) time(nullptr));
211 207
212 Suite *encryptsave = encryptsave_suite(); 208 Suite *encryptsave = encryptsave_suite();
213 SRunner *test_runner = srunner_create(encryptsave); 209 SRunner *test_runner = srunner_create(encryptsave);