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 <stdint.h>
13 #include <stdio.h>
14
15 #include "common/print_util.h"
16 #include "common/oscore_edhoc_error.h"
17 #include "common/print_util.h"
18
print_array(const uint8_t * in_data,uint32_t in_len)19 void print_array(const uint8_t *in_data, uint32_t in_len)
20 {
21 printf(" (size %lu):", (unsigned long)in_len);
22 if (NULL != in_data) {
23 for (uint32_t i = 0; i < in_len; i++) {
24 if (i % 16 == 0)
25 printf("\n\t%02X ", in_data[i]);
26 else
27 printf("%02X ", in_data[i]);
28 }
29 }
30 printf("\n");
31 }
32
handle_runtime_error(int error_code,const char * file_name,const int line)33 void handle_runtime_error(int error_code, const char *file_name, const int line)
34 {
35 (void)error_code;
36 (void)file_name;
37 (void)line;
38
39 #ifdef DEBUG_PRINT
40 if (transport_deinitialized == error_code) {
41 PRINTF(transport_deinit_message, file_name, line);
42 } else {
43 PRINTF(runtime_error_message, error_code, file_name, line);
44 }
45 #endif
46 }
47
handle_external_runtime_error(int error_code,const char * file_name,const int line)48 void handle_external_runtime_error(int error_code, const char *file_name,
49 const int line)
50 {
51 (void)error_code;
52 (void)file_name;
53 (void)line;
54
55 #ifdef DEBUG_PRINT
56 PRINTF(external_runtime_error_message, error_code, file_name, line);
57 #endif
58 }
59