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 #ifndef EDHOC_TESTS_H 12 #define EDHOC_TESTS_H 13 14 #include <stdint.h> 15 //#include "../../samples/common/test_vec_parser.h" 16 17 struct messages { 18 uint8_t *m1; 19 uint32_t m1_len; 20 uint8_t *m2; 21 uint32_t m2_len; 22 uint8_t *m3; 23 uint32_t m3_len; 24 uint8_t *m4; 25 uint32_t m4_len; 26 }; 27 28 //extern struct messages_bufs m_bufs; 29 extern struct messages m; 30 31 enum role { INITIATOR, RESPONDER }; 32 33 /** 34 * @brief Runs an initiator/responder and compares the results with the * official test vectors. 35 * @param p is INITIATOR or RESPONDER 36 * @param vec_num the test vector number 37 */ 38 int test_edhoc(enum role p, uint8_t vec_num); 39 40 /** 41 * @brief Tests the functions of the exporter interface 42 */ 43 void test_exporter(void); 44 45 /** 46 * @brief Executes an instance of a responder and a initiator in 47 * parallel and checks if the results are the same. This test is 48 * especially relevant for ECC suites, e.g. P256 since signatures 49 * created with such suites are non-deterministic and therefore it 50 * is not possible to run only one of the party and to compare the 51 * results with pre computed values. 52 * @param vec_num the test vector number 53 */ 54 void test_initiator_responder_interaction(int vec_num); 55 56 void t_initiator_responder_interaction1(); 57 void t_initiator_responder_interaction2(); 58 #endif