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_decode.h" 12 : : #include "cbor/edhoc_decode_cert.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 decode_cert(zcbor_state_t *state, struct cert *result); 20 : : 21 : : 22 : 0 : static bool decode_cert( 23 : : zcbor_state_t *state, struct cert *result) 24 : : { 25 : : zcbor_log("%s\r\n", __func__); 26 : : 27 : 0 : bool tmp_result = (((((zcbor_int32_decode(state, (&(*result).cert_type)))) 28 [ # # ]: 0 : && ((zcbor_int32_decode(state, (&(*result).cert_serial_number)))) 29 [ # # ]: 0 : && ((zcbor_tstr_decode(state, (&(*result).cert_issuer)))) 30 [ # # ]: 0 : && ((zcbor_int32_decode(state, (&(*result).cert_validity_not_before)))) 31 [ # # ]: 0 : && ((zcbor_int32_decode(state, (&(*result).cert_validity_not_after)))) 32 [ # # ]: 0 : && ((zcbor_bstr_decode(state, (&(*result).cert_subject)))) 33 [ # # ]: 0 : && ((zcbor_int32_decode(state, (&(*result).cert_subject_public_key_algorithm)))) 34 [ # # ]: 0 : && ((zcbor_bstr_decode(state, (&(*result).cert_pk)))) 35 [ # # ]: 0 : && ((zcbor_int32_decode(state, (&(*result).cert_extensions)))) 36 [ # # ]: 0 : && ((zcbor_int32_decode(state, (&(*result).cert_issuer_signature_algorithm)))) 37 [ # # # # ]: 0 : && ((zcbor_bstr_decode(state, (&(*result).cert_signature))))))); 38 : : 39 : 0 : if (!tmp_result) { 40 : : zcbor_trace_file(state); 41 : : zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); 42 : : } else { 43 : : zcbor_log("%s success\r\n", __func__); 44 : : } 45 : : 46 : 0 : return tmp_result; 47 : : } 48 : : 49 : : 50 : : 51 : 0 : int cbor_decode_cert( 52 : : const uint8_t *payload, size_t payload_len, 53 : : struct cert *result, 54 : : size_t *payload_len_out) 55 : : { 56 : : zcbor_state_t states[2]; 57 : : 58 : 0 : return zcbor_entry_function(payload, payload_len, (void *)result, payload_len_out, states, 59 : : (zcbor_decoder_t *)decode_cert, sizeof(states) / sizeof(zcbor_state_t), 11); 60 : : }