This file implements Optiga comms abstraction layer for IFX I2C Protocol. More...
Go to the source code of this file.
Classes | |
struct | optiga_comms |
Optiga comms structure. More... | |
#define | OPTIGA_COMMS_DATA_OFFSET (0x05) |
#define | OPTIGA_COMMS_PRL_OVERHEAD (0x0D) |
typedef struct optiga_comms | optiga_comms_t |
Optiga comms structure. More... | |
optiga_comms_t | optiga_comms |
optiga communication structure More... | |
optiga_comms_t * | optiga_comms_create (callback_handler_t callback, void *context) |
Provides the singleton OPTIGA instance. More... | |
void | optiga_comms_destroy (optiga_comms_t *optiga_comms) |
Deinitializes the OPTIGA comms instance. More... | |
optiga_lib_status_t | optiga_comms_set_callback_context (optiga_comms_t *p_optiga_comms, void *context) |
Sets the callers context to OPTIGA comms instance. More... | |
optiga_lib_status_t | optiga_comms_set_callback_handler (optiga_comms_t *p_optiga_comms, callback_handler_t handler) |
Sets the callback handler to OPTIGA comms instance. More... | |
LIBRARY_EXPORTS optiga_lib_status_t | optiga_comms_open (optiga_comms_t *p_ctx) |
Opens the communication channel with OPTIGA. More... | |
LIBRARY_EXPORTS optiga_lib_status_t | optiga_comms_reset (optiga_comms_t *p_ctx, uint8_t reset_type) |
Resets the OPTIGA. More... | |
LIBRARY_EXPORTS optiga_lib_status_t | optiga_comms_transceive (optiga_comms_t *p_ctx, const uint8_t *p_tx_data, uint16_t tx_data_length, uint8_t *p_rx_data, uint16_t *p_rx_data_len) |
Sends and receives the APDU. More... | |
LIBRARY_EXPORTS optiga_lib_status_t | optiga_comms_close (optiga_comms_t *p_ctx) |
Closes the communication channel with OPTIGA. More... | |
This file implements Optiga comms abstraction layer for IFX I2C Protocol.
Copyright (c) 2019 Infineon Technologies AG
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
\endcopyright
#define OPTIGA_COMMS_DATA_OFFSET (0x05) |
#define OPTIGA_COMMS_PRL_OVERHEAD (0x0D) |
typedef struct optiga_comms optiga_comms_t |
Optiga comms structure.
LIBRARY_EXPORTS optiga_lib_status_t optiga_comms_close | ( | optiga_comms_t * | p_ctx | ) |
Closes the communication channel with OPTIGA.
Closes the communication with OPTIGA.
[in,out] | p_ctx | Valid instance of optiga_comms_t created using optiga_comms_create |
OPTIGA_COMMS_SUCCESS | |
OPTIGA_COMMS_ERROR |
optiga_comms_t* optiga_comms_create | ( | callback_handler_t | callback, |
void * | context | ||
) |
Provides the singleton OPTIGA instance.
Creates an instance of optiga_comms_t.
[in] | callback | Pointer to callback function, must not be NULL |
[in] | context | Pointer to upper layer context. |
optiga_comms_t | * On successful instance creation |
NULL | Memory allocation failure |
void optiga_comms_destroy | ( | optiga_comms_t * | optiga_comms | ) |
Deinitializes the OPTIGA comms instance.
Destroys the instance of optiga_comms_t.
[in] | optiga_comms | Valid instance of optiga_comms_t created using optiga_comms_create |
LIBRARY_EXPORTS optiga_lib_status_t optiga_comms_open | ( | optiga_comms_t * | p_ctx | ) |
Opens the communication channel with OPTIGA.
Initializes the communication with OPTIGA
[in,out] | p_ctx | Valid instance of optiga_comms_t created using optiga_comms_create |
OPTIGA_COMMS_SUCCESS | |
OPTIGA_COMMS_ERROR |
LIBRARY_EXPORTS optiga_lib_status_t optiga_comms_reset | ( | optiga_comms_t * | p_ctx, |
uint8_t | reset_type | ||
) |
Resets the OPTIGA.
Resets the communication channel with OPTIGA.
[in,out] | p_ctx | Valid instance of optiga_comms_t created using optiga_comms_create |
[in,out] | reset_type | Type of reset
|
OPTIGA_COMMS_SUCCESS | |
OPTIGA_COMMS_ERROR |
optiga_lib_status_t optiga_comms_set_callback_context | ( | optiga_comms_t * | p_optiga_comms, |
void * | context | ||
) |
Sets the callers context to OPTIGA comms instance.
Sets the callers context to optiga_comms_t.
[in] | p_optiga_comms | Valid instance of optiga_comms_t created using optiga_comms_create |
[in] | context | Pointer to callers context |
optiga_lib_status_t optiga_comms_set_callback_handler | ( | optiga_comms_t * | p_optiga_comms, |
callback_handler_t | handler | ||
) |
Sets the callback handler to OPTIGA comms instance.
Sets the callback handler to optiga_comms_t instance.
[in] | p_optiga_comms | Valid instance of optiga_comms_t created using optiga_comms_create |
[in] | handler | Pointer to callback handler |
LIBRARY_EXPORTS optiga_lib_status_t optiga_comms_transceive | ( | optiga_comms_t * | p_ctx, |
const uint8_t * | p_tx_data, | ||
uint16_t | tx_data_length, | ||
uint8_t * | p_rx_data, | ||
uint16_t * | p_rx_data_len | ||
) |
Sends and receives the APDU.
Sends a command to OPTIGA and receives a response.
[in,out] | p_ctx | Valid instance of optiga_comms_t created using optiga_comms_create |
[in] | p_tx_data | Pointer to the transmit data buffer |
[in] | tx_data_length | Length of the transmit data buffer |
[in,out] | p_rx_data | Pointer to the receive data buffer |
[in,out] | p_rx_data_len | Pointer to the length of the receive data buffer |
OPTIGA_COMMS_SUCCESS | |
OPTIGA_COMMS_ERROR | |
OPTIGA_COMMS_ERROR_STACK_MEMORY | |
OPTIGA_COMMS_ERROR_HANDSHAKE | |
OPTIGA_COMMS_ERROR_SESSION |
optiga communication structure