OPTIGA™ Trust M
Host Library Documentation
optiga_comms.h
Go to the documentation of this file.
1 
39 #ifndef _OPTIGA_COMMS_H_
40 #define _OPTIGA_COMMS_H_
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
49 
50 #ifdef OPTIGA_COMMS_SHIELDED_CONNECTION
51 // Offset for data
52 #define OPTIGA_COMMS_DATA_OFFSET (0x05)
53 // Overhead buffer size for user buffer
54 #define OPTIGA_COMMS_PRL_OVERHEAD (0x0D)
55 #else
56 #define OPTIGA_COMMS_DATA_OFFSET (0x00)
57 #define OPTIGA_COMMS_PRL_OVERHEAD (0x00)
58 #endif
59 
61 typedef struct optiga_comms
62 {
64  void * p_comms_ctx;
72  uint8_t state;
73 #ifdef OPTIGA_COMMS_SHIELDED_CONNECTION
74  uint8_t protection_level;
77  uint8_t protocol_version;
79  uint8_t manage_context_operation;
80 #endif
81  void * p_pal_os_event_ctx;
84 
87 
110  void * context);
111 
131 
149  void *context);
150 
167  callback_handler_t handler);
213 
214 
239 LIBRARY_EXPORTS optiga_lib_status_t optiga_comms_reset(optiga_comms_t * p_ctx, uint8_t reset_type);
240 
302  const uint8_t * p_tx_data,
303  uint16_t tx_data_length,
304  uint8_t * p_rx_data,
305  uint16_t * p_rx_data_len);
306 
330 
331 
332 
333 #ifdef __cplusplus
334 }
335 #endif
336 
337 #endif /*_OPTIGA_COMMS_H_*/
338 
upper_layer_callback_t
void(* upper_layer_callback_t)(void *upper_layer_ctx, optiga_lib_status_t event)
typedef for application event handler
Definition: optiga_lib_types.h:96
optiga_lib_return_codes.h
This file defines the error codes for the all the layers and modules. OPTIGA host library return val...
optiga_comms::upper_layer_handler
upper_layer_callback_t upper_layer_handler
Upper layer handler.
Definition: optiga_comms.h:68
optiga_comms_create
optiga_comms_t * optiga_comms_create(callback_handler_t callback, void *context)
Provides the singleton OPTIGA instance.
optiga_comms
Optiga comms structure.
Definition: optiga_comms.h:62
optiga_lib_types.h
This file contains the type definitions for the fundamental data types.
optiga_comms_close
LIBRARY_EXPORTS optiga_lib_status_t optiga_comms_close(optiga_comms_t *p_ctx)
Closes the communication channel with OPTIGA.
optiga_comms_transceive
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.
optiga_comms_t
struct optiga_comms optiga_comms_t
Optiga comms structure.
optiga_comms_open
LIBRARY_EXPORTS optiga_lib_status_t optiga_comms_open(optiga_comms_t *p_ctx)
Opens the communication channel with OPTIGA.
optiga_comms::state
uint8_t state
OPTIGA comms state.
Definition: optiga_comms.h:72
optiga_comms::p_upper_layer_ctx
void * p_upper_layer_ctx
Upper layer context.
Definition: optiga_comms.h:66
optiga_comms::instance_init_state
uint8_t instance_init_state
Holds the instance initialization state.
Definition: optiga_comms.h:70
optiga_comms_reset
LIBRARY_EXPORTS optiga_lib_status_t optiga_comms_reset(optiga_comms_t *p_ctx, uint8_t reset_type)
Resets the OPTIGA.
optiga_lib_common.h
This file provides the prototypes for the commonly used functions and structures of OPTIGA Library.
optiga_comms
optiga_comms_t optiga_comms
optiga communication structure
optiga_comms_set_callback_context
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.
callback_handler_t
void(* callback_handler_t)(void *callback_ctx, optiga_lib_status_t event)
typedef for event callback handler
Definition: optiga_lib_types.h:99
optiga_comms::p_pal_os_event_ctx
void * p_pal_os_event_ctx
Pointer to the pal os event instance/context.
Definition: optiga_comms.h:82
optiga_comms_destroy
void optiga_comms_destroy(optiga_comms_t *optiga_comms)
Deinitializes the OPTIGA comms instance.
optiga_lib_status_t
uint16_t optiga_lib_status_t
typedef for OPTIGA host library status
Definition: optiga_lib_types.h:90
optiga_comms::p_comms_ctx
void * p_comms_ctx
Comms structure pointer.
Definition: optiga_comms.h:64
optiga_comms_set_callback_handler
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.