1 /*
2    Copyright (c) 2021 Fraunhofer AISEC. See the COPYRIGHT
3    file at the top-level directory of this distribution.
4 
5    Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6    http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7    <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8    option. This file may not be copied, modified, or distributed
9    except according to those terms.
10 */
11 
12 #include <zephyr/zephyr.h>
13 #include <zephyr/ztest.h>
14 #include "edhoc_integration_tests/edhoc_tests.h"
15 #include "oscore_tests.h"
16 
17 // static void test_initiator1(void)
18 // {
19 // 	test_edhoc(INITIATOR, 1);
20 // }
21 // static void test_initiator2(void)
22 // {
23 // 	test_edhoc(INITIATOR, 2);
24 // }
25 // static void test_initiator3(void)
26 // {
27 // 	test_edhoc(INITIATOR, 3);
28 // }
29 // static void test_initiator4(void)
30 // {
31 // 	test_edhoc(INITIATOR, 4);
32 // }
33 // static void test_initiator8(void)
34 // {
35 // 	test_edhoc(INITIATOR, 8);
36 // }
37 // static void test_initiator9(void)
38 // {
39 // 	test_edhoc(INITIATOR, 9);
40 // }
41 // static void test_initiator12(void)
42 // {
43 // 	test_edhoc(INITIATOR, 12);
44 // }
45 // static void test_initiator13(void)
46 // {
47 // 	test_edhoc(INITIATOR, 13);
48 // }
49 // static void test_initiator14(void)
50 // {
51 // 	test_edhoc(INITIATOR, 14);
52 // }
53 // static void test_initiator15(void)
54 // {
55 // 	test_edhoc(INITIATOR, 15);
56 // }
57 // static void test_initiator16(void)
58 // {
59 // 	test_edhoc(INITIATOR, 16);
60 // }
61 // static void test_initiator17(void)
62 // {
63 // 	test_edhoc(INITIATOR, 17);
64 // }
65 /********************************/
66 // static void test_responder1(void)
67 // {
68 // 	test_edhoc(RESPONDER, 1);
69 // }
70 // static void test_responder2(void)
71 // {
72 // 	test_edhoc(RESPONDER, 2);
73 // }
74 // static void test_responder3(void)
75 // {
76 // 	test_edhoc(RESPONDER, 3);
77 // }
78 // static void test_responder4(void)
79 // {
80 // 	test_edhoc(RESPONDER, 4);
81 // }
82 // static void test_responder8(void)
83 // {
84 // 	test_edhoc(RESPONDER, 8);
85 // }
86 // static void test_responder9(void)
87 // {
88 // 	test_edhoc(RESPONDER, 9);
89 // }
90 // static void test_responder12(void)
91 // {
92 // 	test_edhoc(RESPONDER, 12);
93 // }
94 // static void test_responder13(void)
95 // {
96 // 	test_edhoc(RESPONDER, 13);
97 // }
98 // static void test_responder14(void)
99 // {
100 // 	test_edhoc(RESPONDER, 14);
101 // }
102 // static void test_responder15(void)
103 // {
104 // 	test_edhoc(RESPONDER, 15);
105 // }
106 // static void test_responder16(void)
107 // {
108 // 	test_edhoc(RESPONDER, 16);
109 // }
110 // static void test_responder17(void)
111 // {
112 // 	test_edhoc(RESPONDER, 17);
113 // }
114 
test_initiator_responder_interaction1(void)115 static void test_initiator_responder_interaction1(void)
116 {
117 	test_initiator_responder_interaction(1);
118 }
119 
test_initiator_responder_interaction2(void)120 static void test_initiator_responder_interaction2(void)
121 {
122 	test_initiator_responder_interaction(2);
123 }
124 
test_main(void)125 void test_main(void)
126 {
127 	/* EDHOC testvector tests  */
128 
129 	ztest_test_suite(exporter, ztest_unit_test(test_exporter));
130 	ztest_test_suite(
131 		initiator_responder_interaction,
132 		ztest_unit_test(test_initiator_responder_interaction1),
133 		ztest_unit_test(test_initiator_responder_interaction2));
134 
135 	/* OSCORE test-vector tests */
136 	ztest_test_suite(
137 		oscore_tests,
138 		ztest_unit_test(t1_oscore_client_request_response),
139 		ztest_unit_test(t2_oscore_server_request_response),
140 		ztest_unit_test(t3_oscore_client_request),
141 		ztest_unit_test(t4_oscore_server_key_derivation),
142 		ztest_unit_test(t5_oscore_client_request),
143 		ztest_unit_test(t6_oscore_server_key_derivation),
144 		ztest_unit_test(t8_oscore_server_response_simple_ack),
145 		ztest_unit_test(t9_oscore_client_server_observe),
146 		ztest_unit_test(t10_oscore_client_server_after_reboot),
147 		ztest_unit_test(t11_oscore_ssn_overflow_protection),
148 		ztest_unit_test(
149 			t100_inner_outer_option_split__no_special_options),
150 		ztest_unit_test(
151 			t101_inner_outer_option_split__with_observe_notification),
152 		ztest_unit_test(
153 			t102_inner_outer_option_split__with_observe_registration),
154 		ztest_unit_test(
155 			t103_oscore_pkg_generate__request_with_observe_registration),
156 		ztest_unit_test(
157 			t104_oscore_pkg_generate__request_with_observe_notification),
158 		ztest_unit_test(
159 			t105_inner_outer_option_split__too_many_options),
160 		ztest_unit_test(t106_oscore_option_generate_no_piv),
161 		ztest_unit_test(t200_options_serialize_deserialize),
162 		ztest_unit_test(t201_coap_serialize_deserialize),
163 		ztest_unit_test(t202_options_deserialize_corner_cases),
164 		ztest_unit_test(t203_coap_get_message_type),
165 		ztest_unit_test(t300_oscore_option_parser_no_piv),
166 		ztest_unit_test(t301_oscore_option_parser_wrong_n),
167 		ztest_unit_test(t302_oscore_option_parser_no_kid),
168 		ztest_unit_test(t303_options_reorder),
169 		ztest_unit_test(t400_is_class_e),
170 		ztest_unit_test(t401_cache_echo_val),
171 		ztest_unit_test(t402_echo_val_is_fresh),
172 		ztest_unit_test(t403_uri_path_create),
173 		ztest_unit_test(t404_get_observe_value),
174 		ztest_unit_test(t500_oscore_context_init_corner_cases),
175 		ztest_unit_test(t501_piv2ssn),
176 		ztest_unit_test(t502_ssn2piv),
177 		ztest_unit_test(t503_derive_corner_case),
178 		ztest_unit_test(t504_context_freshness),
179 		ztest_unit_test(t600_server_replay_init_test),
180 		ztest_unit_test(t601_server_replay_reinit_test),
181 		ztest_unit_test(t602_server_replay_check_at_start_test),
182 		ztest_unit_test(t603_server_replay_check_in_progress_test),
183 		ztest_unit_test(t604_server_replay_insert_zero_test),
184 		ztest_unit_test(t605_server_replay_insert_test),
185 		ztest_unit_test(t606_server_replay_standard_scenario_test),
186 		ztest_unit_test(t700_interactions_init_test),
187 		ztest_unit_test(t701_interactions_set_record_test),
188 		ztest_unit_test(t702_interactions_get_record_test),
189 		ztest_unit_test(t703_interactions_remove_record_test),
190 		ztest_unit_test(t704_interactions_usecases_test)
191 		);
192 
193 	ztest_run_test_suite(exporter);
194 	ztest_run_test_suite(initiator_responder_interaction);
195 	ztest_run_test_suite(oscore_tests);
196 }
197