root/openpgpsdk/trunk/tests/tests.h

Revision 517 (checked in by rachel, 6 years ago)

Added OPS_E_UNIMPLEMENTED error
Changed cbinfo struct to support stacked errors in callbacks
Changed RSA encryption test *NOT* to enforce writing of multiple packets
Changed RSA signature test to use OPS validation

Line 
1 #ifndef __TESTS__
2 #define __TESTS_
3
4 #include <assert.h>
5 #include <stdio.h>
6 #include <string.h>
7 #include <stdlib.h>
8 #ifndef WIN32
9 #include <unistd.h>
10 #else
11 #include <direct.h>
12 #define snprintf _snprintf
13 #define random   rand
14 #endif
15 #include <fcntl.h>
16 #include <sys/stat.h>
17 #include <sys/types.h>
18
19 #include <openpgpsdk/memory.h>
20 #include <openpgpsdk/create.h>
21
22 // test suites
23
24 #include "CUnit/Basic.h"
25
26 CU_pSuite suite_crypto();
27 extern CU_pSuite suite_packet_types();
28 extern CU_pSuite suite_rsa_decrypt();
29 extern CU_pSuite suite_rsa_encrypt();
30 extern CU_pSuite suite_rsa_encrypt_GPGtest();
31 extern CU_pSuite suite_rsa_signature();
32 extern CU_pSuite suite_rsa_verify();
33
34 // utility functions
35
36 void setup_test_keys();
37 void cleanup();
38
39 int mktmpdir();
40 extern char dir[];
41 char* create_testtext(const char *text);
42 void create_testdata(const char *text, unsigned char *buf, const int maxlen);
43 void create_testfile(const char *name);
44 #define MAXBUF 1024
45
46 ops_parse_cb_return_t
47 callback_general(const ops_parser_content_t *content_,ops_parse_cb_info_t *cbinfo);
48 ops_parse_cb_return_t
49 callback_cmd_get_secret_key(const ops_parser_content_t *content_,ops_parse_cb_info_t *cbinfo);
50 ops_parse_cb_return_t
51 callback_cmd_get_secret_key_passphrase(const ops_parser_content_t *content_,ops_parse_cb_info_t *cbinfo);
52 ops_parse_cb_return_t
53 callback_literal_data(const ops_parser_content_t *content_,ops_parse_cb_info_t *cbinfo);
54 ops_parse_cb_return_t
55 callback_pk_session_key(const ops_parser_content_t *content_,ops_parse_cb_info_t *cbinfo);
56 ops_parse_cb_return_t
57 callback_signature(const ops_parser_content_t *content_,ops_parse_cb_info_t *cbinfo);
58
59 void reset_vars();
60 int file_compare(char* file1, char* file2);
61
62 ops_keyring_t pub_keyring;
63 ops_keyring_t sec_keyring;
64 ops_memory_t* mem_literal_data;
65
66 // "Alpha" is the user who has NO passphrase on his key
67 char* alpha_user_id;
68 char* alpha_name;
69 const ops_key_data_t *alpha_pub_keydata;
70 const ops_key_data_t *alpha_sec_keydata;
71 const ops_public_key_t *alpha_pkey;
72 const ops_secret_key_t *alpha_skey;
73 char* alpha_passphrase;
74
75 // "Bravo" is the user who has a passphrase on his key
76 char* bravo_name;
77 char* bravo_passphrase;
78 char* bravo_user_id;
79 const ops_key_data_t *bravo_pub_keydata;
80 const ops_key_data_t *bravo_sec_keydata;
81 const ops_public_key_t *bravo_pkey;
82 const ops_secret_key_t *bravo_skey;
83 //const ops_key_data_t *decrypter;
84 #endif
85
Note: See TracBrowser for help on using the browser.