This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Initialisation hints
Artem Yushev edited this page Jan 18, 2019
·
1 revision
Depending on a selected platform, the initialization routine might vary.
The function optiga_init()
should be called before any call to Crypt API or Util API
Below is an examples which work for most of platforms:
#include "optiga/optiga_util.h"
#include "optiga/ifx_i2c/ifx_i2c_config.h"
/* The communication context `ifx_i2c_context_0` is declared in the header file ifx_i2c_config.h */
optiga_comms_t optiga_comms = {(void*)&ifx_i2c_context_0,NULL,NULL, OPTIGA_COMMS_SUCCESS};
static int32_t optiga_init(void)
{
int32_t status = (int32_t) OPTIGA_LIB_ERROR;
do
{
/* Optionally you might need to initialize some of the Trust X PAL functions. If you have them implemented
In this case they should be declared as extern.
pal_gpio_init();
pal_os_event_init();
*/
status = optiga_util_open_application(&optiga_comms);
if(OPTIGA_LIB_SUCCESS != status)
{
printf( ("Failure: CmdLib_OpenApplication(): 0x%04X\n\r", status) );
break;
}
status = OPTIGA_LIB_SUCCESS;
} while(0);
return status;
}