Branch data Line data Source code
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 : :
19 : 969 : void print_array(const uint8_t *in_data, uint32_t in_len)
20 : : {
21 : 969 : printf(" (size %lu):", (unsigned long)in_len);
22 [ + + ]: 969 : if (NULL != in_data) {
23 [ + + ]: 62657 : for (uint32_t i = 0; i < in_len; i++) {
24 [ + + ]: 61715 : if (i % 16 == 0)
25 : 4220 : printf("\n\t%02X ", in_data[i]);
26 : : else
27 : 57495 : printf("%02X ", in_data[i]);
28 : : }
29 : : }
30 : 969 : printf("\n");
31 : 969 : }
32 : :
33 : 2 : 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 [ - + ]: 2 : if (transport_deinitialized == error_code) {
41 : 0 : PRINTF(transport_deinit_message, file_name, line);
42 : : } else {
43 : 2 : PRINTF(runtime_error_message, error_code, file_name, line);
44 : : }
45 : : #endif
46 : 2 : }
47 : :
48 : 0 : 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 : 0 : PRINTF(external_runtime_error_message, error_code, file_name, line);
57 : : #endif
58 : 0 : }
|