hsw-nbt 1.2.0
OPTIGA Authenticate NBT Host Library for C
ifx-tlv.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2024-2026 Infineon Technologies AG
2// SPDX-License-Identifier: MIT
3
9#ifndef IFX_TLV_H
10#define IFX_TLV_H
11
12#include "ifx-utils-lib.h"
13#include "ifx-utils.h"
14#include "infineon/ifx-error.h"
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20/* Function identifier */
21
26#define IFX_TLV_DGI_ENCODER UINT8_C(0x01)
27
32#define IFX_TLV_DGI_DECODER UINT8_C(0x02)
33
37#define IFX_TLV_DGI_2B_LEN_IDENTIFIER UINT8_C(0xFF)
38
42#define IFX_TLV_DGI_LEN_IDENTIFIER_SIZE UINT8_C(0x01)
43
47#define IFX_TLV_DGI_MIN_LEN_SIZE UINT8_C(0x01)
48
52#define IFX_TLV_DGI_TAG_SIZE UINT8_C(0x02)
53
57#define IFX_TLV_DGI_LEN_SIZE_1B UINT8_C(0x01)
58
62#define IFX_TLV_DGI_LEN_SIZE_2B UINT8_C(0x02)
63
68#define IFX_TLV_DGI_LEN_WITH_ID_SIZE UINT8_C(0x03)
69
73#define IFX_TLV_DGI_ENCODED_BYTES_INVALID UINT8_C(0xF9)
74
79typedef struct
80{
82 uint16_t tag;
83
85 uint32_t length;
86
88 uint8_t *value;
89} ifx_tlv_t;
90
110 uint32_t tlv_data_count,
111 ifx_blob_t *encoded_bytes);
112
134 uint32_t *tlv_data_count, ifx_tlv_t *tlv_data);
140#ifdef __cplusplus
141}
142
143#endif /* __cplusplus */
144#endif /* IFX_TLV_H */
Infineon specific error code creation and parsing.
uint32_t ifx_status_t
Custom return code type used by all Infineon host software libraries.
Definition ifx-error.h:91
ifx_status_t ifx_tlv_dgi_decode(const ifx_blob_t *encoded_bytes, uint32_t *tlv_data_count, ifx_tlv_t *tlv_data)
Decodes the byte array into array of TLV type data. This method decodes DGI TLV formatted data,...
ifx_status_t ifx_tlv_dgi_encode(const ifx_tlv_t *tlv_data, uint32_t tlv_data_count, ifx_blob_t *encoded_bytes)
Encodes the array of TLV type data into byte array. This method encodes in DGI TLV format,...
Provides the module, method and error identifiers of the library.
Provides utility functions and macros.
Data storage for data and data length where both are required as parameters.
Definition ifx-utils.h:189
Data storage for TLV(tag, length & value) fields TLV value field can be NULL.
Definition ifx-tlv.h:80
uint8_t * value
Definition ifx-tlv.h:88
uint32_t length
Definition ifx-tlv.h:85
uint16_t tag
Definition ifx-tlv.h:82