39 #ifndef _OPTIGA_UTIL_H_ 40 #define _OPTIGA_UTIL_H_ 49 #define OPTIGA_UTIL_WRITE_ONLY (0x00) 50 #define OPTIGA_UTIL_ERASE_AND_WRITE (0x40) 55 #define OPTIGA_UTIL_CONTEXT_NONE (0x00) 81 #ifdef OPTIGA_COMMS_SHIELDED_CONNECTION 86 #endif //OPTIGA_COMMS_SHIELDED_CONNECTION 92 #ifdef OPTIGA_COMMS_SHIELDED_CONNECTION 120 uint8_t configuration_type,
249 bool_t perform_hibernate);
367 const uint8_t * buffer,
403 const uint8_t * buffer,
442 uint8_t manifest_version,
443 const uint8_t * manifest,
444 uint16_t manifest_length);
480 const uint8_t * fragment,
481 uint16_t fragment_length);
515 const uint8_t * fragment,
516 uint16_t fragment_length);
548 uint16_t optiga_counter_oid,
576 #ifdef OPTIGA_COMMS_SHIELDED_CONNECTION 577 #define OPTIGA_UTIL_SET_COMMS_PROTECTION_LEVEL(p_instance, protection_level) \ 579 optiga_util_set_comms_params(p_instance, \ 580 OPTIGA_COMMS_PROTECTION_LEVEL, \ 584 #define OPTIGA_UTIL_SET_COMMS_PROTECTION_LEVEL(p_instance, protection_level) {} 603 #ifdef OPTIGA_COMMS_SHIELDED_CONNECTION 604 #define OPTIGA_UTIL_SET_COMMS_PROTOCOL_VERSION(p_instance, version) \ 606 optiga_util_set_comms_params(p_instance, \ 607 OPTIGA_COMMS_PROTOCOL_VERSION, \ 611 #define OPTIGA_UTIL_SET_COMMS_PROTOCOL_VERSION(p_instance, version) {} 614 #if defined (OPTIGA_LIB_ENABLE_LOGGING) && defined (OPTIGA_LIB_ENABLE_UTIL_LOGGING) 629 #define OPTIGA_UTIL_LOG_MESSAGE(msg) \ 631 optiga_lib_print_message(msg,OPTIGA_UTIL_SERVICE,OPTIGA_UTIL_SERVICE_COLOR);\ 649 #define OPTIGA_UTIL_LOG_HEX_DATA(array,array_len) \ 651 optiga_lib_print_array_hex_format(array,array_len,OPTIGA_UNPROTECTED_DATA_COLOR);\ 668 #define OPTIGA_UTIL_LOG_STATUS(return_value) \ 670 if (OPTIGA_LIB_SUCCESS != return_value) \ 672 optiga_lib_print_status(OPTIGA_UTIL_SERVICE,OPTIGA_ERROR_COLOR,return_value); \ 676 optiga_lib_print_status(OPTIGA_UTIL_SERVICE,OPTIGA_UTIL_SERVICE_COLOR,return_value); \ 681 #define OPTIGA_UTIL_LOG_MESSAGE(msg) {} 682 #define OPTIGA_UTIL_LOG_HEX_DATA(array, array_len) {} 683 #define OPTIGA_UTIL_LOG_STATUS(return_value) {} union optiga_util_params optiga_util_params_t
union for OPTIGA util parameters
LIBRARY_EXPORTS optiga_lib_status_t optiga_util_read_data(optiga_util_t *me, uint16_t optiga_oid, uint16_t offset, uint8_t *buffer, uint16_t *length)
Reads data from optiga.
Definition: optiga_util.c:311
LIBRARY_EXPORTS optiga_lib_status_t optiga_util_write_metadata(optiga_util_t *me, uint16_t optiga_oid, const uint8_t *buffer, uint8_t length)
Writes metadata for the user provided data object.
Definition: optiga_util.c:444
LIBRARY_EXPORTS optiga_lib_status_t optiga_util_update_count(optiga_util_t *me, uint16_t optiga_counter_oid, uint8_t count)
Increments the counter object by a value specified by user.
Definition: optiga_util.c:618
LIBRARY_EXPORTS optiga_util_t * optiga_util_create(uint8_t optiga_instance_id, callback_handler_t handler, void *caller_context)
Create an instance of optiga_util_t.
Definition: optiga_util.c:153
optiga_set_data_object_params_t optiga_set_data_object_params
Definition: optiga_util.h:61
LIBRARY_EXPORTS optiga_lib_status_t optiga_util_protected_update_start(optiga_util_t *me, uint8_t manifest_version, const uint8_t *manifest, uint16_t manifest_length)
Initiates the start of protected update of object by writing manifest into OPTIGA object.
Definition: optiga_util.c:537
LIBRARY_EXPORTS optiga_lib_status_t optiga_util_protected_update_final(optiga_util_t *me, const uint8_t *fragment, uint16_t fragment_length)
Sends the last fragment to finalize the protected update of data object.
Definition: optiga_util.c:592
uint8_t protection_level
To provide the encryption and decryption need for command and response.
Definition: optiga_util.h:83
optiga_cmd_t * my_cmd
pointer to optiga command instance
Definition: optiga_util.h:74
LIBRARY_EXPORTS optiga_lib_status_t optiga_util_write_data(optiga_util_t *me, uint16_t optiga_oid, uint8_t write_type, uint16_t offset, const uint8_t *buffer, uint16_t length)
Writes data to optiga.
Definition: optiga_util.c:419
LIBRARY_EXPORTS optiga_lib_status_t optiga_util_close_application(optiga_util_t *me, bool_t perform_hibernate)
Closes the application on OPTIGA and closes the communication with optiga.
Definition: optiga_util.c:262
optiga_get_data_object_params_t optiga_get_data_object_params
Definition: optiga_util.h:63
uint8_t protocol_version
To provide the presentation layer protocol version to be used.
Definition: optiga_util.h:85
callback_handler_t handler
Callback handler.
Definition: optiga_util.h:78
uint8_t bool_t
Typedef for a boolean.
Definition: optiga_lib_types.h:91
void * caller_context
Callback context.
Definition: optiga_util.h:76
LIBRARY_EXPORTS optiga_lib_status_t optiga_util_read_metadata(optiga_util_t *me, uint16_t optiga_oid, uint8_t *buffer, uint16_t *length)
Reads metadata of the specified data object from optiga.
Definition: optiga_util.c:366
Specifies the data structure for data to be written to OPTIGA.
Definition: optiga_lib_common.h:274
LIBRARY_EXPORTS optiga_lib_status_t optiga_util_open_application(optiga_util_t *me, bool_t perform_restore)
Initializes the communication with optiga and open the application on OPTIGA.
Definition: optiga_util.c:215
Specifies the data structure for data to be read from OPTIGA.
Definition: optiga_lib_common.h:251
LIBRARY_EXPORTS optiga_lib_status_t optiga_util_destroy(optiga_util_t *me)
De-Initializes the OPTIGA util instance.
Definition: optiga_util.c:191
uint16_t instance_state
To provide the busy/free status of the util instance.
Definition: optiga_util.h:80
optiga_set_object_protected_params_t optiga_set_object_protected_params
Definition: optiga_util.h:65
Command context.
Definition: optiga_cmd.c:331
Specifies the data structure for protected update.
Definition: optiga_lib_common.h:457
void optiga_util_set_comms_params(optiga_util_t *me, uint8_t configuration_type, uint8_t value)
Sets/updates the OPTIGA Comms Shielded connection configuration in the respective (optiga_util) insta...
Definition: optiga_util.c:129
OPTIGA util instance structure.
Definition: optiga_util.h:69
This file defines APIs, types and data structures used in the Command (cmd) module implementation.
uint16_t optiga_lib_status_t
typedef for OPTIGA host library status
Definition: optiga_lib_types.h:97
void(* callback_handler_t)(void *callback_ctx, optiga_lib_status_t event)
typedef for event callback handler
Definition: optiga_lib_types.h:106
optiga_util_params_t params
Details/references (pointers) to the Application Inputs.
Definition: optiga_util.h:72
LIBRARY_EXPORTS optiga_lib_status_t optiga_util_protected_update_continue(optiga_util_t *me, const uint8_t *fragment, uint16_t fragment_length)
Sends fragment(s) of data to be written to OPTIGA.
Definition: optiga_util.c:566
union for OPTIGA util parameters
Definition: optiga_util.h:58