|
hsw-nbt 1.2.0
OPTIGA Authenticate NBT Host Library for C
|
Generic protocol struct for building ISO/OSI layer stack. More...
#include <infineon/ifx-protocol.h>
Data Fields | |
| ifx_protocol_t * | _base |
| Private base layer in ISO/OSI stack. | |
| uint64_t | _layer_id |
| Private layer identification to verify that correct protocol layer called member functions. | |
| ifx_protocol_activate_callback_t | _activate |
| Private protocol activation function for negotiating protocol specific parameters. | |
| ifx_protocol_transceive_callback_t | _transceive |
| Private function for sending and receiving data at once. | |
| ifx_protocol_transmit_callback_t | _transmit |
| Private function for sending data. | |
| ifx_protocol_receive_callback_t | _receive |
| Private function for receiving data. | |
| ifx_protocol_destroy_callback_t | _destructor |
| Private destructor if further cleanup is necessary. | |
| ifx_logger_t * | _logger |
| Private member for optional Logger. | |
| void * | _properties |
Private member for generic properties as void*. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| ifx_status_t | ifx_apdu_protocol_transceive (ifx_protocol_t *self, const ifx_apdu_t *apdu, ifx_apdu_response_t *response) |
| Sends APDU to secure element reads back APDU response. | |
| ifx_status_t | ifx_i2c_get_clock_frequency (ifx_protocol_t *self, uint32_t *frequency_hz_buffer) |
| Getter for I2C clock frequency in [Hz]. | |
| ifx_status_t | ifx_i2c_set_clock_frequency (ifx_protocol_t *self, uint32_t frequency_hz) |
| Sets I2C clock frequency in [Hz]. | |
| ifx_status_t | ifx_i2c_get_slave_address (ifx_protocol_t *self, uint16_t *address_buffer) |
| Getter for I2C slave address. | |
| ifx_status_t | ifx_i2c_set_slave_address (ifx_protocol_t *self, uint16_t address) |
| Sets I2C slave address. | |
| ifx_status_t | ifx_i2c_get_guard_time (ifx_protocol_t *self, uint32_t *guard_time_us_buffer) |
| Getter for I2C guard time in [us]. | |
| ifx_status_t | ifx_i2c_set_guard_time (ifx_protocol_t *self, uint32_t guard_time_us) |
| Sets guard time to be waited between I2C transmissions. | |
| ifx_status_t | ifx_protocol_activate (ifx_protocol_t *self, uint8_t **response, size_t *response_len) |
| Activates secure element and performs protocol negotiation. | |
| ifx_status_t | ifx_protocol_transceive (ifx_protocol_t *self, const uint8_t *data, size_t data_len, uint8_t **response, size_t *response_len) |
| Sends data via Protocol and reads back response. | |
| void | ifx_protocol_destroy (ifx_protocol_t *self) |
| Frees memory associated with Protocol object (but not object itself). | |
| void | ifx_protocol_set_logger (ifx_protocol_t *self, ifx_logger_t *logger) |
| Sets Logger to be used by Protocol. | |
| ifx_status_t | ifx_t1prime_initialize (ifx_protocol_t *self, ifx_protocol_t *driver) |
| Initializes Protocol object for Global Platform T=1' protocol. | |
| ifx_status_t | ifx_t1prime_set_ifsd (ifx_protocol_t *self, size_t ifsd) |
| Sets maximum information field size of the host device (IFSD). | |
| ifx_status_t | ifx_t1prime_get_bwt (ifx_protocol_t *self, uint16_t *bwt_ms_buffer) |
| Returns current block waiting time (BWT) in [ms]. | |
| ifx_status_t | ifx_t1prime_set_bwt (ifx_protocol_t *self, uint16_t bwt_ms) |
| Sets block waiting time (BWT) in [ms]. | |
| ifx_status_t | ifx_t1prime_set_irq_handler (ifx_protocol_t *self, ifx_t1prime_irq_handler_t irq) |
| Sets T=1' interrupt handler function. | |
| ifx_status_t | ifx_t1prime_get_irq_handler (ifx_protocol_t *self, ifx_t1prime_irq_handler_t *irq_buffer) |
| Getter for T=1' interrupt handler function. | |
Generic protocol struct for building ISO/OSI layer stack.
Definition at line 226 of file ifx-protocol.h.
|
related |
Sends APDU to secure element reads back APDU response.
Encodes APDU, then sends it through ISO/OSI protocol. Reads back response and stores it in APDU response.
| [in] | self | Protocol stack for performing necessary operations. |
| [in] | apdu | APDU to be send to secure element. |
| [out] | response | Buffer to store response information in. |
IFX_SUCCESS if successful, any other value in case of error.
|
related |
Getter for I2C clock frequency in [Hz].
| [in] | self | Protocol object to get clock frequency for. |
| [out] | frequency_hz_buffer | Buffer to store clock frequency in. |
IFX_SUCCESS if successful, any other value in case of error.
|
related |
Getter for I2C guard time in [us].
Some peripherals have a guard time that needs to be waited between consecutive I2C requests. Setting this guard time will ensure that said time is awaited between requests.
| [in] | self | Protocol object to get I2C guard time for. |
| [out] | guard_time_us_buffer | Buffer to store I2C guard time in. |
IFX_SUCCESS if successful, any other value in case of error.
|
related |
Getter for I2C slave address.
| [in] | self | Protocol object to get I2C slave address for. |
| [out] | address_buffer | Buffer to store I2C address in. |
IFX_SUCCESS if successful, any other value in case of error.
|
related |
Sets I2C clock frequency in [Hz].
| [in] | self | Protocol object to set clock frequency for. |
| [in] | frequency_hz | Desired clock frequency in [Hz]. |
IFX_SUCCESS if successful, any other value in case of error.
|
related |
Sets guard time to be waited between I2C transmissions.
| [in] | self | Protocol object to set I2C guard time for. |
| [in] | guard_time_us | Desired I2C guard time in [us]. |
IFX_SUCCESS if successful, any other value in case of error.
|
related |
Sets I2C slave address.
| [in] | self | Protocol object to set I2C slave address for. |
| [out] | address | Desired I2C slave address. |
IFX_SUCCESS if successful, any other value in case of error.
|
related |
Activates secure element and performs protocol negotiation.
Depending on the protocol, data needs to be exchanged with a secure element to negotiate certain protocol aspects like frame sizes, waiting times, etc. This function will perform the initial parameter negotiation.
| [in] | self | Protocol stack for performing necessary operations. |
| [out] | response | Buffer to store response in (e.g. ATR, ATPO, ...). |
| [out] | response_len | Buffer to store number of received bytes in (number of bytes in response). |
IFX_SUCCESS if successful, any other value in case of error.
|
related |
Frees memory associated with Protocol object (but not object itself).
Protocol objects can consist of several layers each of which might hold dynamically allocated data that needs special clean-up functionality. Users would need to manually check which members need special care and free them themselves. Calling this function will ensure that all members have been freed properly.
| [in] | self | Protocol object whose data shall be freed. |
|
related |
Sets Logger to be used by Protocol.
Sets logger for whole protocol stack, so all layers below will also have the logger set.
| [in] | self | Protocol object to set logger for. |
| [in] | logger | Logger object to be used (might be NULL to clear logger). |
|
related |
Sends data via Protocol and reads back response.
Goes through ISO/OSI protocol stack and performs necessary protocol operations (chaining, crc, ...).
| [in] | self | Protocol stack for performing necessary operations. |
| [in] | data | Data to be send via protocol. |
| [in] | data_len | Number of bytes in data. |
| [out] | response | Buffer to store response in. |
| [out] | response_len | Buffer to store number of received bytes in (number of bytes in response ). |
IFX_SUCCESS if successful, any other value in case of error.
|
related |
Returns current block waiting time (BWT) in [ms].
| [in] | self | T=1' protocol stack to get BWT for. |
| [out] | bwt_ms_buffer | Buffer to store BWT value in. |
IFX_SUCCESS if successful, any other value in case of error.
|
related |
Getter for T=1' interrupt handler function.
If value is not set then polling mode is used and NULL is returned.
| [in] | self | T=1' protocol stack to get interrupt handler for. |
| [in] | irq_buffer | Buffer to store interrupt handler in. |
IFX_SUCCESS if successful, any other value in case of
|
related |
Initializes Protocol object for Global Platform T=1' protocol.
| [in] | self | Protocol object to be initialized. |
| [in] | driver | Physical (driver) layer used for communication. |
IFX_SUCCESS if successful, any other value in case of error.
|
related |
Sets block waiting time (BWT) in [ms].
| [in] | self | T=1' protocol stack to set BWT for. |
| [in] | bwt_ms | BWT value to be used. |
IFX_SUCCESS if successful, any other value in case of error.
|
related |
Sets maximum information field size of the host device (IFSD).
| [in] | self | T=1' protocol stack to set IFSD for. |
| [in] | ifsd | IFS value to be used. |
IFX_SUCCESS if successful, any other value in case of error.
|
related |
Sets T=1' interrupt handler function.
If value is not set (NULL - default) then polling mode will be used.
| [in] | self | T=1' protocol stack to set interrupt handler for. |
| [in] | irq | Interrupt handler to be used. |
IFX_SUCCESS if successful, any other value in case of error. | ifx_protocol_activate_callback_t ifx_protocol_t::_activate |
Private protocol activation function for negotiating protocol specific parameters.
Set by implementation's initialization function, do NOT set manually!
Can be NULL if ISO/OSI layer has no specific activation.
Definition at line 257 of file ifx-protocol.h.
| ifx_protocol_t* ifx_protocol_t::_base |
Private base layer in ISO/OSI stack.
Set by implementation's initialization function, do NOT set manually!
Definition at line 234 of file ifx-protocol.h.
| ifx_protocol_destroy_callback_t ifx_protocol_t::_destructor |
Private destructor if further cleanup is necessary.
Set by implementation's initialization function, do NOT set manually!
ifx_protocol_destroy() will call free() for Protocol._properties. If any further cleanup is necessary implement it in this function, otherwise use NULL.
Definition at line 302 of file ifx-protocol.h.
| uint64_t ifx_protocol_t::_layer_id |
Private layer identification to verify that correct protocol layer called member functions.
Set by implementation's initialization function, do NOT set manually!
As C generics cannot differentiate on actual type, this layer ID can be used to differentiate all layers in a full ISO/OSI protocol stack.
Definition at line 246 of file ifx-protocol.h.
| ifx_logger_t* ifx_protocol_t::_logger |
Private member for optional Logger.
Set by ifx_protocol_set_logger(), do NOT set manually!
Might be NULL.
Definition at line 311 of file ifx-protocol.h.
| void* ifx_protocol_t::_properties |
Private member for generic properties as void*.
Only used internally, do NOT set manually!
Used to hold protocol specific properties / state. Might be NULL if no state required.
Definition at line 321 of file ifx-protocol.h.
| ifx_protocol_receive_callback_t ifx_protocol_t::_receive |
Private function for receiving data.
Set by implementation's initialization function, do NOT set manually!
Might be NULL in which case Protocol._transceive must not be NULL.
Definition at line 290 of file ifx-protocol.h.
| ifx_protocol_transceive_callback_t ifx_protocol_t::_transceive |
Private function for sending and receiving data at once.
Set by implementation's initialization function, do NOT set manually!
Might be NULL in which case Protocol._transmit and Protocol._receive must no be NULL.
Definition at line 268 of file ifx-protocol.h.
| ifx_protocol_transmit_callback_t ifx_protocol_t::_transmit |
Private function for sending data.
Set by implementation's initialization function, do NOT set manually!
Might be NULL in which case Protocol._transceive must not be NULL.
Definition at line 279 of file ifx-protocol.h.