hsw-nbt 1.2.0
OPTIGA Authenticate NBT Host Library for C
Data Structures | Macros | Functions
nbt-parse-response.h File Reference

Response parser for apdu-nbt commands. More...

#include "infineon/ifx-apdu.h"
#include "infineon/ifx-utils.h"
#include "infineon/nbt-apdu-lib.h"

Go to the source code of this file.

Data Structures

struct  nbt_applet_version_t
 Structure for the applet version. More...
 
struct  nbt_available_memory_t
 Structure for the available memory. More...
 

Macros

#define NBT_GET_DATA_RESP_PARSER   UINT8_C(0x01)
 Identifier for command get response parser available memory.
 
#define NBT_GET_DATA_MEMORY_RESP_HEADER_LEN   UINT8_C(0x05)
 Length of the header tags of the available memory.
 
#define NBT_LENGTH_TLV   UINT8_C(0x04)
 Length of one memory TLV is present in the response.
 
#define NBT_GET_DATA_DEFAULT_RESP_TAG   UINT8_C(0x6F)
 Get data response will contain this tag as a reference.
 
#define NBT_TAG_DEFAULT_GET_DATA   UINT8_C(0xDF)
 Default get data tag.
 
#define NBT_TAG_APPLET_VERSION   UINT8_C(0x3A)
 Offset for applet version type in the get data.
 
#define NBT_TAG_AVAILABLE_MEMORY   UINT8_C(0x3B)
 Offset for available memory type in the get data.
 
#define NBT_LEN_FILE_CONTROL_INFO   UINT8_C(0x07)
 File control information length for applet version.
 
#define NBT_LEN_APPLET_VERSION   UINT8_C(0x04)
 Length of applet version.
 
#define NBT_LEN_AVAILABLE_MEMORY_INFO   UINT8_C(0x0F)
 Available memory information length for the applet.
 
#define NBT_LEN_AVAILABLE_MEMORY   UINT8_C(0x0C)
 Available memory length.
 
#define NBT_GET_DATA_TLV_LEN_VALUE   UINT8_C(0x02)
 Length of memory data stored in the get data response.
 
#define NBT_GET_DATA_TAG_AVAILABLE_NVM_MEMORY   UINT8_C(0xC6)
 Available persistent or NVM memory.
 
#define NBT_GET_DATA_TAG_AVAILABLE_TRANSIENT_COR   UINT8_C(0xC7)
 Available transient of clear on reset (COR) type.
 
#define NBT_GET_DATA_TAG_AVAILABLE_TRANSIENT_COD   UINT8_C(0xC8)
 Available transient of clear on deselect (COD) type.
 

Functions

ifx_status_t nbt_parse_applet_version (const ifx_apdu_response_t *response, nbt_applet_version_t *applet_version)
 Gets the response data and returns the applet version.
 
ifx_status_t nbt_parse_available_memory (const ifx_apdu_response_t *response, nbt_available_memory_t *available_memory)
 Gets the response data and returns the available memory.
 

Detailed Description

Response parser for apdu-nbt commands.

Definition in file nbt-parse-response.h.

Macro Definition Documentation

◆ NBT_GET_DATA_DEFAULT_RESP_TAG

#define NBT_GET_DATA_DEFAULT_RESP_TAG   UINT8_C(0x6F)

Get data response will contain this tag as a reference.

Definition at line 39 of file nbt-parse-response.h.

◆ NBT_GET_DATA_MEMORY_RESP_HEADER_LEN

#define NBT_GET_DATA_MEMORY_RESP_HEADER_LEN   UINT8_C(0x05)

Length of the header tags of the available memory.

Definition at line 29 of file nbt-parse-response.h.

◆ NBT_GET_DATA_RESP_PARSER

#define NBT_GET_DATA_RESP_PARSER   UINT8_C(0x01)

Identifier for command get response parser available memory.

Definition at line 24 of file nbt-parse-response.h.

◆ NBT_GET_DATA_TAG_AVAILABLE_NVM_MEMORY

#define NBT_GET_DATA_TAG_AVAILABLE_NVM_MEMORY   UINT8_C(0xC6)

