mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-08-05 05:15:27 +00:00
fixup! feat(core): Add Optiga command logging macro.
This commit is contained in:
parent
9755255185
commit
c49a05be9b
@ -50,11 +50,11 @@ const optiga_metadata_item OPTIGA_META_KEY_USE_KEYAGREE =
|
||||
const optiga_metadata_item OPTIGA_META_VERSION_DEFAULT = {
|
||||
(const uint8_t[]){0x00, 0x00}, 2};
|
||||
|
||||
#ifdef NDEBUG
|
||||
#if PRODUCTION
|
||||
#define OPTIGA_LOG(prefix, data, data_size)
|
||||
#else
|
||||
static optiga_log_hex_t log_hex = NULL;
|
||||
void optiga_set_command_log_hex(optiga_log_hex_t f) { log_hex = f; }
|
||||
void optiga_command_set_log_hex(optiga_log_hex_t f) { log_hex = f; }
|
||||
#define OPTIGA_LOG(prefix, data, data_size) \
|
||||
if (log_hex != NULL) { \
|
||||
log_hex(prefix, data, data_size); \
|
||||
|
@ -134,7 +134,7 @@ static uint8_t sec_chan_buffer[OPTIGA_MAX_APDU_SIZE + SEC_CHAN_OVERHEAD_SIZE] =
|
||||
{0};
|
||||
static size_t sec_chan_size = 0;
|
||||
|
||||
#ifdef NDEBUG
|
||||
#if PRODUCTION
|
||||
#define OPTIGA_LOG(prefix, data, data_size)
|
||||
#else
|
||||
static optiga_log_hex_t log_hex = NULL;
|
||||
|
@ -207,8 +207,8 @@ optiga_result optiga_derive_key(optiga_key_derivation deriv, uint16_t oid,
|
||||
optiga_result optiga_set_trust_anchor(void);
|
||||
optiga_result optiga_set_priv_key(uint16_t oid, const uint8_t priv_key[32]);
|
||||
|
||||
#ifndef NDEBUG
|
||||
void optiga_set_command_log_hex(optiga_log_hex_t f);
|
||||
#if !PRODUCTION
|
||||
void optiga_command_set_log_hex(optiga_log_hex_t f);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -34,7 +34,7 @@ typedef enum _optiga_result {
|
||||
OPTIGA_ERR_CMD, // Command error. See error code data object 0xF1C2.
|
||||
} optiga_result;
|
||||
|
||||
#ifndef NDEBUG
|
||||
#if !PRODUCTION
|
||||
typedef void (*optiga_log_hex_t)(const char *prefix, const uint8_t *data,
|
||||
size_t data_size);
|
||||
#endif
|
||||
|
@ -44,7 +44,7 @@ optiga_result optiga_resync(void);
|
||||
optiga_result optiga_soft_reset(void);
|
||||
optiga_result optiga_set_data_reg_len(size_t size);
|
||||
|
||||
#ifndef NDEBUG
|
||||
#if !PRODUCTION
|
||||
void optiga_set_transport_log_hex(optiga_log_hex_t f);
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user