Branch data Line data Source code
1 : : /*
2 : : * Generated using zcbor version 0.8.99
3 : : * https://github.com/NordicSemiconductor/zcbor
4 : : * Generated with a --default-max-qty of 3
5 : : */
6 : :
7 : : #include <stdint.h>
8 : : #include <stdbool.h>
9 : : #include <stddef.h>
10 : : #include <string.h>
11 : : #include "zcbor_encode.h"
12 : : #include "cbor/edhoc_encode_th2.h"
13 : : #include "zcbor_print.h"
14 : :
15 : : #if DEFAULT_MAX_QTY != 3
16 : : #error "The type file was generated with a different default_max_qty than this file"
17 : : #endif
18 : :
19 : : static bool encode_th2(zcbor_state_t *state, const struct th2 *input);
20 : :
21 : :
22 : 6 : static bool encode_th2(
23 : : zcbor_state_t *state, const struct th2 *input)
24 : : {
25 : : zcbor_log("%s\r\n", __func__);
26 : :
27 : 6 : bool tmp_result = (((((zcbor_bstr_encode(state, (&(*input).th2_G_Y))))
28 [ + - + - ]: 6 : && ((zcbor_bstr_encode(state, (&(*input).th2_hash_msg1)))))));
29 : :
30 : 6 : if (!tmp_result) {
31 : : zcbor_trace_file(state);
32 : : zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
33 : : } else {
34 : : zcbor_log("%s success\r\n", __func__);
35 : : }
36 : :
37 : 6 : return tmp_result;
38 : : }
39 : :
40 : :
41 : :
42 : 6 : int cbor_encode_th2(
43 : : uint8_t *payload, size_t payload_len,
44 : : struct th2 *input,
45 : : size_t *payload_len_out)
46 : : {
47 : : zcbor_state_t states[2];
48 : :
49 : 6 : return zcbor_entry_function(payload, payload_len, (void *)input, payload_len_out, states,
50 : : (zcbor_decoder_t *)encode_th2, sizeof(states) / sizeof(zcbor_state_t), 2);
51 : : }
|