Available persistent or NVM memory.

Definition at line 84 of file nbt-parse-response.h.

◆ NBT_GET_DATA_TAG_AVAILABLE_TRANSIENT_COD

#define NBT_GET_DATA_TAG_AVAILABLE_TRANSIENT_COD   UINT8_C(0xC8)

Available transient of clear on deselect (COD) type.

Definition at line 94 of file nbt-parse-response.h.

◆ NBT_GET_DATA_TAG_AVAILABLE_TRANSIENT_COR

#define NBT_GET_DATA_TAG_AVAILABLE_TRANSIENT_COR   UINT8_C(0xC7)

Available transient of clear on reset (COR) type.

Definition at line 89 of file nbt-parse-response.h.

◆ NBT_GET_DATA_TLV_LEN_VALUE

#define NBT_GET_DATA_TLV_LEN_VALUE   UINT8_C(0x02)

Length of memory data stored in the get data response.

Definition at line 79 of file nbt-parse-response.h.

◆ NBT_LEN_APPLET_VERSION

#define NBT_LEN_APPLET_VERSION   UINT8_C(0x04)

Length of applet version.

Definition at line 64 of file nbt-parse-response.h.

◆ NBT_LEN_AVAILABLE_MEMORY

#define NBT_LEN_AVAILABLE_MEMORY   UINT8_C(0x0C)

Available memory length.

Definition at line 74 of file nbt-parse-response.h.

◆ NBT_LEN_AVAILABLE_MEMORY_INFO

#define NBT_LEN_AVAILABLE_MEMORY_INFO   UINT8_C(0x0F)

Available memory information length for the applet.

Definition at line 69 of file nbt-parse-response.h.

◆ NBT_LEN_FILE_CONTROL_INFO

#define NBT_LEN_FILE_CONTROL_INFO   UINT8_C(0x07)

File control information length for applet version.

Definition at line 59 of file nbt-parse-response.h.

◆ NBT_LENGTH_TLV

#define NBT_LENGTH_TLV   UINT8_C(0x04)

Length of one memory TLV is present in the response.

Definition at line 34 of file nbt-parse-response.h.

◆ NBT_TAG_APPLET_VERSION

#define NBT_TAG_APPLET_VERSION   UINT8_C(0x3A)

Offset for applet version type in the get data.

Definition at line 49 of file nbt-parse-response.h.

◆ NBT_TAG_AVAILABLE_MEMORY

#define NBT_TAG_AVAILABLE_MEMORY   UINT8_C(0x3B)

Offset for available memory type in the get data.

Definition at line 54 of file nbt-parse-response.h.

◆ NBT_TAG_DEFAULT_GET_DATA

#define NBT_TAG_DEFAULT_GET_DATA   UINT8_C(0xDF)

Default get data tag.

Definition at line 44 of file nbt-parse-response.h.

Function Documentation

◆ nbt_parse_applet_version()

ifx_status_t nbt_parse_applet_version ( const ifx_apdu_response_t * response,
nbt_applet_version_t * applet_version )

Gets the response data and returns the applet version.

Parameters
[in]responseAPDU response object in parameter contains the response data.
[out]applet_versionApplet version out parameter object to store the applet version.
Returns
ifx_status_t
Return values
IFX_SUCCESS: If API operation is successful
IFX_ILLEGAL_ARGUMENT: If invalid/NULL parameter is passed to function
IFX_OUT_OF_MEMORY: If memory allocation fails

◆ nbt_parse_available_memory()

ifx_status_t nbt_parse_available_memory ( const ifx_apdu_response_t * response,
nbt_available_memory_t * available_memory )

Gets the response data and returns the available memory.

Parameters
[in]responseAPDU response object in parameter contains response data.
[out]available_memoryAvailable memory out parameter object to store the available memory.
Returns
ifx_status_t
Return values
IFX_SUCCESS: If API operation is successful
IFX_ILLEGAL_ARGUMENT: If invalid/NULL parameter is passed to function
IFX_OUT_OF_MEMORY: If memory allocation fails