|
|
|
@ -104,6 +104,26 @@
|
|
|
|
|
// from util.s
|
|
|
|
|
extern void shutdown_privileged(void);
|
|
|
|
|
|
|
|
|
|
#ifdef USE_OPTIGA
|
|
|
|
|
#if !PYOPT
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
#if 1 // color log
|
|
|
|
|
#define OPTIGA_LOG_FORMAT \
|
|
|
|
|
"%" PRIu32 " \x1b[35moptiga\x1b[0m \x1b[32mDEBUG\x1b[0m %s: "
|
|
|
|
|
#else
|
|
|
|
|
#define OPTIGA_LOG_FORMAT "%" PRIu32 " optiga DEBUG %s: "
|
|
|
|
|
#endif
|
|
|
|
|
static void optiga_log_hex(const char *prefix, const uint8_t *data,
|
|
|
|
|
size_t data_size) {
|
|
|
|
|
printf(OPTIGA_LOG_FORMAT, hal_ticks_ms() * 1000, prefix);
|
|
|
|
|
for (size_t i = 0; i < data_size; i++) {
|
|
|
|
|
printf("%02x", data[i]);
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
|
random_delays_init();
|
|
|
|
|
|
|
|
|
@ -199,6 +219,14 @@ int main(void) {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef USE_OPTIGA
|
|
|
|
|
|
|
|
|
|
#if !PYOPT
|
|
|
|
|
// command log is relatively quiet so we enable it in debug builds
|
|
|
|
|
optiga_command_set_log_hex(optiga_log_hex);
|
|
|
|
|
// transport log can be spammy, uncomment if you want it:
|
|
|
|
|
// optiga_transport_set_log_hex(optiga_log_hex);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
optiga_init();
|
|
|
|
|
optiga_open_application();
|
|
|
|
|
if (sectrue == secret_ok) {
|
|
|
|
|