1 /* 2 Copyright (c) 2022 Eriptic Technologies. 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 #ifndef UNIT_TEST_H 13 #define UNIT_TEST_H 14 15 #include "byte_array.h" 16 17 #include "oscore/oscore_coap.h" 18 #include "oscore/security_context.h" 19 20 /*when UNIT_TEST is defined all static functions are not static anymore and 21 can be used in unit test files.*/ 22 #if UNIT_TEST 23 #define STATIC 24 25 /*the prototypes of all static functions that are used in unit tests*/ 26 enum err inner_outer_option_split(struct o_coap_packet *in_o_coap, 27 struct o_coap_option *e_options, 28 uint8_t *e_options_cnt, 29 uint16_t *e_options_len, 30 struct o_coap_option *U_options, 31 uint8_t *U_options_cnt); 32 33 enum err oscore_pkg_generate(struct o_coap_packet *in_o_coap, 34 struct o_coap_packet *out_oscore, 35 struct o_coap_option *u_options, 36 uint8_t u_options_cnt, 37 struct byte_array *in_ciphertext, 38 struct oscore_option *oscore_option); 39 40 enum err oscore_option_parser(const struct o_coap_option *opt, uint8_t opt_cnt, 41 struct compressed_oscore_option *out); 42 43 enum err options_reorder(struct o_coap_option *U_options, uint8_t U_options_cnt, 44 struct o_coap_option *E_options, uint8_t E_options_cnt, 45 struct o_coap_option *out_options, 46 uint8_t *out_options_cnt); 47 48 enum err oscore_option_generate(struct byte_array *piv, struct byte_array *kid, 49 struct byte_array *kid_context, 50 struct oscore_option *oscore_option); 51 52 enum err derive(struct common_context *cc, struct byte_array *id, 53 enum derive_type type, struct byte_array *out); 54 55 #else 56 #define STATIC static 57 #endif 58 59 #endif