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

APDU (response) en-/decoding utility. More...

#include <stddef.h>
#include <stdint.h>
#include "infineon/ifx-error.h"

Go to the source code of this file.

Data Structures

struct  ifx_apdu_t
 Data storage for APDU fields. More...
 
struct  ifx_apdu_response_t
 Data storage struct for APDU response information. More...
 

Macros

#define LIB_APDU   UINT8_C(0x10)
 IFX error encoding library identifier.
 
#define IFX_CHECK_SW_OK(response_sw)   (response_sw == 0x9000)
 Check APDU response status word(SW) is success(0x9000)
 
#define IFX_APDU_LE_ANY   0x100u
 LE value for expecting any number of bytes <= 256.
 
#define IFX_APDU_LE_ANY_EXTENDED   0x10000u
 LE value for expecting any number of bytes <= 65536.
 
#define IFX_APDU_DECODE   0x01u
 IFX error encoding function identifier for ifx_apdu_decode().
 
#define IFX_LC_MISMATCH   0x01u
 Error reason if LC does not match length of data in ifx_apdu_decode().
 
#define IFX_EXTENDED_LEN_MISMATCH   0x02u
 Error reason if LC and LE do not use same form (short / extended) length in ifx_apdu_decode().
 
#define IFX_APDU_ENCODE   0x02u
 IFX error encoding function identifier for ifx_apdu_encode().
 
#define IFX_APDU_RESPONSE_DECODE   0x03u
 IFX error encoding function identifier for ifx_apdu_response_decode().
 
#define IFX_APDU_RESPONSE_ENCODE   0x04u
 IFX error encoding function identifier for ifx_apdu_response_encode().
 

Detailed Description

APDU (response) en-/decoding utility.

Definition in file ifx-apdu.h.

Macro Definition Documentation

◆ IFX_APDU_DECODE

#define IFX_APDU_DECODE   0x01u

IFX error encoding function identifier for ifx_apdu_decode().

Definition at line 49 of file ifx-apdu.h.

◆ IFX_APDU_ENCODE

#define IFX_APDU_ENCODE   0x02u

IFX error encoding function identifier for ifx_apdu_encode().

Definition at line 73 of file ifx-apdu.h.

◆ IFX_APDU_LE_ANY

#define IFX_APDU_LE_ANY   0x100u

LE value for expecting any number of bytes <= 256.

The short length APDU LE encoding according to ISO7816-3 Case 2S or Case 4S is a single byte 0x00 meaning 256 bytes.

Definition at line 36 of file ifx-apdu.h.

◆ IFX_APDU_LE_ANY_EXTENDED

#define IFX_APDU_LE_ANY_EXTENDED   0x10000u

LE value for expecting any number of bytes <= 65536.

The extended length APDU LE encoding according to ISO7816-3 Case 2E or Case 4E is a 2 bytes {0x00, 0x00} meaning 65536 bytes.

Definition at line 44 of file ifx-apdu.h.

◆ IFX_APDU_RESPONSE_DECODE

#define IFX_APDU_RESPONSE_DECODE   0x03u

IFX error encoding function identifier for ifx_apdu_response_decode().

Definition at line 78 of file ifx-apdu.h.

◆ IFX_APDU_RESPONSE_ENCODE

#define IFX_APDU_RESPONSE_ENCODE   0x04u

IFX error encoding function identifier for ifx_apdu_response_encode().

Definition at line 83 of file ifx-apdu.h.

◆ IFX_CHECK_SW_OK

#define IFX_CHECK_SW_OK ( response_sw)    (response_sw == 0x9000)

Check APDU response status word(SW) is success(0x9000)

Parameters
[in]response_swresponse status word(SW).

Definition at line 28 of file ifx-apdu.h.

◆ IFX_EXTENDED_LEN_MISMATCH

#define IFX_EXTENDED_LEN_MISMATCH   0x02u

Error reason if LC and LE do not use same form (short / extended) length in ifx_apdu_decode().

Used in combination with LIB_APDU and IFX_APDU_DECODE so the full result code will always be IFX_ERROR(LIB_APDU,IFX_APDU_DECODE,IFX_EXTENDED_LEN_MISMATCH)

Definition at line 68 of file ifx-apdu.h.

◆ IFX_LC_MISMATCH

#define IFX_LC_MISMATCH   0x01u

Error reason if LC does not match length of data in ifx_apdu_decode().

Used in combination with LIB_APDU and IFX_APDU_DECODE so the full result code will always be IFX_ERROR(LIB_APDU,IFX_APDU_DECODE,IFX_LC_MISMATCH)

Definition at line 58 of file ifx-apdu.h.

◆ LIB_APDU

#define LIB_APDU   UINT8_C(0x10)

IFX error encoding library identifier.

Definition at line 22 of file ifx-apdu.h.