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

NBT protocol API for exchanging APDUs with NBT product. More...

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

Go to the source code of this file.

Data Structures

struct  nbt_cmd_t
 Generic NBT command set structure for building and performing NBT commands. More...
 

Macros

#define NBT_INIT   UINT8_C(0x01)
 Identifier for command set initialize.
 
#define NBT_CMD_LOG_TAG   "NBT_COMMAND"
 String used as source information for logging.
 
#define NBT_CLA   UINT8_C(0x00)
 NBT_CLA type for NBT command: General.
 
#define NBT_CLA_PASS_THROUGH   UINT8_C(0x38)
 NBT_CLA type for NBT commands: pass-through fetch data and put response.
 
#define NBT_INS_SELECT   UINT8_C(0xA4)
 INS type for NBT command: Select file.
 
#define NBT_P1_DEFAULT   UINT8_C(0x00)
 The reference control parameter P1 for NBT command: Wherever 00 is passed.
 
#define NBT_P2_DEFAULT   UINT8_C(0x00)
 The reference control parameter P2 for NBT command: Wherever 00 is passed.
 
#define NBT_P1_SELECT_BY_DF   UINT8_C(0x04)
 The reference control parameter P1 for NBT command: Select by DF name.
 
#define NBT_LE_NONE   UINT8_C(0x00)
 The command expected length Le for NBT command: if expected length is absent.
 

Functions

ifx_status_t nbt_initialize (nbt_cmd_t *self, ifx_protocol_t *protocol, ifx_logger_t *logger)
 Initializes NBT command set object by setting protocol members to valid values.
 
void nbt_destroy (nbt_cmd_t *self)
 Releases the memory associated with NBT command set object (but not object itself).
 
uint8_t * nbt_error_message_get (const nbt_cmd_t *self)
 Returns the error message for last command executed by NBT command set.
 

Detailed Description

NBT protocol API for exchanging APDUs with NBT product.

Definition in file nbt-apdu.h.

Macro Definition Documentation

◆ NBT_CLA

#define NBT_CLA   UINT8_C(0x00)

NBT_CLA type for NBT command: General.

Definition at line 34 of file nbt-apdu.h.

◆ NBT_CLA_PASS_THROUGH

#define NBT_CLA_PASS_THROUGH   UINT8_C(0x38)

NBT_CLA type for NBT commands: pass-through fetch data and put response.

Definition at line 40 of file nbt-apdu.h.

◆ NBT_CMD_LOG_TAG

#define NBT_CMD_LOG_TAG   "NBT_COMMAND"

String used as source information for logging.

Definition at line 29 of file nbt-apdu.h.

◆ NBT_INIT

#define NBT_INIT   UINT8_C(0x01)

Identifier for command set initialize.

Definition at line 24 of file nbt-apdu.h.

◆ NBT_INS_SELECT

#define NBT_INS_SELECT   UINT8_C(0xA4)

INS type for NBT command: Select file.

Definition at line 45 of file nbt-apdu.h.

◆ NBT_LE_NONE

#define NBT_LE_NONE   UINT8_C(0x00)

The command expected length Le for NBT command: if expected length is absent.

Definition at line 69 of file nbt-apdu.h.

◆ NBT_P1_DEFAULT

#define NBT_P1_DEFAULT   UINT8_C(0x00)

The reference control parameter P1 for NBT command: Wherever 00 is passed.

Definition at line 51 of file nbt-apdu.h.

◆ NBT_P1_SELECT_BY_DF

#define NBT_P1_SELECT_BY_DF   UINT8_C(0x04)

The reference control parameter P1 for NBT command: Select by DF name.

Definition at line 63 of file nbt-apdu.h.

◆ NBT_P2_DEFAULT

#define NBT_P2_DEFAULT   UINT8_C(0x00)

The reference control parameter P2 for NBT command: Wherever 00 is passed.

Definition at line 57 of file nbt-apdu.h.

Function Documentation

◆ nbt_destroy()

void nbt_destroy ( nbt_cmd_t * self)

Releases the memory associated with NBT command set object (but not object itself).

Parameters
[in]selfNBT command set object whose data shall be released.

◆ nbt_error_message_get()

uint8_t * nbt_error_message_get ( const nbt_cmd_t * self)

Returns the error message for last command executed by NBT command set.

Parameters
[in]selfNBT command set object
Returns
uint8_t pointer to error message

◆ nbt_initialize()

ifx_status_t nbt_initialize ( nbt_cmd_t * self,
ifx_protocol_t * protocol,
ifx_logger_t * logger )

Initializes NBT command set object by setting protocol members to valid values.

This function is for NBT command set stack developers to start from a clean base, when initializing the command set. It initializes the given NBT command set structure to start with NBT command set.

Parameters
[in]selfNBT command set object to be initialized.
[in]protocolProtocol to handle the communication with NBT tag.
[in]loggerLogger to handle the logging the logs.
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